diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-01-18 22:20:31 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-18 22:20:31 -0500 |
commit | 7256d123ff9620ff1acc494888989c43b176ecee (patch) | |
tree | e51ab4047bde05401758546e607849b5eac629f2 | |
parent | 81ab255b70cd5cc2a3ef6f27414c3655ed26a82f (diff) | |
parent | fd4e6006392d2f6e68348c784e5a59e66786dbe3 (diff) | |
download | servo-7256d123ff9620ff1acc494888989c43b176ecee.tar.gz servo-7256d123ff9620ff1acc494888989c43b176ecee.zip |
Auto merge of #22732 - servo-wpt-sync:wpt_update_18-01-2019, r=jdm
Sync WPT with upstream (18-01-2019)
Automated downstream sync of changes from upstream as of 18-01-2019.
[no-wpt-sync]
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22732)
<!-- Reviewable:end -->
57 files changed, 1734 insertions, 207 deletions
diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index e17bc26df1e..eb12c1e43c1 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -13753,12 +13753,6 @@ {} ] ], - "pointerevents/pointerevent_click_during_capture-manual.html": [ - [ - "/pointerevents/pointerevent_click_during_capture-manual.html", - {} - ] - ], "pointerevents/pointerevent_disabled_form_control-manual.html": [ [ "/pointerevents/pointerevent_disabled_form_control-manual.html", @@ -86567,6 +86561,18 @@ {} ] ], + "css/CSS2/stacking-context/opacity-change-twice-stacking-context.html": [ + [ + "/css/CSS2/stacking-context/opacity-change-twice-stacking-context.html", + [ + [ + "/css/CSS2/stacking-context/opacity-change-twice-stacking-context-ref.html", + "==" + ] + ], + {} + ] + ], "css/CSS2/syntax/at-charset-001.xht": [ [ "/css/CSS2/syntax/at-charset-001.xht", @@ -245883,6 +245889,11 @@ {} ] ], + "css/CSS2/stacking-context/opacity-change-twice-stacking-context-ref.html": [ + [ + {} + ] + ], "css/CSS2/support/100x100-lime.png": [ [ {} @@ -300143,6 +300154,16 @@ {} ] ], + "idle-detection/META.yml": [ + [ + {} + ] + ], + "idle-detection/idle-detection.idl": [ + [ + {} + ] + ], "imagebitmap-renderingcontext/META.yml": [ [ {} @@ -303813,6 +303834,11 @@ {} ] ], + "payment-request/blank.html": [ + [ + {} + ] + ], "payment-request/payment-response/helpers.js": [ [ {} @@ -303953,6 +303979,26 @@ {} ] ], + "portals/resources/portal-forward-with-broadcast.sub.html": [ + [ + {} + ] + ], + "portals/resources/portal-host-cross-origin-navigate.sub.html": [ + [ + {} + ] + ], + "portals/resources/portal-host-cross-origin.sub.html": [ + [ + {} + ] + ], + "portals/resources/portal-host.html": [ + [ + {} + ] + ], "portals/resources/portals-rendering-portal.html": [ [ {} @@ -325248,6 +325294,11 @@ {} ] ], + "workers/examples/fetch_tests_from_worker.js": [ + [ + {} + ] + ], "workers/interfaces/DedicatedWorkerGlobalScope/postMessage/message-event.js": [ [ {} @@ -347130,6 +347181,12 @@ {} ] ], + "css/css-tables/inheritance.html": [ + [ + "/css/css-tables/inheritance.html", + {} + ] + ], "css/css-tables/percent-width-ignored-001.tentative.html": [ [ "/css/css-tables/percent-width-ignored-001.tentative.html", @@ -367882,15 +367939,29 @@ {} ], [ - "/fetch/cross-origin-resource-policy/fetch.any.serviceworker.html", + "/fetch/cross-origin-resource-policy/fetch.any.sharedworker.html", {} ], [ - "/fetch/cross-origin-resource-policy/fetch.any.sharedworker.html", + "/fetch/cross-origin-resource-policy/fetch.any.worker.html", + {} + ] + ], + "fetch/cross-origin-resource-policy/fetch.https.any.js": [ + [ + "/fetch/cross-origin-resource-policy/fetch.https.any.html", {} ], [ - "/fetch/cross-origin-resource-policy/fetch.any.worker.html", + "/fetch/cross-origin-resource-policy/fetch.https.any.serviceworker.html", + {} + ], + [ + "/fetch/cross-origin-resource-policy/fetch.https.any.sharedworker.html", + {} + ], + [ + "/fetch/cross-origin-resource-policy/fetch.https.any.worker.html", {} ] ], @@ -382064,6 +382135,26 @@ {} ] ], + "idle-detection/basics.tentative.https.any.js": [ + [ + "/idle-detection/basics.tentative.https.any.html", + {} + ], + [ + "/idle-detection/basics.tentative.https.any.worker.html", + {} + ] + ], + "idle-detection/idlharness.https.any.js": [ + [ + "/idle-detection/idlharness.https.any.html", + {} + ], + [ + "/idle-detection/idlharness.https.any.worker.html", + {} + ] + ], "imagebitmap-renderingcontext/bitmaprenderer-as-imagesource.html": [ [ "/imagebitmap-renderingcontext/bitmaprenderer-as-imagesource.html", @@ -397062,6 +397153,14 @@ {} ] ], + "payment-request/payment-is-showing.https.html": [ + [ + "/payment-request/payment-is-showing.https.html", + { + "testdriver": true + } + ] + ], "payment-request/payment-request-abort-method.https.html": [ [ "/payment-request/payment-request-abort-method.https.html", @@ -397468,6 +397567,14 @@ } ] ], + "pointerevents/pointerevent_click_during_capture.html": [ + [ + "/pointerevents/pointerevent_click_during_capture.html", + { + "testdriver": true + } + ] + ], "pointerevents/pointerevent_constructor.html": [ [ "/pointerevents/pointerevent_constructor.html", @@ -397562,6 +397669,12 @@ {} ] ], + "portals/portals-host-exposure.sub.html": [ + [ + "/portals/portals-host-exposure.sub.html", + {} + ] + ], "portals/portals-host-null.html": [ [ "/portals/portals-host-null.html", @@ -422488,6 +422601,38 @@ {} ] ], + "workers/examples/fetch_tests_from_worker.html": [ + [ + "/workers/examples/fetch_tests_from_worker.html", + {} + ] + ], + "workers/examples/general.any.js": [ + [ + "/workers/examples/general.any.serviceworker.html", + {} + ], + [ + "/workers/examples/general.any.sharedworker.html", + {} + ], + [ + "/workers/examples/general.any.worker.html", + {} + ] + ], + "workers/examples/general.worker.js": [ + [ + "/workers/examples/general.worker.html", + {} + ] + ], + "workers/examples/onconnect.any.js": [ + [ + "/workers/examples/onconnect.any.sharedworker.html", + {} + ] + ], "workers/importscripts_mime.any.js": [ [ "/workers/importscripts_mime.any.serviceworker.html", @@ -457192,7 +457337,7 @@ "support" ], "common/get-host-info.sub.js": [ - "b46fc4516cf6b1b12b0b438435b65c300fa5a01b", + "743bec18ec26279dc2e83dba664873e4babbf6c3", "support" ], "common/get-host-info.sub.js.headers": [ @@ -522711,6 +522856,14 @@ "94587c5f6e21b92ab7ab1d5ca3b447eb2bdab15b", "reftest" ], + "css/CSS2/stacking-context/opacity-change-twice-stacking-context-ref.html": [ + "da17527af567e0e9d14e181b11ac09548b8003b0", + "support" + ], + "css/CSS2/stacking-context/opacity-change-twice-stacking-context.html": [ + "c3c680c68fad38f55a809f144867cb3fd285db9d", + "reftest" + ], "css/CSS2/support/100x100-lime.png": [ "1b947700808585e8c224cee096247eb5d30a1ded", "support" @@ -572331,6 +572484,10 @@ "d4f0986fcd8452846e004806013f0bc9f66411c4", "testharness" ], + "css/css-tables/inheritance.html": [ + "2c640db6d9ecb61ad02af68257d3647d24146bea", + "testharness" + ], "css/css-tables/internal-containing-block-001.html": [ "a8745487b6702b8b8e8ac85bd843014dc296b717", "reftest" @@ -615148,7 +615305,7 @@ "testharness" ], "fetch/api/basic/mode-no-cors.sub.any.js": [ - "709eef5bf1dbd85600ba88ca4abb5fd1003358d4", + "a4abcac55f39a93a561798c1e072e301ff0cab73", "testharness" ], "fetch/api/basic/mode-same-origin.any.js": [ @@ -616156,7 +616313,11 @@ "testharness" ], "fetch/cross-origin-resource-policy/fetch.any.js": [ - "ded3bdc5daee50fec9c970cd31f24f2bd6f2b60a", + "6f40c8465635cd732dadf2c24589a378c1981bfa", + "testharness" + ], + "fetch/cross-origin-resource-policy/fetch.https.any.js": [ + "98b9ba4785312c1ea2da3825b2f812cb28a4a97c", "testharness" ], "fetch/cross-origin-resource-policy/iframe-loads.html": [ @@ -636555,6 +636716,22 @@ "55cb5ce527ea69fa23e6aba675719bb6524d7411", "manual" ], + "idle-detection/META.yml": [ + "7e5836bc3701366fba535a67a0ffc4032776b104", + "support" + ], + "idle-detection/basics.tentative.https.any.js": [ + "916829e32d752dc83302dcf1c613fb87e9086e5d", + "testharness" + ], + "idle-detection/idle-detection.idl": [ + "f529cd036bf7c166d104f34b645cd87d6a8a1938", + "support" + ], + "idle-detection/idlharness.https.any.js": [ + "d7b5b96b666ee7589b68807faa76af42f1539ee2", + "testharness" + ], "imagebitmap-renderingcontext/META.yml": [ "f6a06f4e7d7625855e271ec5422629ca5e734560", "support" @@ -637488,7 +637665,7 @@ "support" ], "interfaces/html.idl": [ - "3a513c5b9dbb47dc0b7a29af5efcf36259b22ef0", + "d46d1452eadbd3a1a7bb5aadd3a346818492daf1", "support" ], "interfaces/image-capture.idl": [ @@ -637776,7 +637953,7 @@ "support" ], "interfaces/webrtc.idl": [ - "c7529ced356dfa932c403217910d859e69773bea", + "dc51e2f2f3ae8f33b2cde6aa005efa34f46648aa", "support" ], "interfaces/webusb.idl": [ @@ -638244,7 +638421,7 @@ "support" ], "longtask-timing/supported-longtask-types.any.js": [ - "0179fc5e60ceeb3312e060a4fc5f0927b1a1bc29", + "3c68c01d32d614dab435d91a0dce39244f8d7e09", "testharness" ], "magnetometer/META.yml": [ @@ -642592,7 +642769,7 @@ "support" ], "navigation-timing/supported_navigation_type.any.js": [ - "5e9151cea72434b61fc317cc512ed9e61643fdb2", + "3239c7d29ffb11cbfebda12b4e5420bca0131094", "testharness" ], "navigation-timing/test_document_open.html": [ @@ -649632,7 +649809,7 @@ "testharness" ], "paint-timing/supported-paint-type.any.js": [ - "623c880c5735214866352a39bd2d214acaf30753", + "36acf82ca3b646b32977c3d0212a397c6fa8ea09", "testharness" ], "payment-handler/META.yml": [ @@ -649883,6 +650060,10 @@ "cb9acf6eb6a20df5ddd03ef734796cefb6195467", "manual" ], + "payment-request/blank.html": [ + "7852a427e861a9be3c9068deb306b67ad909843f", + "support" + ], "payment-request/change-shipping-option-manual.https.html": [ "a33365bac73ed51b6873215d0f54d79a73422163", "manual" @@ -649911,6 +650092,10 @@ "0484eb868f983e3cdb0efceab5fe2b3c6084b4ab", "testharness" ], + "payment-request/payment-is-showing.https.html": [ + "650b76d61f72d82fce1644be95e1ee2b99a90d95", + "testharness" + ], "payment-request/payment-request-abort-method.https.html": [ "8e561b288d15fa30971dd1f88b930671c83a5887", "testharness" @@ -650319,9 +650504,9 @@ "04d56cb7a51db2be25972c181cf60cf69ba39591", "manual" ], - "pointerevents/pointerevent_click_during_capture-manual.html": [ - "ed0e3e2c1eb7f3970014d899aa3fd5be96628331", - "manual" + "pointerevents/pointerevent_click_during_capture.html": [ + "7f63283b61a4bedac614914b3fda14364abd14ad", + "testharness" ], "pointerevents/pointerevent_constructor.html": [ "b8a97d1a6bb7f7b895d16282a1231c335e35f650", @@ -650691,6 +650876,10 @@ "ac1505d2a5b2fe1df083eae75893483e025a2ad7", "testharness" ], + "portals/portals-host-exposure.sub.html": [ + "83e31bd4735131d35b2a03ae82d07be364497689", + "testharness" + ], "portals/portals-host-null.html": [ "e0f1d63743c54c687d62f86abe278873fa823430", "testharness" @@ -650715,6 +650904,22 @@ "cf09caebc0ff9ac38facde84075a7af5be19fd48", "support" ], + "portals/resources/portal-forward-with-broadcast.sub.html": [ + "39bda69b0eef9b0062809507bfb91d9fc3401d95", + "support" + ], + "portals/resources/portal-host-cross-origin-navigate.sub.html": [ + "44c6c16c5771f1027c3cc82e966342bbaa80ad8d", + "support" + ], + "portals/resources/portal-host-cross-origin.sub.html": [ + "aa369d39f0bd674a5cb1a9ad8954e3106a807687", + "support" + ], + "portals/resources/portal-host.html": [ + "5043a158ea74ef173f166c0580f9c1a27242bd14", + "support" + ], "portals/resources/portals-rendering-portal.html": [ "1b6f23f512da5bb7d1c7b5b85e48277470d2e146", "support" @@ -660736,7 +660941,7 @@ "testharness" ], "resource-timing/supported_resource_type.any.js": [ - "6096ad714904fdd5c0085b33b4240301cdb952fb", + "31e40096ddb2c3a8e38ddbeec00a67ca7a91ce59", "testharness" ], "resource-timing/test_resource_timing.html": [ @@ -665420,7 +665625,7 @@ "support" ], "service-workers/service-worker/resources/worker-interception-iframe.https.html": [ - "ab10a078f3d67a8c213b8511b8ff5ffcde92375b", + "84204a3ee5df1fc3a71784215071b14f0c65f9f2", "support" ], "service-workers/service-worker/resources/worker-interception-redirect-serviceworker.js": [ @@ -665432,7 +665637,7 @@ "support" ], "service-workers/service-worker/resources/worker-load-interceptor.js": [ - "695777a514f65628b25f76549970ddfbc854fee3", + "a5f65c3216e44632ff052bac0448316f25d443c6", "support" ], "service-workers/service-worker/resources/worker-testharness.js": [ @@ -665632,7 +665837,7 @@ "testharness" ], "service-workers/service-worker/worker-interception.https.html": [ - "f9ba656b5178359f2c7b6e2419a57ff12ec79d23", + "7b2941263bf756c33e6d15b36ed96548f886c6c2", "testharness" ], "service-workers/service-worker/xhr-response-url.https.html": [ @@ -676916,7 +677121,7 @@ "testharness" ], "trusted-types/TrustedTypePolicy-createXXX.tentative.html": [ - "6a0151ad9bcf7d02b6a98532ba53db509e086f83", + "475a264790482aedf714958f63a4d47d69661941", "testharness" ], "trusted-types/TrustedTypePolicy-exposed.tentative.html": [ @@ -676928,7 +677133,7 @@ "testharness" ], "trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html": [ - "a162d84cd820051d6c5868c35b58cd347b0026e5", + "37e245ee27aa5828bd97568d9390d9cbfbb6f968", "testharness" ], "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-noNamesGiven.tentative.html": [ @@ -677000,7 +677205,7 @@ "testharness" ], "trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html": [ - "f9cbdc5a889dc765558775ee013a2d9e866ce111", + "d77d9dab58681658d04a7b55d1f340da8f684bfa", "testharness" ], "trusted-types/block-string-assignment-to-Element-setAttributeNS.tentative.html": [ @@ -677008,7 +677213,7 @@ "testharness" ], "trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html": [ - "fd89bb33c13aa0b2ad5867118f03ae1c76ff8028", + "fe27d45d08a2d8f9a98e44c3d0244230f343954d", "testharness" ], "trusted-types/block-string-assignment-to-Location-assign.tentative.html": [ @@ -677028,7 +677233,7 @@ "testharness" ], "trusted-types/block-string-assignment-to-Window-open.tentative.html": [ - "fd30b6edfbaf40c09cabe98d1bd8891446b16e65", + "c66a16d5c00535c3def556afc5daff3a7614c62c", "testharness" ], "trusted-types/idlharness.window.js": [ @@ -677920,7 +678125,7 @@ "support" ], "user-timing/supported-usertiming-types.any.js": [ - "a373c562f94d88460f5b19ff9f00ec503f1c1152", + "ea3b2fe9dc90f70f3998a94a1460460b8b8b5992", "testharness" ], "user-timing/user-timing-tojson.html": [ @@ -682956,7 +683161,7 @@ "support" ], "webrtc/RTCTrackEvent-constructor.html": [ - "9579dd4d4f81be24c065529728183cb2287d15b6", + "a0c031eaa5a25729639d2595f1a5748ae59955cb", "testharness" ], "webrtc/RTCTrackEvent-fire.html": [ @@ -687496,7 +687701,7 @@ "support" ], "workers/README.md": [ - "78cc74371b981de53be670795a0edbc708c78b58", + "b78a05ebdbe81f7a5d46082ccfa2fed771fe63b1", "support" ], "workers/SharedWorkerPerformanceNow.html": [ @@ -687983,6 +688188,26 @@ "f54faf54350990a9593e7af022c9eeb769595b15", "testharness" ], + "workers/examples/fetch_tests_from_worker.html": [ + "5ac765c7eeae8c03678ca98c2f0d89fd826cf45e", + "testharness" + ], + "workers/examples/fetch_tests_from_worker.js": [ + "01ba12a622f3535733c11102ab5fa4793984697c", + "support" + ], + "workers/examples/general.any.js": [ + "2aa82e3db904a2dc4768d3276e11669b44dc66fc", + "testharness" + ], + "workers/examples/general.worker.js": [ + "aeca236781bf870eb80363a612b0c7963f224d8d", + "testharness" + ], + "workers/examples/onconnect.any.js": [ + "85546f2d11df3907f592ee52b7a8ef4faec1f338", + "testharness" + ], "workers/importscripts_mime.any.js": [ "04c63a3a5f6d9bd3b71d94142f65a1825358b8ed", "testharness" diff --git a/tests/wpt/metadata/css/CSS2/stacking-context/opacity-change-twice-stacking-context.html.ini b/tests/wpt/metadata/css/CSS2/stacking-context/opacity-change-twice-stacking-context.html.ini new file mode 100644 index 00000000000..2e6fd71a501 --- /dev/null +++ b/tests/wpt/metadata/css/CSS2/stacking-context/opacity-change-twice-stacking-context.html.ini @@ -0,0 +1,2 @@ +[opacity-change-twice-stacking-context.html] + expected: TIMEOUT diff --git a/tests/wpt/metadata/css/css-transforms/css-transforms-3d-on-anonymous-block-001.html.ini b/tests/wpt/metadata/css/css-transforms/css-transforms-3d-on-anonymous-block-001.html.ini deleted file mode 100644 index bbb2e5f171e..00000000000 --- a/tests/wpt/metadata/css/css-transforms/css-transforms-3d-on-anonymous-block-001.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[css-transforms-3d-on-anonymous-block-001.html] - expected: FAIL diff --git a/tests/wpt/metadata/css/cssom-view/scroll-behavior-smooth.html.ini b/tests/wpt/metadata/css/cssom-view/scroll-behavior-smooth.html.ini index e1a609649d6..bcd187f508c 100644 --- a/tests/wpt/metadata/css/cssom-view/scroll-behavior-smooth.html.ini +++ b/tests/wpt/metadata/css/cssom-view/scroll-behavior-smooth.html.ini @@ -3,3 +3,6 @@ [scroll-behavior: smooth on DIV element] expected: FAIL + [Instant scrolling while doing history navigation.] + expected: FAIL + diff --git a/tests/wpt/metadata/encoding/single-byte-decoder.html.ini b/tests/wpt/metadata/encoding/single-byte-decoder.html.ini index 2206c3b9f32..71dadbb3bf7 100644 --- a/tests/wpt/metadata/encoding/single-byte-decoder.html.ini +++ b/tests/wpt/metadata/encoding/single-byte-decoder.html.ini @@ -2,7 +2,7 @@ type: testharness [single-byte-decoder.html?document] - expected: TIMEOUT + expected: CRASH [ISO-8859-4: iso_8859-4:1988 (document.characterSet and document.inputEncoding)] expected: FAIL @@ -32,7 +32,7 @@ [single-byte-decoder.html?XMLHttpRequest] - expected: CRASH + expected: TIMEOUT [ISO-8859-2: iso_8859-2:1987 (XMLHttpRequest)] expected: FAIL @@ -55,7 +55,7 @@ expected: FAIL [windows-1252: iso_8859-1:1987 (XMLHttpRequest)] - expected: TIMEOUT + expected: FAIL [windows-1254: iso_8859-9:1989 (XMLHttpRequest)] expected: TIMEOUT @@ -63,9 +63,6 @@ [windows-1256: cp1256 (XMLHttpRequest)] expected: TIMEOUT - [windows-1254: iso_8859-9 (XMLHttpRequest)] - expected: TIMEOUT - [windows-1254: iso88599 (XMLHttpRequest)] expected: TIMEOUT @@ -138,16 +135,22 @@ [windows-1252: x-cp1252 (XMLHttpRequest)] expected: TIMEOUT - [windows-1252: l1 (XMLHttpRequest)] - expected: TIMEOUT - [windows-1252: windows-1252 (XMLHttpRequest)] expected: TIMEOUT [windows-1252: us-ascii (XMLHttpRequest)] expected: TIMEOUT - [windows-1252: iso-8859-1 (XMLHttpRequest)] + [windows-1258: cp1258 (XMLHttpRequest)] + expected: TIMEOUT + + [windows-1257: x-cp1257 (XMLHttpRequest)] + expected: TIMEOUT + + [x-mac-cyrillic: x-mac-cyrillic (XMLHttpRequest)] + expected: TIMEOUT + + [windows-1256: windows-1256 (XMLHttpRequest)] expected: TIMEOUT diff --git a/tests/wpt/metadata/fetch/cross-origin-resource-policy/fetch.any.js.ini b/tests/wpt/metadata/fetch/cross-origin-resource-policy/fetch.any.js.ini index e0fd3817835..e3422dbdb00 100644 --- a/tests/wpt/metadata/fetch/cross-origin-resource-policy/fetch.any.js.ini +++ b/tests/wpt/metadata/fetch/cross-origin-resource-policy/fetch.any.js.ini @@ -2,6 +2,7 @@ [fetch] expected: FAIL + [fetch.any.html] [fetch] expected: FAIL @@ -24,6 +25,9 @@ [Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-site' response header.] expected: FAIL + [Cross-scheme (HTTP to HTTPS) no-cors fetch to a same-site URL with a 'Cross-Origin-Resource-Policy: same-site' response header.] + expected: FAIL + [fetch.any.worker.html] [fetch] @@ -47,6 +51,9 @@ [Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' redirect response header.] expected: FAIL + [Cross-scheme (HTTP to HTTPS) no-cors fetch to a same-site URL with a 'Cross-Origin-Resource-Policy: same-site' response header.] + expected: FAIL + [fetch.any.sharedworker.html] [fetch] diff --git a/tests/wpt/metadata/fetch/cross-origin-resource-policy/fetch.https.any.js.ini b/tests/wpt/metadata/fetch/cross-origin-resource-policy/fetch.https.any.js.ini new file mode 100644 index 00000000000..fb9488016dc --- /dev/null +++ b/tests/wpt/metadata/fetch/cross-origin-resource-policy/fetch.https.any.js.ini @@ -0,0 +1,37 @@ +[fetch.https.any.html] + [Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header after a redirection.] + expected: FAIL + + [Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' redirect response header.] + expected: FAIL + + [Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header.] + expected: FAIL + + [Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-site' response header.] + expected: FAIL + + +[fetch.https.any.serviceworker.html] + [fetch] + expected: FAIL + + +[fetch.https.any.sharedworker.html] + [fetch] + expected: FAIL + + +[fetch.https.any.worker.html] + [Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header after a redirection.] + expected: FAIL + + [Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' redirect response header.] + expected: FAIL + + [Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header.] + expected: FAIL + + [Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-site' response header.] + 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 a639f15230c..87c807a49ff 100644 --- a/tests/wpt/metadata/fetch/nosniff/parsing-nosniff.window.js.ini +++ b/tests/wpt/metadata/fetch/nosniff/parsing-nosniff.window.js.ini @@ -11,6 +11,3 @@ [X-Content-Type-Options%3A%20nosniff%0C] expected: FAIL - [Content-Type-Options%3A%20nosniff] - expected: FAIL - diff --git a/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_5.html.ini b/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_4.html.ini index dc2e45516de..385376c7321 100644 --- a/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_5.html.ini +++ b/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_4.html.ini @@ -1,4 +1,4 @@ -[traverse_the_history_5.html] +[traverse_the_history_4.html] [Multiple history traversals, last would be aborted] 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 714d41cd428..a8713f72d2e 100644 --- a/tests/wpt/metadata/html/dom/interfaces.https.html.ini +++ b/tests/wpt/metadata/html/dom/interfaces.https.html.ini @@ -6082,6 +6082,18 @@ [Document interface: attribute onformdata] expected: FAIL + [Window interface: window must inherit property "queueMicrotask(VoidFunction)" with the proper type] + expected: FAIL + + [Window interface: operation postMessage(any, WindowPostMessageOptions)] + expected: FAIL + + [Window interface: calling queueMicrotask(VoidFunction) on window with too few arguments must throw TypeError] + expected: FAIL + + [Window interface: operation queueMicrotask(VoidFunction)] + expected: FAIL + [interfaces.https.html?include=HTML.*] [HTML IDL tests] @@ -9351,6 +9363,36 @@ [HTMLElement interface: document.createElement("noscript") must inherit property "onformdata" with the proper type] expected: FAIL + [HTMLImageElement interface: attribute decoding] + expected: FAIL + + [HTMLElement interface: document.createElement("noscript") must inherit property "autocapitalize" with the proper type] + expected: FAIL + + [HTMLImageElement interface: document.createElement("img") must inherit property "decoding" with the proper type] + expected: FAIL + + [HTMLElement interface: attribute enterKeyHint] + expected: FAIL + + [HTMLScriptElement interface: attribute referrerPolicy] + expected: FAIL + + [HTMLScriptElement interface: document.createElement("script") must inherit property "referrerPolicy" with the proper type] + expected: FAIL + + [HTMLElement interface: document.createElement("noscript") must inherit property "enterKeyHint" with the proper type] + expected: FAIL + + [HTMLImageElement interface: new Image() must inherit property "decoding" with the proper type] + expected: FAIL + + [HTMLElement interface: attribute autocapitalize] + expected: FAIL + + [HTMLIFrameElement interface: attribute allow] + expected: FAIL + [interfaces.https.html?exclude=(Document|Window|HTML.*)] [HTML IDL tests] @@ -10928,3 +10970,33 @@ [FormDataEvent interface: existence and properties of interface prototype object] expected: FAIL + [OffscreenCanvasRenderingContext2D interface: operation measureText(DOMString)] + expected: FAIL + + [CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getContextAttributes()" with the proper type] + expected: FAIL + + [CanvasRenderingContext2D interface: operation getContextAttributes()] + expected: FAIL + + [OffscreenCanvasRenderingContext2D interface: operation fillText(DOMString, unrestricted double, unrestricted double, unrestricted double)] + expected: FAIL + + [OffscreenCanvasRenderingContext2D interface: attribute direction] + expected: FAIL + + [OffscreenCanvasRenderingContext2D interface: attribute textAlign] + expected: FAIL + + [MessagePort interface: operation postMessage(any, PostMessageOptions)] + expected: FAIL + + [OffscreenCanvasRenderingContext2D interface: attribute font] + expected: FAIL + + [OffscreenCanvasRenderingContext2D interface: operation strokeText(DOMString, unrestricted double, unrestricted double, unrestricted double)] + expected: FAIL + + [OffscreenCanvasRenderingContext2D interface: attribute textBaseline] + 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 c7c69ba8fa9..31c45a917b9 100644 --- a/tests/wpt/metadata/html/dom/interfaces.worker.js.ini +++ b/tests/wpt/metadata/html/dom/interfaces.worker.js.ini @@ -732,3 +732,108 @@ [MessageEvent interface: new MessageEvent("message", { data: 5 }) must inherit property "source" with the proper type] expected: FAIL + [OffscreenCanvasRenderingContext2D interface: operation measureText(DOMString)] + expected: FAIL + + [OffscreenCanvasRenderingContext2D interface: operation strokeText(DOMString, unrestricted double, unrestricted double, unrestricted double)] + expected: FAIL + + [TextMetrics interface object length] + expected: FAIL + + [TextMetrics interface: attribute emHeightAscent] + expected: FAIL + + [DedicatedWorkerGlobalScope interface: calling requestAnimationFrame(FrameRequestCallback) on self with too few arguments must throw TypeError] + expected: FAIL + + [TextMetrics interface: attribute ideographicBaseline] + expected: FAIL + + [WorkerGlobalScope interface: self must inherit property "queueMicrotask(VoidFunction)" with the proper type] + expected: FAIL + + [WorkerGlobalScope interface: operation queueMicrotask(VoidFunction)] + expected: FAIL + + [TextMetrics interface: attribute actualBoundingBoxAscent] + expected: FAIL + + [TextMetrics interface: existence and properties of interface prototype object's @@unscopables property] + expected: FAIL + + [WorkerGlobalScope interface: calling queueMicrotask(VoidFunction) on self with too few arguments must throw TypeError] + expected: FAIL + + [DedicatedWorkerGlobalScope interface: self must inherit property "cancelAnimationFrame(unsigned long)" with the proper type] + expected: FAIL + + [TextMetrics interface: attribute emHeightDescent] + expected: FAIL + + [OffscreenCanvasRenderingContext2D interface: operation fillText(DOMString, unrestricted double, unrestricted double, unrestricted double)] + expected: FAIL + + [OffscreenCanvasRenderingContext2D interface: attribute direction] + expected: FAIL + + [TextMetrics interface: attribute actualBoundingBoxDescent] + expected: FAIL + + [TextMetrics interface: attribute actualBoundingBoxLeft] + expected: FAIL + + [TextMetrics interface: existence and properties of interface object] + expected: FAIL + + [OffscreenCanvasRenderingContext2D interface: attribute font] + expected: FAIL + + [DedicatedWorkerGlobalScope interface: calling cancelAnimationFrame(unsigned long) on self with too few arguments must throw TypeError] + expected: FAIL + + [TextMetrics interface: attribute hangingBaseline] + expected: FAIL + + [TextMetrics interface: attribute width] + expected: FAIL + + [TextMetrics interface: attribute actualBoundingBoxRight] + expected: FAIL + + [TextMetrics interface: attribute fontBoundingBoxAscent] + expected: FAIL + + [TextMetrics interface: attribute alphabeticBaseline] + expected: FAIL + + [TextMetrics interface: existence and properties of interface prototype object] + expected: FAIL + + [TextMetrics interface: attribute fontBoundingBoxDescent] + expected: FAIL + + [OffscreenCanvasRenderingContext2D interface: attribute textBaseline] + expected: FAIL + + [OffscreenCanvasRenderingContext2D interface: attribute textAlign] + expected: FAIL + + [TextMetrics interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [DedicatedWorkerGlobalScope interface: self must inherit property "requestAnimationFrame(FrameRequestCallback)" with the proper type] + expected: FAIL + + [DedicatedWorkerGlobalScope interface: operation cancelAnimationFrame(unsigned long)] + expected: FAIL + + [DedicatedWorkerGlobalScope interface: operation requestAnimationFrame(FrameRequestCallback)] + expected: FAIL + + [MessagePort interface: operation postMessage(any, PostMessageOptions)] + expected: FAIL + + [TextMetrics interface object name] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/embedded-content/the-img-element/non-active-document.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/the-img-element/non-active-document.html.ini deleted file mode 100644 index 8cc42056d34..00000000000 --- a/tests/wpt/metadata/html/semantics/embedded-content/the-img-element/non-active-document.html.ini +++ /dev/null @@ -1,10 +0,0 @@ -[non-active-document.html] - [DOMParser] - expected: FAIL - - [createHTMLDocument] - expected: FAIL - - [<template>] - expected: FAIL - diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-scaling.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-scaling.html.ini index 66bd350083b..a56bad443a2 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-scaling.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-scaling.html.ini @@ -1,4 +1,5 @@ [realtimeanalyser-fft-scaling.html] + expected: TIMEOUT [X 2048-point FFT peak position is not equal to 64. Got 0.] expected: FAIL diff --git a/tests/wpt/metadata/workers/examples/general.any.js.ini b/tests/wpt/metadata/workers/examples/general.any.js.ini new file mode 100644 index 00000000000..1287e5a3655 --- /dev/null +++ b/tests/wpt/metadata/workers/examples/general.any.js.ini @@ -0,0 +1,11 @@ +[general.any.serviceworker.html] + [general] + expected: FAIL + + +[general.any.sharedworker.html] + [general] + expected: FAIL + + +[general.any.worker.html] diff --git a/tests/wpt/metadata/workers/examples/onconnect.any.js.ini b/tests/wpt/metadata/workers/examples/onconnect.any.js.ini new file mode 100644 index 00000000000..759a398ef7e --- /dev/null +++ b/tests/wpt/metadata/workers/examples/onconnect.any.js.ini @@ -0,0 +1,4 @@ +[onconnect.any.sharedworker.html] + [onconnect] + expected: FAIL + diff --git a/tests/wpt/metadata/workers/semantics/multiple-workers/005.html.ini b/tests/wpt/metadata/workers/semantics/multiple-workers/005.html.ini index f584fce5df1..268949ced5c 100644 --- a/tests/wpt/metadata/workers/semantics/multiple-workers/005.html.ini +++ b/tests/wpt/metadata/workers/semantics/multiple-workers/005.html.ini @@ -1,5 +1,4 @@ [005.html] - expected: ERROR [dedicated worker in shared worker in dedicated worker] expected: FAIL diff --git a/tests/wpt/web-platform-tests/common/get-host-info.sub.js b/tests/wpt/web-platform-tests/common/get-host-info.sub.js index b46fc4516cf..743bec18ec2 100644 --- a/tests/wpt/web-platform-tests/common/get-host-info.sub.js +++ b/tests/wpt/web-platform-tests/common/get-host-info.sub.js @@ -27,6 +27,7 @@ function get_host_info() { HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT: 'http://' + REMOTE_HOST + HTTP_PORT2_ELIDED, HTTPS_REMOTE_ORIGIN: 'https://' + REMOTE_HOST + HTTPS_PORT_ELIDED, HTTPS_REMOTE_ORIGIN_WITH_CREDS: 'https://foo:bar@' + REMOTE_HOST + HTTPS_PORT_ELIDED, + HTTPS_NOTSAMESITE_ORIGIN: 'https://' + NOTSAMESITE_HOST + HTTPS_PORT_ELIDED, UNAUTHENTICATED_ORIGIN: 'http://' + OTHER_HOST + HTTP_PORT_ELIDED, AUTHENTICATED_ORIGIN: 'https://' + OTHER_HOST + HTTPS_PORT_ELIDED }; diff --git a/tests/wpt/web-platform-tests/css/CSS2/stacking-context/opacity-change-twice-stacking-context-ref.html b/tests/wpt/web-platform-tests/css/CSS2/stacking-context/opacity-change-twice-stacking-context-ref.html new file mode 100644 index 00000000000..da17527af56 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/CSS2/stacking-context/opacity-change-twice-stacking-context-ref.html @@ -0,0 +1,3 @@ +<!doctype HTML> +<div style="width: 100px; height: 100px; z-index: 1; opacity: 0.9; background: blue; position: absolute"> +</div> diff --git a/tests/wpt/web-platform-tests/css/CSS2/stacking-context/opacity-change-twice-stacking-context.html b/tests/wpt/web-platform-tests/css/CSS2/stacking-context/opacity-change-twice-stacking-context.html new file mode 100644 index 00000000000..c3c680c68fa --- /dev/null +++ b/tests/wpt/web-platform-tests/css/CSS2/stacking-context/opacity-change-twice-stacking-context.html @@ -0,0 +1,19 @@ +<!doctype HTML> +<html class="reftest-wait"> + <title>CSS Test: Test for re-paint after stacking context changes opacity twice</title> + <link rel="help" href="https://www.w3.org/TR/CSS2/zindex.html"> + <link rel="match" href="opacity-change-twice-stacking-context-ref.html"> + <script src="/common/reftest-wait.js"></script> + <div id="target" style="width: 100px; height: 100px; z-index: 1; opacity: 0; background: blue; position: absolute"> + </div> + <script> + onload = () => { + requestAnimationFrame(() => requestAnimationFrame(() => { + target.style.opacity = 1; + target.offsetHeight; + target.style.opacity = 0.9; + takeScreenshot(); + })); + } + </script> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-tables/inheritance.html b/tests/wpt/web-platform-tests/css/css-tables/inheritance.html new file mode 100644 index 00000000000..2c640db6d9e --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-tables/inheritance.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Inheritance of CSS Tables properties</title> +<link rel="help" href="https://drafts.csswg.org/css-tables-3/#property-index"> +<meta name="assert" content="Properties inherit or not according to the spec."> +<meta name="assert" content="Properties have initial values according to the spec."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/inheritance-testcommon.js"></script> +</head> +<body> +<div id="container"> + <div id="target"></div> +</div> +<script> +assert_inherited('border-collapse', 'separate', 'collapse'); +assert_inherited('border-spacing', '0px 0px', '10px 20px'); +assert_inherited('caption-side', 'top', 'bottom'); +assert_inherited('empty-cells', 'show', 'hide'); +assert_not_inherited('table-layout', 'auto', 'fixed'); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any.js b/tests/wpt/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any.js index 709eef5bf1d..a4abcac55f3 100644 --- a/tests/wpt/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any.js +++ b/tests/wpt/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any.js @@ -7,6 +7,7 @@ function fetchNoCors(url, isOpaqueFiltered) { return fetch(url + urlQuery, {"mode": "no-cors"}).then(function(resp) { assert_equals(resp.status, 0, "Opaque filter: status is 0"); assert_equals(resp.statusText, "", "Opaque filter: statusText is \"\""); + assert_equals(resp.url, "", "Opaque filter: url is \"\""); assert_equals(resp.type , "opaque", "Opaque filter: response's type is opaque"); assert_equals(resp.headers.get("x-is-filtered"), null, "Header x-is-filtered is filtered"); }); diff --git a/tests/wpt/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.js b/tests/wpt/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.js index ded3bdc5dae..6f40c846563 100644 --- a/tests/wpt/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.js +++ b/tests/wpt/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.js @@ -1,4 +1,4 @@ -// META: global=window,worker +// META: global=window,dedicatedworker,sharedworker // META: script=/common/get-host-info.sub.js const host = get_host_info(); @@ -40,8 +40,8 @@ promise_test((test) => { promise_test((test) => { const remoteURL = httpsBaseURL + "resources/hello.py?corp=same-site"; - return fetch(remoteURL, { mode: "no-cors" }); -}, "Cross-origin no-cors fetch to a same-site URL with a 'Cross-Origin-Resource-Policy: same-site' response header."); + return promise_rejects(test, new TypeError, fetch(remoteURL, { mode: "no-cors" })); +}, "Cross-scheme (HTTP to HTTPS) no-cors fetch to a same-site URL with a 'Cross-Origin-Resource-Policy: same-site' response header."); promise_test((test) => { const remoteURL = httpsBaseURL + "resources/hello.py?corp=same-origin"; diff --git a/tests/wpt/web-platform-tests/fetch/cross-origin-resource-policy/fetch.https.any.js b/tests/wpt/web-platform-tests/fetch/cross-origin-resource-policy/fetch.https.any.js new file mode 100644 index 00000000000..98b9ba47853 --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/cross-origin-resource-policy/fetch.https.any.js @@ -0,0 +1,55 @@ +// META: global=window,worker +// META: script=/common/get-host-info.sub.js + +const host = get_host_info(); +const path = "/fetch/cross-origin-resource-policy/"; +const localBaseURL = host.HTTPS_ORIGIN + path; +const notSameSiteBaseURL = host.HTTPS_NOTSAMESITE_ORIGIN + path; + +promise_test(async () => { + const response = await fetch("./resources/hello.py?corp=same-origin"); + assert_equals(await response.text(), "hello"); +}, "Same-origin fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header."); + +promise_test(async () => { + const response = await fetch("./resources/hello.py?corp=same-site"); + assert_equals(await response.text(), "hello"); +}, "Same-origin fetch with a 'Cross-Origin-Resource-Policy: same-site' response header."); + +promise_test(async (test) => { + const response = await fetch(notSameSiteBaseURL + "resources/hello.py?corp=same-origin"); + assert_equals(await response.text(), "hello"); +}, "Cross-origin cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header."); + +promise_test(async (test) => { + const response = await fetch(notSameSiteBaseURL + "resources/hello.py?corp=same-site"); + assert_equals(await response.text(), "hello"); +}, "Cross-origin cors fetch with a 'Cross-Origin-Resource-Policy: same-site' response header."); + +promise_test((test) => { + const remoteURL = notSameSiteBaseURL + "resources/hello.py?corp=same-origin"; + return promise_rejects(test, new TypeError, fetch(remoteURL, { mode : "no-cors" })); +}, "Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header."); + +promise_test((test) => { + const remoteURL = notSameSiteBaseURL + "resources/hello.py?corp=same-site"; + return promise_rejects(test, new TypeError, fetch(remoteURL, { mode: "no-cors" })); +}, "Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-site' response header."); + +promise_test((test) => { + const finalURL = notSameSiteBaseURL + "resources/hello.py?corp=same-origin"; + return promise_rejects(test, new TypeError, fetch("resources/redirect.py?redirectTo=" + encodeURIComponent(finalURL), { mode: "no-cors" })); +}, "Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header after a redirection."); + +promise_test((test) => { + const finalURL = localBaseURL + "resources/hello.py?corp=same-origin"; + return fetch(notSameSiteBaseURL + "resources/redirect.py?redirectTo=" + encodeURIComponent(finalURL), { mode: "no-cors" }); +}, "Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header after a cross-origin redirection."); + +promise_test(async (test) => { + const finalURL = localBaseURL + "resources/hello.py?corp=same-origin"; + + await fetch(finalURL, { mode: "no-cors" }); + + return promise_rejects(test, new TypeError, fetch(notSameSiteBaseURL + "resources/redirect.py?corp=same-origin&redirectTo=" + encodeURIComponent(finalURL), { mode: "no-cors" })); +}, "Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' redirect response header."); diff --git a/tests/wpt/web-platform-tests/idle-detection/META.yml b/tests/wpt/web-platform-tests/idle-detection/META.yml new file mode 100644 index 00000000000..7e5836bc370 --- /dev/null +++ b/tests/wpt/web-platform-tests/idle-detection/META.yml @@ -0,0 +1,5 @@ +spec: https://github.com/inexorabletash/idle-detection +suggested_reviewers: + - goto + - jsbell + - reillyg
\ No newline at end of file diff --git a/tests/wpt/web-platform-tests/idle-detection/basics.tentative.https.any.js b/tests/wpt/web-platform-tests/idle-detection/basics.tentative.https.any.js new file mode 100644 index 00000000000..916829e32d7 --- /dev/null +++ b/tests/wpt/web-platform-tests/idle-detection/basics.tentative.https.any.js @@ -0,0 +1,69 @@ +// META: title=Idle Detection API: Basics + +'use strict'; + +promise_test(async t => { + let promise = navigator.idle.query(); + assert_equals(promise.constructor, Promise, + 'query() returns a promise'); + + let status = await promise; + assert_true(status instanceof IdleStatus, + 'query() promise resolves to an IdleStatus'); + + assert_true(['active', 'idle', 'locked'].includes(status.state), + 'status has a valid state'); +}, 'query() basics'); + +promise_test(async t => { + let used = false; + + await navigator.idle.query({ + get threshold() { + used = true; + return 1; + } + }); + + assert_true(used, 'query() options "threshold" member was used'); +}, 'query() uses threshold property'); + +promise_test(async t => { + return promise_rejects( + t, + new TypeError, + navigator.idle.query({threshold: 0}), + 'Threshold of 0 should reject'); +}, 'query() throws with invalid threshold (0)'); + +promise_test(async t => { + return promise_rejects( + t, + new TypeError, + navigator.idle.query({threshold: null}), + 'Threshold of null should reject'); +}, 'query() throws with invalid threshold (null)'); + +promise_test(async t => { + return promise_rejects( + t, + new TypeError, + navigator.idle.query({threshold: -1}), + 'Threshold of negative numbers should reject'); +}, 'query() throws with invalid threshold (-1)'); + +promise_test(async t => { + return promise_rejects( + t, + new TypeError, + navigator.idle.query({threshold: NaN}), + 'Threshold of NaN should reject'); +}, 'query() throws with invalid threshold (NaN)'); + +promise_test(async t => { + return navigator.idle.query(); +}, 'query() uses a default value for the threshold when none is passed'); + +promise_test(async t => { + return navigator.idle.query({threshold: undefined}); +}, 'query() uses a default value for the threshold'); diff --git a/tests/wpt/web-platform-tests/idle-detection/idle-detection.idl b/tests/wpt/web-platform-tests/idle-detection/idle-detection.idl new file mode 100644 index 00000000000..f529cd036bf --- /dev/null +++ b/tests/wpt/web-platform-tests/idle-detection/idle-detection.idl @@ -0,0 +1,32 @@ +[SecureContext] +interface mixin NavigatorIdle { + readonly attribute IdleManager idle; +}; + +Navigator includes NavigatorIdle; +WorkerNavigator includes NavigatorIdle; + +[ + SecureContext, + Exposed=(Window,Worker) +] interface IdleManager { + Promise<IdleStatus> query(optional IdleOptions options); +}; + +dictionary IdleOptions { + unsigned long threshold; +}; + +[ + SecureContext, + Exposed=(Window,Worker) +] interface IdleStatus : EventTarget { + readonly attribute IdleState state; + attribute EventHandler onchange; +}; + +enum IdleState { + "active", + "idle", + "locked" +}; diff --git a/tests/wpt/web-platform-tests/idle-detection/idlharness.https.any.js b/tests/wpt/web-platform-tests/idle-detection/idlharness.https.any.js new file mode 100644 index 00000000000..d7b5b96b666 --- /dev/null +++ b/tests/wpt/web-platform-tests/idle-detection/idlharness.https.any.js @@ -0,0 +1,32 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://github.com/inexorabletash/idle-detection + +'use strict'; + +promise_test(async () => { + const srcs = ['./idle-detection.idl', + '/interfaces/dom.idl', '/interfaces/html.idl']; + const [idle, dom, html] = await Promise.all( + srcs.map(i => fetch(i).then(r => r.text()))); + + const idl_array = new IdlArray(); + idl_array.add_idls(idle); + idl_array.add_dependency_idls(dom); + idl_array.add_dependency_idls(html); + + self.idle = await navigator.idle.query(); + + idl_array.add_objects({ + IdleManager: ['navigator.idle'], + IdleStatus: ['idle'], + }); + if (self.Window) { + idl_array.add_objects({ Navigator: ['navigator'] }); + } else { + idl_array.add_objects({ WorkerNavigator: ['navigator'] }); + } + + idl_array.test(); +}, 'Test IDL implementation of Idle Detection API'); diff --git a/tests/wpt/web-platform-tests/interfaces/html.idl b/tests/wpt/web-platform-tests/interfaces/html.idl index 3a513c5b9db..d46d1452ead 100644 --- a/tests/wpt/web-platform-tests/interfaces/html.idl +++ b/tests/wpt/web-platform-tests/interfaces/html.idl @@ -1,3 +1,10 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into reffy-reports +// (https://github.com/tidoust/reffy-reports) +// Source: HTML Standard (https://html.spec.whatwg.org/) + +// Example interface manually removed here, see https://github.com/tidoust/reffy/issues/129. + [Exposed=Window, LegacyUnenumerableNamedProperties] interface HTMLAllCollection { @@ -15,6 +22,7 @@ interface HTMLFormControlsCollection : HTMLCollection { getter (RadioNodeList or Element)? namedItem(DOMString name); // shadows inherited namedItem() }; +[Exposed=Window] interface RadioNodeList : NodeList { attribute DOMString value; }; @@ -65,8 +73,8 @@ partial interface Document { readonly attribute HTMLOrSVGScriptElement? currentScript; // classic scripts in a document tree only // dynamic markup insertion - [CEReactions] Document open(optional DOMString type = "text/html", optional DOMString replace = ""); - WindowProxy open(USVString url, DOMString name, DOMString features); + [CEReactions] Document open(optional DOMString unused1, optional DOMString unused2); // both arguments are ignored + WindowProxy? open(USVString url, DOMString name, DOMString features); [CEReactions] void close(); [CEReactions] void write(DOMString... text); [CEReactions] void writeln(DOMString... text); @@ -105,25 +113,23 @@ interface HTMLElement : Element { readonly attribute DOMString accessKeyLabel; [CEReactions] attribute boolean draggable; [CEReactions] attribute boolean spellcheck; + [CEReactions] attribute DOMString autocapitalize; [CEReactions] attribute [TreatNullAs=EmptyString] DOMString innerText; }; -dictionary FocusOptions { - boolean preventScroll = false; -}; - HTMLElement includes GlobalEventHandlers; HTMLElement includes DocumentAndElementEventHandlers; HTMLElement includes ElementContentEditable; HTMLElement includes HTMLOrSVGElement; // Note: intentionally not [HTMLConstructor] +[Exposed=Window] interface HTMLUnknownElement : HTMLElement { }; interface mixin HTMLOrSVGElement { [SameObject] readonly attribute DOMStringMap dataset; - attribute DOMString nonce; + attribute DOMString nonce; // intentionally no [CEReactions] [CEReactions] attribute long tabIndex; void focus(optional FocusOptions options); @@ -140,9 +146,7 @@ interface DOMStringMap { [Exposed=Window, HTMLConstructor] -interface HTMLHtmlElement : HTMLElement { - // also has obsolete members -}; +interface HTMLHtmlElement : HTMLElement {}; [Exposed=Window, HTMLConstructor] @@ -184,8 +188,6 @@ interface HTMLMetaElement : HTMLElement { [CEReactions] attribute DOMString name; [CEReactions] attribute DOMString httpEquiv; [CEReactions] attribute DOMString content; - - // also has obsolete members }; [Exposed=Window, @@ -197,35 +199,25 @@ HTMLStyleElement includes LinkStyle; [Exposed=Window, HTMLConstructor] -interface HTMLBodyElement : HTMLElement { - // also has obsolete members -}; +interface HTMLBodyElement : HTMLElement {}; HTMLBodyElement includes WindowEventHandlers; [Exposed=Window, HTMLConstructor] -interface HTMLHeadingElement : HTMLElement { - // also has obsolete members -}; +interface HTMLHeadingElement : HTMLElement {}; [Exposed=Window, HTMLConstructor] -interface HTMLParagraphElement : HTMLElement { - // also has obsolete members -}; +interface HTMLParagraphElement : HTMLElement {}; [Exposed=Window, HTMLConstructor] -interface HTMLHRElement : HTMLElement { - // also has obsolete members -}; +interface HTMLHRElement : HTMLElement {}; [Exposed=Window, HTMLConstructor] -interface HTMLPreElement : HTMLElement { - // also has obsolete members -}; +interface HTMLPreElement : HTMLElement {}; [Exposed=Window, HTMLConstructor] @@ -239,42 +231,30 @@ interface HTMLOListElement : HTMLElement { [CEReactions] attribute boolean reversed; [CEReactions] attribute long start; [CEReactions] attribute DOMString type; - - // also has obsolete members }; [Exposed=Window, HTMLConstructor] -interface HTMLUListElement : HTMLElement { - // also has obsolete members -}; +interface HTMLUListElement : HTMLElement {}; [Exposed=Window, HTMLConstructor] interface HTMLMenuElement : HTMLElement { - - // also has obsolete members }; [Exposed=Window, HTMLConstructor] interface HTMLLIElement : HTMLElement { [CEReactions] attribute long value; - - // also has obsolete members }; [Exposed=Window, HTMLConstructor] -interface HTMLDListElement : HTMLElement { - // also has obsolete members -}; +interface HTMLDListElement : HTMLElement {}; [Exposed=Window, HTMLConstructor] -interface HTMLDivElement : HTMLElement { - // also has obsolete members -}; +interface HTMLDivElement : HTMLElement {}; [Exposed=Window, HTMLConstructor] @@ -290,8 +270,6 @@ interface HTMLAnchorElement : HTMLElement { [CEReactions] attribute DOMString text; [CEReactions] attribute DOMString referrerPolicy; - - // also has obsolete members }; HTMLAnchorElement includes HTMLHyperlinkElementUtils; @@ -313,9 +291,7 @@ interface HTMLSpanElement : HTMLElement {}; [Exposed=Window, HTMLConstructor] -interface HTMLBRElement : HTMLElement { - // also has obsolete members -}; +interface HTMLBRElement : HTMLElement {}; interface mixin HTMLHyperlinkElementUtils { [CEReactions] stringifier attribute USVString href; @@ -370,10 +346,9 @@ interface HTMLImageElement : HTMLElement { readonly attribute boolean complete; readonly attribute USVString currentSrc; [CEReactions] attribute DOMString referrerPolicy; + [CEReactions] attribute DOMString decoding; Promise<void> decode(); - - // also has obsolete members }; [Exposed=Window, @@ -383,18 +358,15 @@ interface HTMLIFrameElement : HTMLElement { [CEReactions] attribute DOMString srcdoc; [CEReactions] attribute DOMString name; [SameObject, PutForwards=value] readonly attribute DOMTokenList sandbox; + [CEReactions] attribute DOMString allow; [CEReactions] attribute boolean allowFullscreen; [CEReactions] attribute boolean allowPaymentRequest; - [CEReactions] attribute boolean allowUserMedia; [CEReactions] attribute DOMString width; [CEReactions] attribute DOMString height; [CEReactions] attribute DOMString referrerPolicy; readonly attribute Document? contentDocument; readonly attribute WindowProxy? contentWindow; Document? getSVGDocument(); - [SameObject, PutForwards=value] readonly attribute DOMTokenList delegateStickyUserActivation; - - // also has obsolete members }; [Exposed=Window, @@ -405,8 +377,6 @@ interface HTMLEmbedElement : HTMLElement { [CEReactions] attribute DOMString width; [CEReactions] attribute DOMString height; Document? getSVGDocument(); - - // also has obsolete members }; [Exposed=Window, @@ -430,8 +400,6 @@ interface HTMLObjectElement : HTMLElement { boolean checkValidity(); boolean reportValidity(); void setCustomValidity(DOMString error); - - // also has obsolete members }; [Exposed=Window, @@ -439,8 +407,6 @@ interface HTMLObjectElement : HTMLElement { interface HTMLParamElement : HTMLElement { [CEReactions] attribute DOMString name; [CEReactions] attribute DOMString value; - - // also has obsolete members }; [Exposed=Window, @@ -681,8 +647,6 @@ interface HTMLAreaElement : HTMLElement { [CEReactions] attribute DOMString rel; [SameObject, PutForwards=value] readonly attribute DOMTokenList relList; [CEReactions] attribute DOMString referrerPolicy; - - // also has obsolete members }; HTMLAreaElement includes HTMLHyperlinkElementUtils; @@ -707,32 +671,24 @@ interface HTMLTableElement : HTMLElement { [SameObject] readonly attribute HTMLCollection rows; HTMLTableRowElement insertRow(optional long index = -1); [CEReactions] void deleteRow(long index); - - // also has obsolete members }; [Exposed=Window, HTMLConstructor] -interface HTMLTableCaptionElement : HTMLElement { - // also has obsolete members -}; +interface HTMLTableCaptionElement : HTMLElement {}; [Exposed=Window, HTMLConstructor] interface HTMLTableColElement : HTMLElement { [CEReactions] attribute unsigned long span; - - // also has obsolete members }; [Exposed=Window, HTMLConstructor] interface HTMLTableSectionElement : HTMLElement { [SameObject] readonly attribute HTMLCollection rows; - HTMLElement insertRow(optional long index = -1); + HTMLTableRowElement insertRow(optional long index = -1); [CEReactions] void deleteRow(long index); - - // also has obsolete members }; [Exposed=Window, @@ -743,8 +699,6 @@ interface HTMLTableRowElement : HTMLElement { [SameObject] readonly attribute HTMLCollection cells; HTMLTableCellElement insertCell(optional long index = -1); [CEReactions] void deleteCell(long index); - - // also has obsolete members }; [Exposed=Window, @@ -757,8 +711,6 @@ interface HTMLTableCellElement : HTMLElement { [CEReactions] attribute DOMString scope; // only conforming for th elements [CEReactions] attribute DOMString abbr; // only conforming for th elements - - // also has obsolete members }; [Exposed=Window, @@ -855,8 +807,6 @@ interface HTMLInputElement : HTMLElement { void setRangeText(DOMString replacement); void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode = "preserve"); void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); - - // also has obsolete members }; [Exposed=Window, @@ -969,7 +919,7 @@ interface HTMLTextAreaElement : HTMLElement { readonly attribute DOMString type; [CEReactions] attribute DOMString defaultValue; - [CEReactions] attribute [TreatNullAs=EmptyString] DOMString value; + attribute [TreatNullAs=EmptyString] DOMString value; readonly attribute unsigned long textLength; readonly attribute boolean willValidate; @@ -1055,8 +1005,6 @@ interface HTMLFieldSetElement : HTMLElement { HTMLConstructor] interface HTMLLegendElement : HTMLElement { readonly attribute HTMLFormElement? form; - - // also has obsolete members }; enum SelectionMode { @@ -1118,6 +1066,7 @@ interface HTMLScriptElement : HTMLElement { [CEReactions] attribute DOMString? crossOrigin; [CEReactions] attribute DOMString text; [CEReactions] attribute DOMString integrity; + [CEReactions] attribute DOMString referrerPolicy; }; @@ -1139,7 +1088,7 @@ dictionary AssignedNodesOptions { boolean flatten = false; }; -typedef (CanvasRenderingContext2D or ImageBitmapRenderingContext or WebGLRenderingContext) RenderingContext; +typedef (CanvasRenderingContext2D or ImageBitmapRenderingContext or WebGLRenderingContext or WebGL2RenderingContext) RenderingContext; [Exposed=Window, HTMLConstructor] @@ -1177,6 +1126,8 @@ enum ImageSmoothingQuality { "low", "medium", "high" }; interface CanvasRenderingContext2D { // back-reference to the canvas readonly attribute HTMLCanvasElement canvas; + + CanvasRenderingContext2DSettings getContextAttributes(); }; CanvasRenderingContext2D includes CanvasState; CanvasRenderingContext2D includes CanvasTransform; @@ -1212,6 +1163,7 @@ interface mixin CanvasTransform { void setTransform(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f); void setTransform(optional DOMMatrix2DInit transform); void resetTransform(); + }; interface mixin CanvasCompositing { @@ -1224,6 +1176,7 @@ interface mixin CanvasImageSmoothing { // image smoothing attribute boolean imageSmoothingEnabled; // (default true) attribute ImageSmoothingQuality imageSmoothingQuality; // (default low) + }; interface mixin CanvasFillStrokeStyles { @@ -1233,6 +1186,7 @@ interface mixin CanvasFillStrokeStyles { CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1); CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1); CanvasPattern? createPattern(CanvasImageSource image, [TreatNullAs=EmptyString] DOMString repetition); + }; interface mixin CanvasShadowStyles { @@ -1264,7 +1218,6 @@ interface mixin CanvasDrawPath { void stroke(Path2D path); void clip(optional CanvasFillRule fillRule = "nonzero"); void clip(Path2D path, optional CanvasFillRule fillRule = "nonzero"); - void resetClip(); boolean isPointInPath(unrestricted double x, unrestricted double y, optional CanvasFillRule fillRule = "nonzero"); boolean isPointInPath(Path2D path, unrestricted double x, unrestricted double y, optional CanvasFillRule fillRule = "nonzero"); boolean isPointInStroke(unrestricted double x, unrestricted double y); @@ -1336,9 +1289,12 @@ interface mixin CanvasPath { void quadraticCurveTo(unrestricted double cpx, unrestricted double cpy, unrestricted double x, unrestricted double y); void bezierCurveTo(unrestricted double cp1x, unrestricted double cp1y, unrestricted double cp2x, unrestricted double cp2y, unrestricted double x, unrestricted double y); void arcTo(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radius); + void rect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); void arc(unrestricted double x, unrestricted double y, unrestricted double radius, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false); + void ellipse(unrestricted double x, unrestricted double y, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false); + }; [Exposed=(Window,Worker)] @@ -1353,7 +1309,7 @@ interface CanvasPattern { void setTransform(optional DOMMatrix2DInit transform); }; -[Exposed=Window] +[Exposed=(Window,Worker)] interface TextMetrics { // x-direction readonly attribute double width; // advance width @@ -1367,7 +1323,9 @@ interface TextMetrics { readonly attribute double actualBoundingBoxDescent; readonly attribute double emHeightAscent; readonly attribute double emHeightDescent; - Baselines getBaselines(); + readonly attribute double hangingBaseline; + readonly attribute double alphabeticBaseline; + readonly attribute double ideographicBaseline; }; [Constructor(unsigned long sw, unsigned long sh), @@ -1397,27 +1355,25 @@ dictionary ImageBitmapRenderingContextSettings { boolean alpha = true; }; -typedef (OffscreenCanvasRenderingContext2D or - WebGLRenderingContext) OffscreenRenderingContext; +typedef (OffscreenCanvasRenderingContext2D or WebGLRenderingContext or WebGL2RenderingContext) OffscreenRenderingContext; dictionary ImageEncodeOptions { DOMString type = "image/png"; unrestricted double quality = 1.0; }; -enum OffscreenRenderingContextId { "2d", "webgl" }; +enum OffscreenRenderingContextId { "2d", "webgl", "webgl2" }; [Constructor([EnforceRange] unsigned long long width, [EnforceRange] unsigned long long height), Exposed=(Window,Worker), Transferable] interface OffscreenCanvas : EventTarget { - attribute unsigned long long width; - attribute unsigned long long height; + attribute [EnforceRange] unsigned long long width; + attribute [EnforceRange] unsigned long long height; OffscreenRenderingContext? getContext(OffscreenRenderingContextId contextId, optional any options = null); ImageBitmap transferToImageBitmap(); Promise<Blob> convertToBlob(optional ImageEncodeOptions options); }; - [Exposed=(Window,Worker)] interface OffscreenCanvasRenderingContext2D { void commit(); @@ -1433,33 +1389,41 @@ OffscreenCanvasRenderingContext2D includes CanvasShadowStyles; OffscreenCanvasRenderingContext2D includes CanvasFilters; OffscreenCanvasRenderingContext2D includes CanvasRect; OffscreenCanvasRenderingContext2D includes CanvasDrawPath; +OffscreenCanvasRenderingContext2D includes CanvasText; OffscreenCanvasRenderingContext2D includes CanvasDrawImage; OffscreenCanvasRenderingContext2D includes CanvasImageData; OffscreenCanvasRenderingContext2D includes CanvasPathDrawingStyles; +OffscreenCanvasRenderingContext2D includes CanvasTextDrawingStyles; OffscreenCanvasRenderingContext2D includes CanvasPath; - [Exposed=Window] interface CustomElementRegistry { - [CEReactions] void define(DOMString name, Function constructor, optional ElementDefinitionOptions options); + [CEReactions] void define(DOMString name, CustomElementConstructor constructor, optional ElementDefinitionOptions options); any get(DOMString name); Promise<void> whenDefined(DOMString name); [CEReactions] void upgrade(Node root); }; +callback CustomElementConstructor = any (); + dictionary ElementDefinitionOptions { DOMString extends; }; +dictionary FocusOptions { + boolean preventScroll = false; +}; + interface mixin ElementContentEditable { [CEReactions] attribute DOMString contentEditable; + [CEReactions] attribute DOMString enterKeyHint; readonly attribute boolean isContentEditable; [CEReactions] attribute DOMString inputMode; }; [Exposed=Window, Constructor] - interface DataTransfer { +interface DataTransfer { attribute DOMString dropEffect; attribute DOMString effectAllowed; @@ -1514,6 +1478,7 @@ interface Window : EventTarget { [Replaceable] readonly attribute WindowProxy self; [Unforgeable] readonly attribute Document document; attribute DOMString name; + [PutForwards=href, Unforgeable] readonly attribute Location location; readonly attribute History history; readonly attribute CustomElementRegistry customElements; @@ -1545,7 +1510,8 @@ interface Window : EventTarget { // the user agent readonly attribute Navigator navigator; - readonly attribute ApplicationCache applicationCache; + + [SecureContext] readonly attribute ApplicationCache applicationCache; // user prompts void alert(); @@ -1554,20 +1520,12 @@ interface Window : EventTarget { DOMString? prompt(optional DOMString message = "", optional DOMString default = ""); void print(); - unsigned long requestAnimationFrame(FrameRequestCallback callback); - void cancelAnimationFrame(unsigned long handle); - void postMessage(any message, USVString targetOrigin, optional sequence<object> transfer = []); - void postMessage(any message, optional sequence<object> transfer = [], optional WindowPostMessageOptions options); - - // also has obsolete members + void postMessage(any message, optional WindowPostMessageOptions options); }; Window includes GlobalEventHandlers; -Window includes WindowEventHandlers; - -callback FrameRequestCallback = void (DOMHighResTimeStamp time); -dictionary WindowPostMessageOptions { +dictionary WindowPostMessageOptions : PostMessageOptions { USVString targetOrigin = "/"; }; @@ -1580,7 +1538,6 @@ enum ScrollRestoration { "auto", "manual" }; [Exposed=Window] interface History { - readonly attribute unsigned long index; readonly attribute unsigned long length; attribute ScrollRestoration scrollRestoration; readonly attribute any state; @@ -1647,7 +1604,8 @@ interface BeforeUnloadEvent : Event { attribute DOMString returnValue; }; -[Exposed=Window] +[SecureContext, + Exposed=Window] interface ApplicationCache : EventTarget { // update status @@ -1825,6 +1783,9 @@ interface mixin WindowOrWorkerGlobalScope { long setInterval(TimerHandler handler, optional long timeout = 0, any... arguments); void clearInterval(optional long handle = 0); + // microtask queuing + void queueMicrotask(VoidFunction callback); + // ImageBitmap Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, optional ImageBitmapOptions options); Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options); @@ -1854,8 +1815,6 @@ interface mixin NavigatorID { readonly attribute DOMString userAgent; [Exposed=Window] readonly attribute DOMString vendor; [Exposed=Window] readonly attribute DOMString vendorSub; // constant "" - - // also has additional members in a partial interface }; partial interface NavigatorID { @@ -1944,6 +1903,15 @@ dictionary ImageBitmapOptions { ResizeQuality resizeQuality = "low"; }; +callback FrameRequestCallback = void (DOMHighResTimeStamp time); + +interface mixin AnimationFrameProvider { + unsigned long requestAnimationFrame(FrameRequestCallback callback); + void cancelAnimationFrame(unsigned long handle); +}; +Window includes AnimationFrameProvider; +DedicatedWorkerGlobalScope includes AnimationFrameProvider; + [Constructor(DOMString type, optional MessageEventInit eventInitDict), Exposed=(Window,Worker,AudioWorklet)] interface MessageEvent : Event { readonly attribute any data; @@ -2038,7 +2006,8 @@ interface MessageChannel { [Exposed=(Window,Worker,AudioWorklet), Transferable] interface MessagePort : EventTarget { - void postMessage(any message, optional sequence<object> transfer = []); + void postMessage(any message, sequence<object> transfer); + void postMessage(any message, optional PostMessageOptions options); void start(); void close(); @@ -2047,6 +2016,10 @@ interface MessagePort : EventTarget { attribute EventHandler onmessageerror; }; +dictionary PostMessageOptions { + sequence<object> transfer = []; +}; + [Constructor(DOMString name), Exposed=(Window,Worker)] interface BroadcastChannel : EventTarget { readonly attribute DOMString name; @@ -2075,7 +2048,8 @@ interface WorkerGlobalScope : EventTarget { interface DedicatedWorkerGlobalScope : WorkerGlobalScope { [Replaceable] readonly attribute DOMString name; - void postMessage(any message, optional sequence<object> transfer = []); + void postMessage(any message, sequence<object> transfer); + void postMessage(any message, optional PostMessageOptions options); void close(); @@ -2100,14 +2074,15 @@ interface mixin AbstractWorker { interface Worker : EventTarget { void terminate(); - void postMessage(any message, optional sequence<object> transfer = []); + void postMessage(any message, sequence<object> transfer); + void postMessage(any message, optional PostMessageOptions options); attribute EventHandler onmessage; attribute EventHandler onmessageerror; }; dictionary WorkerOptions { WorkerType type = "classic"; - RequestCredentials credentials = "omit"; // credentials is only used if type is "module" + RequestCredentials credentials = "same-origin"; // credentials is only used if type is "module" DOMString name = ""; }; @@ -2174,6 +2149,8 @@ interface StorageEvent : Event { readonly attribute DOMString? newValue; readonly attribute USVString url; readonly attribute Storage? storageArea; + + void initStorageEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false, optional DOMString? key = null, optional DOMString? oldValue = null, optional DOMString? newValue = null, optional USVString url = "", optional Storage? storageArea = null); }; dictionary StorageEventInit : EventInit { @@ -2293,6 +2270,7 @@ interface HTMLFontElement : HTMLElement { [CEReactions] attribute [TreatNullAs=EmptyString] DOMString color; [CEReactions] attribute DOMString face; [CEReactions] attribute DOMString size; + }; partial interface HTMLHeadingElement { diff --git a/tests/wpt/web-platform-tests/interfaces/webrtc.idl b/tests/wpt/web-platform-tests/interfaces/webrtc.idl index c7529ced356..dc51e2f2f3a 100644 --- a/tests/wpt/web-platform-tests/interfaces/webrtc.idl +++ b/tests/wpt/web-platform-tests/interfaces/webrtc.idl @@ -402,6 +402,7 @@ dictionary RTCRtpSynchronizationSource : RTCRtpContributingSource { }; [Exposed=Window] interface RTCDtlsTransport : EventTarget { + [SameObject] readonly attribute RTCIceTransport iceTransport; readonly attribute RTCDtlsTransportState state; sequence<ArrayBuffer> getRemoteCertificates(); diff --git a/tests/wpt/web-platform-tests/longtask-timing/supported-longtask-types.any.js b/tests/wpt/web-platform-tests/longtask-timing/supported-longtask-types.any.js index 0179fc5e60c..3c68c01d32d 100644 --- a/tests/wpt/web-platform-tests/longtask-timing/supported-longtask-types.any.js +++ b/tests/wpt/web-platform-tests/longtask-timing/supported-longtask-types.any.js @@ -7,3 +7,32 @@ test(() => { assert_false(types.includes("taskattribution"), "There should NOT be 'taskattribution' in PerformanceObserver.supportedEntryTypes"); }, "supportedEntryTypes contains 'longtask' but not 'taskattribution'."); + +function syncWait(waitDuration) { + if (waitDuration <= 0) + return; + + const startTime = performance.now(); + let unused = ''; + for (let i = 0; i < 10000; i++) + unused += '' + Math.random(); + + return syncWait(waitDuration - (performance.now() - startTime)); +} + +if (typeof PerformanceObserver.supportedEntryTypes !== "undefined") { + const entryType = "longtask"; + if (PerformanceObserver.supportedEntryTypes.includes(entryType)) { + promise_test(async () => { + await new Promise((resolve) => { + new PerformanceObserver(function (list, observer) { + observer.disconnect(); + resolve(); + }).observe({entryTypes: [entryType]}); + + // Force the PerformanceEntry. + syncWait(50); + }) + }, `'${entryType}' entries should be observable.`) + } +} diff --git a/tests/wpt/web-platform-tests/navigation-timing/supported_navigation_type.any.js b/tests/wpt/web-platform-tests/navigation-timing/supported_navigation_type.any.js index 5e9151cea72..3239c7d29ff 100644 --- a/tests/wpt/web-platform-tests/navigation-timing/supported_navigation_type.any.js +++ b/tests/wpt/web-platform-tests/navigation-timing/supported_navigation_type.any.js @@ -4,3 +4,17 @@ test(() => { assert_true(PerformanceObserver.supportedEntryTypes.includes("navigation"), "There should be an entry 'navigation' in PerformanceObserver.supportedEntryTypes"); }, "supportedEntryTypes contains 'navigation'."); + +if (typeof PerformanceObserver.supportedEntryTypes !== "undefined") { + const entryType = "navigation"; + if (PerformanceObserver.supportedEntryTypes.includes(entryType)) { + promise_test(async() => { + await new Promise((resolve) => { + new PerformanceObserver(function (list, observer) { + observer.disconnect(); + resolve(); + }).observe({entryTypes: [entryType]}); + }) + }, `'${entryType}' entries should be observable.`) + } +} diff --git a/tests/wpt/web-platform-tests/paint-timing/supported-paint-type.any.js b/tests/wpt/web-platform-tests/paint-timing/supported-paint-type.any.js index 623c880c573..36acf82ca3b 100644 --- a/tests/wpt/web-platform-tests/paint-timing/supported-paint-type.any.js +++ b/tests/wpt/web-platform-tests/paint-timing/supported-paint-type.any.js @@ -4,3 +4,22 @@ test(() => { assert_true(PerformanceObserver.supportedEntryTypes.includes("paint"), "There should be an entry 'paint' in PerformanceObserver.supportedEntryTypes"); }, "supportedEntryTypes contains 'paint'."); + +if (typeof PerformanceObserver.supportedEntryTypes !== "undefined") { + const entryType = 'paint'; + if (PerformanceObserver.supportedEntryTypes.includes(entryType)) { + promise_test(async() => { + await new Promise((resolve) => { + new PerformanceObserver(function (list, observer) { + observer.disconnect(); + resolve(); + }).observe({entryTypes: [entryType]}); + + // Force the PerformanceEntry. + // Use `self` for Workers. + if (self.document) + document.head.parentNode.appendChild(document.createTextNode('foo')); + }) + }, `'${entryType}' entries should be observable.`) + } +} diff --git a/tests/wpt/web-platform-tests/payment-request/blank.html b/tests/wpt/web-platform-tests/payment-request/blank.html new file mode 100644 index 00000000000..7852a427e86 --- /dev/null +++ b/tests/wpt/web-platform-tests/payment-request/blank.html @@ -0,0 +1 @@ +<!DOCTYPE html> <meta charset="utf-8" /> diff --git a/tests/wpt/web-platform-tests/payment-request/payment-is-showing.https.html b/tests/wpt/web-platform-tests/payment-request/payment-is-showing.https.html new file mode 100644 index 00000000000..650b76d61f7 --- /dev/null +++ b/tests/wpt/web-platform-tests/payment-request/payment-is-showing.https.html @@ -0,0 +1,380 @@ +<!DOCTYPE html> <meta charset="utf-8" /> +<title>Test for PaymentRequest.show(optional promise) method</title> +<link + rel="help" + href="https://w3c.github.io/browser-payment-api/#dfn-payment-request-is-showing" +/> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="/resources/testdriver.js"></script> +<body> + <script> + "use strict"; + const applePayMethod = { + supportedMethods: "https://apple.com/apple-pay", + data: { + version: 3, + merchantIdentifier: "merchant.com.example", + countryCode: "US", + merchantCapabilities: ["supports3DS"], + supportedNetworks: ["visa"], + }, + }; + const methods = [{ supportedMethods: "basic-card" }, applePayMethod]; + const details = { + total: { + label: "Total", + amount: { + currency: "USD", + value: "1.00", + }, + }, + }; + + /** + * Attaches an iframe to window.document. + * + * @param {String} src Optional resource URL to load. + * @returns {Promise} Resolves when the src loads. + */ + async function attachIframe(src = "blank.html") { + const iframe = document.createElement("iframe"); + iframe.allowPaymentRequest = true; + iframe.src = src; + document.body.appendChild(iframe); + await new Promise(resolve => { + iframe.addEventListener("load", resolve, { once: true }); + }); + return iframe; + } + + /** + * Creates a popup window + * + * @param {String} src Optional resource URL to load. + * @returns {Promise} Resolves when the src loads. + */ + async function loadPopup(src = "blank.html") { + const popupWindow = await test_driver.bless("a popup window", () => + window.open(src, "", "width=400,height=400") + ); + await new Promise(resolve => { + popupWindow.addEventListener("load", resolve, { once: true }); + }); + popupWindow.focus(); + return popupWindow; + } + + promise_test(async t => { + const request1 = new PaymentRequest(methods, details); + const request2 = new PaymentRequest(methods, details); + + // Sets the "payment-relevant browsing context's payment request is showing boolean" to true. + const showPromise1 = test_driver.bless("show payment request", () => + request1.show() + ); + + // Try to show a second payment sheet in the same window, which should reject. + const showPromise2 = test_driver.bless("show payment request", () => + // Sets the request's state to "closed", and rejects with AbortError. + // See: https://github.com/w3c/payment-request/pull/821 + request2.show() + ); + + await promise_rejects( + t, + "AbortError", + showPromise2, + "Attempting to show a second payment request must reject." + ); + await request1.abort(); + + await promise_rejects( + t, + "AbortError", + showPromise1, + "request1 was aborted via .abort()" + ); + // Finally, request2 should have been "closed", so trying to show + // it will again result in promise rejected with an InvalidStateError. + // See: https://github.com/w3c/payment-request/pull/821 + const rejectedPromise = request2.show(); + await promise_rejects( + t, + "InvalidStateError", + rejectedPromise, + "Attempting to show a second payment request must reject." + ); + // Finally, we confirm that request2's returned promises are unique. + assert_not_equals( + showPromise2, + rejectedPromise, + "Returned Promises be unique" + ); + }, "The top browsing context can only show one payment sheet at a time."); + + promise_test(async t => { + const iframe = await attachIframe(); + const iframeWindow = iframe.contentWindow; + + // Payment requests + const iframeRequest = new iframeWindow.PaymentRequest(methods, details); + const windowRequest = new window.PaymentRequest(methods, details); + + // Let's get some blessed showPromises + const showPromise = test_driver.bless("show payment request", () => { + // iframe sets "is showing boolean", ignore the returned promise. + iframeRequest.show(); + // The top level window now tries to show() the payment request. + return windowRequest.show(); + }); + + await promise_rejects( + t, + "AbortError", + showPromise, + "iframe is already showing a payment request." + ); + + // Cleanup + await iframeRequest.abort(); + iframe.remove(); + }, "If an iframe shows a payment request, the top-level browsing context can't also show one."); + + promise_test(async t => { + const iframe = await attachIframe(); + const iframeWindow = iframe.contentWindow; + + // Payment requests + const iframeRequest = new iframeWindow.PaymentRequest(methods, details); + const windowRequest = new window.PaymentRequest(methods, details); + + // We show a payment request via the the top level browsing context, + // windowRequest.show() sets "is showing boolean" to true. + // We don't care about the returned promise. + test_driver.bless("show payment request", () => windowRequest.show()); + + // calling iframeRequest.show() must return a rejected promise. + const iframeShowPromise = test_driver.bless("show payment request", () => + iframeRequest.show() + ); + + await promise_rejects( + t, + "AbortError", + iframeShowPromise, + "The top window is already showing a payment request." + ); + + // Cleanup + await windowRequest.abort(); + iframe.remove(); + }, "An iframe cannot show a payment request if the top-level window is already showing one."); + + promise_test(async t => { + const popupWindow = await loadPopup(); + + // Create requests + const popupRequest = new popupWindow.PaymentRequest(methods, details); + const windowRequest = new window.PaymentRequest(methods, details); + + // show the Popup's payment request. + const popupShowPromise = test_driver.bless( + "show popup's payment request", + () => + // popupRequest.show(), but via the window.PaymentRequest.prototype + window.PaymentRequest.prototype.show.call(popupRequest) + ); + const showPromise = test_driver.bless("show window payment request", () => + windowRequest.show() + ); + await promise_rejects( + t, + "AbortError", + showPromise, + "Expected window's showPromise to reject, request is already showing" + ); + popupWindow.close(); + }, "Using a popup window prevents the top-browsing context from showing a payment request"); + + promise_test(async t => { + const iframe = await attachIframe(); + const iframeWindow = iframe.contentWindow; + const popupWindow = await loadPopup(); + + // Create requests + const windowRequest = new window.PaymentRequest(methods, details); + const popupRequest = new popupWindow.PaymentRequest(methods, details); + const iframeRequest = new iframeWindow.PaymentRequest(methods, details); + // Get the showPromise for each browsing context + const [ + windowShowPromise, + popupShowPromise, + iframeShowPromise, + ] = await test_driver.bless("show payment request", () => { + return [ + windowRequest.show(), + popupRequest.show(), + iframeRequest.show(), + ]; + }); + + // popupRequest and iframeRequest will both reject + await promise_rejects( + t, + "AbortError", + popupShowPromise, + "Expected popupShowPromise to reject, request is already showing." + ); + + await promise_rejects( + t, + "AbortError", + iframeShowPromise, + "Expected iframeShowPromise to reject, request is already showing." + ); + + await windowRequest.abort(); + popupWindow.close(); + iframe.remove(); + }, "Given multiple nested browsing contexts, and window calls show() first, other nested browsing contexts can't show a request."); + + promise_test(async t => { + const iframe = await attachIframe(); + const iframeWindow = iframe.contentWindow; + const popupWindow = await loadPopup(); + + // Create requests + const windowRequest = new window.PaymentRequest(methods, details); + const popupRequest = new popupWindow.PaymentRequest(methods, details); + const iframeRequest = new iframeWindow.PaymentRequest(methods, details); + + // Get the showPromise for each browsing context + const [ + popupShowPromise, + windowShowPromise, + iframeShowPromise, + ] = await test_driver.bless("show payment request", () => { + return [ + popupRequest.show(), + windowRequest.show(), + iframeRequest.show(), + ]; + }); + + // windowShowPromise and iframeRequest will both reject + await promise_rejects( + t, + "AbortError", + windowShowPromise, + "Expected windowShowPromise to reject, the popup is showing a payment request." + ); + + await promise_rejects( + t, + "AbortError", + iframeShowPromise, + "Expected iframeShowPromise to reject, the popup is showing a payment request." + ); + + await popupRequest.abort(); + popupWindow.close(); + iframe.remove(); + }, "Given multiple nested browsing contexts, and popup calls show() first, other nested browsing contexts can't show a request."); + + promise_test(async t => { + const iframe = await attachIframe(); + const iframeWindow = iframe.contentWindow; + const popupWindow = await loadPopup(); + + // Create requests + const windowRequest = new window.PaymentRequest(methods, details); + const popupRequest = new popupWindow.PaymentRequest(methods, details); + const iframeRequest = new iframeWindow.PaymentRequest(methods, details); + + // Get the showPromise for each browsing context + const [ + iframeShowPromise, + popupShowPromise, + windowShowPromise, + ] = await test_driver.bless("show payment request", () => { + return [ + iframeRequest.show(), + popupRequest.show(), + windowRequest.show(), + ]; + }); + + // windowShowPromise and iframeRequest will both reject + await promise_rejects( + t, + "AbortError", + windowShowPromise, + "Expected windowShowPromise to reject, the popup is showing a payment request." + ); + + await promise_rejects( + t, + "AbortError", + popupShowPromise, + "Expected popupShowPromise to reject, the popup is showing a payment request." + ); + + await iframeRequest.abort(); + popupWindow.close(); + iframe.remove(); + }, "Given multiple nested browsing contexts, and an iframe calls show() first, other nested browsing contexts can't show a request."); + + promise_test(async t => { + const iframe = await attachIframe(); + const iframeWindow = iframe.contentWindow; + const iframeRequest = new iframeWindow.PaymentRequest(methods, details); + const iframeShowPromise = test_driver.bless("show payment request", () => + iframeRequest.show() + ); + + // We navigate away, causing the payment sheet to close + // and the request is showing boolean to become false. + iframe.src = "blank.html?abc=123"; + await new Promise(resolve => (iframe.onload = resolve)); + await promise_rejects( + t, + "AbortError", + iframeShowPromise, + "Navigating iframe away must cause the iframeShowPromise to reject." + ); + iframe.remove(); + + // Now we should be ok to spin up a new payment request + const request = new window.PaymentRequest(method, details); + const showPromise = request.show(); + await request.abort(); + }, "Navigating an iframe as a nested browsing context sets 'payment request is showing boolean' to false."); + + promise_test(async t => { + const popupWindow = await loadPopup(); + const popupRequest = new popupWindow.PaymentRequest(methods, details); + const showPromise = test_driver.bless("show payment request", () => + popupRequest.show() + ); + + // We navigate away, causing the payment sheet to close + // and the request is showing boolean to become false. + popupWindow.location = "blank.html?abc=123"; + await new Promise(resolve => (popupWindow.onload = resolve)); + await promise_rejects( + t, + "AbortError", + showPromise, + "Navigating away must cause the showPromise to reject with an AbortError" + ); + popupWindow.close(); + + // Now we should be ok to spin up a new payment request. + const request = new window.PaymentRequest(method, details); + request.show(); + await request.abort(); + }, "Navigating a popup as a nested browsing context sets 'payment request is showing boolean' to false."); + </script> +</body> diff --git a/tests/wpt/web-platform-tests/pointerevents/pointerevent_click_during_capture-manual.html b/tests/wpt/web-platform-tests/pointerevents/pointerevent_click_during_capture.html index ed0e3e2c1eb..7f63283b61a 100644 --- a/tests/wpt/web-platform-tests/pointerevents/pointerevent_click_during_capture-manual.html +++ b/tests/wpt/web-platform-tests/pointerevents/pointerevent_click_during_capture.html @@ -7,6 +7,9 @@ <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="pointerevent_support.js"></script> + <script src="/resources/testdriver.js"></script> + <script src="/resources/testdriver-actions.js"></script> + <script src="/resources/testdriver-vendor.js"></script> <style> .box { margin: 10px; @@ -35,13 +38,13 @@ phase = PhaseEnum.Phase1; receivedEvents = []; } - + function run() { var test_pointerEvent = setup_pointerevent_test("click target during capture", ['mouse']); var grey = document.getElementById('grey'); var blue = document.getElementById('blue'); var green = document.getElementById('green'); - + ['gotpointercapture', 'lostpointercapture', 'pointerdown', 'pointerup', 'click'].forEach(function(eventName) { [grey, blue, green].forEach(function(target) { target.addEventListener(eventName, function(event) { @@ -49,14 +52,14 @@ receivedEvents.push(event.type + '@' + target.id); if (phase == PhaseEnum.Phase1 && target == green && event.type == 'click') { test(function() { - assert_equals(receivedEvents.join(','), 'pointerdown@green,pointerup@green,click@green', 'An element should only receive click when it is the first common ancestor of pointerdown and pointerup targets'); + assert_equals(receivedEvents.join(','), 'pointerdown@green,pointerup@green,click@green', 'An element should only receive click when it is the first common ancestor of pointerdown and pointerup targets'); }, "Click target when pointerup/down targeted at the same element with no capture"); phase = PhaseEnum.Phase2; receivedEvents = []; } if (phase == PhaseEnum.Phase2 && target == grey && event.type == 'click') { test(function() { - assert_equals(receivedEvents.join(','), 'pointerdown@blue,pointerup@green,click@grey', 'An element should only receive click when it is the first common ancestor of pointerdown and pointerup targets'); + assert_equals(receivedEvents.join(','), 'pointerdown@blue,pointerup@green,click@grey', 'An element should only receive click when it is the first common ancestor of pointerdown and pointerup targets'); }, "Click target when pointerup/down targeted at different elements with no capture"); phase = PhaseEnum.Phase1WithCapturing; receivedEvents = []; @@ -64,13 +67,13 @@ if (target == blue && event.type == 'lostpointercapture') { if (phase == PhaseEnum.Phase1WithCapturing) { test_pointerEvent.step(function() { - assert_equals(receivedEvents.join(','), 'pointerdown@green,gotpointercapture@blue,pointerup@blue,click@grey,lostpointercapture@blue', 'An element should only receive click when it is the first common ancestor of pointerdown and pointerup targets'); + assert_equals(receivedEvents.join(','), 'pointerdown@green,gotpointercapture@blue,pointerup@blue,click@grey,lostpointercapture@blue', 'An element should only receive click when it is the first common ancestor of pointerdown and pointerup targets'); }); phase = PhaseEnum.Phase2WithCapturing; receivedEvents = []; } else if (phase == PhaseEnum.Phase2WithCapturing) { test_pointerEvent.step(function() { - assert_equals(receivedEvents.join(','), 'pointerdown@blue,gotpointercapture@blue,pointerup@blue,click@blue,lostpointercapture@blue', 'An element should only receive click when it is the first common ancestor of pointerdown and pointerup targets'); + assert_equals(receivedEvents.join(','), 'pointerdown@blue,gotpointercapture@blue,pointerup@blue,click@blue,lostpointercapture@blue', 'An element should only receive click when it is the first common ancestor of pointerdown and pointerup targets'); }); test_pointerEvent.done(); } @@ -83,6 +86,27 @@ }); }); }); + + // Inject mouse inputs. + var green = document.getElementById('green'); + var blue = document.getElementById('blue'); + new test_driver.Actions() + .pointerMove(0, 0, {origin: green}) + .pointerDown() + .pointerUp() + .pointerMove(0, 0, {origin: blue}) + .pointerDown() + .pointerMove(0, 0, {origin: green}) + .pointerUp() + .pointerMove(0, 0, {origin: green}) + .pointerDown() + .pointerUp() + .pointerMove(0, 0, {origin: blue}) + .pointerDown() + .pointerMove(0, 0, {origin: green}) + .pointerUp() + .send(); + } </script> </head> diff --git a/tests/wpt/web-platform-tests/portals/portals-host-exposure.sub.html b/tests/wpt/web-platform-tests/portals/portals-host-exposure.sub.html new file mode 100644 index 00000000000..83e31bd4735 --- /dev/null +++ b/tests/wpt/web-platform-tests/portals/portals-host-exposure.sub.html @@ -0,0 +1,44 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<script> + let channelIndex = 0; + async function openPortalAndReceiveMessage(portalSrc) { + let channelName = `portals-host-exposure-${channelIndex++}` + let broadcastChannel = new BroadcastChannel(channelName); + try { + let received = new Promise((resolve, reject) => { + broadcastChannel.addEventListener('message', e => { + resolve(e.data); + }, {once: true}) + }); + let portal = document.createElement('portal'); + portal.src = `${portalSrc}?broadcastchannel=${channelName}`; + document.body.appendChild(portal); + return await received; + } finally { + broadcastChannel.close(); + } + } + + promise_test(async t => { + let {hasHost} = await openPortalAndReceiveMessage( + 'resources/portal-host.html'); + assert_true(hasHost, "window.portalHost should be defined"); + }, "window.portalHost should be exposed in same-origin portal"); + + promise_test(async t => { + let {hasHost} = await openPortalAndReceiveMessage( + 'http://{{hosts[alt][www]}}:{{ports[http][0]}}/portals/resources/portal-host-cross-origin.sub.html'); + assert_true(hasHost, "window.portalHost should be defined"); + }, "window.portalHost should be exposed in cross-origin portal"); + + promise_test(async t => { + let {hasHost} = await openPortalAndReceiveMessage( + 'resources/portal-host-cross-origin-navigate.sub.html'); + assert_true(hasHost, "window.portalHost should be defined"); + }, "window.portalHost should be exposed in portal after cross-origin navigation"); + +</script> +</body> diff --git a/tests/wpt/web-platform-tests/portals/resources/portal-forward-with-broadcast.sub.html b/tests/wpt/web-platform-tests/portals/resources/portal-forward-with-broadcast.sub.html new file mode 100644 index 00000000000..39bda69b0ee --- /dev/null +++ b/tests/wpt/web-platform-tests/portals/resources/portal-forward-with-broadcast.sub.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<body> + <script> + function forwardMessage(e) { + let broadcastChannel = new BroadcastChannel(new URL(location).searchParams.get('broadcastchannel')); + try { + broadcastChannel.postMessage(e.data); + } finally { + broadcastChannel.close(); + } + } + window.addEventListener("message", forwardMessage); + </script> +</body> diff --git a/tests/wpt/web-platform-tests/portals/resources/portal-host-cross-origin-navigate.sub.html b/tests/wpt/web-platform-tests/portals/resources/portal-host-cross-origin-navigate.sub.html new file mode 100644 index 00000000000..44c6c16c577 --- /dev/null +++ b/tests/wpt/web-platform-tests/portals/resources/portal-host-cross-origin-navigate.sub.html @@ -0,0 +1,7 @@ +<!DOCTYPE html> +<body> + <script> + let channelName = new URL(location).searchParams.get('broadcastchannel'); + window.location.href = `http://{{hosts[alt][www]}}:{{ports[http][0]}}/portals/resources/portal-host-cross-origin.sub.html?broadcastchannel=${channelName}`; + </script> +</body> diff --git a/tests/wpt/web-platform-tests/portals/resources/portal-host-cross-origin.sub.html b/tests/wpt/web-platform-tests/portals/resources/portal-host-cross-origin.sub.html new file mode 100644 index 00000000000..aa369d39f0b --- /dev/null +++ b/tests/wpt/web-platform-tests/portals/resources/portal-host-cross-origin.sub.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<body> + <script> + let message = { + hasHost: !!window.portalHost + }; + let forwardingIframe = document.createElement('iframe'); + let channelName = new URL(location).searchParams.get('broadcastchannel'); + forwardingIframe.src = `http://{{host}}:{{ports[http][0]}}/portals/resources/portal-forward-with-broadcast.sub.html?broadcastchannel=${channelName}`; + forwardingIframe.onload = () => { + forwardingIframe.contentWindow.postMessage(message, '*'); + } + document.body.appendChild(forwardingIframe); + </script> +</body> diff --git a/tests/wpt/web-platform-tests/portals/resources/portal-host.html b/tests/wpt/web-platform-tests/portals/resources/portal-host.html new file mode 100644 index 00000000000..5043a158ea7 --- /dev/null +++ b/tests/wpt/web-platform-tests/portals/resources/portal-host.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<body> + <script> + let message = { + hasHost: !!window.portalHost + }; + let broadcastChannel = new BroadcastChannel(new URL(location).searchParams.get('broadcastchannel')); + try { + broadcastChannel.postMessage(message); + } finally { + broadcastChannel.close(); + } + </script> +</body> diff --git a/tests/wpt/web-platform-tests/resource-timing/supported_resource_type.any.js b/tests/wpt/web-platform-tests/resource-timing/supported_resource_type.any.js index 6096ad71490..31e40096ddb 100644 --- a/tests/wpt/web-platform-tests/resource-timing/supported_resource_type.any.js +++ b/tests/wpt/web-platform-tests/resource-timing/supported_resource_type.any.js @@ -4,3 +4,21 @@ assert_true(PerformanceObserver.supportedEntryTypes.includes("resource"), "There should be an entry 'resource' in PerformanceObserver.supportedEntryTypes"); }, "supportedEntryTypes contains 'resource'."); + +if (typeof PerformanceObserver.supportedEntryTypes !== "undefined") { + const entryType = "resource"; + if (PerformanceObserver.supportedEntryTypes.includes(entryType)) { + promise_test(async() => { + await new Promise((resolve) => { + new PerformanceObserver(function (list, observer) { + observer.disconnect(); + resolve(); + }).observe({entryTypes: [entryType]}); + + // Force the PerformanceEntry. + // Use `self` for Workers. + fetch(self.location.href + "?" + Math.random()); + }) + }, `'${entryType}' entries should be observable.`) + } +} diff --git a/tests/wpt/web-platform-tests/service-workers/service-worker/resources/worker-interception-iframe.https.html b/tests/wpt/web-platform-tests/service-workers/service-worker/resources/worker-interception-iframe.https.html index ab10a078f3d..84204a3ee5d 100644 --- a/tests/wpt/web-platform-tests/service-workers/service-worker/resources/worker-interception-iframe.https.html +++ b/tests/wpt/web-platform-tests/service-workers/service-worker/resources/worker-interception-iframe.https.html @@ -1,4 +1,5 @@ <script src="/common/get-host-info.sub.js"></script> +<script src="/resources/testharness.js"></script> <script src="test-helpers.sub.js?pipe=sub"></script> <script> var host_info = get_host_info(); @@ -11,7 +12,7 @@ function boilerplate_test(url, msg) { worker.postMessage(msg); }) .then(function(data) { - window.parent.postMessage({results: data}, host_info['HTTPS_ORIGIN']); + assert_equals(data, "This load was successfully intercepted."); }); } diff --git a/tests/wpt/web-platform-tests/service-workers/service-worker/resources/worker-load-interceptor.js b/tests/wpt/web-platform-tests/service-workers/service-worker/resources/worker-load-interceptor.js index 695777a514f..a5f65c3216e 100644 --- a/tests/wpt/web-platform-tests/service-workers/service-worker/resources/worker-load-interceptor.js +++ b/tests/wpt/web-platform-tests/service-workers/service-worker/resources/worker-load-interceptor.js @@ -8,6 +8,8 @@ self.onfetch = function(event) { if (url.indexOf("synthesized-response.txt") != -1) { event.respondWith(new Response(response_text)); } else if (url.indexOf("synthesized-response.js") != -1) { - event.respondWith(new Response(response_script)); + event.respondWith(new Response( + response_script, + {headers: {'Content-Type': 'application/javascript'}})); } }; diff --git a/tests/wpt/web-platform-tests/service-workers/service-worker/worker-interception.https.html b/tests/wpt/web-platform-tests/service-workers/service-worker/worker-interception.https.html index f9ba656b517..7b2941263bf 100644 --- a/tests/wpt/web-platform-tests/service-workers/service-worker/worker-interception.https.html +++ b/tests/wpt/web-platform-tests/service-workers/service-worker/worker-interception.https.html @@ -106,12 +106,6 @@ promise_test(function(t) { var service_worker = 'resources/worker-load-interceptor.js'; var scope = 'resources/'; - window.addEventListener('message', t.step_func(on_message), false); - function on_message(e) { - assert_equals(e.data.results, "This load was successfully intercepted."); - t.done(); - } - return service_worker_unregister_and_register(t, service_worker, scope) .then(function(r) { t.add_cleanup(function() { diff --git a/tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicy-createXXX.tentative.html b/tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicy-createXXX.tentative.html index 6a0151ad9bc..475a2647904 100644 --- a/tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicy-createXXX.tentative.html +++ b/tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicy-createXXX.tentative.html @@ -36,7 +36,7 @@ assert_equals(el.title, INPUTS.URL); el.title = policy.createURL(INPUTS.HTML); - assert_equals(el.title, ""); + assert_equals(el.title, INPUTS.HTML); }, "Attributes without type constraints will work as before."); test(t => { @@ -71,14 +71,14 @@ const urlTestCases = [ [ s => s, INPUTS.SCRIPTURL ], - [ s => null, "" ], + [ s => null, "null" ], [ s => s + "#duck", INPUTS.SCRIPTURL + "#duck" ], [ s => { throw new Error() }, new Error() ], [ s => s + "#" + aGlobalVarForSideEffectTesting, INPUTS.SCRIPTURL + "#global" ], [ anotherGlobalFunction.bind(aGlobalObject), INPUTS.SCRIPTURL + "#well," ], [ s => anotherGlobalFunction(s), - INPUTS.SCRIPTURL + "#a%20global%20var%20named%20foo" ], + INPUTS.SCRIPTURL + "#a global var named foo" ], ]; function policyBuilder(trustedMethodName, trustedType, defaultArg) { diff --git a/tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html b/tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html index a162d84cd82..37e245ee27a 100644 --- a/tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html +++ b/tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html @@ -165,7 +165,7 @@ }, "script_url = identity function"); test(t => { - createScriptURLTest('TestPolicyScriptURL2', { createScriptURL: s => null }, "", t); + createScriptURLTest('TestPolicyScriptURL2', { createScriptURL: s => null }, "null", t); }, "script_url = null"); var scriptURLstr = '#duck'; @@ -240,7 +240,7 @@ }, "url = identity function"); test(t => { - createURLTest('TestPolicyURL2', { createURL: s => null }, "", t); + createURLTest('TestPolicyURL2', { createURL: s => null }, "null", t); }, "url = null"); var URLstr = '#x'; diff --git a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html index f9cbdc5a889..d77d9dab586 100644 --- a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html +++ b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html @@ -97,20 +97,14 @@ URLTestCases.forEach(c => { test(t => { assert_element_accepts_trusted_type(c[0], c[1], INPUTS.URL, RESULTS.URL); - - // Properties that actually parse the URLs will resort to the base URL - // when given a null or empty URL. - assert_element_accepts_trusted_type(c[0], c[1], null, "" + window.location); + assert_element_accepts_trusted_type(c[0], c[1], null, window.location.toString().replace(/[^\/]*$/, "null")); }, c[0] + "." + c[1] + " accepts string and null after default policy was created."); }); scriptURLTestCases.forEach(c => { test(t => { assert_element_accepts_trusted_type(c[0], c[1], INPUTS.SCRIPTURL, RESULTS.SCRIPTURL); - - // Properties that actually parse the URLs will resort to the base URL - // when given a null or empty URL. - assert_element_accepts_trusted_type(c[0], c[1], null, "" + window.location); + assert_element_accepts_trusted_type(c[0], c[1], null, window.location.toString().replace(/[^\/]*$/, "null")); }, c[0] + "." + c[1] + " accepts string and null after default policy was created."); }); diff --git a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html index fd89bb33c13..fe27d45d08a 100644 --- a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html +++ b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html @@ -74,14 +74,14 @@ URLTestCases.forEach(c => { test(t => { assert_element_accepts_trusted_type(c[0], c[1], INPUTS.URL, RESULTS.URL); - assert_element_accepts_trusted_type(c[0], c[1], null, "" + window.location); + assert_element_accepts_trusted_type(c[0], c[1], null, window.location.toString().replace(/[^\/]*$/, "null")); }, c[0] + "." + c[1] + " accepts string and null after default policy was created"); }); scriptURLTestCases.forEach(c => { test(t => { assert_element_accepts_trusted_type(c[0], c[1], INPUTS.SCRIPTURL, RESULTS.SCRIPTURL); - assert_element_accepts_trusted_type(c[0], c[1], null, "" + window.location); + assert_element_accepts_trusted_type(c[0], c[1], null, window.location.toString().replace(/[^\/]*$/, "null")); }, c[0] + "." + c[1] + " accepts string and null after default policy was created"); }); diff --git a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-Window-open.tentative.html b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-Window-open.tentative.html index fd30b6edfba..c66a16d5c00 100644 --- a/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-Window-open.tentative.html +++ b/tests/wpt/web-platform-tests/trusted-types/block-string-assignment-to-Window-open.tentative.html @@ -15,9 +15,9 @@ let p = createURL_policy(window, nb); let url = p.createURL(INPUTS.URL); let child_window = win.open(url, "", ""); + t.add_cleanup(_ => child_window.close()); child_window.onload = t.step_func_done(_ => { assert_equals(child_window.location.href, "" + url); - child_window.close(); }); } @@ -25,15 +25,14 @@ let p = createURL_policy(window, nb); assert_throws(new TypeError(), _ => { let child_window = win.open(url, "", ""); - child_window.close(); }); } function testWindowDoesntThrow(t, url, expected, win) { let child_window = win.open(url, "", ""); + t.add_cleanup(_ => child_window.close()); child_window.onload = t.step_func_done(_ => { assert_equals(child_window.location.href, expected); - child_window.close(); }); } diff --git a/tests/wpt/web-platform-tests/user-timing/supported-usertiming-types.any.js b/tests/wpt/web-platform-tests/user-timing/supported-usertiming-types.any.js index a373c562f94..ea3b2fe9dc9 100644 --- a/tests/wpt/web-platform-tests/user-timing/supported-usertiming-types.any.js +++ b/tests/wpt/web-platform-tests/user-timing/supported-usertiming-types.any.js @@ -9,3 +9,29 @@ test(() => { assert_greater_than(types.indexOf("measure"), types.indexOf('mark'), "The 'measure' entry should appear after the 'mark' entry"); }, "supportedEntryTypes contains 'mark' and 'measure'."); + +if (typeof PerformanceObserver.supportedEntryTypes !== "undefined") { + const entryTypes = { + "mark": () => { + performance.mark('foo'); + }, + "measure": () => { + performance.measure('bar'); + } + } + for (let entryType in entryTypes) { + if (PerformanceObserver.supportedEntryTypes.includes(entryType)) { + promise_test(async() => { + await new Promise((resolve) => { + new PerformanceObserver(function (list, observer) { + observer.disconnect(); + resolve(); + }).observe({entryTypes: [entryType]}); + + // Force the PerformanceEntry. + entryTypes[entryType](); + }) + }, `'${entryType}' entries should be observable.`) + } + } +} diff --git a/tests/wpt/web-platform-tests/webrtc/RTCTrackEvent-constructor.html b/tests/wpt/web-platform-tests/webrtc/RTCTrackEvent-constructor.html index 9579dd4d4f8..a0c031eaa5a 100644 --- a/tests/wpt/web-platform-tests/webrtc/RTCTrackEvent-constructor.html +++ b/tests/wpt/web-platform-tests/webrtc/RTCTrackEvent-constructor.html @@ -41,7 +41,7 @@ assert_equals(trackEvent.receiver, receiver); assert_equals(trackEvent.track, track); assert_array_equals(trackEvent.streams, []); - assert_equals(trackEvent.streams, trackEvent.streams); // [SameObject] + assert_equals(trackEvent.streams, trackEvent.streams, '[SameObject]'); assert_equals(trackEvent.transceiver, transceiver); assert_equals(trackEvent.type, 'track'); diff --git a/tests/wpt/web-platform-tests/workers/README.md b/tests/wpt/web-platform-tests/workers/README.md index 78cc74371b9..b78a05ebdbe 100644 --- a/tests/wpt/web-platform-tests/workers/README.md +++ b/tests/wpt/web-platform-tests/workers/README.md @@ -1,2 +1,137 @@ +# Worker WPT tests + These are the workers (`Worker`, `SharedWorker`) tests for the [Web workers chapter of the HTML Standard](https://html.spec.whatwg.org/multipage/workers.html). + +See also +[testharness.js API > Web Workers](https://web-platform-tests.org/writing-tests/testharness-api.html#web-workers). + +## Writing `*.any.js` + +The easiest and most recommended way to write tests for workers +is to create .any.js-style tests. + +Official doc: +[WPT > File Name Flags > Test Features](https://web-platform-tests.org/writing-tests/file-names.html#test-features). + +- Standard `testharness.js`-style can be used (and is enforced). +- The same test can be run on window and many types of workers. +- All glue code are automatically generated. +- No need to care about how to create and communicate with each type of workers, + thanks to `fetch_tests_from_worker` in `testharness.js`. + +Converting existing tests into `.any.js`-style also has benefits: + +- Multiple tests can be merged into one. +- Tests written for window can be run on workers + with a very low development cost. + +### How to write tests + +If you write `testharness.js`-based tests in `foo.any.js` and +specify types of workers to be tested, +the test can run on any of dedicated, shared and service workers. + +See `examples/general.any.js` for example. + +Even for testing specific features in a specific type of workers +(e.g. shared worker's `onconnect`), `.any.js`-style tests can be used. + +See `examples/onconnect.any.js` for example. + +### How to debug tests + +Whether each individual test passed or failed, +and its assertion failures (if any) are all reported in the final results. + +`console.log()` might not appear in the test results and +thus might not be useful for printf debugging. +For example, in Chromium, this message + +- Appears (in stderr) on a window or a dedicated worker, but +- Does NOT appear on a shared worker or a service worker. + +### How it works + +`.any.js`-style tests use +`fetch_tests_from_worker` functionality of `testharness.js`. + +The WPT test server generates necessary glue code +(including generated Document HTML and worker top-level scripts). +See +[serve.py](https://github.com/web-platform-tests/wpt/blob/master/tools/serve/serve.py) +for the actual glue code. + +Note that `.any.js` file is not the worker top-level script, +and currently we cannot set response headers to the worker top-level script, +e.g. to set Referrer Policy of the workers. + +## Writing `*.worker.js` + +Similar to `.any.js`, you can also write `.worker.js` +for tests only for dedicated workers. +Almost the same as `.any.js`, except for the things listed below. + +Official doc: +[WPT > File Name Flags > Test Features](https://web-platform-tests.org/writing-tests/file-names.html#test-features). + +### How to write tests + +You have to write two things manually (which is generated in `.any.js` tests): + +- `importScripts("/resources/testharness.js");` at the beginning. +- `done();` at the bottom. + +Note: Even if you write `async_test()` or `promise_test()`, +this global `done()` is always needed +(this is different from async_test's `done()`) +for dedicated workers and shared workers. +See official doc: +[testharness.js API > Determining when all tests are complete](https://web-platform-tests.org/writing-tests/testharness-api.html#determining-when-all-tests-are-complete). + +See `examples/general.worker.js` for example. + +### How it works + +`.worker.js`-style tests also use +`fetch_tests_from_worker` functionality of `testharness.js`. + +The WPT test server generates glue code in Document HTML-side, +but not for worker top-level scripts. +This is why you have to manually write `importScripts()` etc. +See +[serve.py](https://github.com/web-platform-tests/wpt/blob/master/tools/serve/serve.py) +for the actual glue code. + +Unlike `*.any.js` cases, the `*.worker.js` is the worker top-level script. + +## Using `fetch_tests_from_worker` + +If you need more flexibility, +writing tests using `fetch_tests_from_worker` is the way to go. +For example, when + +- Additional processing is needed on the parent Document. +- Workers should be created in a specific way. +- You are writing non-WPT tests using `testharness.js`. + +You have to write the main HTMLs and the worker scripts, +but most of the glue code needed for running tests on workers +are provided by `fetch_tests_from_worker`. + +### How to write tests + +See + +- `examples/fetch_tests_from_worker.html` and + `examples/fetch_tests_from_worker.js`. + +## Writing the whole tests manually + +If `fetch_tests_from_worker` isn't suitable for your specific case +(which should be rare but might be still possible), +you have to write the whole tests, +including the main Document HTML, worker scripts, +and message passing code between them. + +TODO: Supply the templates for writing this kind of tests. diff --git a/tests/wpt/web-platform-tests/workers/examples/fetch_tests_from_worker.html b/tests/wpt/web-platform-tests/workers/examples/fetch_tests_from_worker.html new file mode 100644 index 00000000000..5ac765c7eea --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/examples/fetch_tests_from_worker.html @@ -0,0 +1,21 @@ +<!doctype html> +<!-- + This file is an example of a hand-written test using + fetch_tests_from_worker(). + Unlike *.any.js or *.worker.js tests, fetch_tests_from_worker.html/js files + are manually written and no generated glue code are involved. +--> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +fetch_tests_from_worker(new Worker("fetch_tests_from_worker.js")); + +// If you want to test on SharedWorker, +// fetch_tests_from_worker(new SharedWorker("fetch_tests_from_worker.js")); + +// See ServiceWorkersHandler in +// https://github.com/web-platform-tests/wpt/blob/master/tools/serve/serve.py +// for the generated snippet used in .any.js for service workers. +// Note: when testing service workers, also add ".https." file flag in the +// main HTML's file name to run the test on HTTPS. +</script> diff --git a/tests/wpt/web-platform-tests/workers/examples/fetch_tests_from_worker.js b/tests/wpt/web-platform-tests/workers/examples/fetch_tests_from_worker.js new file mode 100644 index 00000000000..01ba12a622f --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/examples/fetch_tests_from_worker.js @@ -0,0 +1,28 @@ +// This file is an example of a hand-written test using +// fetch_tests_from_worker(). +// Unlike *.any.js or *.worker.js tests, fetch_tests_from_worker.html/js files +// are manually written and no generated glue code are involved. + +// fetch_tests_from_worker() requires testharness.js both on the parent +// document and on the worker. +importScripts("/resources/testharness.js"); + +// ============================================================================ + +// Test body. +test(() => { + assert_equals(1, 1, "1 == 1"); + }, + "Test that should pass" +); + +// ============================================================================ + +// `done()` is always needed at the bottom for dedicated workers and shared +// workers, even if you write `async_test()` or `promise_test()`. +// `async_test()` and `promise_test()` called before this `done()` +// will continue and assertions/failures after this `done()` are not ignored. +// See +// https://web-platform-tests.org/writing-tests/testharness-api.html#determining-when-all-tests-are-complete +// for details. +done(); diff --git a/tests/wpt/web-platform-tests/workers/examples/general.any.js b/tests/wpt/web-platform-tests/workers/examples/general.any.js new file mode 100644 index 00000000000..2aa82e3db90 --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/examples/general.any.js @@ -0,0 +1,34 @@ +// META: global=!default,worker + +// See +// https://web-platform-tests.org/writing-tests/testharness.html#multi-global-tests +// for how to specify in which global scopes to run this tests, +// how to specify additional scripts needed, etc. + +// testharness.js is imported (via importScripts()) by generated glue code by +// WPT server. +// See AnyWorkerHandler in +// https://github.com/web-platform-tests/wpt/blob/master/tools/serve/serve.py. + +// ============================================================================ + +// Test body. +// .any.js tests are always testharness.js-based. +test(() => { + assert_equals(1, 1, "1 == 1"); + }, + "Test that should pass" +); + +test(() => { + // This file is "general.any.js" but the worker top-level script is + // "general.any.worker.js", which is generated by the WPT server. + assert_equals(location.pathname, "/workers/examples/general.any.worker.js"); + }, + "Worker top-level script is a generated script." +); + +// done() is NOT needed in .any.js tests, as it is called by generated +// glue code by the WPT server. +// See AnyWorkerHandler in +// https://github.com/web-platform-tests/wpt/blob/master/tools/serve/serve.py. diff --git a/tests/wpt/web-platform-tests/workers/examples/general.worker.js b/tests/wpt/web-platform-tests/workers/examples/general.worker.js new file mode 100644 index 00000000000..aeca236781b --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/examples/general.worker.js @@ -0,0 +1,35 @@ +// This file is an example of a test using *.worker.js mechanism. +// The parent document that calls fetch_tests_from_worker() is auto-generated +// but there are no generated code in the worker side. + +// fetch_tests_from_worker() requires testharness.js both on the parent +// document and on the worker. +importScripts("/resources/testharness.js"); + +// ============================================================================ + +// Test body. +test(() => { + assert_equals(1, 1, "1 == 1"); + }, + "Test that should pass" +); + +test(() => { + // This file is "general.worker.js" and this file itself is the worker + // top-level script (which is different from the .any.js case). + assert_equals(location.pathname, "/workers/examples/general.worker.js"); + }, + "Worker top-level script is the .worker.js file itself." +); + +// ============================================================================ + +// `done()` is always needed at the bottom for dedicated workers and shared +// workers, even if you write `async_test()` or `promise_test()`. +// `async_test()` and `promise_test()` called before this `done()` +// will continue and assertions/failures after this `done()` are not ignored. +// See +// https://web-platform-tests.org/writing-tests/testharness-api.html#determining-when-all-tests-are-complete +// for details. +done(); diff --git a/tests/wpt/web-platform-tests/workers/examples/onconnect.any.js b/tests/wpt/web-platform-tests/workers/examples/onconnect.any.js new file mode 100644 index 00000000000..85546f2d11d --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/examples/onconnect.any.js @@ -0,0 +1,4 @@ +// META: global=!default,sharedworker +const t = async_test("onconnect is called"); +onconnect = t.step_func_done((event) => { +}); |