diff options
121 files changed, 1074 insertions, 658 deletions
diff --git a/tests/wpt/metadata/FileAPI/url/url-in-tags-revoke.window.js.ini b/tests/wpt/metadata/FileAPI/url/url-in-tags-revoke.window.js.ini index faa00f45ecf..d4f62ed7113 100644 --- a/tests/wpt/metadata/FileAPI/url/url-in-tags-revoke.window.js.ini +++ b/tests/wpt/metadata/FileAPI/url/url-in-tags-revoke.window.js.ini @@ -7,7 +7,7 @@ expected: FAIL [Opening a blob URL in a new window immediately before revoking it works.] - expected: TIMEOUT + expected: FAIL [Opening a blob URL in a noopener about:blank window immediately before revoking it works.] expected: TIMEOUT diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 7bd994ff6e9..ded5eff2b11 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -52880,6 +52880,19 @@ {} ] ], + "float-paint-relayout.html": [ + "0499e3e9a260b069adec05f1abc66feccc178bcc", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], "floated-table-wider-than-specified.html": [ "f93d50e43dd3eb49d5c8964200b7fe4ebb5bd6c8", [ @@ -146204,6 +146217,19 @@ {} ] ], + "change-list-descendant-display.html": [ + "18296f8862887eb1b666eb20f1ced0dd4cc78392", + [ + null, + [ + [ + "/css/css-lists/change-list-descendant-display-ref.html", + "==" + ] + ], + {} + ] + ], "change-list-style-position-001.html": [ "5f56ee76ff70d12738ef6cef2a6f713141c82dec", [ @@ -155102,6 +155128,19 @@ {} ] ], + "position-sticky-scroll-reposition.html": [ + "b75275c64fe3b8b1130abade63ea69c575085b80", + [ + null, + [ + [ + "/css/css-position/position-sticky-scroll-reposition-ref.html", + "==" + ] + ], + {} + ] + ], "position-sticky-scroll-with-clip-and-abspos.html": [ "46085b49b4c405bdc1d0a05eafda3faca8ecf74a", [ @@ -185186,6 +185225,19 @@ {} ] ], + "outline-023.html": [ + "ba623d997349aeb5743ad83006257ddcb4a29070", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square-only.html", + "==" + ] + ], + {} + ] + ], "outline-color-001.html": [ "4245b2ceb7393a73850a223e498987e0e1bc4aa3", [ @@ -236017,84 +236069,10 @@ [] ] }, - "origin-policy": { - "policy-content-security-comma-in-policy": [ - "42990f93e6d2722d9895e69e66679994f5e8fc36", - [] - ], - "policy-content-security-double-content-security": [ - "be9b3750647d12117d966bbea534db7c41792451", - [] - ], - "policy-content-security-double-policies": [ - "2e625c5c46389b77fbe7ec418dff010e6cd0ed5f", - [] - ], - "policy-content-security-noimg": [ - "cd57b7b21e916b42c2dc74b70d1a4834ff8ee04f", - [] - ], - "policy-content-security-noimg-report-only": [ - "13c662ef2d6e1c754c869ad63cea5a439fde8010", - [] - ], - "policy-content-security-non-array": [ - "b96546c5f88fe77a219822f35ec7c516e3396fec", - [] - ], - "policy-content-security-non-object": [ - "7f6e1383640125115b135ac87bfe0f414628f6ac", - [] - ], - "policy-content-security-non-string": [ - "8649b17c4d8e73e03d3f1231e572a9b34713703e", - [] - ], - "policy-content-security-valid": [ - "d4babb7949eefdf8c7867d5aea268977791c447f", - [] - ], - "policy-content-security-valid-with-multi-item-array": [ - "45ec32200d5f6e3340866d2dc3dff6031aba5a47", - [] - ], - "policy-content-security-valid-with-semicolon": [ - "e777d5c96d5921d4b13b49a223059755f9697881", - [] - ], - "policy-csp-1": [ - "d4babb7949eefdf8c7867d5aea268977791c447f", - [] - ], - "policy-csp-2": [ - "34a6c5c873b5775edaaac2bbb70029d76dc20074", - [] - ], - "policy-features-comma-in-policy": [ - "e991c788f24a160907029a12c747cd70328876d8", - [] - ], - "policy-features-double-features": [ - "583f1eaa2fcda8773d71c94118a4e315844a64d1", - [] - ], - "policy-features-double-policy": [ - "fb216bc47298384a0261ef27b78d412ffc0e383b", - [] - ], - "policy-features-non-object": [ - "b4d255440dc4b30da15dc1e0521f0f64f54570c4", - [] - ], - "policy-features-non-string": [ - "8b758c7f617790b989c62374f850769b259b1e48", - [] - ], - "policy-features-valid": [ - "22ef8992cf7b5e3712fa760d9157c2d464830ef0", - [] - ] - } + "origin-policy": [ + "df2b83256c2265fdcf1e48b6f1b06c852412cb23", + [] + ] }, "2dcontext": { "2x2.png": [ @@ -291568,6 +291546,10 @@ "f7d113d37804f0af90c6496f9e1dcf290860cf3d", [] ], + "change-list-descendant-display-ref.html": [ + "1a69ab6ea5404fe127cc8253ea5778ae0a3b3cca", + [] + ], "change-list-style-position-001-ref.html": [ "e87702a67b81f9863937d91fba56c0642c06ca6d", [] @@ -293594,6 +293576,10 @@ "a052eae56247143d82ce72a044884ab744ed46a8", [] ], + "position-sticky-scroll-reposition-ref.html": [ + "487a2322fc5aad723458a90e40922331b83bb299", + [] + ], "position-sticky-scroll-with-clip-and-abspos-ref.html": [ "a36934e38079cfc8fd6e9d36524968675235983e", [] @@ -328616,101 +328602,109 @@ }, "origin-policy": { "content-security": { - "comma-in-policy.https.html.headers": [ - "32e453ab20de0c3241e602cdf0af50769f741744", - [] - ], - "double-content-security.https.html.headers": [ - "a380b053c270c6159ff62497179c5a346b703047", + "resources": { + "allow-unsafe-eval-disallow-images.mjs": [ + "8715e74e5df81959e358fb94802b77965a494e8a", + [] + ], + "allow-unsafe-eval.mjs": [ + "bd6ca6f8bbd1e99dd339107a8817cdb337e6f8c4", + [] + ], + "disallow-unsafe-eval-disallow-images.mjs": [ + "41b25553d56338aea764e48b3eb7eae21bc7464f", + [] + ], + "helper.mjs": [ + "5eff7e16ba04a73464215c62a49409560af32c38", + [] + ], + "trigger-violation-report-report-only.mjs": [ + "9766717e309b5f04187b4e24d5ec7cc6e0fe7ebe", + [] + ], + "trigger-violation-report.mjs": [ + "319c87b0f8a6723ffcdf0cad9308915f6d6eb10c", + [] + ] + } + }, + "features": { + "resources": { + "helper.mjs": [ + "7ced355e645c7bafd96aa55ef175cb995311aff9", + [] + ], + "no-camera-no-geolocation.mjs": [ + "b25d9abcb92ec99fa44b46a12587eb49d84d6a64", + [] + ], + "no-camera-yes-geolocation.mjs": [ + "a961deeb38989b3d19a37033b5fb654979fac03e", + [] + ], + "yes-camera-yes-geolocation.mjs": [ + "9f3b1d8303fe63a86ac9215a563816a54baf4448", + [] + ] + } + }, + "policies": { + "README.md": [ + "b07be74035f2dee0f379f0a8c499cd392f81f96a", [] ], - "double-policies.https.html.headers": [ - "23f1d1434057d27edf57fe4108cc7399b01915ff", + "op1 cspfp-comma-in-policy.json": [ + "189d28db8ba80d672799d9402d95f21a87a1e8c7", [] ], - "helper.js": [ - "4875977afa4437abf6523426eedf99ee19a62e35", + "op10 cspfp-valid.json": [ + "0fc1d163f2b61951813eae9ca84f2d4fe7f59703", [] ], - "non-array.https.html.headers": [ - "31e6f375ef967e2173a0ab49063d22001612449a", + "op2 cspfp-double-top-level.json": [ + "26d798b585d96fd29994dc39544a15bd2f6a639d", [] ], - "non-object.https.html.headers": [ - "812ea9445eca18decb01d648fa916203ffea7f0d", + "op3 cspfp-double-second-level.json": [ + "6665332807bea371939ebbaefef35ea3d412509d", [] ], - "non-string.https.html.headers": [ - "0b9ce2ee3f84c520fcba14d1267d93f7be48ce41", + "op4 csp-non-array.json": [ + "5916b1ff9b572dd4564916dd9ae50ab8cba3eb69", [] ], - "trigger-violation-report-report-only.https.html.headers": [ - "cb27e1500e0b4e484bc83d02ec3f6cc85aab43e1", + "op5 cspfp-non-object.json": [ + "7488f9bfef297e069d10845c2048f1ea261850da", [] ], - "trigger-violation-report.https.html.headers": [ - "08bcb9fa94171eeaf7df9b8c33487968f105e323", + "op6 cspfp-non-string.json": [ + "5c6941bf8fd18928e6c1d4cea381f625f9923ee5", [] ], - "valid-with-multi-item-array.https.html.headers": [ - "eeddaba7a59b580a7d94599c805fab7ef1297b29", + "op7 csp-noimg-report-only.json": [ + "fd5c522042a7e06b9947e64594d797a2ddf67483", [] ], - "valid-with-semicolon.https.html.headers": [ - "eeddaba7a59b580a7d94599c805fab7ef1297b29", + "op8 csp-noimg.json": [ + "b88e1f80bf93c9b64007b5991c82b97a8ea2b2cd", [] ], - "valid.https.html.headers": [ - "78aeeacd934c90fabddd5ddd7b3a1f6a4e5dd9a3", + "op9 csp-valid-with-multi-item-array.json": [ + "edd743038db8d48a8f23ae903c8170205119dc2c", [] ] }, - "features": { - "comma-in-policy.https.html.headers": [ - "c0e68720516a6665ade1b59539f3ff985790ff58", - [] - ], - "double-features.https.html.headers": [ - "f0a57380a8f570d96a0f9070f55a25641167030f", - [] - ], - "double-policy.https.html.headers": [ - "c1421693e4dafffa69184991110810101f84687c", - [] - ], - "helper.js": [ - "f9c16b58c2cf8bf85e5efb630ca7379ff14d36d3", - [] - ], - "non-object.https.html.headers": [ - "e8f68712ed341e947fb8a85ca8aa0aee40839095", - [] - ], - "non-string.https.html.headers": [ - "4c6c376697b855ca61dc96b8f689675c11cbf769", + "resources": { + "origin-policy-test-runner.js": [ + "a1c6453debd20d7abc3923a273a0c1890dcab7a6", [] ], - "valid.https.html.headers": [ - "9d0e25792c46d4039462ed50070bbed4c5c35269", + "subframe-with-origin-policy.py": [ + "636a649a0e20bebe36ccd013b72b8e1f315d674e", [] ] - }, - "origin-policy-report-to.https.tentative.sub.html.sub.headers": [ - "92a90c347d3a7d009bb3a71c586ef598f3770d47", - [] - ], - "sec-origin-policy-header.html.py": [ - "7754e04a313c12957304a3bd3c1a0657eba15151", - [] - ], - "sec-origin-policy-subframe.html": [ - "d716ba11d97ce613b71b9e374ddfd23b35996e25", - [] - ], - "sec-origin-policy-subframe.html.sub.headers": [ - "a046f0096ba1b3005c353f262e6e8619f7e5aa5b", - [] - ] + } }, "page-visibility": { "META.yml": [ @@ -328793,6 +328787,10 @@ "ac3307b619ccfb464a5fa44820cea39befdd8f2e", [] ], + "app-respond-with-minimal-ui.js": [ + "0e6b1b78b9197d8d1582c8eb70bbcc15ba3861c4", + [] + ], "app-supports-shipping-contact-delegation.js": [ "770e2de64f13eeef8a1ee21783c2997facc8ff0b", [] @@ -354578,6 +354576,10 @@ "1f14334290a3ce8b707cff3b9a01caca952b9863", [] ], + "post-message-on-load-worker.js": [ + "e1c547ab6a4d577280442dbfcbec5a5ec9296666", + [] + ], "sandboxed-tests.html": [ "811c925f56f11934cf3cb9ec508b73d601525c27", [] @@ -403576,8 +403578,22 @@ {} ] ], + "CSSStyleSheet-constructable-disabled-regular-sheet-insertion.html": [ + "ef4ea1480658af9aee9ef3464650893481d8ed46", + [ + null, + {} + ] + ], + "CSSStyleSheet-constructable-duplicate.html": [ + "30a3ed1d09bbbd779d7b56df91908de948b6bc4b", + [ + null, + {} + ] + ], "CSSStyleSheet-constructable.html": [ - "539075b47efc8599c3d9147f2e4b417783fb1df5", + "c7e215381048eddedcf3c33166790815fc685aea", [ null, {} @@ -470334,77 +470350,70 @@ "origin-policy": { "content-security": { "comma-in-policy.https.html": [ - "88d72446392e6751253d658edee7b79475af1fc3", + "07d10811f0bf853503052458ab76e0049969bdd4", [ null, {} ] ], "double-content-security.https.html": [ - "99046803c9fe305489a0aba915fc0d2f2aa40eb2", + "357bd7669a66865ababa1434f9f2dc5319cdb3d0", [ null, {} ] ], "double-policies.https.html": [ - "925b9d5a31e10ff865cf6125f677933211627251", + "327670fcad0b3aeecd6206f338ae661db62b2b8c", [ null, {} ] ], "non-array.https.html": [ - "78a67e16eb9d3058371e4d0dc0b389b007f4ef10", + "c95b5a15b0e6414c90adeda7923d4c06372b76cf", [ null, {} ] ], "non-object.https.html": [ - "359c6c7692294ebb1bfe0104b3a79c2e924af075", + "220136c4d050bea76853b8590ae7f01c11b4d25a", [ null, {} ] ], "non-string.https.html": [ - "8af3c1c4dff13699d37175590231d40d7bf61e4e", + "57c29fe265bebe22f133b3dbd2f3f3e03771cf7a", [ null, {} ] ], "trigger-violation-report-report-only.https.html": [ - "3e5038b501dec9e5fd028018fa832a5144c81b34", + "9eb83792852eb563e0da242465928341c915b7b5", [ null, {} ] ], "trigger-violation-report.https.html": [ - "22beca5a3dbbc9251bbde3580a0a9997488c463b", + "f981b2b05cef7e5ff16e2e8530e5c5a4e6d654f8", [ null, {} ] ], "valid-with-multi-item-array.https.html": [ - "bc9ebd0cccfcbd7d2fa28dfd7bea914de449c725", + "36333a1e4b19943fb25032aeb2d9c98925bcf456", [ null, {} ] ], "valid-with-semicolon.https.html": [ - "82158f1cf7044f8dcf3eeb652e521494a801c667", - [ - null, - {} - ] - ], - "valid.https.html": [ - "36e5ddbf958b317ef703b1309d037b21a2186596", + "9eadc8f89d31ab8f652ce2ebadae8bc96c130f63", [ null, {} @@ -470413,62 +470422,48 @@ }, "features": { "comma-in-policy.https.html": [ - "1b991f0d8b68af01681d9b77a9b21506ffe3fd58", + "a9faba4bfd4dd0cf5104a639302fb67e4a0f280b", [ null, {} ] ], "double-features.https.html": [ - "8397f849f30148021f70883d4418591f72d647dc", + "aa687d681c66d628e4140abe571021b7f16eb876", [ null, {} ] ], "double-policy.https.html": [ - "f1d63d6de966b36c0b410a5b62b803b9d7b40885", + "d9e544acaaf6a4e1a5c6e8987ed2d72ed777cb4e", [ null, {} ] ], "non-object.https.html": [ - "31f632bf0f1fed54666de913dd6a1c9a333e5388", + "2bd4b67e600c9bbb655461f161e1ad6da6619663", [ null, {} ] ], "non-string.https.html": [ - "019014c980a4a3a0565e10288b053c0da86e9f91", + "190d224a4cfe05bb1a4ea57b104f7d31d862fdcc", [ null, {} ] ], - "valid.https.html": [ - "6ff2076a7f076e78c73de5a019a52530a033f034", + "valid-with-semicolon.https.html": [ + "8d2d0f4495ff7f401991accc044f21fef115ad75", [ null, {} ] ] - }, - "origin-policy-report-to.https.tentative.sub.html": [ - "dfef7a1d133c267b8a27e5acb6c4ac89cfbc8ee7", - [ - null, - {} - ] - ], - "origin-policy.https.tentative.html": [ - "34a71fe40a192418a3f9a5792d7ee5fdecf970dd", - [ - null, - {} - ] - ] + } }, "page-visibility": { "idlharness.window.js": [ @@ -470825,6 +470820,13 @@ {} ] ], + "respond-with-minimal-ui.https.html": [ + "2474185a5ed719115b8afb39eac78584cecbb285", + [ + null, + {} + ] + ], "same-object-attributes.https.html": [ "b9a9dd82d247a80b00e4bc033eeea134d5f900c1", [ @@ -559993,6 +559995,24 @@ {} ] ], + "dedicated-worker-in-data-url-context.window.js": [ + "1b1ce232a739313d80ef5641aa799c978e53abea", + [ + "workers/dedicated-worker-in-data-url-context.window.html", + { + "script_metadata": [ + [ + "title", + "data URL dedicated worker in data URL context" + ], + [ + "script", + "/service-workers/service-worker/resources/test-helpers.sub.js" + ] + ] + } + ] + ], "examples": { "fetch_tests_from_worker.html": [ "5ac765c7eeae8c03678ca98c2f0d89fd826cf45e", @@ -561182,6 +561202,24 @@ {} ] ], + "shared-worker-in-data-url-context.window.js": [ + "f0cc98b75cbfd0d1bc084e445c47f3f6c7dd219c", + [ + "workers/shared-worker-in-data-url-context.window.html", + { + "script_metadata": [ + [ + "title", + "data URL shared worker in data URL context" + ], + [ + "script", + "/service-workers/service-worker/resources/test-helpers.sub.js" + ] + ] + } + ] + ], "shared-worker-name-via-options.html": [ "1914d66db7489f6306c4365a4d7b7b9fb59fe00e", [ diff --git a/tests/wpt/metadata/css/CSS2/floats/hit-test-floats-003.html.ini b/tests/wpt/metadata/css/CSS2/floats/hit-test-floats-003.html.ini deleted file mode 100644 index f29da48a2a0..00000000000 --- a/tests/wpt/metadata/css/CSS2/floats/hit-test-floats-003.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[hit-test-floats-003.html] - [Miss float below something else] - expected: FAIL - diff --git a/tests/wpt/metadata/css/CSS2/floats/hit-test-floats-004.html.ini b/tests/wpt/metadata/css/CSS2/floats/hit-test-floats-004.html.ini deleted file mode 100644 index 4bfb0c2053a..00000000000 --- a/tests/wpt/metadata/css/CSS2/floats/hit-test-floats-004.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[hit-test-floats-004.html] - [Miss float below something else] - expected: FAIL - diff --git a/tests/wpt/metadata/css/css-transitions/no-transition-from-ua-to-blocking-stylesheet.html.ini b/tests/wpt/metadata/css/css-transitions/no-transition-from-ua-to-blocking-stylesheet.html.ini index 70a00a101f6..e35a452a186 100644 --- a/tests/wpt/metadata/css/css-transitions/no-transition-from-ua-to-blocking-stylesheet.html.ini +++ b/tests/wpt/metadata/css/css-transitions/no-transition-from-ua-to-blocking-stylesheet.html.ini @@ -1,2 +1,2 @@ [no-transition-from-ua-to-blocking-stylesheet.html] - expected: FAIL + expected: TIMEOUT diff --git a/tests/wpt/metadata/css/cssom-view/MediaQueryList-addListener-removeListener.html.ini b/tests/wpt/metadata/css/cssom-view/MediaQueryList-addListener-removeListener.html.ini index 628b1fab770..c884dc82eab 100644 --- a/tests/wpt/metadata/css/cssom-view/MediaQueryList-addListener-removeListener.html.ini +++ b/tests/wpt/metadata/css/cssom-view/MediaQueryList-addListener-removeListener.html.ini @@ -2,3 +2,6 @@ [listeners are called when <iframe> is resized] expected: FAIL + [listeners are called correct number of times] + expected: FAIL + diff --git a/tests/wpt/metadata/css/cssom-view/elementFromPoint-001.html.ini b/tests/wpt/metadata/css/cssom-view/elementFromPoint-001.html.ini deleted file mode 100644 index e38782d8c85..00000000000 --- a/tests/wpt/metadata/css/cssom-view/elementFromPoint-001.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[elementFromPoint-001.html] - [CSSOM View - 5 - extensions to the Document interface] - expected: FAIL - diff --git a/tests/wpt/metadata/css/cssom-view/elementFromPosition.html.ini b/tests/wpt/metadata/css/cssom-view/elementFromPosition.html.ini index 5733d536fd3..85e94926cb3 100644 --- a/tests/wpt/metadata/css/cssom-view/elementFromPosition.html.ini +++ b/tests/wpt/metadata/css/cssom-view/elementFromPosition.html.ini @@ -21,6 +21,3 @@ [test the top of layer] expected: FAIL - [test some point of the element: top left corner] - expected: FAIL - diff --git a/tests/wpt/metadata/css/cssom-view/elementsFromPoint-iframes.html.ini b/tests/wpt/metadata/css/cssom-view/elementsFromPoint-iframes.html.ini index 6ef8bb1049f..171592fc08f 100644 --- a/tests/wpt/metadata/css/cssom-view/elementsFromPoint-iframes.html.ini +++ b/tests/wpt/metadata/css/cssom-view/elementsFromPoint-iframes.html.ini @@ -2,6 +2,3 @@ [elementsFromPoint on the root document for points in iframe elements] expected: FAIL - [elementsFromPoint on inner documents] - expected: FAIL - diff --git a/tests/wpt/metadata/css/cssom-view/elementsFromPoint-invalid-cases.html.ini b/tests/wpt/metadata/css/cssom-view/elementsFromPoint-invalid-cases.html.ini deleted file mode 100644 index e181af5397f..00000000000 --- a/tests/wpt/metadata/css/cssom-view/elementsFromPoint-invalid-cases.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[elementsFromPoint-invalid-cases.html] - [The root element is the last element returned for otherwise empty queries within the viewport] - expected: FAIL - diff --git a/tests/wpt/metadata/css/cssom/CSSStyleSheet-constructable-disabled-regular-sheet-insertion.html.ini b/tests/wpt/metadata/css/cssom/CSSStyleSheet-constructable-disabled-regular-sheet-insertion.html.ini new file mode 100644 index 00000000000..d9dd9972f10 --- /dev/null +++ b/tests/wpt/metadata/css/cssom/CSSStyleSheet-constructable-disabled-regular-sheet-insertion.html.ini @@ -0,0 +1,4 @@ +[CSSStyleSheet-constructable-disabled-regular-sheet-insertion.html] + [Shouldn't crash / assert when inserting a stylesheet after there are disabled constructable sheets] + expected: FAIL + diff --git a/tests/wpt/metadata/css/cssom/CSSStyleSheet-constructable-duplicate.html.ini b/tests/wpt/metadata/css/cssom/CSSStyleSheet-constructable-duplicate.html.ini new file mode 100644 index 00000000000..02e7376e855 --- /dev/null +++ b/tests/wpt/metadata/css/cssom/CSSStyleSheet-constructable-duplicate.html.ini @@ -0,0 +1,4 @@ +[CSSStyleSheet-constructable-duplicate.html] + [Cascade order of a stylesheet for duplicate sheets.] + expected: FAIL + diff --git a/tests/wpt/metadata/custom-elements/reactions/HTMLMediaElement.html.ini b/tests/wpt/metadata/custom-elements/reactions/HTMLMediaElement.html.ini new file mode 100644 index 00000000000..2ca05f57bb0 --- /dev/null +++ b/tests/wpt/metadata/custom-elements/reactions/HTMLMediaElement.html.ini @@ -0,0 +1,2 @@ +[HTMLMediaElement.html] + expected: TIMEOUT diff --git a/tests/wpt/metadata/fetch/content-type/response.window.js.ini b/tests/wpt/metadata/fetch/content-type/response.window.js.ini index fe7dcc1ce77..d5c2bfe8a7e 100644 --- a/tests/wpt/metadata/fetch/content-type/response.window.js.ini +++ b/tests/wpt/metadata/fetch/content-type/response.window.js.ini @@ -315,21 +315,21 @@ [<iframe>: separate response Content-Type: text/html;" text/plain] expected: FAIL - [<iframe>: separate response Content-Type: text/plain */*;charset=gbk] + [<iframe>: combined response Content-Type: text/html */*;charset=gbk] expected: FAIL - [<iframe>: separate response Content-Type: text/html */*] + [<iframe>: combined response Content-Type: */* text/html] expected: FAIL - [<iframe>: separate response Content-Type: text/plain */*] + [<iframe>: combined response Content-Type: text/html;charset=gbk text/plain text/html] expected: FAIL - [<iframe>: combined response Content-Type: text/html */*;charset=gbk] + [<iframe>: combined response Content-Type: text/html */*] expected: FAIL - [<iframe>: combined response Content-Type: text/html;" \\" text/plain] + [<iframe>: separate response Content-Type: text/html;x=" text/plain] expected: FAIL - [<iframe>: separate response Content-Type: text/html;" \\" text/plain] + [<iframe>: combined response Content-Type: text/html;x=" text/plain] expected: FAIL diff --git a/tests/wpt/metadata/fetch/content-type/script.window.js.ini b/tests/wpt/metadata/fetch/content-type/script.window.js.ini index d2df9b78483..5c001592859 100644 --- a/tests/wpt/metadata/fetch/content-type/script.window.js.ini +++ b/tests/wpt/metadata/fetch/content-type/script.window.js.ini @@ -56,3 +56,6 @@ [separate text/javascript x/x] expected: FAIL + [separate text/javascript;charset=windows-1252 error text/javascript] + 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 30e1b851fd4..61682d248e2 100644 --- a/tests/wpt/metadata/fetch/nosniff/parsing-nosniff.window.js.ini +++ b/tests/wpt/metadata/fetch/nosniff/parsing-nosniff.window.js.ini @@ -11,3 +11,6 @@ [X-Content-Type-Options%3A%20nosniff%2C%2C%40%23%24%23%25%25%26%5E%26%5E*()()11!] expected: FAIL + [X-Content-Type-Options%3A%20%40%23%24%23%25%25%26%5E%26%5E*()()11!%2Cnosniff] + expected: FAIL + diff --git a/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_2.html.ini b/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_2.html.ini new file mode 100644 index 00000000000..75d75b4cda2 --- /dev/null +++ b/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_2.html.ini @@ -0,0 +1,4 @@ +[traverse_the_history_2.html] + [Multiple history traversals, last would be aborted] + 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_5.html.ini new file mode 100644 index 00000000000..dc2e45516de --- /dev/null +++ b/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_5.html.ini @@ -0,0 +1,4 @@ +[traverse_the_history_5.html] + [Multiple history traversals, last would be aborted] + expected: FAIL + diff --git a/tests/wpt/metadata/html/interaction/focus/the-autofocus-attribute/supported-elements.html.ini b/tests/wpt/metadata/html/interaction/focus/the-autofocus-attribute/supported-elements.html.ini index f1aa94c7ced..8b743f36e1d 100644 --- a/tests/wpt/metadata/html/interaction/focus/the-autofocus-attribute/supported-elements.html.ini +++ b/tests/wpt/metadata/html/interaction/focus/the-autofocus-attribute/supported-elements.html.ini @@ -4,7 +4,7 @@ expected: FAIL [Element with tabindex should support autofocus] - expected: FAIL + expected: TIMEOUT [Host element with delegatesFocus including no focusable descendants should be skipped] expected: NOTRUN @@ -16,5 +16,5 @@ expected: NOTRUN [Non-HTMLElement should not support autofocus] - expected: TIMEOUT + expected: NOTRUN diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels.html.ini index 61bbf310609..7eadac021e8 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels.html.ini @@ -17,3 +17,6 @@ [X Rendered audio for channel 5 does not equal [0,0.0626220703125,0.125030517578125,0.18695068359375,0.24810791015625,0.308319091796875,0.3673095703125,0.42486572265625,0.480743408203125,0.53472900390625,0.58660888671875,0.636199951171875,0.68328857421875,0.727691650390625,0.76922607421875,0.8077392578125...\] with an element-wise tolerance of {"absoluteThreshold":0.000030517578125,"relativeThreshold":0}.\n\tIndex\tActual\t\t\tExpected\t\tAbsError\t\tRelError\t\tTest threshold\n\t[1\]\t3.6732959747314453e-1\t6.2622070312500000e-2\t3.0470752716064453e-1\t4.8658168859649127e+0\t3.0517578125000000e-5\n\t[2\]\t6.8329977989196777e-1\t1.2503051757812500e-1\t5.5826926231384277e-1\t4.4650639949963384e+0\t3.0517578125000000e-5\n\t[3\]\t9.0373212099075317e-1\t1.8695068359375000e-1\t7.1678143739700317e-1\t3.8340669508039502e+0\t3.0517578125000000e-5\n\t[4\]\t9.9780619144439697e-1\t2.4810791015625000e-1\t7.4969828128814697e-1\t3.0216621502152523e+0\t3.0517578125000000e-5\n\t[5\]\t9.5236867666244507e-1\t3.0831909179687500e-1\t6.4404958486557007e-1\t2.0889059484187866e+0\t3.0517578125000000e-5\n\t...and 42286 more errors.\n\tMax AbsError of 1.9962286949157715e+0 at index of 12332.\n\t[12332\]\t9.9879217147827148e-1\t-9.9743652343750000e-1\t1.9962286949157715e+0\t2.0013591321441684e+0\t3.0517578125000000e-5\n\tMax RelError of Infinity at index of 10584.\n\t[10584\]\t-5.8778524398803711e-1\t0.0000000000000000e+0\t5.8778524398803711e-1\tInfinity\t3.0517578125000000e-5\n] expected: FAIL + [X Rendered audio for channel 5 does not equal [0,0.0626220703125,0.125030517578125,0.18695068359375,0.24810791015625,0.308319091796875,0.3673095703125,0.42486572265625,0.480743408203125,0.53472900390625,0.58660888671875,0.636199951171875,0.68328857421875,0.727691650390625,0.76922607421875,0.8077392578125...\] with an element-wise tolerance of {"absoluteThreshold":0.000030517578125,"relativeThreshold":0}.\n\tIndex\tActual\t\t\tExpected\t\tAbsError\t\tRelError\t\tTest threshold\n\t[1\]\t3.6732959747314453e-1\t6.2622070312500000e-2\t3.0470752716064453e-1\t4.8658168859649127e+0\t3.0517578125000000e-5\n\t[2\]\t6.8329977989196777e-1\t1.2503051757812500e-1\t5.5826926231384277e-1\t4.4650639949963384e+0\t3.0517578125000000e-5\n\t[3\]\t9.0373212099075317e-1\t1.8695068359375000e-1\t7.1678143739700317e-1\t3.8340669508039502e+0\t3.0517578125000000e-5\n\t[4\]\t9.9780619144439697e-1\t2.4810791015625000e-1\t7.4969828128814697e-1\t3.0216621502152523e+0\t3.0517578125000000e-5\n\t[5\]\t9.5236867666244507e-1\t3.0831909179687500e-1\t6.4404958486557007e-1\t2.0889059484187866e+0\t3.0517578125000000e-5\n\t...and 44036 more errors.\n\tMax AbsError of 1.9962286949157715e+0 at index of 32177.\n\t[32177\]\t9.9879217147827148e-1\t-9.9743652343750000e-1\t1.9962286949157715e+0\t2.0013591321441684e+0\t3.0517578125000000e-5\n\tMax RelError of Infinity at index of 21168.\n\t[21168\]\t9.5105654001235962e-1\t0.0000000000000000e+0\t9.5105654001235962e-1\tInfinity\t3.0517578125000000e-5\n] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching.html.ini index 3390c574de3..873f6179f2c 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching.html.ini @@ -140,3 +140,9 @@ [X SNR (-591.4728047569859 dB) is not greater than or equal to 65.737. Got -591.4728047569859.] expected: FAIL + [X SNR (-543.5504687141402 dB) is not greater than or equal to 65.737. Got -543.5504687141402.] + expected: FAIL + + [X Stitched sine-wave buffers at sample rate 43800 does not equal [0,0.06264832615852356,0.12505052983760834,0.18696144223213196,0.24813786149024963,0.308339387178421,0.36732959747314453,0.4248766601085663,0.480754554271698,0.5347436666488647,0.5866320133209229,0.6362156271934509,0.6832997798919678,0.7276994585990906,0.7692402601242065,0.8077589869499207...\] with an element-wise tolerance of {"absoluteThreshold":0.0038986,"relativeThreshold":0}.\n\tIndex\tActual\t\t\tExpected\t\tAbsError\t\tRelError\t\tTest threshold\n\t[19030\]\t1.0053343057791861e+29\t-7.3546999692916870e-1\t1.0053343057791861e+29\t1.3669276924643975e+29\t3.8985999999999999e-3\n\t[19031\]\t-3.6017334461212158e-1\t-6.9157749414443970e-1\t3.3140414953231812e-1\t4.7920030992665957e-1\t3.8985999999999999e-3\n\t[38059\]\t1.9958413252754581e+29\t-9.8956179618835449e-1\t1.9958413252754581e+29\t2.0168940767147069e+29\t3.8985999999999999e-3\n\t[38060\]\t-8.8409073650836945e-2\t-9.9664616584777832e-1\t9.0823709219694138e-1\t9.1129341918891205e-1\t3.8985999999999999e-3\n\tMax AbsError of 1.9958413252754581e+29 at index of 38059.\n\tMax RelError of 2.0168940767147069e+29 at index of 38059.\n] + expected: FAIL + diff --git a/tests/wpt/metadata/webmessaging/with-ports/018.html.ini b/tests/wpt/metadata/webmessaging/with-ports/018.html.ini deleted file mode 100644 index 663a1f8fa30..00000000000 --- a/tests/wpt/metadata/webmessaging/with-ports/018.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[018.html] - expected: TIMEOUT - [origin of the script that invoked the method, javascript:] - expected: TIMEOUT - diff --git a/tests/wpt/metadata/webmessaging/without-ports/017.html.ini b/tests/wpt/metadata/webmessaging/without-ports/017.html.ini new file mode 100644 index 00000000000..064cf47545b --- /dev/null +++ b/tests/wpt/metadata/webmessaging/without-ports/017.html.ini @@ -0,0 +1,5 @@ +[017.html] + expected: TIMEOUT + [origin of the script that invoked the method, about:blank] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/workers/dedicated-worker-in-data-url-context.window.js.ini b/tests/wpt/metadata/workers/dedicated-worker-in-data-url-context.window.js.ini new file mode 100644 index 00000000000..e414df35fd6 --- /dev/null +++ b/tests/wpt/metadata/workers/dedicated-worker-in-data-url-context.window.js.ini @@ -0,0 +1,4 @@ +[dedicated-worker-in-data-url-context.window.html] + [Create a dedicated worker in a data url dedicated worker] + expected: FAIL + diff --git a/tests/wpt/metadata/workers/shared-worker-in-data-url-context.window.js.ini b/tests/wpt/metadata/workers/shared-worker-in-data-url-context.window.js.ini new file mode 100644 index 00000000000..10dda3a6659 --- /dev/null +++ b/tests/wpt/metadata/workers/shared-worker-in-data-url-context.window.js.ini @@ -0,0 +1,7 @@ +[shared-worker-in-data-url-context.window.html] + [Create a shared worker in a data url frame] + expected: FAIL + + [Create a data url shared worker in a data url frame] + expected: FAIL + diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy b/tests/wpt/web-platform-tests/.well-known/origin-policy new file mode 100644 index 00000000000..df2b83256c2 --- /dev/null +++ b/tests/wpt/web-platform-tests/.well-known/origin-policy @@ -0,0 +1,18 @@ +import os +import glob + + +def main(request, response): + host_piece = request.url_parts.hostname.split(".")[0] + + filepath_pattern = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath( + __file__)), "../origin-policy/policies/", "{} *.json".format(host_piece))) + + matches = glob.glob(filepath_pattern) + + if len(matches) != 1: + return 404, [], '{} origin policies found at a path matching "{}"'.format(len(matches), filepath_pattern) + + with open(matches[0]) as f: + data = f.read() + return 200, [('Content-Type', 'application/originpolicy+json')], data diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-comma-in-policy b/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-comma-in-policy deleted file mode 100644 index 42990f93e6d..00000000000 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-comma-in-policy +++ /dev/null @@ -1,5 +0,0 @@ -{ - "content_security": { - "policies": ["script-src 'self' 'unsafe-inline', img-src 'none'"] - } -} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-double-content-security b/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-double-content-security deleted file mode 100644 index be9b3750647..00000000000 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-double-content-security +++ /dev/null @@ -1,8 +0,0 @@ -{ - "content_security": { - "policies": ["script-src 'self' 'unsafe-inline'"] - }, - "content_security": { - "policies": ["img-src 'none'"] - } -} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-double-policies b/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-double-policies deleted file mode 100644 index 2e625c5c463..00000000000 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-double-policies +++ /dev/null @@ -1,6 +0,0 @@ -{ - "content_security": { - "policies": ["script-src 'self' 'unsafe-inline'"], - "policies": ["img-src 'none'"] - } -} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-noimg-report-only b/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-noimg-report-only deleted file mode 100644 index 13c662ef2d6..00000000000 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-noimg-report-only +++ /dev/null @@ -1,5 +0,0 @@ -{ - "content_security": { - "policies_report_only": ["img-src 'none'"] - } -} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-non-object b/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-non-object deleted file mode 100644 index 7f6e1383640..00000000000 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-non-object +++ /dev/null @@ -1,3 +0,0 @@ -{ - "content_security": ["script-src 'self' 'unsafe-inline'"] -} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-non-string b/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-non-string deleted file mode 100644 index 8649b17c4d8..00000000000 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-non-string +++ /dev/null @@ -1,5 +0,0 @@ -{ - "content_security": { - "policies": [["script-src 'self' 'unsafe-inline'"]] - } -} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-valid b/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-valid deleted file mode 100644 index d4babb7949e..00000000000 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-valid +++ /dev/null @@ -1,5 +0,0 @@ -{ - "content_security": { - "policies": ["script-src 'self' 'unsafe-inline'"] - } -} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-valid-with-multi-item-array b/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-valid-with-multi-item-array deleted file mode 100644 index 45ec32200d5..00000000000 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-valid-with-multi-item-array +++ /dev/null @@ -1,5 +0,0 @@ -{ - "content_security": { - "policies": ["script-src 'self' 'unsafe-inline'", "img-src 'none'"] - } -} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-valid-with-semicolon b/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-valid-with-semicolon deleted file mode 100644 index e777d5c96d5..00000000000 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-valid-with-semicolon +++ /dev/null @@ -1,5 +0,0 @@ -{ - "content_security": { - "policies": ["script-src 'self' 'unsafe-inline'; img-src 'none'"] - } -} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-csp-1 b/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-csp-1 deleted file mode 100644 index d4babb7949e..00000000000 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-csp-1 +++ /dev/null @@ -1,5 +0,0 @@ -{ - "content_security": { - "policies": ["script-src 'self' 'unsafe-inline'"] - } -} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-csp-2 b/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-csp-2 deleted file mode 100644 index 34a6c5c873b..00000000000 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-csp-2 +++ /dev/null @@ -1,5 +0,0 @@ -{ - "content_security": { - "policies": ["script-src 'self' 'nonce-test'"] - } -} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-comma-in-policy b/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-comma-in-policy deleted file mode 100644 index e991c788f24..00000000000 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-comma-in-policy +++ /dev/null @@ -1,5 +0,0 @@ -{ - "features": { - "policy": "camera 'self' https://example.com/, geolocation 'self' https://example.com/" - } -} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-double-features b/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-double-features deleted file mode 100644 index 583f1eaa2fc..00000000000 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-double-features +++ /dev/null @@ -1,8 +0,0 @@ -{ - "features": { - "policy": "camera 'self' https://example.com/" - }, - "features": { - "policy": "geolocation 'self' https://example.com/" - } -} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-double-policy b/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-double-policy deleted file mode 100644 index fb216bc4729..00000000000 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-double-policy +++ /dev/null @@ -1,6 +0,0 @@ -{ - "features": { - "policy": "camera 'self' https://example.com/", - "policy": "geolocation 'self' https://example.com/" - } -} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-non-object b/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-non-object deleted file mode 100644 index b4d255440dc..00000000000 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-non-object +++ /dev/null @@ -1,3 +0,0 @@ -{ - "features": "camera 'self' https://example.com/" -} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-non-string b/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-non-string deleted file mode 100644 index 8b758c7f617..00000000000 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-non-string +++ /dev/null @@ -1,5 +0,0 @@ -{ - "features": { - "policy": ["camera 'self' https://example.com/"] - } -} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-valid b/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-valid deleted file mode 100644 index 22ef8992cf7..00000000000 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-features-valid +++ /dev/null @@ -1,5 +0,0 @@ -{ - "features": { - "policy": "camera 'self' https://example.com/; geolocation 'self' https://example.com/" - } -} diff --git a/tests/wpt/web-platform-tests/css/CSS2/floats/float-paint-relayout.html b/tests/wpt/web-platform-tests/css/CSS2/floats/float-paint-relayout.html new file mode 100644 index 00000000000..0499e3e9a26 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/CSS2/floats/float-paint-relayout.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1049973"> +<link rel="match" href="../../reference/ref-filled-green-100px-square.xht"> +<p>Test passes if there is a filled green square and <strong>no red</strong>.</p> +<div style="width: 100px; height: 100px; background: red; overflow: auto;"> + <div id="target" style="display: none; float: left; width: 100px; height: 100px; background: green;"></div> +</div> +<script> +document.body.offsetTop; +document.getElementById('target').style.display = 'block'; +</script> diff --git a/tests/wpt/web-platform-tests/css/css-lists/change-list-descendant-display-ref.html b/tests/wpt/web-platform-tests/css/css-lists/change-list-descendant-display-ref.html new file mode 100644 index 00000000000..1a69ab6ea54 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-lists/change-list-descendant-display-ref.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Lists: test the change of descendant's display</title> +<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com"> +<style> +.inline { + display: inline; +} +</style> +<ol> + <li><div class="target inline">text</div></li> + <li><div class="target">text</div></li> + <li><div><div class="target inline">text</div></div></li> + <li><div><div class="target">text</div></div></li> + <li><div><div><div class="target inline">text</div></div></div></li> + <li><div><div><div class="target">text</div></div></div></li> +</ol> diff --git a/tests/wpt/web-platform-tests/css/css-lists/change-list-descendant-display.html b/tests/wpt/web-platform-tests/css/css-lists/change-list-descendant-display.html new file mode 100644 index 00000000000..18296f88628 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-lists/change-list-descendant-display.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<meta charset="utf-8"> +<title>CSS Lists: test the change of descendant's display</title> +<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com"> +<link rel="match" href="change-list-descendant-display-ref.html"> +<link rel="help" href="https://www.w3.org/TR/CSS22/generate.html#lists"> +<meta name="assert" content="Check that an outside marker looks good when + the descendant of the list item that contains the 1st line box changes + from 'display: block' to 'display: inline' or vice versa."> +<style> +.inline { + display: inline; +} +</style> +<ol> + <li><div class="target">text</div></li> + <li><div class="target inline">text</div></li> + <li><div><div class="target">text</div></div></li> + <li><div><div class="target inline">text</div></div></li> + <li><div><div><div class="target">text</div></div></div></li> + <li><div><div><div class="target inline">text</div></div></div></li> +</ol> +<script src="/common/reftest-wait.js"></script> +<script> +addEventListener("load", async () => { + for (let target of document.querySelectorAll(".target")) { + await new Promise(resolve => requestAnimationFrame(resolve)); + target.classList.toggle("inline"); + } + takeScreenshot(); +}, {once: true}); +</script> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-position/position-sticky-scroll-reposition-ref.html b/tests/wpt/web-platform-tests/css/css-position/position-sticky-scroll-reposition-ref.html new file mode 100644 index 00000000000..487a2322fc5 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-position/position-sticky-scroll-reposition-ref.html @@ -0,0 +1,10 @@ +<!doctype html> +<title>Test that style mutation of contain:strict plus position:sticky updates sticky position</title> +<link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos"> +<link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org"> +<div id="scroller" style="width: 200px; height: 200px; overflow-y: scroll; + will-change: transform;"> + <div id="scrollbar" style="width: 100px; height: 100px; position: sticky; background: lightblue; + top: 5px; left: 50px; contain: strict;"></div> + <div style="width: 100px; height: 500px;"></div> +</div> diff --git a/tests/wpt/web-platform-tests/css/css-position/position-sticky-scroll-reposition.html b/tests/wpt/web-platform-tests/css/css-position/position-sticky-scroll-reposition.html new file mode 100644 index 00000000000..b75275c64fe --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-position/position-sticky-scroll-reposition.html @@ -0,0 +1,20 @@ +<!doctype html> +<html class="reftest-wait"> +<title>Test that style mutation of contain:strict plus position:sticky updates sticky position</title> +<link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos"> +<link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org"> +<link rel="match" href="position-sticky-scroll-reposition-ref.html"> +<div id="scroller" style="width: 200px; height: 200px; overflow-y: scroll; + will-change: transform;"> + <div id="sticky" style="width: 100px; height: 100px; position: sticky; background: lightblue; + top: 50px; left: 50px; contain: strict;"></div> + <div style="width: 100px; height: 500px;"></div> +</div> +<script src="/common/reftest-wait.js"></script> +<script> + requestAnimationFrame(() => + requestAnimationFrame(() => { + sticky.style.top = '5px'; + takeScreenshot(); + })); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-ui/outline-023.html b/tests/wpt/web-platform-tests/css/css-ui/outline-023.html new file mode 100644 index 00000000000..ba623d99734 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-ui/outline-023.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html> +<title>Tests that a paint clip, clips an outline.</title> +<link rel="match" href="../reference/ref-filled-green-100px-square-only.html"> +<link rel="help" href="https://drafts.csswg.org/css-ui-3/#outline"> +<link rel="help" href="https://www.w3.org/TR/CSS21/zindex.html"> +<p>Test passes if there is a filled green square.</p> +<div style="overflow: hidden; width: 100px; height: 100px; background: green;"> + <div style="display: block; width: 110px; height: 110px; margin: -5px; outline: solid blue 3px;"></div> +</div> diff --git a/tests/wpt/web-platform-tests/css/cssom/CSSStyleSheet-constructable-disabled-regular-sheet-insertion.html b/tests/wpt/web-platform-tests/css/cssom/CSSStyleSheet-constructable-disabled-regular-sheet-insertion.html new file mode 100644 index 00000000000..ef4ea148065 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/cssom/CSSStyleSheet-constructable-disabled-regular-sheet-insertion.html @@ -0,0 +1,22 @@ +<!doctype html> +<title>Shouldn't crash / assert when inserting a stylesheet after there are disabled constructable sheets</title> +<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> +<link rel="help" href="https://wicg.github.io/construct-stylesheets/"> +<script src = '/resources/testharness.js'></script> +<script src = '/resources/testharnessreport.js'></script> +<div id="host"></div> +<script> +test(function() { + let sheet = new CSSStyleSheet({ disabled: true }); + sheet.replaceSync("div { color: red }"); + + let root = document.getElementById("host").attachShadow({ mode: "open" }); + root.adoptedStyleSheets = [sheet]; + let style = document.createElement("style"); + root.innerHTML = ` + <style>div { color: green }</style> + <div>Should be green</div> + `; + assert_equals(getComputedStyle(root.querySelector("div")).color, "rgb(0, 128, 0)", "Should insert the sheet at the right position and not crash"); +}); +</script> diff --git a/tests/wpt/web-platform-tests/css/cssom/CSSStyleSheet-constructable-duplicate.html b/tests/wpt/web-platform-tests/css/cssom/CSSStyleSheet-constructable-duplicate.html new file mode 100644 index 00000000000..30a3ed1d09b --- /dev/null +++ b/tests/wpt/web-platform-tests/css/cssom/CSSStyleSheet-constructable-duplicate.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>Cascade order of a stylesheet for duplicate sheets.</title> +<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> +<link rel="help" href="https://wicg.github.io/construct-stylesheets/"> +<script src = '/resources/testharness.js'></script> +<script src = '/resources/testharnessreport.js'></script> +<div></div> +<script> +test(function() { + let sheets = []; + + for (let i = 0; i < 2; ++i) { + sheets.push(new CSSStyleSheet()); + sheets[i].replaceSync("div { z-index: " + i + " }"); + } + + document.adoptedStyleSheets = [sheets[1], sheets[0], sheets[1]]; + assert_equals(getComputedStyle(document.querySelector("div")).zIndex, "1", "duplicate stylesheet should take right position in the cascade"); +}); +</script> diff --git a/tests/wpt/web-platform-tests/css/cssom/CSSStyleSheet-constructable.html b/tests/wpt/web-platform-tests/css/cssom/CSSStyleSheet-constructable.html index 539075b47ef..c7e21538104 100644 --- a/tests/wpt/web-platform-tests/css/cssom/CSSStyleSheet-constructable.html +++ b/tests/wpt/web-platform-tests/css/cssom/CSSStyleSheet-constructable.html @@ -47,8 +47,8 @@ test(() => { }, "document.adoptedStyleSheets should initially have length 0."); test(() => { - const sheet = new CSSStyleSheet({title: "Red", disabled: true, media: "screen, print"}); - assert_equals(sheet.title, "Red"); + const sheet = new CSSStyleSheet({disabled: true, media: "screen, print"}); + assert_equals(sheet.title, null); assert_equals(sheet.ownerNode, null); assert_equals(sheet.ownerRule, null); assert_equals(sheet.media.length, 2); @@ -96,11 +96,16 @@ test(() => { assert_equals(sheet3.cssRules.length, 0); }, 'new CSSStyleSheet produces empty CSSStyleSheet'); +test(() => { + const sheet = new CSSStyleSheet({title: "something"}); + assert_equals(sheet.title, null); +}, "title cannot be set in the CSSStyleSheet constructor"); + promise_test(() => { - const sheet = new CSSStyleSheet({title: "Red", disabled: true, media: "screen, print"}); + const sheet = new CSSStyleSheet({disabled: true, media: "screen, print"}); const promise_sheet = sheet.replace(redStyleTexts[0]); return promise_sheet.then(function(sheet) { - assert_equals(sheet.title, "Red"); + assert_equals(sheet.title, null); assert_equals(sheet.ownerNode, null); assert_equals(sheet.ownerRule, null); assert_equals(sheet.media.length, 2); @@ -119,8 +124,8 @@ promise_test(() => { function createAllSheetsPromise() { const greenSheet = new CSSStyleSheet(); const redSheet = new CSSStyleSheet({media: "screen, print"}); - const blueSheet = new CSSStyleSheet({title: "Blue", disabled: true}); - const whiteSheet = new CSSStyleSheet({title: "White", disabled: true}); + const blueSheet = new CSSStyleSheet({disabled: true}); + const whiteSheet = new CSSStyleSheet({disabled: true}); const yellowSheet = new CSSStyleSheet({disabled: false}); const greenPromise = greenSheet.replace(greenStyleText); diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/comma-in-policy.https.html b/tests/wpt/web-platform-tests/origin-policy/content-security/comma-in-policy.https.html index 88d72446392..07d10811f0b 100644 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/comma-in-policy.https.html +++ b/tests/wpt/web-platform-tests/origin-policy/content-security/comma-in-policy.https.html @@ -3,9 +3,14 @@ <title>Commas in "content_security/policy" cause parse errors and thus no CSP</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="helper.js"></script> +<script src="../resources/origin-policy-test-runner.js"></script> + +<div id="log"></div> <script> "use strict"; -runCSPTest({ unsafeEval: true }); +runTestsInSubframe({ + hostname: "op1", + testJS: "resources/allow-unsafe-eval.mjs" +}); </script> diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/comma-in-policy.https.html.headers b/tests/wpt/web-platform-tests/origin-policy/content-security/comma-in-policy.https.html.headers deleted file mode 100644 index 32e453ab20d..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/comma-in-policy.https.html.headers +++ /dev/null @@ -1 +0,0 @@ -Sec-Origin-Policy: policy=policy-content-security-comma-in-policy diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/double-content-security.https.html b/tests/wpt/web-platform-tests/origin-policy/content-security/double-content-security.https.html index 99046803c9f..357bd7669a6 100644 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/double-content-security.https.html +++ b/tests/wpt/web-platform-tests/origin-policy/content-security/double-content-security.https.html @@ -3,11 +3,14 @@ <title>Of two "content_security" items only the second counts</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="helper.js"></script> +<script src="../resources/origin-policy-test-runner.js"></script> -<body> +<div id="log"></div> <script> "use strict"; -runCSPTest({ unsafeEval: true, img: false }); +runTestsInSubframe({ + hostname: "op2", + testJS: "resources/allow-unsafe-eval-disallow-images.mjs" +}); </script> diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/double-content-security.https.html.headers b/tests/wpt/web-platform-tests/origin-policy/content-security/double-content-security.https.html.headers deleted file mode 100644 index a380b053c27..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/double-content-security.https.html.headers +++ /dev/null @@ -1 +0,0 @@ -Sec-Origin-Policy: policy=policy-content-security-double-content-security diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/double-policies.https.html b/tests/wpt/web-platform-tests/origin-policy/content-security/double-policies.https.html index 925b9d5a31e..327670fcad0 100644 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/double-policies.https.html +++ b/tests/wpt/web-platform-tests/origin-policy/content-security/double-policies.https.html @@ -3,11 +3,14 @@ <title>Of two "content_security/policies" items only the second counts</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="helper.js"></script> +<script src="../resources/origin-policy-test-runner.js"></script> -<body> +<div id="log"></div> <script> "use strict"; -runCSPTest({ unsafeEval: true, img: false }); +runTestsInSubframe({ + hostname: "op3", + testJS: "resources/allow-unsafe-eval-disallow-images.mjs" +}); </script> diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/double-policies.https.html.headers b/tests/wpt/web-platform-tests/origin-policy/content-security/double-policies.https.html.headers deleted file mode 100644 index 23f1d143405..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/double-policies.https.html.headers +++ /dev/null @@ -1 +0,0 @@ -Sec-Origin-Policy: policy=policy-content-security-double-policies diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/non-array.https.html b/tests/wpt/web-platform-tests/origin-policy/content-security/non-array.https.html index 78a67e16eb9..c95b5a15b0e 100644 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/non-array.https.html +++ b/tests/wpt/web-platform-tests/origin-policy/content-security/non-array.https.html @@ -3,9 +3,14 @@ <title>Non-array "content_security/policies" member must be ignored</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="helper.js"></script> +<script src="../resources/origin-policy-test-runner.js"></script> + +<div id="log"></div> <script> "use strict"; -runCSPTest({ unsafeEval: true }); +runTestsInSubframe({ + hostname: "op4", + testJS: "resources/allow-unsafe-eval.mjs" +}); </script> diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/non-array.https.html.headers b/tests/wpt/web-platform-tests/origin-policy/content-security/non-array.https.html.headers deleted file mode 100644 index 31e6f375ef9..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/non-array.https.html.headers +++ /dev/null @@ -1 +0,0 @@ -Sec-Origin-Policy: policy=policy-content-security-non-array diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/non-object.https.html b/tests/wpt/web-platform-tests/origin-policy/content-security/non-object.https.html index 359c6c76922..220136c4d05 100644 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/non-object.https.html +++ b/tests/wpt/web-platform-tests/origin-policy/content-security/non-object.https.html @@ -3,9 +3,14 @@ <title>Non-object "content_security" member must be ignored</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="helper.js"></script> +<script src="../resources/origin-policy-test-runner.js"></script> + +<div id="log"></div> <script> "use strict"; -runCSPTest({ unsafeEval: true }); +runTestsInSubframe({ + hostname: "op5", + testJS: "resources/allow-unsafe-eval.mjs" +}); </script> diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/non-object.https.html.headers b/tests/wpt/web-platform-tests/origin-policy/content-security/non-object.https.html.headers deleted file mode 100644 index 812ea9445ec..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/non-object.https.html.headers +++ /dev/null @@ -1 +0,0 @@ -Sec-Origin-Policy: policy=policy-content-security-non-object diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/non-string.https.html b/tests/wpt/web-platform-tests/origin-policy/content-security/non-string.https.html index 8af3c1c4dff..57c29fe265b 100644 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/non-string.https.html +++ b/tests/wpt/web-platform-tests/origin-policy/content-security/non-string.https.html @@ -3,9 +3,14 @@ <title>Non-string "content_security/policies" array member must be ignored</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="helper.js"></script> +<script src="../resources/origin-policy-test-runner.js"></script> + +<div id="log"></div> <script> "use strict"; -runCSPTest({ unsafeEval: true }); +runTestsInSubframe({ + hostname: "op6", + testJS: "resources/allow-unsafe-eval.mjs" +}); </script> diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/non-string.https.html.headers b/tests/wpt/web-platform-tests/origin-policy/content-security/non-string.https.html.headers deleted file mode 100644 index 0b9ce2ee3f8..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/non-string.https.html.headers +++ /dev/null @@ -1 +0,0 @@ -Sec-Origin-Policy: policy=policy-content-security-non-string diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/resources/allow-unsafe-eval-disallow-images.mjs b/tests/wpt/web-platform-tests/origin-policy/content-security/resources/allow-unsafe-eval-disallow-images.mjs new file mode 100644 index 00000000000..8715e74e5df --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/content-security/resources/allow-unsafe-eval-disallow-images.mjs @@ -0,0 +1,3 @@ +import { runCSPTest } from "./helper.mjs"; + +runCSPTest({ unsafeEval: true, img: false }); diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/resources/allow-unsafe-eval.mjs b/tests/wpt/web-platform-tests/origin-policy/content-security/resources/allow-unsafe-eval.mjs new file mode 100644 index 00000000000..bd6ca6f8bbd --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/content-security/resources/allow-unsafe-eval.mjs @@ -0,0 +1,3 @@ +import { runCSPTest } from "./helper.mjs"; + +runCSPTest({ unsafeEval: true }); diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/resources/disallow-unsafe-eval-disallow-images.mjs b/tests/wpt/web-platform-tests/origin-policy/content-security/resources/disallow-unsafe-eval-disallow-images.mjs new file mode 100644 index 00000000000..41b25553d56 --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/content-security/resources/disallow-unsafe-eval-disallow-images.mjs @@ -0,0 +1,3 @@ +import { runCSPTest } from "./helper.mjs"; + +runCSPTest({ unsafeEval: false, img: false }); diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/helper.js b/tests/wpt/web-platform-tests/origin-policy/content-security/resources/helper.mjs index 4875977afa4..5eff7e16ba0 100644 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/helper.js +++ b/tests/wpt/web-platform-tests/origin-policy/content-security/resources/helper.mjs @@ -1,4 +1,4 @@ -window.waitForOneSecurityPolicyViolationEvent = expectedBlockedURI => { +export function waitForOneSecurityPolicyViolationEvent(expectedBlockedURI) { return new Promise(resolve => { let eventCount = 0; let blockedURI = null; @@ -17,9 +17,9 @@ window.waitForOneSecurityPolicyViolationEvent = expectedBlockedURI => { }); }); }); -}; +} -window.waitForImgFail = imgSrc => { +export function waitForImgFail(imgSrc) { return new Promise((resolve, reject) => { const img = document.createElement("img"); img.onload = () => reject(new Error("Must not load the image")); @@ -28,10 +28,9 @@ window.waitForImgFail = imgSrc => { img.src = imgSrc; document.body.append(img); }); -}; +} - -window.waitForImgSuccess = imgSrc => { +export function waitForImgSuccess(imgSrc) { return new Promise((resolve, reject) => { const img = document.createElement("img"); img.onload = () => resolve(); @@ -40,10 +39,10 @@ window.waitForImgSuccess = imgSrc => { img.src = imgSrc; document.body.append(img); }); -}; +} // Both params are optional; if they are not given as booleans then we will not test that aspect. -window.runCSPTest = ({ unsafeEval, img }) => { +export function runCSPTest({ unsafeEval, img }) { if (unsafeEval === true) { test(() => { eval("window.evalAllowed = true;"); @@ -70,4 +69,4 @@ window.runCSPTest = ({ unsafeEval, img }) => { "img loading must be disallowed" ); } -}; +} diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/resources/trigger-violation-report-report-only.mjs b/tests/wpt/web-platform-tests/origin-policy/content-security/resources/trigger-violation-report-report-only.mjs new file mode 100644 index 00000000000..9766717e309 --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/content-security/resources/trigger-violation-report-report-only.mjs @@ -0,0 +1,12 @@ +import { waitForOneSecurityPolicyViolationEvent, waitForImgSuccess } from "./helper.mjs"; + +promise_test(() => { + const imgURL = (new URL("/common/security-features/subresource/image.py", document.location)).href; + + return Promise.all([ + waitForOneSecurityPolicyViolationEvent(imgURL).then(blockedURI => { + assert_equals(blockedURI, imgURL); + }), + waitForImgSuccess(imgURL) + ]); +}); diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/resources/trigger-violation-report.mjs b/tests/wpt/web-platform-tests/origin-policy/content-security/resources/trigger-violation-report.mjs new file mode 100644 index 00000000000..319c87b0f8a --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/content-security/resources/trigger-violation-report.mjs @@ -0,0 +1,12 @@ +import { waitForOneSecurityPolicyViolationEvent, waitForImgFail } from "./helper.mjs"; + +promise_test(() => { + const imgURL = (new URL("/common/security-features/subresource/image.py", document.location)).href; + + return Promise.all([ + waitForOneSecurityPolicyViolationEvent(imgURL).then(blockedURI => { + assert_equals(blockedURI, imgURL); + }), + waitForImgFail(imgURL) + ]); +}); diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/trigger-violation-report-report-only.https.html b/tests/wpt/web-platform-tests/origin-policy/content-security/trigger-violation-report-report-only.https.html index 3e5038b501d..9eb83792852 100644 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/trigger-violation-report-report-only.https.html +++ b/tests/wpt/web-platform-tests/origin-policy/content-security/trigger-violation-report-report-only.https.html @@ -3,21 +3,14 @@ <title>CSP via origin policy must trigger a securitypolicyviolation event even when the CSP is report-only</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="helper.js"></script> +<script src="../resources/origin-policy-test-runner.js"></script> -<body> +<div id="log"></div> <script> "use strict"; - -promise_test(() => { - const imgURL = (new URL("/common/security-features/subresource/image.py", document.location)).href; - - return Promise.all([ - waitForOneSecurityPolicyViolationEvent(imgURL).then(blockedURI => { - assert_equals(blockedURI, imgURL); - }), - waitForImgSuccess(imgURL) - ]); +runTestsInSubframe({ + hostname: "op7", + testJS: "resources/trigger-violation-report-report-only.mjs" }); </script> diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/trigger-violation-report-report-only.https.html.headers b/tests/wpt/web-platform-tests/origin-policy/content-security/trigger-violation-report-report-only.https.html.headers deleted file mode 100644 index cb27e1500e0..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/trigger-violation-report-report-only.https.html.headers +++ /dev/null @@ -1 +0,0 @@ -Sec-Origin-Policy: policy=policy-content-security-noimg-report-only diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/trigger-violation-report.https.html b/tests/wpt/web-platform-tests/origin-policy/content-security/trigger-violation-report.https.html index 22beca5a3db..f981b2b05ce 100644 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/trigger-violation-report.https.html +++ b/tests/wpt/web-platform-tests/origin-policy/content-security/trigger-violation-report.https.html @@ -3,21 +3,14 @@ <title>CSP via origin policy must trigger a securitypolicyviolation event</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="helper.js"></script> +<script src="../resources/origin-policy-test-runner.js"></script> -<body> +<div id="log"></div> <script> "use strict"; - -promise_test(() => { - const imgURL = (new URL("/common/security-features/subresource/image.py", document.location)).href; - - return Promise.all([ - waitForOneSecurityPolicyViolationEvent(imgURL).then(blockedURI => { - assert_equals(blockedURI, imgURL); - }), - waitForImgFail(imgURL) - ]); +runTestsInSubframe({ + hostname: "op8", + testJS: "resources/trigger-violation-report.mjs" }); </script> diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/trigger-violation-report.https.html.headers b/tests/wpt/web-platform-tests/origin-policy/content-security/trigger-violation-report.https.html.headers deleted file mode 100644 index 08bcb9fa941..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/trigger-violation-report.https.html.headers +++ /dev/null @@ -1 +0,0 @@ -Sec-Origin-Policy: policy=policy-content-security-noimg diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/valid-with-multi-item-array.https.html b/tests/wpt/web-platform-tests/origin-policy/content-security/valid-with-multi-item-array.https.html index bc9ebd0cccf..36333a1e4b1 100644 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/valid-with-multi-item-array.https.html +++ b/tests/wpt/web-platform-tests/origin-policy/content-security/valid-with-multi-item-array.https.html @@ -3,11 +3,14 @@ <title>"content_security/policy" can contain multiple array items to enforce multiple CSPs</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="helper.js"></script> +<script src="../resources/origin-policy-test-runner.js"></script> -<body> +<div id="log"></div> <script> "use strict"; -runCSPTest({ unsafeEval: false, img: false }); +runTestsInSubframe({ + hostname: "op9", + testJS: "resources/disallow-unsafe-eval-disallow-images.mjs" +}); </script> diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/valid-with-multi-item-array.https.html.headers b/tests/wpt/web-platform-tests/origin-policy/content-security/valid-with-multi-item-array.https.html.headers deleted file mode 100644 index eeddaba7a59..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/valid-with-multi-item-array.https.html.headers +++ /dev/null @@ -1 +0,0 @@ -Sec-Origin-Policy: policy=policy-content-security-valid-with-semicolon diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/valid-with-semicolon.https.html b/tests/wpt/web-platform-tests/origin-policy/content-security/valid-with-semicolon.https.html index 82158f1cf70..9eadc8f89d3 100644 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/valid-with-semicolon.https.html +++ b/tests/wpt/web-platform-tests/origin-policy/content-security/valid-with-semicolon.https.html @@ -3,11 +3,14 @@ <title>"content_security/policy" array items can contain semicolons to enforce multiple CSP directives</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="helper.js"></script> +<script src="../resources/origin-policy-test-runner.js"></script> -<body> +<div id="log"></div> <script> "use strict"; -runCSPTest({ unsafeEval: false, img: false }); +runTestsInSubframe({ + hostname: "op10", + testJS: "resources/disallow-unsafe-eval-disallow-images.mjs" +}); </script> diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/valid-with-semicolon.https.html.headers b/tests/wpt/web-platform-tests/origin-policy/content-security/valid-with-semicolon.https.html.headers deleted file mode 100644 index eeddaba7a59..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/valid-with-semicolon.https.html.headers +++ /dev/null @@ -1 +0,0 @@ -Sec-Origin-Policy: policy=policy-content-security-valid-with-semicolon diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/valid.https.html b/tests/wpt/web-platform-tests/origin-policy/content-security/valid.https.html deleted file mode 100644 index 36e5ddbf958..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/valid.https.html +++ /dev/null @@ -1,11 +0,0 @@ -<!DOCTYPE HTML> -<meta charset="utf-8"> -<title>Valid "content_security" member disallows eval</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="helper.js"></script> - -<script> -"use strict"; -runCSPTest({ unsafeEval: false }); -</script> diff --git a/tests/wpt/web-platform-tests/origin-policy/content-security/valid.https.html.headers b/tests/wpt/web-platform-tests/origin-policy/content-security/valid.https.html.headers deleted file mode 100644 index 78aeeacd934..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/content-security/valid.https.html.headers +++ /dev/null @@ -1 +0,0 @@ -Sec-Origin-Policy: policy=policy-content-security-valid diff --git a/tests/wpt/web-platform-tests/origin-policy/features/comma-in-policy.https.html b/tests/wpt/web-platform-tests/origin-policy/features/comma-in-policy.https.html index 1b991f0d8b6..a9faba4bfd4 100644 --- a/tests/wpt/web-platform-tests/origin-policy/features/comma-in-policy.https.html +++ b/tests/wpt/web-platform-tests/origin-policy/features/comma-in-policy.https.html @@ -3,9 +3,14 @@ <title>Commas in "features/policy" cause parse errors and thus no feature policy</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="helper.js"></script> +<script src="../resources/origin-policy-test-runner.js"></script> + +<div id="log"></div> <script> "use strict"; -runFPTest({ camera: false, geolocation: false }); +runTestsInSubframe({ + hostname: "op1", + testJS: "resources/no-camera-no-geolocation.mjs" +}); </script> diff --git a/tests/wpt/web-platform-tests/origin-policy/features/comma-in-policy.https.html.headers b/tests/wpt/web-platform-tests/origin-policy/features/comma-in-policy.https.html.headers deleted file mode 100644 index c0e68720516..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/features/comma-in-policy.https.html.headers +++ /dev/null @@ -1 +0,0 @@ -Sec-Origin-Policy: policy=policy-features-comma-in-policy diff --git a/tests/wpt/web-platform-tests/origin-policy/features/double-features.https.html b/tests/wpt/web-platform-tests/origin-policy/features/double-features.https.html index 8397f849f30..aa687d681c6 100644 --- a/tests/wpt/web-platform-tests/origin-policy/features/double-features.https.html +++ b/tests/wpt/web-platform-tests/origin-policy/features/double-features.https.html @@ -3,9 +3,14 @@ <title>Of two "features" items only the second counts</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="helper.js"></script> +<script src="../resources/origin-policy-test-runner.js"></script> + +<div id="log"></div> <script> "use strict"; -runFPTest({ camera: false, geolocation: true }); +runTestsInSubframe({ + hostname: "op2", + testJS: "resources/no-camera-yes-geolocation.mjs" +}); </script> diff --git a/tests/wpt/web-platform-tests/origin-policy/features/double-features.https.html.headers b/tests/wpt/web-platform-tests/origin-policy/features/double-features.https.html.headers deleted file mode 100644 index f0a57380a8f..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/features/double-features.https.html.headers +++ /dev/null @@ -1 +0,0 @@ -Sec-Origin-Policy: policy=policy-features-double-features diff --git a/tests/wpt/web-platform-tests/origin-policy/features/double-policy.https.html b/tests/wpt/web-platform-tests/origin-policy/features/double-policy.https.html index f1d63d6de96..d9e544acaaf 100644 --- a/tests/wpt/web-platform-tests/origin-policy/features/double-policy.https.html +++ b/tests/wpt/web-platform-tests/origin-policy/features/double-policy.https.html @@ -3,9 +3,14 @@ <title>Of two "features/policy" items only the second counts</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="helper.js"></script> +<script src="../resources/origin-policy-test-runner.js"></script> + +<div id="log"></div> <script> "use strict"; -runFPTest({ camera: false, geolocation: true }); +runTestsInSubframe({ + hostname: "op2", + testJS: "resources/no-camera-yes-geolocation.mjs" +}); </script> diff --git a/tests/wpt/web-platform-tests/origin-policy/features/double-policy.https.html.headers b/tests/wpt/web-platform-tests/origin-policy/features/double-policy.https.html.headers deleted file mode 100644 index c1421693e4d..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/features/double-policy.https.html.headers +++ /dev/null @@ -1 +0,0 @@ -Sec-Origin-Policy: policy=policy-features-double-policy diff --git a/tests/wpt/web-platform-tests/origin-policy/features/non-object.https.html b/tests/wpt/web-platform-tests/origin-policy/features/non-object.https.html index 31f632bf0f1..2bd4b67e600 100644 --- a/tests/wpt/web-platform-tests/origin-policy/features/non-object.https.html +++ b/tests/wpt/web-platform-tests/origin-policy/features/non-object.https.html @@ -3,9 +3,14 @@ <title>Non-object "features" member must be ignored</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="helper.js"></script> +<script src="../resources/origin-policy-test-runner.js"></script> + +<div id="log"></div> <script> "use strict"; -runFPTest({ camera: false, geolocation: false }); +runTestsInSubframe({ + hostname: "op5", + testJS: "resources/no-camera-no-geolocation.mjs" +}); </script> diff --git a/tests/wpt/web-platform-tests/origin-policy/features/non-object.https.html.headers b/tests/wpt/web-platform-tests/origin-policy/features/non-object.https.html.headers deleted file mode 100644 index e8f68712ed3..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/features/non-object.https.html.headers +++ /dev/null @@ -1 +0,0 @@ -Sec-Origin-Policy: policy=policy-features-non-object diff --git a/tests/wpt/web-platform-tests/origin-policy/features/non-string.https.html b/tests/wpt/web-platform-tests/origin-policy/features/non-string.https.html index 019014c980a..190d224a4cf 100644 --- a/tests/wpt/web-platform-tests/origin-policy/features/non-string.https.html +++ b/tests/wpt/web-platform-tests/origin-policy/features/non-string.https.html @@ -3,9 +3,14 @@ <title>Non-string "features/policy" member must be ignored</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="helper.js"></script> +<script src="../resources/origin-policy-test-runner.js"></script> + +<div id="log"></div> <script> "use strict"; -runFPTest({ camera: false, geolocation: false }); +runTestsInSubframe({ + hostname: "op6", + testJS: "resources/no-camera-no-geolocation.mjs" +}); </script> diff --git a/tests/wpt/web-platform-tests/origin-policy/features/non-string.https.html.headers b/tests/wpt/web-platform-tests/origin-policy/features/non-string.https.html.headers deleted file mode 100644 index 4c6c376697b..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/features/non-string.https.html.headers +++ /dev/null @@ -1 +0,0 @@ -Sec-Origin-Policy: policy=policy-features-non-string diff --git a/tests/wpt/web-platform-tests/origin-policy/features/helper.js b/tests/wpt/web-platform-tests/origin-policy/features/resources/helper.mjs index f9c16b58c2c..7ced355e645 100644 --- a/tests/wpt/web-platform-tests/origin-policy/features/helper.js +++ b/tests/wpt/web-platform-tests/origin-policy/features/resources/helper.mjs @@ -1,8 +1,8 @@ "use strict"; -window.runFPTest = ({ camera, geolocation }) => { +export function runFPTest({ camera, geolocation }) { test(() => { assert_equals(document.featurePolicy.allowsFeature('camera', 'https://example.com/'), camera, 'camera'); assert_equals(document.featurePolicy.allowsFeature('geolocation', 'https://example.com/'), geolocation, 'geolocation'); }); -}; +} diff --git a/tests/wpt/web-platform-tests/origin-policy/features/resources/no-camera-no-geolocation.mjs b/tests/wpt/web-platform-tests/origin-policy/features/resources/no-camera-no-geolocation.mjs new file mode 100644 index 00000000000..b25d9abcb92 --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/features/resources/no-camera-no-geolocation.mjs @@ -0,0 +1,3 @@ +import { runFPTest } from "./helper.mjs"; + +runFPTest({ camera: false, geolocation: false }); diff --git a/tests/wpt/web-platform-tests/origin-policy/features/resources/no-camera-yes-geolocation.mjs b/tests/wpt/web-platform-tests/origin-policy/features/resources/no-camera-yes-geolocation.mjs new file mode 100644 index 00000000000..a961deeb389 --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/features/resources/no-camera-yes-geolocation.mjs @@ -0,0 +1,3 @@ +import { runFPTest } from "./helper.mjs"; + +runFPTest({ camera: false, geolocation: true }); diff --git a/tests/wpt/web-platform-tests/origin-policy/features/resources/yes-camera-yes-geolocation.mjs b/tests/wpt/web-platform-tests/origin-policy/features/resources/yes-camera-yes-geolocation.mjs new file mode 100644 index 00000000000..9f3b1d8303f --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/features/resources/yes-camera-yes-geolocation.mjs @@ -0,0 +1,3 @@ +import { runFPTest } from "./helper.mjs"; + +runFPTest({ camera: true, geolocation: true }); diff --git a/tests/wpt/web-platform-tests/origin-policy/features/valid-with-semicolon.https.html b/tests/wpt/web-platform-tests/origin-policy/features/valid-with-semicolon.https.html new file mode 100644 index 00000000000..8d2d0f4495f --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/features/valid-with-semicolon.https.html @@ -0,0 +1,16 @@ +<!DOCTYPE HTML> +<meta charset="utf-8"> +<title>Valid "features" member, with a semicolon</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../resources/origin-policy-test-runner.js"></script> + +<div id="log"></div> + +<script> +"use strict"; +runTestsInSubframe({ + hostname: "op10", + testJS: "resources/yes-camera-yes-geolocation.mjs" +}); +</script> diff --git a/tests/wpt/web-platform-tests/origin-policy/features/valid.https.html b/tests/wpt/web-platform-tests/origin-policy/features/valid.https.html deleted file mode 100644 index 6ff2076a7f0..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/features/valid.https.html +++ /dev/null @@ -1,11 +0,0 @@ -<!DOCTYPE HTML> -<meta charset="utf-8"> -<title>Valid "features" member</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="helper.js"></script> - -<script> -"use strict"; -runFPTest({ camera: true, geolocation: true }); -</script> diff --git a/tests/wpt/web-platform-tests/origin-policy/features/valid.https.html.headers b/tests/wpt/web-platform-tests/origin-policy/features/valid.https.html.headers deleted file mode 100644 index 9d0e25792c4..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/features/valid.https.html.headers +++ /dev/null @@ -1 +0,0 @@ -Sec-Origin-Policy: policy=policy-features-valid diff --git a/tests/wpt/web-platform-tests/origin-policy/origin-policy-report-to.https.tentative.sub.html b/tests/wpt/web-platform-tests/origin-policy/origin-policy-report-to.https.tentative.sub.html deleted file mode 100644 index dfef7a1d133..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/origin-policy-report-to.https.tentative.sub.html +++ /dev/null @@ -1,22 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <title>Test that Origin Policy report-to are deliverd to the declared reporting group</title> - <script src='/resources/testharness.js'></script> - <script src='/resources/testharnessreport.js'></script> -</head> -<body> - <iframe id="frame" src="about:blank"></iframe> - <script> - // Navigate the frame to a URL that declares an (invalid) origin policy with - // a report-to directive. - document.getElementById("frame").src = - "https://{{hosts[alt][]}}:{{ports[https][0]}}/origin-policy/sec-origin-policy-subframe.html"; - </script> - <script async defer src='/content-security-policy/support/checkReport.sub.js?reportField=policy&reportValue=nonexistingpolicy'> - // This re-uses CSP reporting test infrastructure, and contains the actual - // test. In addition to sanity checks, it will check whether the report body - // contains a key/value pair as indicated by reportField and reportValue. - </script> -</body> -</html> diff --git a/tests/wpt/web-platform-tests/origin-policy/origin-policy-report-to.https.tentative.sub.html.sub.headers b/tests/wpt/web-platform-tests/origin-policy/origin-policy-report-to.https.tentative.sub.html.sub.headers deleted file mode 100644 index 92a90c347d3..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/origin-policy-report-to.https.tentative.sub.html.sub.headers +++ /dev/null @@ -1 +0,0 @@ -Set-Cookie: origin-policy-report-to=5b4d35b6-0771-46fe-8700-ed2bb59ed4be; Path=/origin-policy/ diff --git a/tests/wpt/web-platform-tests/origin-policy/origin-policy.https.tentative.html b/tests/wpt/web-platform-tests/origin-policy/origin-policy.https.tentative.html deleted file mode 100644 index 34a71fe40a1..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/origin-policy.https.tentative.html +++ /dev/null @@ -1,143 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <script src='/resources/testharness.js'></script> - <script src='/resources/testharnessreport.js'></script> -</head> -<body> - <div id=log></div> - <iframe id=frame></iframe> - <script> - // Navigate the frame to a test page with the given policy and wait for - // postMessage to arrive. Resolve the result promise with the message. - function navigate(policy) { - return new Promise(resolve => { - window.addEventListener("message", event => { resolve(event.data); }, - { once: true }); - document.getElementById("frame").src = - "/origin-policy/sec-origin-policy-header.html.py?policy=" + policy; - }); - } - - // Check whether the message returned from the frame meets our expectations. - function expect(expect_script, expect_eval, message) { - assert_own_property(message, "inline_allowed"); - assert_own_property(message, "eval_allowed"); - assert_equals(message.inline_allowed, expect_script); - assert_equals(message.eval_allowed, expect_eval); - } - - // Generate a more descriptive error message. Re-throw the error. - function descriptive_message(policy, expect_inline, expect_eval, - index, error) { - error.message = `Error occured on entry #${index + 1} ["${policy - }", ${expect_inline}, ${expect_eval}]: "${error}".`; - throw(error); - } - - // Run the navigation + expectation checking for one test case line. - function test_case_entry([policy, expect_inline, expect_eval], index) { - return navigate(policy) - .then(message => expect(expect_inline, expect_eval, message)) - - // This catch handler merely logs a more friendly message, - // pointing you to the exact line of the failing test. - .catch(error => descriptive_message(policy, expect_inline, - expect_eval, index, error)); - } - - function origin_policy_csp_test_case(test_case_list) { - return t => { - // Setup the promise chain for the test. - let chain = Promise.resolve(); - for ([index, val] of test_case_list.entries()) - chain = chain.then(test_case_entry.bind(this, val, index)); - - // Delete the policy as the last element of the chain, on both - // resolve + reject paths, so that a left-over policy won't break - // subsequent tests. - return chain.then(() => navigate("0"), - (error) => { navigate("0"); throw error; }); - } - } - - - // Sanity check: A request with no policy. - promise_test(origin_policy_csp_test_case([ - ["", true, true], // No policy. - ]), "sanity check"); - - // Basic functionality. A policy should have an effect. - promise_test(origin_policy_csp_test_case([ - ["", true, true], // No policy. - ["policy-csp-1", true, false], // policy-csp-1, which forbids eval. - ["0", true, true], // Delete the policy again. - ]), "The basics: A policy should have an effect.."); - - // Basic functionality. Set a policy. Make sure it "sticks". - promise_test(origin_policy_csp_test_case([ - ["", true, true], // No policy. - ["policy-csp-1", true, false], // policy-csp-1, which forbids eval. - ["", true, false], // No policy. Should remember p...-csp-1. - ["0", true, true], // Delete the policy again. - ]), "The basics: A policy should stick."); - - // Set, update, and delete a policy. - promise_test(origin_policy_csp_test_case([ - ["", true, true], - ["policy-csp-1", true, false], // policy-csp-1, which forbids eval. - ["policy-csp-2", false, false], // policy-csp-2, forbids script + eval. - ["0", true, true], // Delete the policy. - ]), "Policy set, update, and delete."); - - // Set, update, and delete a policy. Check on each step whether it 'sticks'. - promise_test(origin_policy_csp_test_case([ - ["", true, true], - ["policy-csp-1", true, false], // policy-csp-1, which forbids eval. - ["", true, false], - ["policy-csp-2", false, false], // Forbid script + eval. - ["", false, false], - ["0", true, true], // Delete the policy. - ["", true, true], - ]), "Policy set-update-delete cycle with checks."); - - // Set a policy, update, then revert to the old one. - promise_test(origin_policy_csp_test_case([ - ["", true, true], - ["policy-csp-1", true, false], // policy-csp-1, which forbids eval. - ["policy-csp-2", false, false], // Forbid script + eval. - ["policy-csp-1", true, false], // policy-csp-1 again. - ["0", true, true], - ]), "Policy set-update-delete cycle."); - - // Set, delete, re-set, and re-delete a policy. - promise_test(origin_policy_csp_test_case([ - ["", true, true], // No policy. - ["policy-csp-1", true, false], // policy-csp-1, which forbids eval. - ["", true, false], - ["0", true, true], // Delete the policy. - ["", true, true], - ["policy-csp-1", true, false], // Set policy after policy was deleted. - ["", true, false], - ["0", true, true], // Delete the policy again. - ["", true, true], - ]), "Policy re-set and re-delete."); - - // We've had some bugs with repeated policies being set, so lets just - // run through a set-update-delete cycle but with every request being - // made twice. - promise_test(origin_policy_csp_test_case([ - ["", true, true], - ["", true, true], - ["policy-csp-1", true, false], - ["policy-csp-1", true, false], - ["policy-csp-2", false, false], - ["policy-csp-2", false, false], - ["0", true, true], - ["0", true, true], - ["", true, true], - ["", true, true], - ]), "Double Trouble"); - </script> -</body> -</html> diff --git a/tests/wpt/web-platform-tests/origin-policy/policies/README.md b/tests/wpt/web-platform-tests/origin-policy/policies/README.md new file mode 100644 index 00000000000..b07be74035f --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/policies/README.md @@ -0,0 +1,5 @@ +These policies are served via the Python script at /.well-known/origin-policy. Their filenames must be in the form `subdomain human-facing-string-with-no-spaces.json`. They will be served in response to requests to that subdomain. + +The human-facing string has no impact on the tests, and just makes it easier to scroll through the list. + +The list of potential hostnames is created by `tools/serve/serve.py`'s `_make_origin_policy_subdomains` function, and can be expanded as necessary. diff --git a/tests/wpt/web-platform-tests/origin-policy/policies/op1 cspfp-comma-in-policy.json b/tests/wpt/web-platform-tests/origin-policy/policies/op1 cspfp-comma-in-policy.json new file mode 100644 index 00000000000..189d28db8ba --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/policies/op1 cspfp-comma-in-policy.json @@ -0,0 +1,13 @@ +{ + "ids": [ + "cspfp-comma-in-policy" + ], + "content_security": { + "policies": [ + "script-src 'self' 'unsafe-inline', img-src 'none'" + ] + }, + "features": { + "policy": "camera 'self' https://example.com/, geolocation 'self' https://example.com/" + } +} diff --git a/tests/wpt/web-platform-tests/origin-policy/policies/op10 cspfp-valid.json b/tests/wpt/web-platform-tests/origin-policy/policies/op10 cspfp-valid.json new file mode 100644 index 00000000000..0fc1d163f2b --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/policies/op10 cspfp-valid.json @@ -0,0 +1,13 @@ +{ + "ids": [ + "cspfp-valid" + ], + "content_security": { + "policies": [ + "script-src 'self' 'unsafe-inline'; img-src 'none'" + ] + }, + "features": { + "policy": "camera 'self' https://example.com/; geolocation 'self' https://example.com/" + } +} diff --git a/tests/wpt/web-platform-tests/origin-policy/policies/op2 cspfp-double-top-level.json b/tests/wpt/web-platform-tests/origin-policy/policies/op2 cspfp-double-top-level.json new file mode 100644 index 00000000000..26d798b585d --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/policies/op2 cspfp-double-top-level.json @@ -0,0 +1,21 @@ +{ + "ids": [ + "cspfp-double-top-level" + ], + "content_security": { + "policies": [ + "script-src 'self' 'unsafe-inline'" + ] + }, + "content_security": { + "policies": [ + "img-src 'none'" + ] + }, + "features": { + "policy": "camera 'self' https://example.com/" + }, + "features": { + "policy": "geolocation 'self' https://example.com/" + } +} diff --git a/tests/wpt/web-platform-tests/origin-policy/policies/op3 cspfp-double-second-level.json b/tests/wpt/web-platform-tests/origin-policy/policies/op3 cspfp-double-second-level.json new file mode 100644 index 00000000000..6665332807b --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/policies/op3 cspfp-double-second-level.json @@ -0,0 +1,17 @@ +{ + "ids": [ + "cspfp-double-second-level" + ], + "content_security": { + "policies": [ + "script-src 'self' 'unsafe-inline'" + ], + "policies": [ + "img-src 'none'" + ] + }, + "features": { + "policy": "camera 'self' https://example.com/", + "policy": "geolocation 'self' https://example.com/" + } +} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-non-array b/tests/wpt/web-platform-tests/origin-policy/policies/op4 csp-non-array.json index b96546c5f88..5916b1ff9b5 100644 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-non-array +++ b/tests/wpt/web-platform-tests/origin-policy/policies/op4 csp-non-array.json @@ -1,4 +1,7 @@ { + "ids": [ + "csp-non-array" + ], "content_security": { "policies": "script-src 'self' 'unsafe-inline'" } diff --git a/tests/wpt/web-platform-tests/origin-policy/policies/op5 cspfp-non-object.json b/tests/wpt/web-platform-tests/origin-policy/policies/op5 cspfp-non-object.json new file mode 100644 index 00000000000..7488f9bfef2 --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/policies/op5 cspfp-non-object.json @@ -0,0 +1,9 @@ +{ + "ids": [ + "cspfp-non-object" + ], + "content_security": [ + "script-src 'self' 'unsafe-inline'" + ], + "features": "camera 'self' https://example.com/" +} diff --git a/tests/wpt/web-platform-tests/origin-policy/policies/op6 cspfp-non-string.json b/tests/wpt/web-platform-tests/origin-policy/policies/op6 cspfp-non-string.json new file mode 100644 index 00000000000..5c6941bf8fd --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/policies/op6 cspfp-non-string.json @@ -0,0 +1,17 @@ +{ + "ids": [ + "csp-non-string" + ], + "content_security": { + "policies": [ + [ + "script-src 'self' 'unsafe-inline'" + ] + ] + }, + "features": { + "policy": [ + "camera 'self' https://example.com/" + ] + } +} diff --git a/tests/wpt/web-platform-tests/origin-policy/policies/op7 csp-noimg-report-only.json b/tests/wpt/web-platform-tests/origin-policy/policies/op7 csp-noimg-report-only.json new file mode 100644 index 00000000000..fd5c522042a --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/policies/op7 csp-noimg-report-only.json @@ -0,0 +1,10 @@ +{ + "ids": [ + "csp-noimg-report-only" + ], + "content_security": { + "policies_report_only": [ + "img-src 'none'" + ] + } +} diff --git a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-noimg b/tests/wpt/web-platform-tests/origin-policy/policies/op8 csp-noimg.json index cd57b7b21e9..b88e1f80bf9 100644 --- a/tests/wpt/web-platform-tests/.well-known/origin-policy/policy-content-security-noimg +++ b/tests/wpt/web-platform-tests/origin-policy/policies/op8 csp-noimg.json @@ -1,4 +1,7 @@ { + "ids": [ + "csp-noimg" + ], "content_security": { "policies": ["img-src 'none'"] } diff --git a/tests/wpt/web-platform-tests/origin-policy/policies/op9 csp-valid-with-multi-item-array.json b/tests/wpt/web-platform-tests/origin-policy/policies/op9 csp-valid-with-multi-item-array.json new file mode 100644 index 00000000000..edd743038db --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/policies/op9 csp-valid-with-multi-item-array.json @@ -0,0 +1,11 @@ +{ + "ids": [ + "csp-valid-with-multi-item-array" + ], + "content_security": { + "policies": [ + "script-src 'self' 'unsafe-inline'", + "img-src 'none'" + ] + } +} diff --git a/tests/wpt/web-platform-tests/origin-policy/resources/origin-policy-test-runner.js b/tests/wpt/web-platform-tests/origin-policy/resources/origin-policy-test-runner.js new file mode 100644 index 00000000000..a1c6453debd --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/resources/origin-policy-test-runner.js @@ -0,0 +1,28 @@ +window.runTestsInSubframe = ({ hostname, testJS }) => { + test(() => { + assert_equals(location.protocol, "https:"); + }, "Prerequisite check: running on HTTPS"); + + promise_test(() => new Promise((resolve, reject) => { + const url = new URL(window.location.href); + url.hostname = `${hostname}.${document.domain}`; + url.pathname = "/origin-policy/resources/subframe-with-origin-policy.py"; + + // Normalize the URL so that callers can idiomatically give values relative + // to themselves. + url.searchParams.append("test", new URL(testJS, document.baseURI).pathname); + + const iframe = document.createElement("iframe"); + iframe.src = url.href; + + // We need to delegate anything we plan to toggle with FP otherwise it will + // be locked to disallowed. + iframe.allow = "camera *; geolocation *"; + + iframe.onload = resolve; + iframe.onerror = () => reject(new Error(`Could not load ${url.href}`)); + document.body.append(iframe); + + fetch_tests_from_window(iframe.contentWindow); + }), "Test setup of the iframe"); +}; diff --git a/tests/wpt/web-platform-tests/origin-policy/resources/subframe-with-origin-policy.py b/tests/wpt/web-platform-tests/origin-policy/resources/subframe-with-origin-policy.py new file mode 100644 index 00000000000..636a649a0e2 --- /dev/null +++ b/tests/wpt/web-platform-tests/origin-policy/resources/subframe-with-origin-policy.py @@ -0,0 +1,26 @@ +def main(request, response): + """Send a response with the Origin-Policy header asking for the latest + policy, that runs the test JS given by the ?test= argument. This is meant + to be loaded into an iframe by origin-policy-test-runner.js. + + The ?test= argument is best given as an absolute path (starting with /) + since it will otherwise be interpreted relative to where this file is + served. + """ + test_file = request.GET.first("test") + + response.headers.set("Origin-Policy", "allowed=(latest)") + response.headers.set("Content-Type", "text/html") + + return """ + <!DOCTYPE html> + <meta charset="utf-8"> + <title>Origin policy subframe</title> + + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + + <div id="log"></div> + + <script type="module" src="%s"></script> + """ % test_file diff --git a/tests/wpt/web-platform-tests/origin-policy/sec-origin-policy-header.html.py b/tests/wpt/web-platform-tests/origin-policy/sec-origin-policy-header.html.py deleted file mode 100644 index 7754e04a313..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/sec-origin-policy-header.html.py +++ /dev/null @@ -1,64 +0,0 @@ -def main(request, response): - """Send a response with the origin policy indicated by the ?policy= argument. - - Won't send a policy when the browser doesn't indicate support. - The response tests whether inline script and eval are allowed, and will - send a corresponding message to the parent frame. - For easier debugging, we'll also show the results in-page. - """ - origin_policy_header = "Sec-Origin-Policy" - request_policy = request.headers.get(origin_policy_header) - response_policy = request.GET.first("policy", default="") - - if request_policy and response_policy: - response.headers.set(origin_policy_header, "policy=%s" % response_policy) - response.headers.set("Vary", "sec-origin-policy") - - response.headers.set("Content-Type", "text/html"); - return """ - <html> - <head> - <title>Page with an Origin Policy</title> - </head> - <body> - <script nonce=test> - let inlineAllowed = false; - let evalAllowed = false; - try { eval('evalAllowed = true;'); } catch (e) {}; - </script> - <script> - inlineAllowed = true; - </script> - - <p>Reveal whether CSP with "unsafe-inline" or "unsafe-eval" is present:</p> - <ul> - <li>inline script allowed: <span id=inline_allowed></span></li> - <li>eval allowed: <span id=eval_allowed></span></li> - </ul> - - <script nonce=test> - const result = { - "inline_allowed": inlineAllowed, - "eval_allowed": evalAllowed, - }; - - // Mirror content into the page for easy debugging: - const styles = { - true: "font-weight: bold; color: green;", - false: "font-weight: bold; color: red", - } - for (const [key, value] of Object.entries(result)) { - let element = document.getElementById(key); - element.textContent = value.toString(); - element.style = styles[value]; - } - - // Send result to parent frame for evaluation. - if (window.parent) { - window.parent.postMessage(result, "*"); - } - </script> - </body> - </html> - """ - diff --git a/tests/wpt/web-platform-tests/origin-policy/sec-origin-policy-subframe.html b/tests/wpt/web-platform-tests/origin-policy/sec-origin-policy-subframe.html deleted file mode 100644 index d716ba11d97..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/sec-origin-policy-subframe.html +++ /dev/null @@ -1,3 +0,0 @@ -The forbidden frame. -Content shouldn't matter, because this frame shouldn't be loaded. -So there. diff --git a/tests/wpt/web-platform-tests/origin-policy/sec-origin-policy-subframe.html.sub.headers b/tests/wpt/web-platform-tests/origin-policy/sec-origin-policy-subframe.html.sub.headers deleted file mode 100644 index a046f0096ba..00000000000 --- a/tests/wpt/web-platform-tests/origin-policy/sec-origin-policy-subframe.html.sub.headers +++ /dev/null @@ -1,3 +0,0 @@ -Report-To: { "group": "report-to-group", "max_age": 1000, "endpoints": [{ "url": "https://{{hosts[alt][]}}:{{ports[https][0]}}/content-security-policy/support/report.py?op=put&reportID=5b4d35b6-0771-46fe-8700-ed2bb59ed4be" }] } -Sec-Origin-Policy: policy=nonexistingpolicy, report-to=report-to-group - diff --git a/tests/wpt/web-platform-tests/payment-handler/app-respond-with-minimal-ui.js b/tests/wpt/web-platform-tests/payment-handler/app-respond-with-minimal-ui.js new file mode 100644 index 00000000000..0e6b1b78b91 --- /dev/null +++ b/tests/wpt/web-platform-tests/payment-handler/app-respond-with-minimal-ui.js @@ -0,0 +1,3 @@ +self.addEventListener('canmakepayment', event => { + event.respondWithMinimalUI(event.methodData[0].data.test); +}); diff --git a/tests/wpt/web-platform-tests/payment-handler/respond-with-minimal-ui.https.html b/tests/wpt/web-platform-tests/payment-handler/respond-with-minimal-ui.https.html new file mode 100644 index 00000000000..2474185a5ed --- /dev/null +++ b/tests/wpt/web-platform-tests/payment-handler/respond-with-minimal-ui.https.html @@ -0,0 +1,89 @@ +<!doctype html> +<meta charset="utf-8"> +<title>Tests for CanMakePaymentEvent.respondWithMinimalUI</title> +<link rel="help" href="https://gist.github.com/rsolomakhin/eba91c185028899883d2c7f37f357d7c"> +<link rel="manifest" href="manifest.json"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +const methodName = window.location.origin; + +async function registerApp(methodName) { + await navigator.serviceWorker.register('app-respond-with-minimal-ui.js'); + const registration = await navigator.serviceWorker.ready; + if (!registration.paymentManager) { + return; + } + if (registration.paymentManager.requestPermission) { + const permission = await registration.paymentManager.requestPermission(); + if (permission !== 'granted') { + return; + } + } + await registration.paymentManager.instruments.set('instrument-key', { + name: 'Test Payment Method', + method: methodName, + }); + return registration; +} + +async function hasEnrolledInstrument(supportedMethods, data) { + return (new PaymentRequest( + [{supportedMethods, data}], + {total: {label: 'Total', amount: {currency: 'USD', value: '0.01'}}})) + .hasEnrolledInstrument(); +} + +promise_test(async t => { + await registerApp(methodName); + assert_false(await hasEnrolledInstrument(methodName, {test: 0})); +}, 'respondWithMinimalUI(0) causes hasEnrolledInstrument() to return "false"'); + +promise_test(async t => { + await registerApp(methodName); + assert_false(await hasEnrolledInstrument(methodName, {test: {}})); +}, 'respondWithMinimalUI({}) causes hasEnrolledInstrument() to return "false"'); + +promise_test(async t => { + await registerApp(methodName); + assert_true(await hasEnrolledInstrument(methodName, + {test: {canMakePayment: true}})); +}, 'respondWithMinimalUI({canMakePayment: true}) causes ' + + 'hasEnrolledInstrument() to return "true"'); + +promise_test(async t => { + await registerApp(methodName); + assert_false(await hasEnrolledInstrument(methodName, + {test: {canMakePayment: false}})); +}, 'respondWithMinimalUI({canMakePayment: false}) causes ' + + 'hasEnrolledInstrument() to return "false"'); + +promise_test(async t => { + await registerApp(methodName); + assert_true(await hasEnrolledInstrument(methodName, {test: + {canMakePayment: true, readyForMinimalUI: true}})); +}, 'respondWithMinimalUI({canMakePayment: true, readyForMinimalUI: true}) does ' + + 'not crash'); + +promise_test(async t => { + await registerApp(methodName); + assert_true(await hasEnrolledInstrument(methodName, {test: + {canMakePayment: true, readyForMinimalUI: true, accountBalance: ''}})); +}, 'respondWithMinimalUI({canMakePayment: true, readyForMinimalUI: true, ' + + 'accountBalance: ""}) does not crash'); + +promise_test(async t => { + await registerApp(methodName); + assert_true(await hasEnrolledInstrument(methodName, {test: + {canMakePayment: true, readyForMinimalUI: true, accountBalance: '--'}})); +}, 'respondWithMinimalUI({canMakePayment: true, readyForMinimalUI: true, ' + + 'accountBalance: "--"}) does not crash'); + +promise_test(async t => { + await registerApp(methodName); + assert_true(await hasEnrolledInstrument(methodName, {test: + {canMakePayment: true, readyForMinimalUI: true, accountBalance: '6.78'}})); +}, 'respondWithMinimalUI({canMakePayment: true, readyForMinimalUI: true, ' + + 'accountBalance: "6.78"}) does not crash'); + +</script> diff --git a/tests/wpt/web-platform-tests/workers/dedicated-worker-in-data-url-context.window.js b/tests/wpt/web-platform-tests/workers/dedicated-worker-in-data-url-context.window.js new file mode 100644 index 00000000000..1b1ce232a73 --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/dedicated-worker-in-data-url-context.window.js @@ -0,0 +1,109 @@ +// META: title=data URL dedicated worker in data URL context +// META: script=/service-workers/service-worker/resources/test-helpers.sub.js +const mimeType = 'application/javascript'; + +// Tests creating a dedicated worker in a data URL iframe. +promise_test(async t => { + const nestedWorkerScriptURL = + new URL('/workers/support/post-message-on-load-worker.js', location.href); + + // This code will be executed in a data URL iframe. The iframe tries to create + // a dedicated worker from |nestedWorkerScriptURL|, but that should result in + // a failure. This is because the data URL iframe has an opaque origin, and + // script fetch is handled as a cross-origin request. + const frameCode = ` + <script> + try { + const worker = new Worker('${nestedWorkerScriptURL}'); + worker.onmessage = e => { + window.parent.postMessage( + 'Worker construction unexpectedly succeeded', '*'); + }; + worker.onerror = e => window.parent.postMessage('PASS', '*'); + } catch (e) { + // Cross-origin request should asynchronously fail during worker script + // fetch because its request mode is 'same-origin'. + window.parent.postMessage( + 'Worker construction unexpectedly synchronously failed', '*'); + } + </script> + `; + + const frame = await with_iframe(`data:text/html;base64,${btoa(frameCode)}`); + const result = await new Promise(r => window.onmessage = e => r(e.data)); + assert_equals(result, 'PASS'); +}, 'Create a dedicated worker in a data url frame'); + +// Tests creating a dedicated worker in a data URL dedicated worker (i.e., +// nested dedicated worker). +promise_test(async t => { + const nestedWorkerScriptURL = + new URL('/workers/support/post-message-on-load-worker.js', location.href); + + // This code will be executed in a data URL dedicated worker. The worker tries + // to create a nested dedicated worker from |nestedWorkerScriptURL|, but that + // should result in a failure. This is because the data URL dedicated worker + // has an opaque origin, and script fetch is handled as a cross-origin + // request. + const workerCode = ` + try { + const worker = new Worker('${nestedWorkerScriptURL}'); + worker.onmessage = + e => postMessage('Worker construction unexpectedly succeeded'); + worker.onerror = e => postMessage('PASS'); + } catch (e) { + // Cross-origin request should asynchronously fail during worker script + // fetch because its request mode is 'same-origin'. + postMessage('Worker construction unexpectedly synchronously failed'); + } + `; + + const result = await new Promise((resolve, reject) => { + const worker = new Worker(`data:${mimeType};base64,${btoa(workerCode)}`); + worker.onmessage = e => resolve(e.data); + worker.onerror = e => reject(e.message); + }); + assert_equals(result, 'PASS'); +}, 'Create a dedicated worker in a data url dedicated worker'); + +// Tests creating a data URL dedicated worker in a data URL iframe. +promise_test(async t => { + // This code will be executed in a data URL iframe. The iframe tries to create + // a data URL dedicated worker. Fetching a data URL from the data URL iframe + // whose origin is opaque is allowed, so the worker construction should + // succeed. The iframe posts the result to the parent frame. + const frameCode = ` + <script> + const worker = new Worker('data:${mimeType},postMessage("PASS");'); + worker.onmessage = e => window.parent.postMessage(e.data, '*'); + worker.onerror = e => { + window.parent.postMessage('FAIL: ' + e.message, '*'); + }; + </script> + `; + + const frame = await with_iframe(`data:text/html;base64,${btoa(frameCode)}`); + const result = await new Promise(r => window.onmessage = e => r(e.data)); + assert_equals(result, 'PASS'); +}, 'Create a data url dedicated worker in a data url frame'); + +// Tests creating a data URL dedicated worker in a data URL dedicated worker +// (i.e., nested dedicated worker). +promise_test(async t => { + // This code will be executed in a data URL dedicated worker. The worker tries + // to create a nested data URL dedicated worker. Fetching a data URL from the + // data URL dedicated worker is allowed, so the worker construction should + // succeed. The worker posts the result to the parent frame. + const workerCode = ` + const worker = new Worker('data:${mimeType},postMessage("PASS");'); + worker.onmessage = e => postMessage(e.data); + worker.onerror = e => postMessage('FAIL: ' + e.message); + `; + + const result = await new Promise((resolve, reject) => { + const worker = new Worker(`data:${mimeType};base64,${btoa(workerCode)}`); + worker.onmessage = e => resolve(e.data); + worker.onerror = e => reject(e.message); + }); + assert_equals(result, 'PASS'); +}, 'Create a data url dedicated worker in a data url dedicated worker'); diff --git a/tests/wpt/web-platform-tests/workers/shared-worker-in-data-url-context.window.js b/tests/wpt/web-platform-tests/workers/shared-worker-in-data-url-context.window.js new file mode 100644 index 00000000000..f0cc98b75cb --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/shared-worker-in-data-url-context.window.js @@ -0,0 +1,63 @@ +// META: title=data URL shared worker in data URL context +// META: script=/service-workers/service-worker/resources/test-helpers.sub.js +const mimeType = 'application/javascript'; + +// Tests creating a data URL shared worker in a data URL iframe. +promise_test(async t => { + const nestedWorkerScriptURL = + new URL('/workers/support/post-message-on-load-worker.js', location.href); + + // This code will be executed in a data URL iframe. The iframe tries to create + // a shared worker from |nestedWorkerScriptURL|, but that should result in a + // failure. This is because the data URL iframe has an opaque origin, and + // script fetch is handled as a cross-origin request. + const frameCode = ` + <script> + try { + const worker = new SharedWorker('${nestedWorkerScriptURL}'); + worker.port.onmessage = e => { + window.parent.postMessage( + 'SharedWorker construction unexpectedly succeeded', '*'); + }; + worker.onerror = e => window.parent.postMessage('PASS', '*'); + } catch (e) { + // Cross-origin request should asynchronously fail during worker script + // fetch because its request mode is 'same-origin'. + window.parent.postMessage( + 'SharedWorker construction unexpectedly synchronously failed', '*'); + } + </script> + `; + + const frame = await with_iframe(`data:text/html;base64,${btoa(frameCode)}`); + const result = await new Promise(r => window.onmessage = e => r(e.data)); + assert_equals(result, 'PASS'); +}, 'Create a shared worker in a data url frame'); + +// Tests creating a data URL shared worker in a data URL iframe. +promise_test(async t => { + const workerCode = `onconnect = e => e.ports[0].postMessage("PASS");`; + + // This code will be executed in a data URL iframe. The iframe tries to create + // a data URL shared worker. Fetching a data URL from the data URL shared + // worker is allowed, so the worker construction should succeed. The worker + // posts the result to the parent frame. + const frameCode = ` + <script> + try { + const worker = new SharedWorker('data:${mimeType},${workerCode};'); + worker.port.onmessage = e => window.parent.postMessage(e.data, '*'); + worker.onerror = e => { + window.parent.postMessage('FAIL: ' + e.message, '*'); + }; + } catch (e) { + window.parent.postMessage( + 'SharedWorker construction unexpectedly synchronously failed', '*'); + } + </script> + `; + + const frame = await with_iframe(`data:text/html;base64,${btoa(frameCode)}`); + const result = await new Promise(r => window.onmessage = e => r(e.data)); + assert_equals(result, 'PASS'); +}, 'Create a data url shared worker in a data url frame'); diff --git a/tests/wpt/web-platform-tests/workers/support/post-message-on-load-worker.js b/tests/wpt/web-platform-tests/workers/support/post-message-on-load-worker.js new file mode 100644 index 00000000000..e1c547ab6a4 --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/support/post-message-on-load-worker.js @@ -0,0 +1,10 @@ +if ('DedicatedWorkerGlobalScope' in self && + self instanceof DedicatedWorkerGlobalScope) { + postMessage('LOADED'); +} else if ( + 'SharedWorkerGlobalScope' in self && + self instanceof SharedWorkerGlobalScope) { + self.onconnect = e => { + e.ports[0].postMessage('LOADED'); + }; +} |