diff options
29 files changed, 583 insertions, 316 deletions
diff --git a/tests/wpt/metadata/FileAPI/url/url-with-fetch.any.js.ini b/tests/wpt/metadata/FileAPI/url/url-with-fetch.any.js.ini index 3b874fc1748..947e223fb28 100644 --- a/tests/wpt/metadata/FileAPI/url/url-with-fetch.any.js.ini +++ b/tests/wpt/metadata/FileAPI/url/url-with-fetch.any.js.ini @@ -34,6 +34,3 @@ [Revoke blob URL after creating Request, will fetch] expected: FAIL - [Revoke blob URL after calling fetch, fetch should succeed] - expected: FAIL - diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index a8bdf749ea3..116c88f2ca7 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -130021,6 +130021,30 @@ {} ] ], + "css/css-multicol/columnfill-auto-max-height-001.html": [ + [ + "css/css-multicol/columnfill-auto-max-height-001.html", + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], + "css/css-multicol/columnfill-auto-max-height-002.html": [ + [ + "css/css-multicol/columnfill-auto-max-height-002.html", + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], "css/css-multicol/float-and-block.html": [ [ "css/css-multicol/float-and-block.html", @@ -445530,16 +445554,28 @@ {} ] ], - "wake-lock/wakelock-insecure-context.html": [ + "wake-lock/wakelock-insecure-context.any.js": [ [ - "wake-lock/wakelock-insecure-context.html", - {} - ] - ], - "wake-lock/wakelock-state-is-global.https.html": [ + "wake-lock/wakelock-insecure-context.any.html", + { + "script_metadata": [ + [ + "title", + "Wake Lock API is not exposed in an insecure context" + ] + ] + } + ], [ - "wake-lock/wakelock-state-is-global.https.html", - {} + "wake-lock/wakelock-insecure-context.any.worker.html", + { + "script_metadata": [ + [ + "title", + "Wake Lock API is not exposed in an insecure context" + ] + ] + } ] ], "wake-lock/wakelock-supported-by-feature-policy.html": [ @@ -445548,10 +445584,28 @@ {} ] ], - "wake-lock/wakelock-type.https.html": [ + "wake-lock/wakelock-type.https.any.js": [ [ - "wake-lock/wakelock-type.https.html", - {} + "wake-lock/wakelock-type.https.any.html", + { + "script_metadata": [ + [ + "title", + "WakeLock.request() with invaild type" + ] + ] + } + ], + [ + "wake-lock/wakelock-type.https.any.worker.html", + { + "script_metadata": [ + [ + "title", + "WakeLock.request() with invaild type" + ] + ] + } ] ], "wasm/create_multiple_memory.worker.js": [ @@ -602143,6 +602197,14 @@ "2949a1996ebae0c48329906ea7ef34c83080e90f", "reftest" ], + "css/css-multicol/columnfill-auto-max-height-001.html": [ + "6d8877e7632bed4f989c233ed38d40a00111be32", + "reftest" + ], + "css/css-multicol/columnfill-auto-max-height-002.html": [ + "7d156b2d0cfde3f1fd1c25a48616e778c3135c74", + "reftest" + ], "css/css-multicol/extremely-tall-multicol-with-extremely-tall-child-crash.html": [ "6e40afe54c9ce9aa50765f778d74640454dcc1ce", "testharness" @@ -651624,7 +651686,7 @@ "testharness" ], "dom/events/EventListener-handleEvent.html": [ - "6630f273fff4b450d1fcc425828b5f1f53357e54", + "1eb80ccb15f0bc6fda7d04d4fc01555ea6b8ab04", "testharness" ], "dom/events/EventListener-incumbent-global-1.sub.html": [ @@ -653020,7 +653082,7 @@ "testharness" ], "dom/traversal/TreeWalker-acceptNode-filter.html": [ - "1446f40f68dd25f13b97bdce2a425cd9f36104d1", + "e2110aff3b3dec517f70866f908de2f919c089a4", "testharness" ], "dom/traversal/TreeWalker-basic.html": [ @@ -674840,7 +674902,7 @@ "support" ], "html/semantics/rellist-feature-detection.html": [ - "d290439d8ee647b2f8d95ddc45ac390dccde9843", + "45debcc49a487d43437b04e6e8a429f7db321db1", "testharness" ], "html/semantics/scripting-1/META.yml": [ @@ -680596,7 +680658,7 @@ "support" ], "interfaces/html.idl": [ - "f44f5da96ff6e400cd51a404e3f06ae558d4cff4", + "5ae46f742922f4c455380745f124769399086eb9", "support" ], "interfaces/image-capture.idl": [ @@ -680900,7 +680962,7 @@ "support" ], "interfaces/webxr.idl": [ - "2d1bd9fe5f5702d69051fe00b2f958a9a3a4b82c", + "63327a3f55d79f1acdc2cbd53a98b0a089aade2d", "support" ], "interfaces/worklets.idl": [ @@ -694428,7 +694490,7 @@ "testharness" ], "preload/download-resources.html": [ - "510ebb480457e9e1b0d6ea788a8bd36c825bc634", + "557c9656b1813c52e373ee70e565a44e966389bf", "testharness" ], "preload/dynamic-adding-preload-imagesrcset.html": [ @@ -694448,7 +694510,7 @@ "testharness" ], "preload/link-header-on-subresource.html": [ - "087a3429e649348d2b35fd92bf03ebc6307c72dc", + "7047115a1caf4989ea5e80e80db35bc2dcdf2a6b", "testharness" ], "preload/link-header-preload-delay-onload.html": [ @@ -694488,7 +694550,7 @@ "testharness" ], "preload/onerror-event.html": [ - "8190be87a4b7caf69ba07d07d239ff8143be3b05", + "2038e06e941cf7b146fcb744c6c5a2ded3072abc", "testharness" ], "preload/onload-event.html": [ @@ -694496,11 +694558,11 @@ "testharness" ], "preload/preload-csp.sub.html": [ - "65e9b3a2a6d350598e88cd2c8a7e4fa8d10d7533", + "62d0c71039b7c06a4299ac71e055ff3786de5c41", "testharness" ], "preload/preload-default-csp.sub.html": [ - "923431456cf7e01d66556fda7241be0e660dacc0", + "9fc11945866834c70c9ad270fb11d37a443ac3d0", "testharness" ], "preload/preload-strict-dynamic.html": [ @@ -723399,20 +723461,16 @@ "6f05d23550e2b0c967fac5b436a5e3336222ffe2", "support" ], - "wake-lock/wakelock-insecure-context.html": [ - "2c61f41311db3f9edf0502ea752ca27970eed3fb", - "testharness" - ], - "wake-lock/wakelock-state-is-global.https.html": [ - "2eee31982498caab44b5160237c7ce7f8ce9a569", + "wake-lock/wakelock-insecure-context.any.js": [ + "f32cc3c354354f99852bb198760cdbd9229355a4", "testharness" ], "wake-lock/wakelock-supported-by-feature-policy.html": [ "d6289fff43c8717ac6e9ace59713e6fd70bd249d", "testharness" ], - "wake-lock/wakelock-type.https.html": [ - "df7a68a040bef273efcd2584dfe3612adc05d85b", + "wake-lock/wakelock-type.https.any.js": [ + "26ebcbef557014fe5b5b7d4f4f145ac5f0305a02", "testharness" ], "wasm/META.yml": [ diff --git a/tests/wpt/metadata/dom/events/EventListener-handleEvent.html.ini b/tests/wpt/metadata/dom/events/EventListener-handleEvent.html.ini index 9815c2a274c..72f7b4b3565 100644 --- a/tests/wpt/metadata/dom/events/EventListener-handleEvent.html.ini +++ b/tests/wpt/metadata/dom/events/EventListener-handleEvent.html.ini @@ -8,3 +8,9 @@ [calls `handleEvent` method of `EventListener`] expected: FAIL + [throws if `handleEvent` is falsy and not callable] + expected: FAIL + + [throws if `handleEvent` is thruthy and not callable] + expected: FAIL + diff --git a/tests/wpt/metadata/fetch/content-type/response.window.js.ini b/tests/wpt/metadata/fetch/content-type/response.window.js.ini index 526971acaba..ed72b0bad35 100644 --- a/tests/wpt/metadata/fetch/content-type/response.window.js.ini +++ b/tests/wpt/metadata/fetch/content-type/response.window.js.ini @@ -312,15 +312,6 @@ [<iframe>: separate response Content-Type: text/plain */*;charset=gbk] expected: FAIL - [<iframe>: combined response Content-Type: */* text/html] - expected: FAIL - - [<iframe>: combined response Content-Type: text/html;charset=gbk text/plain text/html] - expected: FAIL - - [<iframe>: combined response Content-Type: text/html */*;charset=gbk] - expected: FAIL - [<iframe>: separate response Content-Type: text/html;charset=gbk text/plain text/html] expected: FAIL @@ -333,3 +324,9 @@ [<iframe>: separate response Content-Type: text/html;" \\" text/plain] expected: FAIL + [<iframe>: separate response Content-Type: text/html */*] + expected: FAIL + + [<iframe>: combined response Content-Type: text/html;x=" text/plain] + expected: FAIL + diff --git a/tests/wpt/metadata/fetch/nosniff/parsing-nosniff.window.js.ini b/tests/wpt/metadata/fetch/nosniff/parsing-nosniff.window.js.ini index 849e7ec770e..ce73518c20a 100644 --- a/tests/wpt/metadata/fetch/nosniff/parsing-nosniff.window.js.ini +++ b/tests/wpt/metadata/fetch/nosniff/parsing-nosniff.window.js.ini @@ -14,6 +14,6 @@ [X-Content-Type-Options%3A%20'NosniFF'] expected: FAIL - [X-Content-Type-Options%3A%20no%0D%0AX-Content-Type-Options%3A%20nosniff] + [X-Content-Type-Options%3A%20%2Cnosniff] expected: FAIL diff --git a/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_1.html.ini b/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_1.html.ini deleted file mode 100644 index 87b07c3e670..00000000000 --- a/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_1.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[traverse_the_history_1.html] - [Multiple history traversals from the same task] - expected: FAIL - diff --git a/tests/wpt/metadata/html/dom/interfaces.https.html.ini b/tests/wpt/metadata/html/dom/interfaces.https.html.ini index d048aad6f1b..4606098c2b5 100644 --- a/tests/wpt/metadata/html/dom/interfaces.https.html.ini +++ b/tests/wpt/metadata/html/dom/interfaces.https.html.ini @@ -6765,9 +6765,6 @@ [HTMLMediaElement interface: document.createElement("video") must inherit property "seekable" with the proper type] expected: FAIL - [HTMLMediaElement interface: document.createElement("video") must inherit property "loop" with the proper type] - expected: PASS - [HTMLMediaElement interface: document.createElement("video") must inherit property "controls" with the proper type] expected: FAIL @@ -6780,9 +6777,6 @@ [HTMLMediaElement interface: document.createElement("audio") must inherit property "seekable" with the proper type] expected: FAIL - [HTMLMediaElement interface: document.createElement("audio") must inherit property "loop" with the proper type] - expected: PASS - [HTMLMediaElement interface: document.createElement("audio") must inherit property "controls" with the proper type] expected: FAIL @@ -6795,9 +6789,6 @@ [HTMLMediaElement interface: new Audio() must inherit property "seekable" with the proper type] expected: FAIL - [HTMLMediaElement interface: new Audio() must inherit property "loop" with the proper type] - expected: PASS - [HTMLMediaElement interface: new Audio() must inherit property "controls" with the proper type] expected: FAIL @@ -6807,9 +6798,6 @@ [HTMLMediaElement interface: attribute seekable] expected: FAIL - [HTMLMediaElement interface: attribute loop] - expected: PASS - [HTMLMediaElement interface: operation play()] expected: FAIL @@ -9363,6 +9351,15 @@ [HTMLLinkElement interface: attribute imageSrcset] expected: FAIL + [HTMLFormElement interface: document.createElement("form") must inherit property "requestSubmit(HTMLElement)" with the proper type] + expected: FAIL + + [HTMLFormElement interface: operation requestSubmit(HTMLElement)] + expected: FAIL + + [HTMLFormElement interface: calling requestSubmit(HTMLElement) on document.createElement("form") with too few arguments must throw TypeError] + expected: FAIL + [interfaces.https.html?exclude=(Document|Window|HTML.*)] [HTML IDL tests] @@ -10817,3 +10814,30 @@ [ElementInternals interface: existence and properties of interface prototype object's "constructor" property] expected: FAIL + [ElementInternals interface: operation setValidity(ValidityStateFlags, DOMString, HTMLElement)] + expected: FAIL + + [ElementInternals interface: operation setFormValue([object Object\],[object Object\],[object Object\], [object Object\],[object Object\],[object Object\])] + expected: FAIL + + [ElementInternals interface: operation reportValidity()] + expected: FAIL + + [ElementInternals interface: operation checkValidity()] + expected: FAIL + + [ElementInternals interface: attribute labels] + expected: FAIL + + [ElementInternals interface: attribute form] + expected: FAIL + + [ElementInternals interface: attribute willValidate] + expected: FAIL + + [ElementInternals interface: attribute validationMessage] + expected: FAIL + + [ElementInternals interface: attribute validity] + expected: FAIL + diff --git a/tests/wpt/metadata/html/dom/interfaces.worker.js.ini b/tests/wpt/metadata/html/dom/interfaces.worker.js.ini index 6144c27c83d..2301241aec5 100644 --- a/tests/wpt/metadata/html/dom/interfaces.worker.js.ini +++ b/tests/wpt/metadata/html/dom/interfaces.worker.js.ini @@ -834,3 +834,27 @@ [TextMetrics interface object name] expected: FAIL + [ImageBitmapRenderingContext interface: operation transferFromImageBitmap(ImageBitmap)] + expected: FAIL + + [ImageBitmapRenderingContext interface: existence and properties of interface object] + expected: FAIL + + [ImageBitmapRenderingContext interface: existence and properties of interface prototype object] + expected: FAIL + + [ImageBitmapRenderingContext interface: attribute canvas] + expected: FAIL + + [ImageBitmapRenderingContext interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [ImageBitmapRenderingContext interface object name] + expected: FAIL + + [ImageBitmapRenderingContext interface: existence and properties of interface prototype object's @@unscopables property] + expected: FAIL + + [ImageBitmapRenderingContext interface object length] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/rellist-feature-detection.html.ini b/tests/wpt/metadata/html/semantics/rellist-feature-detection.html.ini index d2762c55d7b..d64c90f3857 100644 --- a/tests/wpt/metadata/html/semantics/rellist-feature-detection.html.ini +++ b/tests/wpt/metadata/html/semantics/rellist-feature-detection.html.ini @@ -2,3 +2,15 @@ [Make sure that relList based feature detection is working] expected: FAIL + [Make sure that relList based feature detection is working for <a>] + expected: FAIL + + [Make sure that relList based feature detection is working for <form>] + expected: FAIL + + [Make sure that relList based feature detection is working for <area>] + expected: FAIL + + [Make sure that relList based feature detection is working for <link>] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/execution-timing/077.html.ini b/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/execution-timing/077.html.ini deleted file mode 100644 index bcd2fd0eab8..00000000000 --- a/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/execution-timing/077.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[077.html] - [ adding several types of scripts through the DOM and removing some of them confuses scheduler ] - expected: FAIL - diff --git a/tests/wpt/mozilla/meta/css/transition_calc_implicit.html.ini b/tests/wpt/mozilla/meta/css/transition_calc_implicit.html.ini new file mode 100644 index 00000000000..dbea4f293ad --- /dev/null +++ b/tests/wpt/mozilla/meta/css/transition_calc_implicit.html.ini @@ -0,0 +1,2 @@ +[transition_calc_implicit.html] + expected: TIMEOUT diff --git a/tests/wpt/mozilla/meta/mozilla/paint_timing.html.ini b/tests/wpt/mozilla/meta/mozilla/paint_timing.html.ini new file mode 100644 index 00000000000..14a9e778f39 --- /dev/null +++ b/tests/wpt/mozilla/meta/mozilla/paint_timing.html.ini @@ -0,0 +1,4 @@ +[paint_timing.html] + [Performance entries observer] + expected: FAIL + diff --git a/tests/wpt/web-platform-tests/css/css-multicol/columnfill-auto-max-height-001.html b/tests/wpt/web-platform-tests/css/css-multicol/columnfill-auto-max-height-001.html new file mode 100644 index 00000000000..6d8877e7632 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-multicol/columnfill-auto-max-height-001.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> + + <meta charset="UTF-8"> + + <title>CSS Multi-column Layout Test: 'column-fill: auto' and height constrained of a multi-column container</title> + + <!-- + + See also + + Bug 1348839: 'column-fill: auto' does not fill as expected, content ends up in one column + https://bugzilla.mozilla.org/show_bug.cgi?id=1348839 + + --> + + <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> + <link rel="help" href="https://www.w3.org/TR/css-multicol-1/#cf" title="7.1 column-fill"> + <link rel="match" href="../reference/ref-filled-green-100px-square.xht"> + + <meta name="flags" content=""> + <meta content="This test verifies how content is distributed among columns when the height of a multi-column container is constrained and when 'column-fill' is set to 'auto'. In this test, the line box height is exactly 25px. So, content should fill 4 lines of the first column and should only fill up the first column. Since column rules are only drawn between two columns that both have content and since the test expects only 1 column filled with content, therefore the column rule should not be painted, thus the 'no red' test success condition." name="assert"> + + <style> + div + { + color: green; + column-count: 2; + column-fill: auto; /* fill columns sequentially */ + column-gap: 4em; /* computes to 100px */ + column-rule: red solid 4em; + font-family: Ahem; + /* + To download Ahem font: + http://www.w3.org/Style/CSS/Test/Fonts/Ahem/ + */ + font-size: 25px; + line-height: 1; + max-height: 100px; + width: 300px; + } + </style> + + <p>Test passes if there is a filled green square and <strong>no red</strong>. + + <div>Abcd efgh ijkl mno.</div> diff --git a/tests/wpt/web-platform-tests/css/css-multicol/columnfill-auto-max-height-002.html b/tests/wpt/web-platform-tests/css/css-multicol/columnfill-auto-max-height-002.html new file mode 100644 index 00000000000..7d156b2d0cf --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-multicol/columnfill-auto-max-height-002.html @@ -0,0 +1,59 @@ +<!DOCTYPE html> + + <meta charset="UTF-8"> + + <title>CSS Multi-column Layout Test: 'column-fill: auto' and height constrained of a multi-column container</title> + + <!-- + + See also + + Bug 1348839: 'column-fill: auto' does not fill as expected, content ends up in one column + https://bugzilla.mozilla.org/show_bug.cgi?id=1348839 + + --> + + <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> + <link rel="help" href="https://www.w3.org/TR/css-multicol-1/#cf" title="7.1 column-fill"> + <link rel="match" href="../reference/ref-filled-green-100px-square.xht"> + + <meta name="flags" content=""> + <meta content="This test verifies how content is distributed among columns when the height of a multi-column container is constrained and when 'column-fill' is set to 'auto'. In this test, the line box height is exactly 25px. So, content should fill 4 lines of the first column and should only fill up the first column. Since column rules are only drawn between two columns that both have content and since the test expects only 1 column filled with content, therefore the column rule should not be painted, thus the 'no red' test success condition." name="assert"> + + <style> + div + { + color: green; + column-count: 4; + column-fill: auto; /* fill columns sequentially */ + column-gap: 4em; /* computes to 100px */ + column-rule: red solid 4em; + font-family: Ahem; + /* + To download Ahem font: + http://www.w3.org/Style/CSS/Test/Fonts/Ahem/ + */ + font-size: 25px; + line-height: 1; + max-height: 100px; + orphans: 1; + /* + In this test, the orphans property specifies the + minimum number of line boxes that must be left + in a column box before a column break, that must + be left at the bottom of a column box. + */ + widows: 1; + /* + In this test, the widows property specifies the + minimum number of line boxes that must be left + in a column box after a column break, that must + be left at the top of a column box. + */ + width: 700px; + } + </style> + + <p>Test passes if there is a filled green square and <strong>no red</strong>. + + <div>Abcd efgh ijkl mno.</div> diff --git a/tests/wpt/web-platform-tests/dom/events/EventListener-handleEvent.html b/tests/wpt/web-platform-tests/dom/events/EventListener-handleEvent.html index 6630f273fff..1eb80ccb15f 100644 --- a/tests/wpt/web-platform-tests/dom/events/EventListener-handleEvent.html +++ b/tests/wpt/web-platform-tests/dom/events/EventListener-handleEvent.html @@ -5,13 +5,12 @@ <script src="/resources/testharnessreport.js"></script> <link rel="help" href="https://dom.spec.whatwg.org/#callbackdef-eventlistener"> <div id=log></div> -<div id=target></div> <script> setup({ allow_uncaught_exception: true }); test(function(t) { var type = "foo"; - var target = document.getElementById("target"); + var target = document.createElement("div"); var eventListener = { handleEvent: function(evt) { var that = this; @@ -30,12 +29,16 @@ test(function(t) { test(function(t) { var type = "foo"; - var target = document.getElementById("target"); - var thrownError = new Error(); + var target = document.createElement("div"); + var thrownError = { name: "test" }; var uncaughtError; - - window.addEventListener("error", function(event) { + var errorHandler = function(event) { uncaughtError = event.error; + }; + + window.addEventListener("error", errorHandler); + t.add_cleanup(function() { + window.removeEventListener("error", errorHandler); }); target.addEventListener(type, { @@ -50,7 +53,7 @@ test(function(t) { test(function(t) { var type = "foo"; - var target = document.getElementById("target"); + var target = document.createElement("div"); var calls = 0; target.addEventListener(type, { @@ -68,11 +71,27 @@ test(function(t) { test(function(t) { var type = "foo"; - var target = document.getElementById("target"); - var uncaughtError; + var target = document.createElement("div"); + var calls = 0; + var eventListener = function() { calls++; }; + eventListener.handleEvent = t.unreached_func("`handleEvent` method should not be called on functions"); + + target.addEventListener(type, eventListener); + target.dispatchEvent(new Event(type)); + assert_equals(calls, 1); +}, "doesn't call `handleEvent` method on callable `EventListener`"); - window.addEventListener("error", function(event) { +test(function(t) { + var type = "foo"; + var target = document.createElement("div"); + var uncaughtError; + var errorHandler = function(event) { uncaughtError = event.error; + }; + + window.addEventListener("error", errorHandler); + t.add_cleanup(function() { + window.removeEventListener("error", errorHandler); }); target.addEventListener(type, { @@ -81,5 +100,26 @@ test(function(t) { target.dispatchEvent(new Event(type)); assert_true(uncaughtError instanceof TypeError); -}, "throws if `handleEvent` is not callable"); +}, "throws if `handleEvent` is falsy and not callable"); + +test(function(t) { + var type = "foo"; + var target = document.createElement("div"); + var uncaughtError; + var errorHandler = function(event) { + uncaughtError = event.error; + }; + + window.addEventListener("error", errorHandler); + t.add_cleanup(function() { + window.removeEventListener("error", errorHandler); + }); + + target.addEventListener(type, { + handleEvent: 1, + }); + + target.dispatchEvent(new Event(type)); + assert_true(uncaughtError instanceof TypeError); +}, "throws if `handleEvent` is thruthy and not callable"); </script> diff --git a/tests/wpt/web-platform-tests/dom/traversal/TreeWalker-acceptNode-filter.html b/tests/wpt/web-platform-tests/dom/traversal/TreeWalker-acceptNode-filter.html index 1446f40f68d..e2110aff3b3 100644 --- a/tests/wpt/web-platform-tests/dom/traversal/TreeWalker-acceptNode-filter.html +++ b/tests/wpt/web-platform-tests/dom/traversal/TreeWalker-acceptNode-filter.html @@ -8,6 +8,7 @@ Test adapted from https://dxr.mozilla.org/chromium/source/src/third_party/WebKit <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="traversal-support.js"></script> +<link rel="help" href="https://dom.spec.whatwg.org/#callbackdef-nodefilter"> <div id=log></div> </head> <body> @@ -102,10 +103,10 @@ test(function() assert_node(walker.currentNode, { type: Element, id: 'root' }); }, 'Testing with object with non-function acceptNode property'); -test(function() +test(function(t) { var filter = function() { return NodeFilter.FILTER_ACCEPT; }; - filter.acceptNode = function(node) { return NodeFilter.FILTER_SKIP; }; + filter.acceptNode = t.unreached_func("`acceptNode` method should not be called on functions"); var walker = document.createTreeWalker(testElement, NodeFilter.SHOW_ELEMENT, filter); assert_node(walker.firstChild(), { type: Element, id: 'A1' }); assert_node(walker.nextNode(), { type: Element, id: 'B1' }); @@ -113,17 +114,6 @@ test(function() test(function() { - var filter = { - acceptNode: function(node) { - return NodeFilter.FILTER_ACCEPT; - } - }; - var walker = document.createTreeWalker(testElement, NodeFilter.SHOW_ELEMENT, filter); - assert_node(walker.firstChild(), { type: Element, id: 'A1' }); -}, 'Testing acceptNode callee'); - -test(function() -{ var test_error = { name: "test" }; var walker = document.createTreeWalker(testElement, NodeFilter.SHOW_ELEMENT, function(node) { @@ -135,6 +125,38 @@ test(function() assert_node(walker.currentNode, { type: Element, id: 'root' }); }, 'Testing with filter function that throws'); +test(function() { + var testError = { name: "test" }; + var filter = { + get acceptNode() { + throw testError; + }, + }; + + var walker = document.createTreeWalker(testElement, NodeFilter.SHOW_ELEMENT, filter); + assert_throws(testError, function() { walker.firstChild(); }); + assert_node(walker.currentNode, { type: Element, id: 'root' }); + assert_throws(testError, function() { walker.nextNode(); }); + assert_node(walker.currentNode, { type: Element, id: 'root' }); +}, "rethrows errors when getting `acceptNode`"); + +test(function() { + var calls = 0; + var walker = document.createTreeWalker(testElement, NodeFilter.SHOW_ELEMENT, { + get acceptNode() { + calls++; + return function() { + return NodeFilter.FILTER_ACCEPT; + }; + }, + }); + + assert_equals(calls, 0); + walker.nextNode(); + walker.nextNode(); + assert_equals(calls, 2); +}, "performs `Get` on every traverse"); + test(function() { var test_error = { name: "test" }; diff --git a/tests/wpt/web-platform-tests/html/semantics/rellist-feature-detection.html b/tests/wpt/web-platform-tests/html/semantics/rellist-feature-detection.html index d290439d8ee..45debcc49a4 100644 --- a/tests/wpt/web-platform-tests/html/semantics/rellist-feature-detection.html +++ b/tests/wpt/web-platform-tests/html/semantics/rellist-feature-detection.html @@ -24,10 +24,11 @@ link_support_table['a'] = { 'apple-touch-icon-precomposed', 'canonical'] }; link_support_table['area'] = link_support_table['a']; -link_support_table['form'] = link_support_table['form']; +link_support_table['form'] = link_support_table['a']; -function test_rellist(tag_name, rel_table) { - let element = document.createElement(tag_name); +function test_rellist(tag_name) { + const rel_table = link_support_table[tag_name]; + const element = document.createElement(tag_name); let tag = element.tagName; // Test that setting rel is also setting relList, for both // valid and invalid values. @@ -74,10 +75,10 @@ function test_rellist(tag_name, rel_table) { } } -test(function() { - test_rellist('LINK', link_support_table['link']); - test_rellist('A', link_support_table['a']); - test_rellist('AREA', link_support_table['area']); - test_rellist('FORM', link_support_table['form']); -}, 'Make sure that relList based feature detection is working'); +['link', 'a', 'area', 'form'].forEach(tag_name => { + test( + () => test_rellist(tag_name), + `Make sure that relList based feature detection is working for <${tag_name}>` + ); +}); </script> diff --git a/tests/wpt/web-platform-tests/interfaces/html.idl b/tests/wpt/web-platform-tests/interfaces/html.idl index f44f5da96ff..5ae46f74292 100644 --- a/tests/wpt/web-platform-tests/interfaces/html.idl +++ b/tests/wpt/web-platform-tests/interfaces/html.idl @@ -116,6 +116,8 @@ interface HTMLElement : Element { [CEReactions] attribute DOMString autocapitalize; [CEReactions] attribute [TreatNullAs=EmptyString] DOMString innerText; + + ElementInternals attachInternals(); }; HTMLElement includes GlobalEventHandlers; @@ -795,6 +797,7 @@ interface HTMLFormElement : HTMLElement { getter (RadioNodeList or Element) (DOMString name); void submit(); + void requestSubmit(optional HTMLElement submitter); [CEReactions] void reset(); boolean checkValidity(); boolean reportValidity(); @@ -1412,9 +1415,9 @@ interface Path2D { }; Path2D includes CanvasPath; -[Exposed=Window] +[Exposed=(Window,Worker)] interface ImageBitmapRenderingContext { - readonly attribute HTMLCanvasElement canvas; + readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas; void transferFromImageBitmap(ImageBitmap? bitmap); }; @@ -1422,14 +1425,14 @@ dictionary ImageBitmapRenderingContextSettings { boolean alpha = true; }; -typedef (OffscreenCanvasRenderingContext2D or WebGLRenderingContext or WebGL2RenderingContext) OffscreenRenderingContext; +typedef (OffscreenCanvasRenderingContext2D or ImageBitmapRenderingContext or WebGLRenderingContext or WebGL2RenderingContext) OffscreenRenderingContext; dictionary ImageEncodeOptions { DOMString type = "image/png"; unrestricted double quality; }; -enum OffscreenRenderingContextId { "2d", "webgl", "webgl2" }; +enum OffscreenRenderingContextId { "2d", "bitmaprenderer", "webgl", "webgl2" }; [Constructor([EnforceRange] unsigned long long width, [EnforceRange] unsigned long long height), Exposed=(Window,Worker), Transferable] interface OffscreenCanvas : EventTarget { @@ -1477,6 +1480,40 @@ dictionary ElementDefinitionOptions { DOMString extends; }; +[Exposed=Window] +interface ElementInternals { + // Form-associated custom elements + + void setFormValue((File or USVString or FormData)? value, + optional (File or USVString or FormData)? state); + + readonly attribute HTMLFormElement? form; + + void setValidity(ValidityStateFlags flags, + optional DOMString message, + optional HTMLElement anchor); + readonly attribute boolean willValidate; + readonly attribute ValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + boolean reportValidity(); + + readonly attribute NodeList labels; +}; + +dictionary ValidityStateFlags { + boolean valueMissing = false; + boolean typeMismatch = false; + boolean patternMismatch = false; + boolean tooLong = false; + boolean tooShort = false; + boolean rangeUnderflow = false; + boolean rangeOverflow = false; + boolean stepMismatch = false; + boolean badInput = false; + boolean customError = false; +}; + dictionary FocusOptions { boolean preventScroll = false; }; diff --git a/tests/wpt/web-platform-tests/interfaces/webxr.idl b/tests/wpt/web-platform-tests/interfaces/webxr.idl index 2d1bd9fe5f5..63327a3f55d 100644 --- a/tests/wpt/web-platform-tests/interfaces/webxr.idl +++ b/tests/wpt/web-platform-tests/interfaces/webxr.idl @@ -32,7 +32,7 @@ enum XREnvironmentBlendMode { // Attributes readonly attribute XREnvironmentBlendMode environmentBlendMode; [SameObject] readonly attribute XRRenderState renderState; - readonly attribute XRInputSourceArray inputSources; + [SameObject] readonly attribute XRInputSourceArray inputSources; // Methods void updateRenderState(optional XRRenderStateInit state); diff --git a/tests/wpt/web-platform-tests/preload/download-resources.html b/tests/wpt/web-platform-tests/preload/download-resources.html index 510ebb48045..557c9656b18 100644 --- a/tests/wpt/web-platform-tests/preload/download-resources.html +++ b/tests/wpt/web-platform-tests/preload/download-resources.html @@ -1,10 +1,8 @@ <!DOCTYPE html> +<title>Makes sure that preloaded resources are downloaded</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/preload/resources/preload_helper.js"></script> -<script> - var t = async_test('Makes sure that preloaded resources are downloaded'); -</script> <link rel=preload href="resources/dummy.js" as=script> <link rel=preload href="resources/dummy.css" as=style> <link rel=preload href="resources/square.png" as=image> @@ -17,9 +15,25 @@ <link rel=preload href="resources/dummy.xml" as="fetch"> <body> <script> - window.addEventListener("load", t.step_func(function() { - t.step_timeout(function() { - verifyPreloadAndRTSupport() + setup({explicit_done: true}); + + var iterations = 0; + + function check_finished() { + if (numberOfResourceTimingEntries("resources/dummy.js") == 1 && + numberOfResourceTimingEntries("resources/dummy.css") == 1 && + numberOfResourceTimingEntries("/fonts/CanvasTest.ttf") == 1 && + numberOfResourceTimingEntries("resources/white.mp4") == 1 && + numberOfResourceTimingEntries("resources/sound_5.oga") == 1 && + numberOfResourceTimingEntries("resources/foo.vtt") == 1 && + numberOfResourceTimingEntries("resources/dummy.xml?foo=bar") == 0 && + numberOfResourceTimingEntries("resources/dummy.xml?novalue") == 0 && + numberOfResourceTimingEntries("resources/dummy.xml") == 1) { + done(); + } + iterations++; + if (iterations == 10) { + // At least one is expected to fail, but this should give details to the exact failure(s). verifyNumberOfResourceTimingEntries("resources/dummy.js", 1); verifyNumberOfResourceTimingEntries("resources/dummy.css", 1); verifyNumberOfResourceTimingEntries("/fonts/CanvasTest.ttf", 1); @@ -29,8 +43,15 @@ verifyNumberOfResourceTimingEntries("resources/dummy.xml?foo=bar", 0); verifyNumberOfResourceTimingEntries("resources/dummy.xml?novalue", 0); verifyNumberOfResourceTimingEntries("resources/dummy.xml", 1); - t.done(); - }, 5000); - })); + done(); + } else { + step_timeout(check_finished, 500); + } + } + + window.addEventListener("load", function() { + verifyPreloadAndRTSupport(); + step_timeout(check_finished, 500); + }); </script> </body> diff --git a/tests/wpt/web-platform-tests/preload/link-header-on-subresource.html b/tests/wpt/web-platform-tests/preload/link-header-on-subresource.html index 087a3429e64..7047115a1ca 100644 --- a/tests/wpt/web-platform-tests/preload/link-header-on-subresource.html +++ b/tests/wpt/web-platform-tests/preload/link-header-on-subresource.html @@ -1,18 +1,31 @@ <!DOCTYPE html> +<title>Makes sure that Link headers on subresources preload resources</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/preload/resources/preload_helper.js"></script> -<script> - var t = async_test('Makes sure that Link headers on subresources preload resources'); -</script> <link rel=stylesheet href="resources/dummy-preloads-subresource.css?link-header-on-subresource"> <script> - window.addEventListener("load", t.step_func(function() { - t.step_timeout(function() { - verifyPreloadAndRTSupport(); + setup({explicit_done: true}); + + var iterations = 0; + + function check_finished() { + if (numberOfResourceTimingEntries("/fonts/CanvasTest.ttf?link-header-on-subresource") == 1) { + done(); + } + iterations++; + if (iterations == 10) { + // This is expected to fail, but this should give details to the exact failure. verifyNumberOfResourceTimingEntries("/fonts/CanvasTest.ttf?link-header-on-subresource", 1); - t.done(); - }, 5000); - })); + done(); + } else { + step_timeout(check_finished, 500); + } + } + + window.addEventListener("load", function() { + verifyPreloadAndRTSupport(); + step_timeout(check_finished, 500); + }); </script> diff --git a/tests/wpt/web-platform-tests/preload/onerror-event.html b/tests/wpt/web-platform-tests/preload/onerror-event.html index 8190be87a4b..2038e06e941 100644 --- a/tests/wpt/web-platform-tests/preload/onerror-event.html +++ b/tests/wpt/web-platform-tests/preload/onerror-event.html @@ -1,12 +1,10 @@ <!DOCTYPE html> <html> -<head></head> -<body> +<title>Makes sure that preloaded resources trigger the onerror event</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/preload/resources/preload_helper.js"></script> <script> - var t = async_test('Makes sure that preloaded resources trigger the onerror event'); var scriptFailed = false; var styleFailed = false; var imageFailed = false; @@ -28,10 +26,20 @@ <link rel=preload href="non-existent/dummy.xml?foo" as=foobarxmlthing onerror="gibberishFailed = true;"> <link rel=preload href="non-existent/dummy.xml?fetch" as=fetch onerror="fetchFailed = true;"> <link rel=preload href="non-existent/dummy.xml?empty" onerror="emptyFailed = true;"> +<body> <script> - window.onload = t.step_func(function() { - t.step_timeout(function() { - verifyPreloadAndRTSupport(); + setup({explicit_done: true}); + + var iterations = 0; + + function check_finished() { + if (styleFailed && scriptFailed && imageFailed && fontFailed && videoFailed && audioFailed && + trackFailed && !gibberishFailed && fetchFailed && !emptyFailed) { + done(); + } + iterations++; + if (iterations == 10) { + // At least one is expected to fail, but this should give details to the exact failure(s). assert_true(styleFailed, "style triggered error event"); assert_true(scriptFailed, "script triggered error event"); assert_true(imageFailed, "image triggered error event"); @@ -42,8 +50,15 @@ assert_false(gibberishFailed, "gibberish as value did not trigger error event"); assert_true(fetchFailed, "fetch as triggered error event"); assert_false(emptyFailed, "empty as triggered error event"); - t.done(); - }, 5000); + done(); + } else { + step_timeout(check_finished, 500); + } + } + + window.addEventListener("load", function() { + verifyPreloadAndRTSupport(); + step_timeout(check_finished, 500); }); </script> </body> diff --git a/tests/wpt/web-platform-tests/preload/preload-csp.sub.html b/tests/wpt/web-platform-tests/preload/preload-csp.sub.html index 65e9b3a2a6d..62d0c71039b 100644 --- a/tests/wpt/web-platform-tests/preload/preload-csp.sub.html +++ b/tests/wpt/web-platform-tests/preload/preload-csp.sub.html @@ -15,41 +15,41 @@ <link rel=preload href="resources/dummy.xml"> <body> <script> -setup({explicit_done: true}); + setup({explicit_done: true}); -var iterations = 0; + var iterations = 0; -function check_finished() { - if (numberOfResourceTimingEntries("{{host}}:{{ports[http][1]}}/preload/resources/dummy.js") == 0 && - numberOfResourceTimingEntries("resources/dummy.css") == 0 && - numberOfResourceTimingEntries("resources/square.png") == 0 && - numberOfResourceTimingEntries("/fonts/CanvasTest.ttf") == 0 && - numberOfResourceTimingEntries("resources/white.mp4") == 0 && - numberOfResourceTimingEntries("resources/sound_5.oga") == 0 && - numberOfResourceTimingEntries("resources/foo.vtt") == 0 && - numberOfResourceTimingEntries("resources/dummy.xml") == 0) { - done(); + function check_finished() { + if (numberOfResourceTimingEntries("{{host}}:{{ports[http][1]}}/preload/resources/dummy.js") == 0 && + numberOfResourceTimingEntries("resources/dummy.css") == 0 && + numberOfResourceTimingEntries("resources/square.png") == 0 && + numberOfResourceTimingEntries("/fonts/CanvasTest.ttf") == 0 && + numberOfResourceTimingEntries("resources/white.mp4") == 0 && + numberOfResourceTimingEntries("resources/sound_5.oga") == 0 && + numberOfResourceTimingEntries("resources/foo.vtt") == 0 && + numberOfResourceTimingEntries("resources/dummy.xml") == 0) { + done(); + } + iterations++; + if (iterations == 10) { + // At least one is expected to fail, but this should give details to the exact failure(s). + verifyNumberOfResourceTimingEntries("{{host}}:{{ports[http][1]}}/preload/resources/dummy.js", 0); + verifyNumberOfResourceTimingEntries("resources/dummy.css", 0); + verifyNumberOfResourceTimingEntries("resources/square.png", 0); + verifyNumberOfResourceTimingEntries("/fonts/CanvasTest.ttf", 0); + verifyNumberOfResourceTimingEntries("resources/white.mp4", 0); + verifyNumberOfResourceTimingEntries("resources/sound_5.oga", 0); + verifyNumberOfResourceTimingEntries("resources/foo.vtt", 0); + verifyNumberOfResourceTimingEntries("resources/dummy.xml", 0); + done(); + } else { + step_timeout(check_finished, 500); + } } - iterations++; - if (iterations == 10) { - // At least one is expected to fail, but this should give details to the exact failure(s). - verifyNumberOfResourceTimingEntries("{{host}}:{{ports[http][1]}}/preload/resources/dummy.js", 0); - verifyNumberOfResourceTimingEntries("resources/dummy.css", 0); - verifyNumberOfResourceTimingEntries("resources/square.png", 0); - verifyNumberOfResourceTimingEntries("/fonts/CanvasTest.ttf", 0); - verifyNumberOfResourceTimingEntries("resources/white.mp4", 0); - verifyNumberOfResourceTimingEntries("resources/sound_5.oga", 0); - verifyNumberOfResourceTimingEntries("resources/foo.vtt", 0); - verifyNumberOfResourceTimingEntries("resources/dummy.xml", 0); - done(); - } else { - step_timeout(check_finished, 500); - } -} -window.addEventListener("load", function() { - verifyPreloadAndRTSupport(); - step_timeout(check_finished, 500); -}); + window.addEventListener("load", function() { + verifyPreloadAndRTSupport(); + step_timeout(check_finished, 500); + }); </script> diff --git a/tests/wpt/web-platform-tests/preload/preload-default-csp.sub.html b/tests/wpt/web-platform-tests/preload/preload-default-csp.sub.html index 923431456cf..9fc11945866 100644 --- a/tests/wpt/web-platform-tests/preload/preload-default-csp.sub.html +++ b/tests/wpt/web-platform-tests/preload/preload-default-csp.sub.html @@ -15,41 +15,41 @@ <link rel=preload href="resources/dummy.xml"> <body> <script> -setup({explicit_done: true}); + setup({explicit_done: true}); -var iterations = 0; + var iterations = 0; -function check_finished() { - if (numberOfResourceTimingEntries("{{host}}:{{ports[http][1]}}/preload/resources/dummy.js") == 0 && - numberOfResourceTimingEntries("resources/dummy.css") == 0 && - numberOfResourceTimingEntries("resources/square.png") == 0 && - numberOfResourceTimingEntries("/fonts/CanvasTest.ttf") == 0 && - numberOfResourceTimingEntries("resources/white.mp4") == 0 && - numberOfResourceTimingEntries("resources/sound_5.oga") == 0 && - numberOfResourceTimingEntries("resources/foo.vtt") == 0 && - numberOfResourceTimingEntries("resources/dummy.xml") == 0) { - done(); + function check_finished() { + if (numberOfResourceTimingEntries("{{host}}:{{ports[http][1]}}/preload/resources/dummy.js") == 0 && + numberOfResourceTimingEntries("resources/dummy.css") == 0 && + numberOfResourceTimingEntries("resources/square.png") == 0 && + numberOfResourceTimingEntries("/fonts/CanvasTest.ttf") == 0 && + numberOfResourceTimingEntries("resources/white.mp4") == 0 && + numberOfResourceTimingEntries("resources/sound_5.oga") == 0 && + numberOfResourceTimingEntries("resources/foo.vtt") == 0 && + numberOfResourceTimingEntries("resources/dummy.xml") == 0) { + done(); + } + iterations++; + if (iterations == 10) { + // At least one is expected to fail, but this should give details to the exact failure(s). + verifyNumberOfResourceTimingEntries("{{host}}:{{ports[http][1]}}/preload/resources/dummy.js", 0); + verifyNumberOfResourceTimingEntries("resources/dummy.css", 0); + verifyNumberOfResourceTimingEntries("resources/square.png", 0); + verifyNumberOfResourceTimingEntries("/fonts/CanvasTest.ttf", 0); + verifyNumberOfResourceTimingEntries("resources/white.mp4", 0); + verifyNumberOfResourceTimingEntries("resources/sound_5.oga", 0); + verifyNumberOfResourceTimingEntries("resources/foo.vtt", 0); + verifyNumberOfResourceTimingEntries("resources/dummy.xml", 0); + done(); + } else { + step_timeout(check_finished, 500); + } } - iterations++; - if (iterations == 10) { - // At least one is expected to fail, but this should give details to the exact failure(s). - verifyNumberOfResourceTimingEntries("{{host}}:{{ports[http][1]}}/preload/resources/dummy.js", 0); - verifyNumberOfResourceTimingEntries("resources/dummy.css", 0); - verifyNumberOfResourceTimingEntries("resources/square.png", 0); - verifyNumberOfResourceTimingEntries("/fonts/CanvasTest.ttf", 0); - verifyNumberOfResourceTimingEntries("resources/white.mp4", 0); - verifyNumberOfResourceTimingEntries("resources/sound_5.oga", 0); - verifyNumberOfResourceTimingEntries("resources/foo.vtt", 0); - verifyNumberOfResourceTimingEntries("resources/dummy.xml", 0); - done(); - } else { - step_timeout(check_finished, 500); - } -} -window.addEventListener("load", function() { - verifyPreloadAndRTSupport(); - step_timeout(check_finished, 500); -}); + window.addEventListener("load", function() { + verifyPreloadAndRTSupport(); + step_timeout(check_finished, 500); + }); </script> diff --git a/tests/wpt/web-platform-tests/wake-lock/wakelock-insecure-context.any.js b/tests/wpt/web-platform-tests/wake-lock/wakelock-insecure-context.any.js new file mode 100644 index 00000000000..f32cc3c3543 --- /dev/null +++ b/tests/wpt/web-platform-tests/wake-lock/wakelock-insecure-context.any.js @@ -0,0 +1,5 @@ +//META: title=Wake Lock API is not exposed in an insecure context + +test(() => { + assert_false("WakeLock" in self, "'WakeLock' must not be exposed"); +}, "Wake Lock API is not exposed in an insecure context"); diff --git a/tests/wpt/web-platform-tests/wake-lock/wakelock-insecure-context.html b/tests/wpt/web-platform-tests/wake-lock/wakelock-insecure-context.html deleted file mode 100644 index 2c61f41311d..00000000000 --- a/tests/wpt/web-platform-tests/wake-lock/wakelock-insecure-context.html +++ /dev/null @@ -1,13 +0,0 @@ -<!DOCTYPE html> -<meta charset="utf-8"> -<title>Wake Lock API is not exposed in an insecure context</title> -<link rel="help" href="https://w3c.github.io/wake-lock/#wake-locks"> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script> - -test(t => { - assert_false("WakeLock" in self, "'WakeLock' must not be exposed"); -}, "Wake Lock API is not exposed in an insecure context"); - -</script> diff --git a/tests/wpt/web-platform-tests/wake-lock/wakelock-state-is-global.https.html b/tests/wpt/web-platform-tests/wake-lock/wakelock-state-is-global.https.html deleted file mode 100644 index 2eee3198249..00000000000 --- a/tests/wpt/web-platform-tests/wake-lock/wakelock-state-is-global.https.html +++ /dev/null @@ -1,75 +0,0 @@ -<!DOCTYPE html> -<meta charset="utf-8"> -<title>wake lock state should be global</title> -<link rel="help" href="https://w3c.github.io/wake-lock/"> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> - -<body> -<script id="iframe" type="text/plain"> -let iframeWakeLock; -const controller = new AbortController(); -const signal = controller.signal; -window.onmessage = async message => { - switch(message.data) { - case "ACQUIRED": - iframeWakeLock = new WakeLock("screen"); - await iframeWakeLock.request({ signal }); - parent.postMessage(iframeWakeLock.active, "*"); - break; - case "RELEASED": - controller.abort(); - parent.postMessage(iframeWakeLock.active, "*"); - break; - default: - parent.postMessage("unknown operation", "*"); - } -} -</script> - -<script> -function load_iframe() { - return new Promise(resolve => { - const iframe = document.createElement("iframe"); - iframe.onload = () => { resolve(iframe); }; - iframe.srcdoc = "<script>" + - document.getElementById('iframe').textContent + - "<\/script>"; - document.body.appendChild(iframe); - }); -} - -function wait_for_message(iframe) { - return new Promise(resolve => { - self.addEventListener("message", function listener(e) { - if (e.source === iframe.contentWindow) { - resolve(e.data); - self.removeEventListener("message", listener); - } - }); - }); -} - -promise_test(async t => { - const wakeLock = await new WakeLock("screen"); - const iframe = await load_iframe(); - const eventWatcher = new EventWatcher(t, wakeLock, "activechange"); - - assert_false(wakeLock.active, "wakeLock is initially false"); - - //when iframe wake lock is acquired, parent wake lock should be actived - iframe.contentWindow.postMessage("ACQUIRED", "*"); - const isActive1 = await wait_for_message(iframe); - await eventWatcher.wait_for("activechange"); - assert_true(isActive1, "the iframe wake lock state is actived when iframe wake lock is acquired"); - assert_true(wakeLock.active, "the wake lock state is actived when iframe wake lock is acquired"); - - //when iframe wake lock is released, parent wake lock should be inactived - iframe.contentWindow.postMessage("RELEASED", "*"); - const isActive2 = await wait_for_message(iframe); - eventWatcher.wait_for("activechange"); - assert_false(isActive2, "the iframe wake lock state is inactived when iframe wake lock is released"); - assert_false(wakeLock.active, "the wake lock state is inactived when iframe wake lock is released"); -}, "Test that wake lock state should be global"); -</script> -</body> diff --git a/tests/wpt/web-platform-tests/wake-lock/wakelock-type.https.any.js b/tests/wpt/web-platform-tests/wake-lock/wakelock-type.https.any.js new file mode 100644 index 00000000000..26ebcbef557 --- /dev/null +++ b/tests/wpt/web-platform-tests/wake-lock/wakelock-type.https.any.js @@ -0,0 +1,19 @@ +//META: title=WakeLock.request() with invaild type + +promise_test(async t => { + await promise_rejects(t, new TypeError(), WakeLock.request()); +}, "'TypeError' is thrown when set an empty wake lock type"); + +promise_test(t => { + const invalidTypes = [ + "invalid", + null, + 123, + {}, + "", + true + ]; + invalidTypes.map(async invalidType => { + await promise_rejects(t, new TypeError(), WakeLock.request(invalidType)); + }); +}, "'TypeError' is thrown when set an invalid wake lock type"); diff --git a/tests/wpt/web-platform-tests/wake-lock/wakelock-type.https.html b/tests/wpt/web-platform-tests/wake-lock/wakelock-type.https.html deleted file mode 100644 index df7a68a040b..00000000000 --- a/tests/wpt/web-platform-tests/wake-lock/wakelock-type.https.html +++ /dev/null @@ -1,38 +0,0 @@ -<!DOCTYPE html> -<meta charset="utf-8"> -<title>WakeLockType Test</title> -<link rel="help" href="https://w3c.github.io/wake-lock/"> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> - -<script> - -test(() => { - const wakeLock = new WakeLock("screen"); - assert_equals(wakeLock.type, "screen"); -}, "Test that wakeLock.type is 'screen' when screen wake lock is invoked"); - -test(() => { - const wakeLock = new WakeLock("system"); - assert_equals(wakeLock.type, "system"); -}, "Test that wakeLock.type is 'system' when system wake lock is invoked"); - -test(() => { - assert_throws(new TypeError(), () => new WakeLock()); -}, "'TypeError' is thrown when set an empty wake lock type"); - -test(() => { - const invalidTypes = [ - "invalid", - null, - 123, - {}, - "", - true - ]; - invalidTypes.map(invalidType => { - assert_throws(new TypeError(), () => new WakeLock(invalidType)); - }) -}, "'TypeError' is thrown when set an invalid wake lock type"); - -</script> |