diff options
author | Tarik Eshaq <tarikeshaq@gmail.com> | 2021-01-10 09:49:45 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-10 12:49:45 -0500 |
commit | 9801858cb0675de801b1c15d1b3826c88406068a (patch) | |
tree | ac4b085f297b949c1625acd26a7d50c52a2cae3f /runtime/js | |
parent | f7e09c6a555e115c004feca56f8b279c5f18c9b2 (diff) |
tests(wpt/console): Enables web platform tests for console (#9013)
Diffstat (limited to 'runtime/js')
-rw-r--r-- | runtime/js/02_console.js | 9 | ||||
-rw-r--r-- | runtime/js/99_main.js | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/runtime/js/02_console.js b/runtime/js/02_console.js index 971837bd6..11b819850 100644 --- a/runtime/js/02_console.js +++ b/runtime/js/02_console.js @@ -1449,7 +1449,14 @@ // For historical web-compatibility reasons, the namespace object for // console must have as its [[Prototype]] an empty object, created as if // by ObjectCreate(%ObjectPrototype%), instead of %ObjectPrototype%. - const console = Object.create({}); + const console = Object.create({}, { + [Symbol.toStringTag]: { + enumerable: false, + writable: false, + configurable: true, + value: "console", + }, + }); Object.assign(console, this); return console; } diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index 284bef48c..21e1ed5eb 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -245,6 +245,11 @@ delete Object.prototype.__proto__; setTimeout: util.writable(timers.setTimeout), }; + // The console seems to be the only one that should be writable and non-enumerable + // thus we don't have a unique helper for it. If other properties follow the same + // structure, it might be worth it to define a helper in `util` + windowOrWorkerGlobalScope.console.enumerable = false; + const mainRuntimeGlobalProperties = { Window: globalInterfaces.windowConstructorDescriptor, window: util.readOnly(globalThis), |