Skip to content

Commit

Permalink
Console object's @@toStringTag should be "console" instead of "Console"
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=215750

Reviewed by Ross Kirsling.

LayoutTests/imported/w3c:

Import ToT wpt/console tests including @@toStringTag tests.

* resources/import-expectations.json:
* web-platform-tests/console/META.yml: Added.
* web-platform-tests/console/console-is-a-namespace.any-expected.txt: Added.
* web-platform-tests/console/console-is-a-namespace.any.html: Added.
* web-platform-tests/console/console-is-a-namespace.any.js: Added.
(test):
* web-platform-tests/console/console-is-a-namespace.any.worker-expected.txt: Added.
* web-platform-tests/console/console-is-a-namespace.any.worker.html: Added.
* web-platform-tests/console/console-label-conversion.any-expected.txt: Added.
* web-platform-tests/console/console-label-conversion.any.html: Added.
* web-platform-tests/console/console-label-conversion.any.js: Added.
(const.method.of.methods.test):
* web-platform-tests/console/console-label-conversion.any.worker-expected.txt: Added.
* web-platform-tests/console/console-label-conversion.any.worker.html: Added.
* web-platform-tests/console/console-namespace-object-class-string.any-expected.txt: Added.
* web-platform-tests/console/console-namespace-object-class-string.any.html: Added.
* web-platform-tests/console/console-namespace-object-class-string.any.js: Added.
(test):
(test.t.t.add_cleanup):
* web-platform-tests/console/console-namespace-object-class-string.any.worker-expected.txt: Added.
* web-platform-tests/console/console-namespace-object-class-string.any.worker.html: Added.
* web-platform-tests/console/console-tests-historical.any-expected.txt: Added.
* web-platform-tests/console/console-tests-historical.any.html: Added.
* web-platform-tests/console/console-tests-historical.any.js: Added.
(test):
* web-platform-tests/console/console-tests-historical.any.worker-expected.txt: Added.
* web-platform-tests/console/console-tests-historical.any.worker.html: Added.
* web-platform-tests/console/idlharness.any-expected.txt: Added.
* web-platform-tests/console/idlharness.any.html: Added.
* web-platform-tests/console/idlharness.any.js: Added.
* web-platform-tests/console/idlharness.any.worker-expected.txt: Added.
* web-platform-tests/console/idlharness.any.worker.html: Added.
* web-platform-tests/console/w3c-import.log: Added.

Source/JavaScriptCore:

Use "console" instead of "Console". Now, namespace object has @@toStringTag.
web-platform-tests/wpt#24717

* runtime/ConsoleObject.cpp:

LayoutTests:

* fast/dom/Window/window-lookup-precedence-expected.txt:
* fast/loader/window-properties-restored-from-page-cache-expected.txt:
* http/tests/security/cross-frame-access-put-expected.txt:
* inspector/debugger/pause-for-internal-scripts-expected.txt:
* inspector/debugger/stepping/stepping-internal-scripts-expected.txt:
* js/console-expected.txt:
* js/console.html:
* platform/gtk/fast/dom/Window/window-lookup-precedence-expected.txt:
* platform/mac-wk2/fast/dom/Window/window-lookup-precedence-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@266030 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
ysuzuki@apple.com committed Aug 22, 2020
1 parent b073b41 commit d0e4c24
Show file tree
Hide file tree
Showing 43 changed files with 352 additions and 15 deletions.
17 changes: 17 additions & 0 deletions LayoutTests/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
2020-08-21 Yusuke Suzuki <ysuzuki@apple.com>

Console object's @@toStringTag should be "console" instead of "Console"
https://bugs.webkit.org/show_bug.cgi?id=215750

Reviewed by Ross Kirsling.

* fast/dom/Window/window-lookup-precedence-expected.txt:
* fast/loader/window-properties-restored-from-page-cache-expected.txt:
* http/tests/security/cross-frame-access-put-expected.txt:
* inspector/debugger/pause-for-internal-scripts-expected.txt:
* inspector/debugger/stepping/stepping-internal-scripts-expected.txt:
* js/console-expected.txt:
* js/console.html:
* platform/gtk/fast/dom/Window/window-lookup-precedence-expected.txt:
* platform/mac-wk2/fast/dom/Window/window-lookup-precedence-expected.txt:

2020-08-20 Darin Adler <darin@apple.com>

Move node geometry functions from Range to RenderObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ PASS win['statusbar'] == '[object BarProp]' is true
PASS win['statusbar'] == '[object BarProp]' is true
PASS win['toolbar'] == '[object BarProp]' is true
PASS win['toolbar'] == '[object BarProp]' is true
PASS win['console'] == '[object Console]' is true
PASS win['console'] == '[object console]' is true
PASS win['history'] == '[object History]' is true
PASS win['navigator'] == '[object Navigator]' is true
PASS win['navigator'] == '[object Navigator]' is true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This test makes sure that various properties on the window object are correctly reconnected after restoring a page from the page cache.
[object ApplicationCache]
[object Console]
[object console]
[object Crypto]
[object History]
[object Storage]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ ALERT: PASS: window.XPathEvaluator should be 'function XPathEvaluator() { [na
ALERT: PASS: window.XPathResult should be 'function XPathResult() { [native code]}' and is.
ALERT: PASS: window.clientInformation should be '[object Navigator]' and is.
ALERT: PASS: window.closed should be 'false' and is.
ALERT: PASS: window.console should be '[object Console]' and is.
ALERT: PASS: window.console should be '[object console]' and is.
ALERT: PASS: window.crypto should be '[object Crypto]' and is.
ALERT: PASS: window.defaultStatus should be '' and is.
ALERT: PASS: window.defaultstatus should be '' and is.
Expand Down
43 changes: 43 additions & 0 deletions LayoutTests/imported/w3c/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
2020-08-21 Yusuke Suzuki <ysuzuki@apple.com>

Console object's @@toStringTag should be "console" instead of "Console"
https://bugs.webkit.org/show_bug.cgi?id=215750

Reviewed by Ross Kirsling.

Import ToT wpt/console tests including @@toStringTag tests.

* resources/import-expectations.json:
* web-platform-tests/console/META.yml: Added.
* web-platform-tests/console/console-is-a-namespace.any-expected.txt: Added.
* web-platform-tests/console/console-is-a-namespace.any.html: Added.
* web-platform-tests/console/console-is-a-namespace.any.js: Added.
(test):
* web-platform-tests/console/console-is-a-namespace.any.worker-expected.txt: Added.
* web-platform-tests/console/console-is-a-namespace.any.worker.html: Added.
* web-platform-tests/console/console-label-conversion.any-expected.txt: Added.
* web-platform-tests/console/console-label-conversion.any.html: Added.
* web-platform-tests/console/console-label-conversion.any.js: Added.
(const.method.of.methods.test):
* web-platform-tests/console/console-label-conversion.any.worker-expected.txt: Added.
* web-platform-tests/console/console-label-conversion.any.worker.html: Added.
* web-platform-tests/console/console-namespace-object-class-string.any-expected.txt: Added.
* web-platform-tests/console/console-namespace-object-class-string.any.html: Added.
* web-platform-tests/console/console-namespace-object-class-string.any.js: Added.
(test):
(test.t.t.add_cleanup):
* web-platform-tests/console/console-namespace-object-class-string.any.worker-expected.txt: Added.
* web-platform-tests/console/console-namespace-object-class-string.any.worker.html: Added.
* web-platform-tests/console/console-tests-historical.any-expected.txt: Added.
* web-platform-tests/console/console-tests-historical.any.html: Added.
* web-platform-tests/console/console-tests-historical.any.js: Added.
(test):
* web-platform-tests/console/console-tests-historical.any.worker-expected.txt: Added.
* web-platform-tests/console/console-tests-historical.any.worker.html: Added.
* web-platform-tests/console/idlharness.any-expected.txt: Added.
* web-platform-tests/console/idlharness.any.html: Added.
* web-platform-tests/console/idlharness.any.js: Added.
* web-platform-tests/console/idlharness.any.worker-expected.txt: Added.
* web-platform-tests/console/idlharness.any.worker.html: Added.
* web-platform-tests/console/w3c-import.log: Added.

2020-08-20 Chris Dumez <cdumez@apple.com>

Unreviewed, rebaseline flaky webaudio tests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"web-platform-tests/clipboard-apis": "import",
"web-platform-tests/common": "import",
"web-platform-tests/compat": "skip",
"web-platform-tests/console": "skip",
"web-platform-tests/console": "import",
"web-platform-tests/content-security-policy": "import",
"web-platform-tests/cookies": "skip",
"web-platform-tests/cookies/resources": "import",
Expand Down
5 changes: 5 additions & 0 deletions LayoutTests/imported/w3c/web-platform-tests/console/META.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
spec: https://console.spec.whatwg.org/
suggested_reviewers:
- domenic
- pwnall
- domfarolino
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

PASS console exists on the global object
PASS console has the right property descriptors
PASS Console (uppercase, as if it were an interface) must not exist
PASS The prototype chain must be correct

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- This file is required for WebKit test infrastructure to run the templated test -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"use strict";
// https://heycam.github.io/webidl/#es-namespaces
// https://console.spec.whatwg.org/#console-namespace

test(() => {
assert_true(self.hasOwnProperty("console"));
}, "console exists on the global object");

test(() => {
const propDesc = Object.getOwnPropertyDescriptor(self, "console");
assert_equals(propDesc.writable, true, "must be writable");
assert_equals(propDesc.enumerable, false, "must not be enumerable");
assert_equals(propDesc.configurable, true, "must be configurable");
assert_equals(propDesc.value, console, "must have the right value");
}, "console has the right property descriptors");

test(() => {
assert_false("Console" in self);
}, "Console (uppercase, as if it were an interface) must not exist");

test(() => {
const prototype1 = Object.getPrototypeOf(console);
const prototype2 = Object.getPrototypeOf(prototype1);

assert_equals(Object.getOwnPropertyNames(prototype1).length, 0, "The [[Prototype]] must have no properties");
assert_equals(prototype2, Object.prototype, "The [[Prototype]]'s [[Prototype]] must be %ObjectPrototype%");
}, "The prototype chain must be correct");
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

PASS console exists on the global object
PASS console has the right property descriptors
PASS Console (uppercase, as if it were an interface) must not exist
PASS The prototype chain must be correct

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- This file is required for WebKit test infrastructure to run the templated test -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

PASS console.count()'s label gets converted to string via label.toString() when label is an object
PASS console.count() throws exceptions generated by erroneous label.toString() conversion
PASS console.countReset()'s label gets converted to string via label.toString() when label is an object
PASS console.countReset() throws exceptions generated by erroneous label.toString() conversion
PASS console.time()'s label gets converted to string via label.toString() when label is an object
PASS console.time() throws exceptions generated by erroneous label.toString() conversion
PASS console.timeLog()'s label gets converted to string via label.toString() when label is an object
PASS console.timeLog() throws exceptions generated by erroneous label.toString() conversion
PASS console.timeEnd()'s label gets converted to string via label.toString() when label is an object
PASS console.timeEnd() throws exceptions generated by erroneous label.toString() conversion

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- This file is required for WebKit test infrastructure to run the templated test -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"use strict";
// https://console.spec.whatwg/org/#counting
// https://console.spec.whatwg/org/#timing

const methods = ['count', 'countReset', 'time', 'timeLog', 'timeEnd'];

for (const method of methods) {
test(() => {
let labelToStringCalled = false;

console[method]({
toString() {
labelToStringCalled = true;
}
});

assert_true(labelToStringCalled, `${method}() must call toString() on label when label is an object`);
}, `console.${method}()'s label gets converted to string via label.toString() when label is an object`);

test(() => {
assert_throws_js(Error, () => {
console[method]({
toString() {
throw new Error('conversion error');
}
});
}, `${method} must re-throw any exceptions thrown by label.toString() conversion`);
}, `console.${method}() throws exceptions generated by erroneous label.toString() conversion`);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

PASS console.count()'s label gets converted to string via label.toString() when label is an object
PASS console.count() throws exceptions generated by erroneous label.toString() conversion
PASS console.countReset()'s label gets converted to string via label.toString() when label is an object
PASS console.countReset() throws exceptions generated by erroneous label.toString() conversion
PASS console.time()'s label gets converted to string via label.toString() when label is an object
PASS console.time() throws exceptions generated by erroneous label.toString() conversion
PASS console.timeLog()'s label gets converted to string via label.toString() when label is an object
PASS console.timeLog() throws exceptions generated by erroneous label.toString() conversion
PASS console.timeEnd()'s label gets converted to string via label.toString() when label is an object
PASS console.timeEnd() throws exceptions generated by erroneous label.toString() conversion

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- This file is required for WebKit test infrastructure to run the templated test -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

PASS @@toStringTag exists on the namespace object with the appropriate descriptor
PASS Object.prototype.toString applied to the namespace object
PASS Object.prototype.toString applied after modifying the namespace object's @@toStringTag
PASS Object.prototype.toString applied after deleting @@toStringTag

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- This file is required for WebKit test infrastructure to run the templated test -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"use strict";
// https://heycam.github.io/webidl/#es-namespaces
// https://console.spec.whatwg.org/#console-namespace

test(() => {
assert_own_property(console, Symbol.toStringTag);

const propDesc = Object.getOwnPropertyDescriptor(console, Symbol.toStringTag);
assert_equals(propDesc.value, "console", "value");
assert_equals(propDesc.writable, false, "writable");
assert_equals(propDesc.enumerable, false, "enumerable");
assert_equals(propDesc.configurable, true, "configurable");
}, "@@toStringTag exists on the namespace object with the appropriate descriptor");

test(() => {
assert_equals(console.toString(), "[object console]");
assert_equals(Object.prototype.toString.call(console), "[object console]");
}, "Object.prototype.toString applied to the namespace object");

test(t => {
assert_own_property(console, Symbol.toStringTag, "Precondition: @@toStringTag on the namespace object");
t.add_cleanup(() => {
Object.defineProperty(console, Symbol.toStringTag, { value: "console" });
});

Object.defineProperty(console, Symbol.toStringTag, { value: "Test" });
assert_equals(console.toString(), "[object Test]");
assert_equals(Object.prototype.toString.call(console), "[object Test]");
}, "Object.prototype.toString applied after modifying the namespace object's @@toStringTag");

test(t => {
assert_own_property(console, Symbol.toStringTag, "Precondition: @@toStringTag on the namespace object");
t.add_cleanup(() => {
Object.defineProperty(console, Symbol.toStringTag, { value: "console" });
});

assert_true(delete console[Symbol.toStringTag]);
assert_equals(console.toString(), "[object Object]");
assert_equals(Object.prototype.toString.call(console), "[object Object]");
}, "Object.prototype.toString applied after deleting @@toStringTag");
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

PASS @@toStringTag exists on the namespace object with the appropriate descriptor
PASS Object.prototype.toString applied to the namespace object
PASS Object.prototype.toString applied after modifying the namespace object's @@toStringTag
PASS Object.prototype.toString applied after deleting @@toStringTag

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- This file is required for WebKit test infrastructure to run the templated test -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

PASS 'timeline' function should not exist on the console object
PASS 'timelineEnd' function should not exist on the console object
PASS 'markTimeline' function should not exist on the console object

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- This file is required for WebKit test infrastructure to run the templated test -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* These tests assert the non-existence of certain
* legacy Console methods that are not included in
* the specification: http://console.spec.whatwg.org/
*/

"use strict";

test(() => {
assert_equals(console.timeline, undefined, "console.timeline should be undefined");
}, "'timeline' function should not exist on the console object");

test(() => {
assert_equals(console.timelineEnd, undefined, "console.timelineEnd should be undefined");
}, "'timelineEnd' function should not exist on the console object");

test(() => {
assert_equals(console.markTimeline, undefined, "console.markTimeline should be undefined");
}, "'markTimeline' function should not exist on the console object");
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

PASS 'timeline' function should not exist on the console object
PASS 'timelineEnd' function should not exist on the console object
PASS 'markTimeline' function should not exist on the console object

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- This file is required for WebKit test infrastructure to run the templated test -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

PASS idl_test setup
PASS idl_test validation
PASS console namespace: operation assert(optional boolean, any...)
PASS console namespace: operation clear()
PASS console namespace: operation debug(any...)
PASS console namespace: operation error(any...)
PASS console namespace: operation info(any...)
PASS console namespace: operation log(any...)
PASS console namespace: operation table(optional any, optional sequence<DOMString>)
PASS console namespace: operation trace(any...)
PASS console namespace: operation warn(any...)
PASS console namespace: operation dir(optional any, optional object?)
PASS console namespace: operation dirxml(any...)
PASS console namespace: operation count(optional DOMString)
PASS console namespace: operation countReset(optional DOMString)
PASS console namespace: operation group(any...)
PASS console namespace: operation groupCollapsed(any...)
PASS console namespace: operation groupEnd()
PASS console namespace: operation time(optional DOMString)
PASS console namespace: operation timeLog(optional DOMString, any...)
PASS console namespace: operation timeEnd(optional DOMString)

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- This file is required for WebKit test infrastructure to run the templated test -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js

// https://console.spec.whatwg.org/

idl_test(
['console'],
[] // no deps
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

PASS idl_test setup
PASS idl_test validation
PASS console namespace: operation assert(optional boolean, any...)
PASS console namespace: operation clear()
PASS console namespace: operation debug(any...)
PASS console namespace: operation error(any...)
PASS console namespace: operation info(any...)
PASS console namespace: operation log(any...)
PASS console namespace: operation table(optional any, optional sequence<DOMString>)
PASS console namespace: operation trace(any...)
PASS console namespace: operation warn(any...)
PASS console namespace: operation dir(optional any, optional object?)
PASS console namespace: operation dirxml(any...)
PASS console namespace: operation count(optional DOMString)
PASS console namespace: operation countReset(optional DOMString)
PASS console namespace: operation group(any...)
PASS console namespace: operation groupCollapsed(any...)
PASS console namespace: operation groupEnd()
PASS console namespace: operation time(optional DOMString)
PASS console namespace: operation timeLog(optional DOMString, any...)
PASS console namespace: operation timeEnd(optional DOMString)

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- This file is required for WebKit test infrastructure to run the templated test -->
Loading

0 comments on commit d0e4c24

Please sign in to comment.