1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-24 16:19:12 -05:00

tests(wpt/console): Enables web platform tests for console (#9013)

This commit is contained in:
Tarik Eshaq 2021-01-10 09:49:45 -08:00 committed by GitHub
parent f7e09c6a55
commit 9801858cb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 2 deletions

View file

@ -313,7 +313,7 @@ unitTest(function consoleTestStringifyCircular(): void {
);
assertEquals(
stringify(console),
`{
`console {
log: [Function: log],
debug: [Function: log],
info: [Function: log],
@ -334,6 +334,7 @@ unitTest(function consoleTestStringifyCircular(): void {
clear: [Function: clear],
trace: [Function: trace],
indentLevel: 0,
[Symbol(Symbol.toStringTag)]: "console",
[Symbol(isConsoleInstance)]: true
}`,
);

View file

@ -174,6 +174,12 @@
"structured-serialize-detail",
"user_timing_exists"
],
"console": [
"console-is-a-namespace",
"console-label-conversion",
"console-namespace-object-class-string",
"console-tests-historical",
],
"WebCryptoApi": [
"getRandomValues"
]

View file

@ -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;
}

View file

@ -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),