From a5dad1787e89ee1404bc98266472f96705cea568 Mon Sep 17 00:00:00 2001 From: Leko Date: Tue, 29 Sep 2020 00:00:38 +0800 Subject: [PATCH] console: add Symbol.toStringTag property Add Symbol.toStringTag property to console object to follow WPT changes Update WPT status of console and the repl test case Refs: https://github.com/web-platform-tests/wpt/pull/24717 --- lib/internal/console/constructor.js | 7 +++++++ test/parallel/test-repl.js | 2 +- test/wpt/status/console.json | 3 --- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index dfad0811b25201..aae511cb6c7ca0 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -19,6 +19,7 @@ const { ReflectOwnKeys, Symbol, SymbolHasInstance, + SymbolToStringTag, WeakMap, } = primordials; @@ -233,6 +234,12 @@ ObjectDefineProperties(Console.prototype, { ...consolePropAttributes, value: groupIndentation }, + [SymbolToStringTag]: { + writable: false, + enumerable: false, + configurable: true, + value: 'console' + } }); } }, diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 10a7e5ab189bba..663b13ca0fe985 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -757,7 +757,7 @@ const errorTests = [ { send: 'console', expect: [ - '{', + 'Object [console] {', ' log: [Function: log],', ' warn: [Function: warn],', ' dir: [Function: dir],', diff --git a/test/wpt/status/console.json b/test/wpt/status/console.json index ed3e1ddda5bfa7..d611638b924c10 100644 --- a/test/wpt/status/console.json +++ b/test/wpt/status/console.json @@ -1,8 +1,5 @@ { "idlharness.any.js": { "fail": ".table, .dir and .timeLog parameter lengths are wrong" - }, - "console-namespace-object-class-string.any.js": { - "fail": "TODO: https://github.com/web-platform-tests/wpt/pull/24717" } }