From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/console/META.yml | 5 ++ .../console/console-count-logging-manual.html | 23 +++++++ .../console/console-countReset-logging-manual.html | 47 +++++++++++++++ .../tests/console/console-is-a-namespace.any.js | 28 +++++++++ .../tests/console/console-label-conversion.any.js | 29 +++++++++ .../tests/console/console-log-large-array.any.js | 8 +++ .../console/console-log-shadowrealm-manual.html | 10 ++++ .../tests/console/console-log-symbol.any.js | 10 ++++ .../console-namespace-object-class-string.any.js | 40 +++++++++++++ ...ole-number-format-specifiers-symbol-manual.html | 26 ++++++++ ...sole-string-format-specifier-symbol-manual.html | 23 +++++++ .../tests/console/console-tests-historical.any.js | 20 +++++++ .../console/console-timing-logging-manual.html | 70 ++++++++++++++++++++++ .../tests/console/idlharness-shadowrealm.window.js | 5 ++ .../web-platform/tests/console/idlharness.any.js | 9 +++ 15 files changed, 353 insertions(+) create mode 100644 testing/web-platform/tests/console/META.yml create mode 100644 testing/web-platform/tests/console/console-count-logging-manual.html create mode 100644 testing/web-platform/tests/console/console-countReset-logging-manual.html create mode 100644 testing/web-platform/tests/console/console-is-a-namespace.any.js create mode 100644 testing/web-platform/tests/console/console-label-conversion.any.js create mode 100644 testing/web-platform/tests/console/console-log-large-array.any.js create mode 100644 testing/web-platform/tests/console/console-log-shadowrealm-manual.html create mode 100644 testing/web-platform/tests/console/console-log-symbol.any.js create mode 100644 testing/web-platform/tests/console/console-namespace-object-class-string.any.js create mode 100644 testing/web-platform/tests/console/console-number-format-specifiers-symbol-manual.html create mode 100644 testing/web-platform/tests/console/console-string-format-specifier-symbol-manual.html create mode 100644 testing/web-platform/tests/console/console-tests-historical.any.js create mode 100644 testing/web-platform/tests/console/console-timing-logging-manual.html create mode 100644 testing/web-platform/tests/console/idlharness-shadowrealm.window.js create mode 100644 testing/web-platform/tests/console/idlharness.any.js (limited to 'testing/web-platform/tests/console') diff --git a/testing/web-platform/tests/console/META.yml b/testing/web-platform/tests/console/META.yml new file mode 100644 index 0000000000..60c95d0d57 --- /dev/null +++ b/testing/web-platform/tests/console/META.yml @@ -0,0 +1,5 @@ +spec: https://console.spec.whatwg.org/ +suggested_reviewers: + - domenic + - pwnall + - domfarolino diff --git a/testing/web-platform/tests/console/console-count-logging-manual.html b/testing/web-platform/tests/console/console-count-logging-manual.html new file mode 100644 index 0000000000..640729f1a2 --- /dev/null +++ b/testing/web-platform/tests/console/console-count-logging-manual.html @@ -0,0 +1,23 @@ + + + +Console Count - Logging Manual Test + + + + + +

Open the console inside the developer tools. It should contain four entries whose contents are:

+

default: 1

+

default: 2

+

default: 3

+

default: 4

+ + + + diff --git a/testing/web-platform/tests/console/console-countReset-logging-manual.html b/testing/web-platform/tests/console/console-countReset-logging-manual.html new file mode 100644 index 0000000000..7fe01f50ed --- /dev/null +++ b/testing/web-platform/tests/console/console-countReset-logging-manual.html @@ -0,0 +1,47 @@ + + + +Console Count Reset - Logging Manual Test + + + + + +

Open the console inside the developer tools. It should contain entries whose contents are:

+

default: 1

+

default: 1

+

default: 1

+

default: 1

+

default: 1

+

default: 1

+

default: 1

+

default: 1

+

a label: 1

+

a label: 1

+

[some warning message indicating that a count for label "b" does not exist]

+ + + + diff --git a/testing/web-platform/tests/console/console-is-a-namespace.any.js b/testing/web-platform/tests/console/console-is-a-namespace.any.js new file mode 100644 index 0000000000..1756ba6bc1 --- /dev/null +++ b/testing/web-platform/tests/console/console-is-a-namespace.any.js @@ -0,0 +1,28 @@ +// META: global=window,dedicatedworker,shadowrealm +"use strict"; +// https://webidl.spec.whatwg.org/#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"); diff --git a/testing/web-platform/tests/console/console-label-conversion.any.js b/testing/web-platform/tests/console/console-label-conversion.any.js new file mode 100644 index 0000000000..4d48df3b1d --- /dev/null +++ b/testing/web-platform/tests/console/console-label-conversion.any.js @@ -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`); +} diff --git a/testing/web-platform/tests/console/console-log-large-array.any.js b/testing/web-platform/tests/console/console-log-large-array.any.js new file mode 100644 index 0000000000..e5cb92d9d3 --- /dev/null +++ b/testing/web-platform/tests/console/console-log-large-array.any.js @@ -0,0 +1,8 @@ +// META: global=window,dedicatedworker,shadowrealm +"use strict"; +// https://console.spec.whatwg.org/ + +test(() => { + console.log(new Array(10000000).fill("x")); + console.log(new Uint8Array(10000000)); +}, "Logging large arrays works"); diff --git a/testing/web-platform/tests/console/console-log-shadowrealm-manual.html b/testing/web-platform/tests/console/console-log-shadowrealm-manual.html new file mode 100644 index 0000000000..b091a850c0 --- /dev/null +++ b/testing/web-platform/tests/console/console-log-shadowrealm-manual.html @@ -0,0 +1,10 @@ + + +Console Logging Manual Test +

Open the console inside the developer tools. It should contain one entry saying "test passed".

+ diff --git a/testing/web-platform/tests/console/console-log-symbol.any.js b/testing/web-platform/tests/console/console-log-symbol.any.js new file mode 100644 index 0000000000..a2facb6c64 --- /dev/null +++ b/testing/web-platform/tests/console/console-log-symbol.any.js @@ -0,0 +1,10 @@ +// META: global=window,dedicatedworker,shadowrealm +"use strict"; +// https://console.spec.whatwg.org/ + +test(() => { + console.log(Symbol()); + console.log(Symbol("abc")); + console.log(Symbol.for("def")); + console.log(Symbol.isConcatSpreadable); +}, "Logging a symbol doesn't throw"); diff --git a/testing/web-platform/tests/console/console-namespace-object-class-string.any.js b/testing/web-platform/tests/console/console-namespace-object-class-string.any.js new file mode 100644 index 0000000000..d3ff7f7d07 --- /dev/null +++ b/testing/web-platform/tests/console/console-namespace-object-class-string.any.js @@ -0,0 +1,40 @@ +"use strict"; +// https://webidl.spec.whatwg.org/#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"); diff --git a/testing/web-platform/tests/console/console-number-format-specifiers-symbol-manual.html b/testing/web-platform/tests/console/console-number-format-specifiers-symbol-manual.html new file mode 100644 index 0000000000..f77b84e515 --- /dev/null +++ b/testing/web-platform/tests/console/console-number-format-specifiers-symbol-manual.html @@ -0,0 +1,26 @@ + + + +Console Number Format Specifiers on Symbols + + + + + +

Open the console inside the developer tools. It should contain 15 entries, each of which are:

+

NaN

+ + + + diff --git a/testing/web-platform/tests/console/console-string-format-specifier-symbol-manual.html b/testing/web-platform/tests/console/console-string-format-specifier-symbol-manual.html new file mode 100644 index 0000000000..3a1b93f735 --- /dev/null +++ b/testing/web-platform/tests/console/console-string-format-specifier-symbol-manual.html @@ -0,0 +1,23 @@ + + + +Console String Format Specifier on Symbols + + + + + +

Open the console inside the developer tools. It should contain five entries, each of which are:

+

Symbol(description)

+ + + + diff --git a/testing/web-platform/tests/console/console-tests-historical.any.js b/testing/web-platform/tests/console/console-tests-historical.any.js new file mode 100644 index 0000000000..1b18a9879f --- /dev/null +++ b/testing/web-platform/tests/console/console-tests-historical.any.js @@ -0,0 +1,20 @@ +// META: global=window,dedicatedworker,shadowrealm +/** + * 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"); diff --git a/testing/web-platform/tests/console/console-timing-logging-manual.html b/testing/web-platform/tests/console/console-timing-logging-manual.html new file mode 100644 index 0000000000..3b9e5cea21 --- /dev/null +++ b/testing/web-platform/tests/console/console-timing-logging-manual.html @@ -0,0 +1,70 @@ + + + +Console Timing Methods - Logging Manual Test + + + + + +

Open the console inside the developer tools. It should contain entries whose contents are:

+

default: <some time>

+

default: <some time>

+ +

default: <some time>

+

default: <some time> extra data

+

default: <some time>

+ +

default: <some time>

+

default: <some time> extra data

+

default: <some time>

+ +

default: <some time>

+

default: <some time> extra data

+

default: <some time>

+ +

custom toString(): <some time>

+

custom toString(): <some time> extra data

+

custom toString(): <some time>

+ +

a label: <some time>

+

a label: <some time> extra data

+

a label: <some time>

+ +

[some warning message indicating that a timer for label "b" does not exist]

+ + + + diff --git a/testing/web-platform/tests/console/idlharness-shadowrealm.window.js b/testing/web-platform/tests/console/idlharness-shadowrealm.window.js new file mode 100644 index 0000000000..8f68252dcd --- /dev/null +++ b/testing/web-platform/tests/console/idlharness-shadowrealm.window.js @@ -0,0 +1,5 @@ +// META: script=/resources/idlharness-shadowrealm.js + +// https://console.spec.whatwg.org/ + +idl_test_shadowrealm(["console"], []); diff --git a/testing/web-platform/tests/console/idlharness.any.js b/testing/web-platform/tests/console/idlharness.any.js new file mode 100644 index 0000000000..1e7ba76ecd --- /dev/null +++ b/testing/web-platform/tests/console/idlharness.any.js @@ -0,0 +1,9 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://console.spec.whatwg.org/ + +idl_test( + ['console'], + [] // no deps +); -- cgit v1.2.3