diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 0a87afe0b01..f62d6f1bec8 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -16238,8 +16238,15 @@ } }, "user-activation": { - "activation-hierarchy-parent-manual.sub.tentative.html": [ - "7dd8018573db2808b7166cf7e94650a2a5a330bc", + "activation-hierarchy-crossorigin-parent-manual.sub.html": [ + "601b9003f7ea9ba9847366a9365a08139f810078", + [ + null, + {} + ] + ], + "activation-hierarchy-sameorigin-parent-manual.html": [ + "a7f423eea56f0e6dd41ecf9a950137ef502fdf12", [ null, {} @@ -136774,32 +136781,6 @@ {} ] ], - "ttwf-reftest-flex-wrap-reverse.html": [ - "f2aefa29e8b5e4461e6a8ae9eb76bc8c1c771698", - [ - null, - [ - [ - "/css/css-flexbox/reference/ttwf-reftest-flex-wrap-reverse-ref.html", - "==" - ] - ], - {} - ] - ], - "ttwf-reftest-flex-wrap.html": [ - "3acd79c46500a81219edbc57fc8f434d22342a8d", - [ - null, - [ - [ - "/css/css-flexbox/reference/ttwf-reftest-flex-wrap-ref.html", - "==" - ] - ], - {} - ] - ], "whitespace-in-flexitem-001.html": [ "bec931a4e331192704701d261807e9b0ce7d3c6b", [ @@ -240355,7 +240336,7 @@ [] ], "echo-ua-client-hints-received.py": [ - "9cf1f8e32ffe3e1079a9ae48303ff314210aa145", + "4af98c75ccedebe10aa02f17881099e95af1527f", [] ], "expect-client-hints-headers-iframe.py": [ @@ -283578,14 +283559,6 @@ "ttwf-reftest-flex-inline-ref.html": [ "369de990ff2190ea0e4592d4dfc354a8a8fcae16", [] - ], - "ttwf-reftest-flex-wrap-ref.html": [ - "bb3e2b947af42106dec6974664075afb9e8cb7d3", - [] - ], - "ttwf-reftest-flex-wrap-reverse-ref.html": [ - "fe6e510ccab62b7121e95bbb3675f7940d7510c9", - [] ] }, "scrollbars-auto-ref.html": [ @@ -315812,7 +315785,7 @@ [] ], "report.py": [ - "17ca65cbf6b3f384dabff5a479eb22730d3de511", + "1f628ca878d6bcaf8f32e2c6ed524e6f0eeda4ca", [] ], "reporting-empty-frame.html": [ @@ -323735,14 +323708,22 @@ }, "user-activation": { "resources": { - "activation-hierarchy-child.sub.html": [ - "ebccc8c0dbf9da8a95049712f0fdd641b66b629b", + "activation-hierarchy-crossorigin-child.sub.html": [ + "6dbd46830442d5790207e1309bf4403a353c9c62", [] ], - "activation-hierarchy-grandchild.html": [ + "activation-hierarchy-crossorigin-grandchild.html": [ "b9fe19a746ffbbe63740df67a77da8a894b573ae", [] ], + "activation-hierarchy-sameorigin-child.html": [ + "d54c7efc9bdcf2cc5c79fed6838729975bee4cfa", + [] + ], + "activation-hierarchy-sameorigin-grandchild.html": [ + "9d664e2356a87496416644d639598adbaa8c43dd", + [] + ], "child-four.html": [ "65d17f273e1868312f59c89f3f2d05bda759ae1a", [] @@ -324475,90 +324456,6 @@ "3803e350c844b4af77b871831817ac0d90aca97f", [] ], - "builtin-support.tentative": { - "@std": { - "__dir__.headers": [ - "e7ec0d6699d07e5b13d0cb6f24c3639258fccdaa", - [] - ], - "blank": [ - "38e1891bf7d5db9ad7063dc1f22bb17f8b1d4446", - [] - ], - "none": [ - "69e165cce5e223684c9d0f0f7848bc6fc02b14cd", - [] - ] - }, - "bare": { - "__dir__.headers": [ - "e7ec0d6699d07e5b13d0cb6f24c3639258fccdaa", - [] - ], - "blank": [ - "841d433acf72f828c34faca23f26e9afd10fbab7", - [] - ], - "none": [ - "2aec0d72826f203074dea5a5268b9f937bdb7183", - [] - ], - "std-blank": [ - "5ded98fd382a52a11d52af57cc7e79f56b083843", - [] - ], - "std-none": [ - "1437d9ff1e0c0c60672a1f656a2ab91aa01601db", - [] - ] - }, - "imported": { - "resources": { - "helpers": { - "parsing.js": [ - "3000f782a11a197b37e3fc7658190fc67ffd4050", - [] - ] - }, - "parsing-addresses.js": [ - "0f5fc73506b1222dd7b3ac422d8c6232ac202bd7", - [] - ], - "parsing-schema.js": [ - "72b6e625d611d1551ff4fc9a2ead389b309fbafa", - [] - ], - "parsing-scope-keys.js": [ - "4993f3a9a8bac441b883be55b58d40423114beab", - [] - ], - "parsing-specifier-keys.js": [ - "9eb423a19eb1fb417526946c1701c7c9dde27c9c", - [] - ], - "resolving-builtins.js": [ - "a9383df843d44794351d5c6ffa5580d4d1254b9c", - [] - ], - "resolving-not-yet-implemented.js": [ - "93d782fdad83d58160061a4caa40659292a50866", - [] - ], - "resolving-scopes.js": [ - "ca19a66840601efe66fa2db24cffdcc0727681c5", - [] - ], - "resolving.js": [ - "29ee31ccbc936787894a43de1f6625608d14a192", - [] - ] - } - }, - "static-import.py": [ - "8d0f5d9f4204384ec9612ddca3ec30cec017d14e", - [] - ] - }, "common": { "README.md": [ "6092c0d767050d0c1b13cfd2360f7a7f17d656a5", @@ -324690,10 +324587,6 @@ "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", [] ], - "jest-test-helper.js": [ - "752c987df52036d1d54985bf1a9f4b27ce20c2d4", - [] - ], "log.js": [ "a024a29bf2482c78cf7eb96544d38217f1d81f81", [] @@ -327685,22 +327578,6 @@ ] }, "sharedworker-classic": { - "cross-http.keep-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], - "cross-http.no-redirect.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], - "cross-http.swap-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], - "cross-https.swap-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], "same-http.keep-scheme.https.html.headers": [ "46e2255e388e9e08377d625b55653a007d59c14e", [] @@ -327709,10 +327586,6 @@ "46e2255e388e9e08377d625b55653a007d59c14e", [] ], - "same-http.swap-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], "same-https.keep-scheme.https.html.headers": [ "46e2255e388e9e08377d625b55653a007d59c14e", [] @@ -327720,10 +327593,6 @@ "same-https.no-redirect.https.html.headers": [ "46e2255e388e9e08377d625b55653a007d59c14e", [] - ], - "same-https.swap-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] ] }, "sharedworker-import-data": { @@ -327769,22 +327638,6 @@ ] }, "sharedworker-module": { - "cross-http.keep-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], - "cross-http.no-redirect.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], - "cross-http.swap-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], - "cross-https.swap-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], "same-http.keep-scheme.https.html.headers": [ "46e2255e388e9e08377d625b55653a007d59c14e", [] @@ -327793,10 +327646,6 @@ "46e2255e388e9e08377d625b55653a007d59c14e", [] ], - "same-http.swap-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], "same-https.keep-scheme.https.html.headers": [ "46e2255e388e9e08377d625b55653a007d59c14e", [] @@ -327804,10 +327653,6 @@ "same-https.no-redirect.https.html.headers": [ "46e2255e388e9e08377d625b55653a007d59c14e", [] - ], - "same-https.swap-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] ] }, "video-tag": { @@ -327867,22 +327712,6 @@ ] }, "worker-classic": { - "cross-http.keep-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], - "cross-http.no-redirect.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], - "cross-http.swap-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], - "cross-https.swap-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], "same-http.keep-scheme.https.html.headers": [ "46e2255e388e9e08377d625b55653a007d59c14e", [] @@ -327891,10 +327720,6 @@ "46e2255e388e9e08377d625b55653a007d59c14e", [] ], - "same-http.swap-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], "same-https.keep-scheme.https.html.headers": [ "46e2255e388e9e08377d625b55653a007d59c14e", [] @@ -327902,10 +327727,6 @@ "same-https.no-redirect.https.html.headers": [ "46e2255e388e9e08377d625b55653a007d59c14e", [] - ], - "same-https.swap-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] ] }, "worker-import-data": { @@ -327951,22 +327772,6 @@ ] }, "worker-module": { - "cross-http.keep-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], - "cross-http.no-redirect.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], - "cross-http.swap-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], - "cross-https.swap-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], "same-http.keep-scheme.https.html.headers": [ "46e2255e388e9e08377d625b55653a007d59c14e", [] @@ -327975,10 +327780,6 @@ "46e2255e388e9e08377d625b55653a007d59c14e", [] ], - "same-http.swap-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] - ], "same-https.keep-scheme.https.html.headers": [ "46e2255e388e9e08377d625b55653a007d59c14e", [] @@ -327986,10 +327787,6 @@ "same-https.no-redirect.https.html.headers": [ "46e2255e388e9e08377d625b55653a007d59c14e", [] - ], - "same-https.swap-scheme.https.html.headers": [ - "46e2255e388e9e08377d625b55653a007d59c14e", - [] ] }, "worklet-animation": { @@ -338608,7 +338405,7 @@ ] }, "testcommon.js": [ - "ca2596885669f24b5f170cf1b023cd3c3cc34b93", + "ab22ff64835e8c12fe0f2432060b79c44881bb5f", [] ] }, @@ -343212,7 +343009,7 @@ [] ], "requirements_mypy.txt": [ - "a478015893d71a45953f9651844a35c2a46ba7d2", + "988ffe848174f7215278c2c4019f924bed3a61f5", [] ], "runner": { @@ -348053,7 +347850,7 @@ [] ], "requirements_firefox.txt": [ - "ae72940810432bed693c001d4b057a1214fd2dac", + "d541a49f3c0992c4a456ce4ebb717908683a464e", [] ], "requirements_ie.txt": [ @@ -350132,7 +349929,7 @@ ] }, "testcommon.js": [ - "f89cbbaf9361b1e50b1473e93ae63aaa1abb34c7", + "811fe784c2635546c8bd1d6befc276d1cfbfad9a", [] ], "timing-model": { @@ -351271,7 +351068,7 @@ ] }, "version.js": [ - "f8067d48eeb9a9942cd2797c57fbaa471044671f", + "0b58dd9b3c4430d337b4a6241f2345f4073a12b9", [] ] }, @@ -351325,6 +351122,10 @@ [] ] }, + "capability_info.js": [ + "10947ee1367e1d943e52a605fe868a06376badbe", + [] + ], "command_buffer": { "basic.spec.js": [ "6762a563c56edafeb225df6af27bd4507825e56f", @@ -351332,7 +351133,7 @@ ], "compute": { "basic.spec.js": [ - "598edea66ab3946b45548ca3cea1d8becd8aec55", + "536f7a9003eded24dced4ebc206c78472b26acb0", [] ] }, @@ -351346,17 +351147,17 @@ [] ], "rendering.spec.js": [ - "7bb7c546b5842aa585dec89ec456ad78a4ccfc18", + "b26b9fbc859d5b2a5fbf79e9e1ca3f76cb02e455", [] ], "storeop.spec.js": [ - "5bf6bd0116c80eea3082fab2f84522027755672b", + "1f758cc5c2ea74d9f2e36f5dd71d321c76cde822", [] ] } }, "copyImageBitmapToTexture.spec.js": [ - "b201bb49750c4f368fe6c39aa1462f1b026a3f69", + "42ad8507ec949c55c441cc3c2808ab8d6ebee7e5", [] ], "examples.spec.js": [ @@ -351367,12 +351168,8 @@ "af6482fcab508705e884cd205cf31f7b9762990a", [] ], - "format_info.js": [ - "5d54bbb8c51ecd39ddb4869ce29e46571726a0cc", - [] - ], "gpu_test.js": [ - "236e9eaeb9d10923d840ff9cbe885a9d534e9230", + "7ab5320d6e95c8c3914c26db5f0cc7ee7a0b0843", [] ], "index.js": [ @@ -351381,33 +351178,33 @@ ], "resource_init": { "sampled_texture_clear.spec.js": [ - "66cee08addd60931f1192a6bf7bc97227b5b4130", + "a8fb1ad71d1ef0fa7030dd59a58733ad34fc0841", [] ] }, "validation": { "createBindGroup.spec.js": [ - "22472f8dff2cf6b4d4206d7e29bc652a56466c4d", + "2f42a8b643d4905a5f15f3abc312e20ce569ecfa", [] ], "createBindGroupLayout.spec.js": [ - "22fa8f5d606e01841485d2567849db8dcd211168", + "b48db9598dd62fc933e14b08974c3aa4af6fbd63", [] ], "createPipelineLayout.spec.js": [ - "9d5394f925b6bec87b1ec7a01f9bd66aa994929e", + "0018c24e54075cf1551af3bbb1cb4d1977386907", [] ], "createRenderPipeline.spec.js": [ - "f6a555526559969c659c74a49d3035573fc013db", + "e4dd32af9e8de43bc29f8bd7ced45638d7a1e6a4", [] ], "createTexture.spec.js": [ - "08c6d1b50b596e32b780f08a7be6d370d0951a75", + "a7317a88f5badd9d65fc881a2a34a8cf652fdee0", [] ], "createView.spec.js": [ - "855d32a3f43990295513385ebbd161fa38d4f04a", + "a4fe7ac2a930ee9bec57528d743f119c8749b6fc", [] ], "error_scope.spec.js": [ @@ -351423,7 +351220,7 @@ [] ], "render_pass.spec.js": [ - "f788fb63d8d0cd0270516a9e51640cb95fdf4118", + "67f7bec6d66977fbb67539897d64ab0506a5f9f5", [] ], "render_pass_descriptor.spec.js": [ @@ -351447,7 +351244,7 @@ [] ], "setVertexBuffer.spec.js": [ - "ba22ee2d2a4e636e2b519003da669bbd33fead2d", + "47b861501296fbe517345a54ca7198e237cdf748", [] ], "setViewport.spec.js": [ @@ -351459,7 +351256,7 @@ [] ], "vertex_state.spec.js": [ - "cc33cde1decd5f42f006007e0e9381d50067babd", + "103a11265c573e7f2873da5893fb92aedcba14ee", [] ] } @@ -377189,7 +376986,7 @@ ] ], "sec-ch-quotes.https.html": [ - "edf4fce785e83a349a57c94371e5d22f867977ed", + "81fe09fb0494b1854c13b93606248ee0920777dd", [ null, {} @@ -377203,7 +377000,7 @@ ] ], "sec-ch-ua.https.html": [ - "b293745365a611475697aaa7b66a8a809cad7b3c", + "bc7a1a8f7d9eabaf71b4d1aed9e8df272edb6c3b", [ null, {} @@ -384507,7 +384304,7 @@ ] ], "CSSAnimation-compositeOrder.tentative.html": [ - "ee204db792666f176a72be43227c944185727f66", + "d55db9a2d117f54cebd447d9bf5ef9f44ab7309a", [ null, {} @@ -403485,6 +403282,13 @@ {} ] ], + "viewport-units-after-font-load.html": [ + "82e8b73d28dfc57ad572936fe46315d0d0289606", + [ + null, + {} + ] + ], "viewport-units-css2-001.html": [ "c51237dd8a07546d31eef6f6f9b3c84b6ac2b65b", [ @@ -425905,6 +425709,47 @@ } ] ], + "cors-preflight-response-validation.any.js": [ + "718e351c1d3f09aa41cc2ea7f7b071f4a7c48b2a", + [ + "fetch/api/cors/cors-preflight-response-validation.any.html", + { + "script_metadata": [ + [ + "script", + "/common/utils.js" + ], + [ + "script", + "../resources/utils.js" + ], + [ + "script", + "/common/get-host-info.sub.js" + ] + ] + } + ], + [ + "fetch/api/cors/cors-preflight-response-validation.any.worker.html", + { + "script_metadata": [ + [ + "script", + "/common/utils.js" + ], + [ + "script", + "../resources/utils.js" + ], + [ + "script", + "/common/get-host-info.sub.js" + ] + ] + } + ] + ], "cors-preflight-star.any.js": [ "d76e9a21fd4b946803d8df193fcf00f53921aa9d", [ @@ -431673,6 +431518,15 @@ {} ] ], + "cache-storage-reporting.https.html": [ + "d9a23bed3effa4f3492a31eeb255224df106030e", + [ + null, + { + "timeout": "long" + } + ] + ], "coep-frame-javascript.https.html": [ "d3e090bd7f7b08bbb75ec8541a1981d928a28e37", [ @@ -431755,10 +431609,12 @@ ] ], "reporting.https.html": [ - "bb0a6a2b0a8101665a25f2187c138ab0bdfd14e5", + "95fe047ea9fc6c7fe0bf33170d67df3e33a04544", [ null, - {} + { + "timeout": "long" + } ] ], "require-corp-about-blank.html": [ @@ -432031,7 +431887,7 @@ ] ], "iframe-popup-same-origin-to-same-origin.https.html": [ - "635f7ab3b872c49c436a5cfcb387e63100322ea3", + "a38376c7fcf6ddc548267cb45467390211736868", [ null, { @@ -432040,7 +431896,7 @@ ] ], "iframe-popup-same-origin-to-unsafe-none.https.html": [ - "6589ad923c1fe2111f6a9865439284875d081b0f", + "4adb4130418ddb189443869f821fb2b235265b7d", [ null, { @@ -434965,6 +434821,13 @@ {} ] ], + "img-aspect-ratio-lazy.tentative.html": [ + "c058aa426de8d72b671f7eae5d36708d69c788c4", + [ + null, + {} + ] + ], "img-aspect-ratio.html": [ "eceef92a6418f3d74ffbd13a08d8e648dff42a3f", [ @@ -448176,7 +448039,7 @@ ] ], "navigator_user_agent.https.html": [ - "4c83c7e8a546dd8c4d37b56f5bdc70d80e23e910", + "0fb9e372b0dd6f5c6463430ee4012e5c040c4a80", [ null, {} @@ -448532,130 +448395,6 @@ ] } }, - "builtin-support.tentative": { - "bare.sub.tentative.html": [ - "e20424aed8a728b31774b71ae98ab7d882df2987", - [ - null, - { - "timeout": "long" - } - ] - ], - "builtin-empty.tentative.html": [ - "9ede75a4c42067a989ee6abaf4728bdaa2d56694", - [ - null, - {} - ] - ], - "builtin-import-scheme.tentative.html": [ - "d9977ae3535c48ebb33e6d3e97bd9d6bab409bc4", - [ - null, - {} - ] - ], - "builtin.tentative.html": [ - "497bb5c606b7648bbdf9a3cd8990b462d9ab7787", - [ - null, - {} - ] - ], - "data.sub.tentative.html": [ - "0377a788491cea37ee42ab4a00fba6a5d0df7d73", - [ - null, - { - "timeout": "long" - } - ] - ], - "fallback-disallowed.sub.tentative.html": [ - "7efe90eb751d981012c7d382842001ba176a3b24", - [ - null, - { - "timeout": "long" - } - ] - ], - "fallback.sub.tentative.html": [ - "45cf6dc1ced1dc34ef7df4ea477a4a85dbee45ee", - [ - null, - { - "timeout": "long" - } - ] - ], - "http.sub.tentative.html": [ - "7689ae13bb5373201890794e7a51e72167e3317d", - [ - null, - {} - ] - ], - "imported": { - "parsing-addresses.tentative.html": [ - "0cc92ce3e5e4be7c44abaa41c5d26046feabc049", - [ - null, - {} - ] - ], - "parsing-schema.tentative.html": [ - "9e3bca2935bcf3f52fdfcb76eeb8339674f0db47", - [ - null, - {} - ] - ], - "parsing-scope-keys.tentative.html": [ - "be23c645d0bf071818f96c01b330a5efcab69594", - [ - null, - {} - ] - ], - "parsing-specifier-keys.tentative.html": [ - "7bc2d4799f1369750a8675f041c32f36f16c1e8f", - [ - null, - {} - ] - ], - "resolving-builtins.tentative.html": [ - "065cfa30964da0ec2958b4e95634804b8994056b", - [ - null, - {} - ] - ], - "resolving-not-yet-implemented.tentative.html": [ - "3bdd591fd0cba9f83c1bfb6a7e3274532efd2961", - [ - null, - {} - ] - ], - "resolving-scopes.tentative.html": [ - "33b49352ccdc3658022559907db7ac5a098ea698", - [ - null, - {} - ] - ], - "resolving.tentative.html": [ - "1d24eb2031e4097551d21df57f0c595957c695ee", - [ - null, - {} - ] - ] - } - }, "common": { "parsing.tentative.html": [ "d3334d7bbb9b4406397f96b596e71463eb252791", @@ -454252,34 +453991,6 @@ ] }, "sharedworker-classic": { - "cross-http.keep-scheme.https.html": [ - "4d785b21f4acccddf824d9c55d9260801a8e576d", - [ - null, - {} - ] - ], - "cross-http.no-redirect.https.html": [ - "a704db4d9347597b56d6d03256a02ec2f9341161", - [ - null, - {} - ] - ], - "cross-http.swap-scheme.https.html": [ - "46a0e267366024e3d6c3a481f7b956ba6c6d2329", - [ - null, - {} - ] - ], - "cross-https.swap-scheme.https.html": [ - "8bc14cb8c85a913a04ff2bd1d91f44d1ca453fd7", - [ - null, - {} - ] - ], "same-http.keep-scheme.https.html": [ "cfada8433e001533b16182bfe788487c4f53ecb3", [ @@ -454294,13 +454005,6 @@ {} ] ], - "same-http.swap-scheme.https.html": [ - "0942ebd3591c7178b68ccb5deb486f69e26111ef", - [ - null, - {} - ] - ], "same-https.keep-scheme.https.html": [ "66eb7541346c74cbf7ccb05170bd561e93f2e685", [ @@ -454314,13 +454018,6 @@ null, {} ] - ], - "same-https.swap-scheme.https.html": [ - "49b0614511afe69621f84207d1b2ee9a6d07a2d3", - [ - null, - {} - ] ] }, "sharedworker-import-data": { @@ -454396,34 +454093,6 @@ ] }, "sharedworker-module": { - "cross-http.keep-scheme.https.html": [ - "530dbe507a1c54addf6158816f79d5ce38d816eb", - [ - null, - {} - ] - ], - "cross-http.no-redirect.https.html": [ - "b716ae6168b42611fba46ff8cf6cc8c3d327cd24", - [ - null, - {} - ] - ], - "cross-http.swap-scheme.https.html": [ - "8696795c4de054e309c4c4ddd0653d5dac3bd881", - [ - null, - {} - ] - ], - "cross-https.swap-scheme.https.html": [ - "12a66d42627ca9b1c624f0679b71a59152adc3da", - [ - null, - {} - ] - ], "same-http.keep-scheme.https.html": [ "64f6d02f60c34cadd46e8538dcabfb0cea77aa8f", [ @@ -454438,13 +454107,6 @@ {} ] ], - "same-http.swap-scheme.https.html": [ - "e7cb04810b9f4cd5f600312ff9b10b3a86aabeac", - [ - null, - {} - ] - ], "same-https.keep-scheme.https.html": [ "30d1a97fa6915703dab636160219cd669dce8c80", [ @@ -454458,13 +454120,6 @@ null, {} ] - ], - "same-https.swap-scheme.https.html": [ - "6601019864b19b62ab695867d306f72c56ad3a17", - [ - null, - {} - ] ] }, "video-tag": { @@ -454563,34 +454218,6 @@ ] }, "worker-classic": { - "cross-http.keep-scheme.https.html": [ - "8a915c29f9f45c37c998c4caa70f819c895f4d06", - [ - null, - {} - ] - ], - "cross-http.no-redirect.https.html": [ - "5aabf759341371ad8323399f83c9160407e3ddca", - [ - null, - {} - ] - ], - "cross-http.swap-scheme.https.html": [ - "90c204d7a0d0dff099916a14a1eeebbb15dbc3e0", - [ - null, - {} - ] - ], - "cross-https.swap-scheme.https.html": [ - "cbc740ae3872c0c668597ea32e794304ce77018e", - [ - null, - {} - ] - ], "same-http.keep-scheme.https.html": [ "93668db49e4f3d79d39ab72bc525db6353a4d74c", [ @@ -454605,13 +454232,6 @@ {} ] ], - "same-http.swap-scheme.https.html": [ - "d5f79ad60212c6ec0b48a5be3e9c6a492d4b7a69", - [ - null, - {} - ] - ], "same-https.keep-scheme.https.html": [ "042bd14fa8160b38c7852c168748a6c70484e4a1", [ @@ -454625,13 +454245,6 @@ null, {} ] - ], - "same-https.swap-scheme.https.html": [ - "09ba5bc858e1e133a372f28935162b0370a08a21", - [ - null, - {} - ] ] }, "worker-import-data": { @@ -454707,34 +454320,6 @@ ] }, "worker-module": { - "cross-http.keep-scheme.https.html": [ - "69dcfb7e5cb5b30f24e0b181b3b3968542673f35", - [ - null, - {} - ] - ], - "cross-http.no-redirect.https.html": [ - "816e3449092a398f12a7287b4d2715764aea56ac", - [ - null, - {} - ] - ], - "cross-http.swap-scheme.https.html": [ - "9e167de1486d409caf0ba5ef4b41d434ad06315c", - [ - null, - {} - ] - ], - "cross-https.swap-scheme.https.html": [ - "700b7dada6774c0540bd012a1be8b7ad6ed4d448", - [ - null, - {} - ] - ], "same-http.keep-scheme.https.html": [ "75e103e634366ff03e22e11d32b0cefed280e1ce", [ @@ -454749,13 +454334,6 @@ {} ] ], - "same-http.swap-scheme.https.html": [ - "f0397f11b69a19ca884dfcaba8abd571d4ed1aa4", - [ - null, - {} - ] - ], "same-https.keep-scheme.https.html": [ "b81758e5b79fa6fbf2b50c2118150087b06caef5", [ @@ -454769,13 +454347,6 @@ null, {} ] - ], - "same-https.swap-scheme.https.html": [ - "74f95a2620887f5bd4713272812cbc12bba8d53e", - [ - null, - {} - ] ] }, "worklet-animation": { @@ -455638,13 +455209,6 @@ ] }, "sharedworker-classic": { - "cross-http.no-redirect.https.html": [ - "3f17e742c30723418e6d05abfcdc645355b167c9", - [ - null, - {} - ] - ], "same-http.no-redirect.https.html": [ "ae2f3db74f5ecb6bf3ac8b30baaf027d2494b55f", [ @@ -455684,13 +455248,6 @@ ] }, "sharedworker-module": { - "cross-http.no-redirect.https.html": [ - "d4717590a42b634824b0d713ee3cb05b7de6a420", - [ - null, - {} - ] - ], "same-http.no-redirect.https.html": [ "4100554d8415507bb4bc600e85974ee009faebbd", [ @@ -455753,13 +455310,6 @@ ] }, "worker-classic": { - "cross-http.no-redirect.https.html": [ - "36ee4ed56d04f5f7b240a1760e17180c58ec8ed4", - [ - null, - {} - ] - ], "same-http.no-redirect.https.html": [ "bdc906277b1d3fde69f8cfe558f77beed9c436ca", [ @@ -455799,13 +455349,6 @@ ] }, "worker-module": { - "cross-http.no-redirect.https.html": [ - "87dd4d87ee0cea8d73f35e95a1f31eafa85669a9", - [ - null, - {} - ] - ], "same-http.no-redirect.https.html": [ "e837b2cbbd2299165bade9dfaeffd0297289feab", [ @@ -456553,27 +456096,6 @@ ] }, "sharedworker-classic": { - "cross-http.keep-scheme.https.html": [ - "4d785b21f4acccddf824d9c55d9260801a8e576d", - [ - null, - {} - ] - ], - "cross-http.no-redirect.https.html": [ - "a704db4d9347597b56d6d03256a02ec2f9341161", - [ - null, - {} - ] - ], - "cross-http.swap-scheme.https.html": [ - "46a0e267366024e3d6c3a481f7b956ba6c6d2329", - [ - null, - {} - ] - ], "same-http.keep-scheme.https.html": [ "cfada8433e001533b16182bfe788487c4f53ecb3", [ @@ -456588,13 +456110,6 @@ {} ] ], - "same-http.swap-scheme.https.html": [ - "0942ebd3591c7178b68ccb5deb486f69e26111ef", - [ - null, - {} - ] - ], "same-https.keep-scheme.https.html": [ "66eb7541346c74cbf7ccb05170bd561e93f2e685", [ @@ -456669,27 +456184,6 @@ ] }, "sharedworker-module": { - "cross-http.keep-scheme.https.html": [ - "530dbe507a1c54addf6158816f79d5ce38d816eb", - [ - null, - {} - ] - ], - "cross-http.no-redirect.https.html": [ - "b716ae6168b42611fba46ff8cf6cc8c3d327cd24", - [ - null, - {} - ] - ], - "cross-http.swap-scheme.https.html": [ - "8696795c4de054e309c4c4ddd0653d5dac3bd881", - [ - null, - {} - ] - ], "same-http.keep-scheme.https.html": [ "64f6d02f60c34cadd46e8538dcabfb0cea77aa8f", [ @@ -456704,13 +456198,6 @@ {} ] ], - "same-http.swap-scheme.https.html": [ - "e7cb04810b9f4cd5f600312ff9b10b3a86aabeac", - [ - null, - {} - ] - ], "same-https.keep-scheme.https.html": [ "30d1a97fa6915703dab636160219cd669dce8c80", [ @@ -456808,27 +456295,6 @@ ] }, "worker-classic": { - "cross-http.keep-scheme.https.html": [ - "8a915c29f9f45c37c998c4caa70f819c895f4d06", - [ - null, - {} - ] - ], - "cross-http.no-redirect.https.html": [ - "5aabf759341371ad8323399f83c9160407e3ddca", - [ - null, - {} - ] - ], - "cross-http.swap-scheme.https.html": [ - "90c204d7a0d0dff099916a14a1eeebbb15dbc3e0", - [ - null, - {} - ] - ], "same-http.keep-scheme.https.html": [ "93668db49e4f3d79d39ab72bc525db6353a4d74c", [ @@ -456843,13 +456309,6 @@ {} ] ], - "same-http.swap-scheme.https.html": [ - "d5f79ad60212c6ec0b48a5be3e9c6a492d4b7a69", - [ - null, - {} - ] - ], "same-https.keep-scheme.https.html": [ "042bd14fa8160b38c7852c168748a6c70484e4a1", [ @@ -456924,27 +456383,6 @@ ] }, "worker-module": { - "cross-http.keep-scheme.https.html": [ - "69dcfb7e5cb5b30f24e0b181b3b3968542673f35", - [ - null, - {} - ] - ], - "cross-http.no-redirect.https.html": [ - "816e3449092a398f12a7287b4d2715764aea56ac", - [ - null, - {} - ] - ], - "cross-http.swap-scheme.https.html": [ - "9e167de1486d409caf0ba5ef4b41d434ad06315c", - [ - null, - {} - ] - ], "same-http.keep-scheme.https.html": [ "75e103e634366ff03e22e11d32b0cefed280e1ce", [ @@ -456959,13 +456397,6 @@ {} ] ], - "same-http.swap-scheme.https.html": [ - "f0397f11b69a19ca884dfcaba8abd571d4ed1aa4", - [ - null, - {} - ] - ], "same-https.keep-scheme.https.html": [ "b81758e5b79fa6fbf2b50c2118150087b06caef5", [ @@ -525717,7 +525148,7 @@ ] ], "scroll-timeline-phases.tentative.html": [ - "0cc4e12864e209602b8c3ad57106deb3927e5be8", + "48ca749d24d5725acaea0981cada6383f0b3a45b", [ null, {} @@ -538527,6 +537958,15 @@ ] ] }, + "trust-tokens": { + "trust-token-parameter-validation.tentative.https.html": [ + "c3a612724ee8a0216f64b7a66434736df9def9a4", + [ + null, + {} + ] + ] + }, "trusted-types": { "DOMParser-parseFromString-regression.tentative.https.html": [ "941d1750b4a3d4fd0c53a48c62689f9665e64dc3", @@ -548355,7 +547795,7 @@ }, "DocumentOrShadowRoot": { "getAnimations.html": [ - "f88ad432c1e4c4bd8b6a1e7e41acc07d761f0593", + "67addc05476fba7107fcc97b6783180093daf96f", [ null, {} @@ -548623,7 +548063,7 @@ ] ], "update-and-send-events-replacement.html": [ - "1391b97a8ae7fa3c84eab6002edf0f87414b56b7", + "fced6ead657cc7a37110b156efe79b4d6cf63ccb", [ null, {} @@ -553482,7 +552922,7 @@ ], "protocol": { "bundle.https.html": [ - "fcc9d470b9f7c5c4215da09666e471dfa0a192d1", + "61d1ff8ac108297dafe333694ddd1194ff53fe26", [ null, {} @@ -586187,34 +585627,6 @@ {} ] ], - "flex-wrap-001.htm": [ - "127100ac0ad9dc5c14e170a346dce38d114a0c99", - [ - null, - {} - ] - ], - "flex-wrap_nowrap.html": [ - "ef53bb2decb00a9ee881ddcc96d350428b036595", - [ - null, - {} - ] - ], - "flex-wrap_wrap-reverse.html": [ - "ce23e935ecc88bb5eade812237bcd4e1088d04b5", - [ - null, - {} - ] - ], - "flex-wrap_wrap.html": [ - "302c9cd325b51c5de485b79e4107b36c0b68dd77", - [ - null, - {} - ] - ], "flexbox-order-from-lowest.html": [ "34bc0276019d03c0dcf4121f412b3eb4a50260d1", [ diff --git a/tests/wpt/metadata/css/CSS2/floats/hit-test-floats-002.html.ini b/tests/wpt/metadata/css/CSS2/floats/hit-test-floats-002.html.ini deleted file mode 100644 index f64b45fea6b..00000000000 --- a/tests/wpt/metadata/css/CSS2/floats/hit-test-floats-002.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[hit-test-floats-002.html] - [Hit test float] - 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 new file mode 100644 index 00000000000..4bfb0c2053a --- /dev/null +++ b/tests/wpt/metadata/css/CSS2/floats/hit-test-floats-004.html.ini @@ -0,0 +1,4 @@ +[hit-test-floats-004.html] + [Miss float below something else] + expected: FAIL + diff --git a/tests/wpt/metadata/css/CSS2/floats/hit-test-floats-005.html.ini b/tests/wpt/metadata/css/CSS2/floats/hit-test-floats-005.html.ini new file mode 100644 index 00000000000..baa9f1a7541 --- /dev/null +++ b/tests/wpt/metadata/css/CSS2/floats/hit-test-floats-005.html.ini @@ -0,0 +1,4 @@ +[hit-test-floats-005.html] + [Miss clipped float] + expected: FAIL + diff --git a/tests/wpt/metadata/css/css-flexbox/ttwf-reftest-flex-wrap-reverse.html.ini b/tests/wpt/metadata/css/css-flexbox/ttwf-reftest-flex-wrap-reverse.html.ini deleted file mode 100644 index 82143bf13e7..00000000000 --- a/tests/wpt/metadata/css/css-flexbox/ttwf-reftest-flex-wrap-reverse.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[ttwf-reftest-flex-wrap-reverse.html] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata/css/css-flexbox/ttwf-reftest-flex-wrap.html.ini b/tests/wpt/metadata/css/css-flexbox/ttwf-reftest-flex-wrap.html.ini deleted file mode 100644 index d72859e7ab1..00000000000 --- a/tests/wpt/metadata/css/css-flexbox/ttwf-reftest-flex-wrap.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[ttwf-reftest-flex-wrap.html] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata/css/css-values/viewport-units-after-font-load.html.ini b/tests/wpt/metadata/css/css-values/viewport-units-after-font-load.html.ini new file mode 100644 index 00000000000..5ac32f7d317 --- /dev/null +++ b/tests/wpt/metadata/css/css-values/viewport-units-after-font-load.html.ini @@ -0,0 +1,5 @@ +[viewport-units-after-font-load.html] + expected: TIMEOUT + [Viewport units are correctly updated after resize even if a font load has happened before] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/fetch/api/cors/cors-preflight-response-validation.any.js.ini b/tests/wpt/metadata/fetch/api/cors/cors-preflight-response-validation.any.js.ini new file mode 100644 index 00000000000..1370c6b59af --- /dev/null +++ b/tests/wpt/metadata/fetch/api/cors/cors-preflight-response-validation.any.js.ini @@ -0,0 +1,15 @@ +[cors-preflight-response-validation.any.html] + [Preflight response with a bad Access-Control-Allow-Methods] + expected: FAIL + + [Preflight response with a bad Access-Control-Allow-Headers] + expected: FAIL + + +[cors-preflight-response-validation.any.worker.html] + [Preflight response with a bad Access-Control-Allow-Methods] + expected: FAIL + + [Preflight response with a bad Access-Control-Allow-Headers] + expected: FAIL + diff --git a/tests/wpt/metadata/fetch/content-type/response.window.js.ini b/tests/wpt/metadata/fetch/content-type/response.window.js.ini index 00e3a2e05f1..0dc412ed582 100644 --- a/tests/wpt/metadata/fetch/content-type/response.window.js.ini +++ b/tests/wpt/metadata/fetch/content-type/response.window.js.ini @@ -312,24 +312,24 @@ [fetch(): separate response Content-Type: text/plain ] expected: NOTRUN - [ + diff --git a/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-response-validation.any.js b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-response-validation.any.js new file mode 100644 index 00000000000..718e351c1d3 --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/api/cors/cors-preflight-response-validation.any.js @@ -0,0 +1,33 @@ +// META: script=/common/utils.js +// META: script=../resources/utils.js +// META: script=/common/get-host-info.sub.js + +function corsPreflightResponseValidation(desc, corsUrl, allowHeaders, allowMethods) { + var uuid_token = token(); + var url = corsUrl; + var requestInit = {"mode": "cors"}; + /* Force preflight */ + requestInit["headers"] = {"x-force-preflight": ""}; + + var urlParameters = "?token=" + uuid_token + "&max_age=0"; + urlParameters += "&allow_headers=x-force-preflight"; + if (allowHeaders) + urlParameters += "," + allowHeaders; + if (allowMethods) + urlParameters += "&allow_methods="+ allowMethods; + + promise_test(function(test) { + return fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token).then(async function(resp) { + assert_equals(resp.status, 200, "Clean stash response's status is 200"); + await promise_rejects_js(test, TypeError, fetch(url + urlParameters, requestInit)); + + return fetch(url + urlParameters).then(function(resp) { + assert_equals(resp.headers.get("x-did-preflight"), "1", "Preflight request has been made"); + }); + }); + }, desc); +} + +var corsUrl = get_host_info().HTTP_REMOTE_ORIGIN + dirname(location.pathname) + RESOURCES_DIR + "preflight.py"; +corsPreflightResponseValidation("Preflight response with a bad Access-Control-Allow-Headers", corsUrl, "Bad value", null); +corsPreflightResponseValidation("Preflight response with a bad Access-Control-Allow-Methods", corsUrl, null, "Bad value"); diff --git a/tests/wpt/web-platform-tests/html/cross-origin-embedder-policy/cache-storage-reporting.https.html b/tests/wpt/web-platform-tests/html/cross-origin-embedder-policy/cache-storage-reporting.https.html new file mode 100644 index 00000000000..d9a23bed3ef --- /dev/null +++ b/tests/wpt/web-platform-tests/html/cross-origin-embedder-policy/cache-storage-reporting.https.html @@ -0,0 +1,237 @@ + + + + Check COEP report are send for CacheStorage requests + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/html/cross-origin-embedder-policy/reporting.https.html b/tests/wpt/web-platform-tests/html/cross-origin-embedder-policy/reporting.https.html index bb0a6a2b0a8..95fe047ea9f 100644 --- a/tests/wpt/web-platform-tests/html/cross-origin-embedder-policy/reporting.https.html +++ b/tests/wpt/web-platform-tests/html/cross-origin-embedder-policy/reporting.https.html @@ -1,11 +1,12 @@ - + + +async_test(async (t) => { + try { + const iframe = document.createElement('iframe'); + t.add_cleanup(() => iframe.remove()); + + const suffix = '&navigation-coep'; + const corp = 'header(cross-origin-resource-policy,cross-origin)'; + const noCoep = `pipe=${corp}`; + const coep = + `pipe=header(cross-origin-embedder-policy,require-corp%3breport-to=%22endpoint%22)|${corp}`; + const coepReportOnly = + `pipe=header(cross-origin-embedder-policy-report-only,require-corp%3breport-to=%22report-only-endpoint%22)|${corp}`; + const path = `/common/blank.html`; + const pipes = [noCoep, coep, coepReportOnly]; + const settings = new Map(); + settings.set(noCoep, { + pipe: noCoep, + value: 'unsafe-none', + reportOnlyValue: 'unsafe-none', + }); + settings.set(coep, { + pipe: coep, + value: 'require-corp', + reportOnlyValue: 'unsafe-none', + }); + settings.set(coepReportOnly, { + pipe: coepReportOnly, + value: 'unsafe-none', + reportOnlyValue: 'require-corp', + }); + + function genUrl(pipe) { + return `${path}?${pipe}${suffix}`; + } + + for (const outer of settings.keys()) { + for (const inner of settings.keys()) { + const iframe = document.createElement('iframe'); + t.add_cleanup(() => iframe.remove()); + + iframe.src = genUrl(outer); + iframe.addEventListener('load', () => { + const w = iframe.contentWindow; + const d = iframe.contentDocument; + const nested = d.createElement('iframe'); + nested.src = genUrl(inner) + '-nested'; + d.body.appendChild(nested); + }, {once: true}); + document.body.appendChild(iframe); + } + } + + // Wait 3 seconds for reports to settle. + await wait(3000); + + function check(rs, inner, outer) { + checkNavigationReportExistence( + rs, genUrl(inner) + '-nested', genUrl(outer)); + } + function checkNoReport(reports, inner, outer) { + checkReportNonExistence( + reports, genUrl(inner) + '-nested', genUrl(outer)); + } + + // outer === noCoep + checkNoReport(reports, noCoep, noCoep); + checkNoReport(reports, coep, noCoep); + checkNoReport(reports, coepReportOnly, noCoep); + checkNoReport(reportsForReportOnly, noCoep, noCoep); + checkNoReport(reportsForReportOnly, coep, noCoep); + checkNoReport(reportsForReportOnly, coepReportOnly, noCoep); + + // outer === coep + check(reports, noCoep, coep); + checkNoReport(reports, coep, coep); + check(reports, coepReportOnly, coep); + checkNoReport(reportsForReportOnly, noCoep, coep); + checkNoReport(reportsForReportOnly, coep, coep); + checkNoReport(reportsForReportOnly, coepReportOnly, coep); + + // outer === coepReportOnly + checkNoReport(reports, noCoep, coepReportOnly); + checkNoReport(reports, coep, coepReportOnly); + checkNoReport(reports, coepReportOnly, coepReportOnly); + check(reportsForReportOnly, noCoep, coepReportOnly); + checkNoReport(reportsForReportOnly, coep, coepReportOnly); + check(reportsForReportOnly, coepReportOnly, coepReportOnly); + + t.done(); + } catch (e) { + t.step(() => { throw e }); + } +}, 'COEP violation on nested frame navigation'); + +promise_test(async (t) => { + const iframe_src = `resources/reporting-empty-frame.html?passthrough`; + // Register a service worker that controls an iframe. + const registration = await service_worker_unregister_and_register( + t, 'resources/sw.js', iframe_src); + t.add_cleanup(() => registration.unregister()); + await wait_for_state(t, registration.installing, 'activated'); + + const iframe = document.createElement('iframe'); + t.add_cleanup(() => iframe.remove()); + + iframe.src = iframe_src; + document.body.appendChild(iframe); + await new Promise(resolve => { + iframe.addEventListener('load', resolve, {once: true}); + }); + + async function fetchInIframe(url) { + const init = { mode: 'no-cors', cache: 'no-store' }; + // Ignore errors. + return iframe.contentWindow.fetch(url, init).catch(() => {}); + } + + const suffix = 'subresource-corp-passthrough-sw'; + const sameOriginUrl = `/common/text-plain.txt?${suffix}`; + const blockedByPureCorp = `${REMOTE_ORIGIN}${BASE}/nothing-same-origin-corp.txt?${suffix}`; + const blockedDueToCoep = `${REMOTE_ORIGIN}/common/text-plain.txt?abc&${suffix}`; + const dest = `${REMOTE_ORIGIN}/common/text-plain.txt?xyz&${suffix}`; + const redirect = `/common/redirect.py?location=${encodeURIComponent(dest)}&${suffix}`; + + fetchInIframe(sameOriginUrl); + fetchInIframe(blockedByPureCorp); + fetchInIframe(blockedDueToCoep); + fetchInIframe(redirect); + + // Wait until |reports| is ready. + await wait(1000); + + checkReportNonExistence(reports, sameOriginUrl, iframe.src); + checkReportNonExistence(reports, blockedByPureCorp, iframe.src); + checkCorpReportExistence(reports, blockedDueToCoep, iframe.src); + checkCorpReportExistence(reports, redirect, iframe.src); + checkReportNonExistence(reports, dest, iframe.src); +}, 'subresource CORP in a passthrough iframe hosted by a service worker without COEP'); + +promise_test(async (t) => { + const iframe_src = `resources/reporting-empty-frame.html`; + // Register a service worker that controls an iframe. + const registration = await service_worker_unregister_and_register( + t, 'resources/sw.js', iframe_src); + t.add_cleanup(() => registration.unregister()); + await wait_for_state(t, registration.installing, 'activated'); + + const iframe = document.createElement('iframe'); + t.add_cleanup(() => iframe.remove()); + + iframe.src = iframe_src; + document.body.appendChild(iframe); + await new Promise(resolve => { + iframe.addEventListener('load', resolve, {once: true}); + }); + + async function fetchInIframe(url) { + const init = { mode: 'no-cors', cache: 'no-store' }; + // Ignore errors. + return iframe.contentWindow.fetch(url, init).catch(() => {}); + } + + const suffix = 'subresource-corp-respondwith-fetch-sw'; + const sameOriginUrl = `/common/text-plain.txt?${suffix}`; + const blockedByPureCorp = `${REMOTE_ORIGIN}${BASE}/nothing-same-origin-corp.txt?${suffix}`; + const blockedDueToCoep = `${REMOTE_ORIGIN}/common/text-plain.txt?abc&${suffix}`; + const dest = `${REMOTE_ORIGIN}/common/text-plain.txt?xyz&${suffix}`; + const redirect = `/common/redirect.py?location=${encodeURIComponent(dest)}&${suffix}`; + + fetchInIframe(sameOriginUrl); + fetchInIframe(blockedByPureCorp); + fetchInIframe(blockedDueToCoep) + fetchInIframe(redirect); + + // Wait until |reports| is ready. + await wait(1000); + + checkReportNonExistence(reports, sameOriginUrl, iframe.src); + checkReportNonExistence(reports, blockedByPureCorp, iframe.src); + checkCorpReportExistence(reports, blockedDueToCoep, iframe.src); + checkCorpReportExistence(reports, redirect, iframe.src); + checkReportNonExistence(reports, dest, iframe.src); +}, 'subresource CORP in a respondWith(fetch) iframe hosted by a service worker without COEP'); +$ diff --git a/tests/wpt/web-platform-tests/html/cross-origin-embedder-policy/resources/report.py b/tests/wpt/web-platform-tests/html/cross-origin-embedder-policy/resources/report.py index 17ca65cbf6b..1f628ca878d 100644 --- a/tests/wpt/web-platform-tests/html/cross-origin-embedder-policy/resources/report.py +++ b/tests/wpt/web-platform-tests/html/cross-origin-embedder-policy/resources/report.py @@ -8,21 +8,23 @@ def main(request, response): response.headers.set('Access-Control-Allow-Methods', 'POST') response.headers.set('Access-Control-Allow-Headers', 'content-type') return '' - + response.headers.set('Access-Control-Allow-Origin', '*') uuidMap = { 'endpoint': '01234567-0123-0123-0123-0123456789AB', 'report-only-endpoint': '01234567-0123-0123-0123-0123456789CD' } + key = 0; + if 'endpoint' in request.GET: + key = uuidMap[request.GET['endpoint']] - response.headers.set('Access-Control-Allow-Origin', '*') - endpoint = request.GET.first('endpoint') - if endpoint not in uuidMap: + if 'key' in request.GET: + key = request.GET['key'] + + if key == 0: response.status = 400 return 'invalid endpoint' path = '/'.join(request.url_parts.path.split('/')[:-1]) + '/' - key = uuidMap[endpoint] - if request.method == 'POST': reports = request.server.stash.take(key, path) or [] for report in json.loads(request.body): diff --git a/tests/wpt/web-platform-tests/html/cross-origin-opener-policy/iframe-popup-same-origin-to-same-origin.https.html b/tests/wpt/web-platform-tests/html/cross-origin-opener-policy/iframe-popup-same-origin-to-same-origin.https.html index 635f7ab3b87..a38376c7fcf 100644 --- a/tests/wpt/web-platform-tests/html/cross-origin-opener-policy/iframe-popup-same-origin-to-same-origin.https.html +++ b/tests/wpt/web-platform-tests/html/cross-origin-opener-policy/iframe-popup-same-origin-to-same-origin.https.html @@ -8,18 +8,21 @@
\ No newline at end of file + diff --git a/tests/wpt/web-platform-tests/html/cross-origin-opener-policy/iframe-popup-same-origin-to-unsafe-none.https.html b/tests/wpt/web-platform-tests/html/cross-origin-opener-policy/iframe-popup-same-origin-to-unsafe-none.https.html index 6589ad923c1..4adb4130418 100644 --- a/tests/wpt/web-platform-tests/html/cross-origin-opener-policy/iframe-popup-same-origin-to-unsafe-none.https.html +++ b/tests/wpt/web-platform-tests/html/cross-origin-opener-policy/iframe-popup-same-origin-to-unsafe-none.https.html @@ -8,18 +8,22 @@
diff --git a/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-lazy.tentative.html b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-lazy.tentative.html new file mode 100644 index 00000000000..c058aa426de --- /dev/null +++ b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-lazy.tentative.html @@ -0,0 +1,31 @@ + +Image width and height attributes are used to infer aspect-ratio for lazy-loaded images + + + + +
+ + diff --git a/tests/wpt/web-platform-tests/html/user-activation/activation-hierarchy-parent-manual.sub.tentative.html b/tests/wpt/web-platform-tests/html/user-activation/activation-hierarchy-crossorigin-parent-manual.sub.html similarity index 83% rename from tests/wpt/web-platform-tests/html/user-activation/activation-hierarchy-parent-manual.sub.tentative.html rename to tests/wpt/web-platform-tests/html/user-activation/activation-hierarchy-crossorigin-parent-manual.sub.html index 7dd8018573d..601b9003f7e 100644 --- a/tests/wpt/web-platform-tests/html/user-activation/activation-hierarchy-parent-manual.sub.tentative.html +++ b/tests/wpt/web-platform-tests/html/user-activation/activation-hierarchy-crossorigin-parent-manual.sub.html @@ -1,8 +1,4 @@ - @@ -11,7 +7,8 @@ -

Activation state is visible in parent and not in child

+

User activation visibility across cross-origin frame boundary

+

Confirms that the state is visible in parent and not in child

  1. Click anywhere on the green area (child frame).
@@ -31,7 +28,7 @@ t.done(); } })); - child.src = "http://{{domains[www1]}}:{{ports[http][0]}}/html/user-activation/resources/activation-hierarchy-child.sub.html"; + child.src = "http://{{domains[www1]}}:{{ports[http][0]}}/html/user-activation/resources/activation-hierarchy-crossorigin-child.sub.html"; }, "Parent test"); diff --git a/tests/wpt/web-platform-tests/html/user-activation/activation-hierarchy-sameorigin-parent-manual.html b/tests/wpt/web-platform-tests/html/user-activation/activation-hierarchy-sameorigin-parent-manual.html new file mode 100644 index 00000000000..a7f423eea56 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/user-activation/activation-hierarchy-sameorigin-parent-manual.html @@ -0,0 +1,35 @@ + + + + + + + + + +

User activation visibility across same-origin frame boundary

+

Confirms that the state is visible in both parent and child

+
    +
  1. Click anywhere on the green area (child frame). +
+ + + + diff --git a/tests/wpt/web-platform-tests/html/user-activation/resources/activation-hierarchy-child.sub.html b/tests/wpt/web-platform-tests/html/user-activation/resources/activation-hierarchy-crossorigin-child.sub.html similarity index 92% rename from tests/wpt/web-platform-tests/html/user-activation/resources/activation-hierarchy-child.sub.html rename to tests/wpt/web-platform-tests/html/user-activation/resources/activation-hierarchy-crossorigin-child.sub.html index ebccc8c0dbf..6dbd4683044 100644 --- a/tests/wpt/web-platform-tests/html/user-activation/resources/activation-hierarchy-child.sub.html +++ b/tests/wpt/web-platform-tests/html/user-activation/resources/activation-hierarchy-crossorigin-child.sub.html @@ -25,7 +25,7 @@ t.done(); })); - grandchild.src = "http://{{domains[www2]}}:{{ports[http][0]}}/html/user-activation/resources/activation-hierarchy-grandchild.html"; + grandchild.src = "http://{{domains[www2]}}:{{ports[http][0]}}/html/user-activation/resources/activation-hierarchy-crossorigin-grandchild.html"; }, "Child test"); diff --git a/tests/wpt/web-platform-tests/html/user-activation/resources/activation-hierarchy-grandchild.html b/tests/wpt/web-platform-tests/html/user-activation/resources/activation-hierarchy-crossorigin-grandchild.html similarity index 100% rename from tests/wpt/web-platform-tests/html/user-activation/resources/activation-hierarchy-grandchild.html rename to tests/wpt/web-platform-tests/html/user-activation/resources/activation-hierarchy-crossorigin-grandchild.html diff --git a/tests/wpt/web-platform-tests/html/user-activation/resources/activation-hierarchy-sameorigin-child.html b/tests/wpt/web-platform-tests/html/user-activation/resources/activation-hierarchy-sameorigin-child.html new file mode 100644 index 00000000000..d54c7efc9bd --- /dev/null +++ b/tests/wpt/web-platform-tests/html/user-activation/resources/activation-hierarchy-sameorigin-child.html @@ -0,0 +1,32 @@ + + + + + + + +

Child frame

+ + + + diff --git a/tests/wpt/web-platform-tests/html/user-activation/resources/activation-hierarchy-sameorigin-grandchild.html b/tests/wpt/web-platform-tests/html/user-activation/resources/activation-hierarchy-sameorigin-grandchild.html new file mode 100644 index 00000000000..9d664e2356a --- /dev/null +++ b/tests/wpt/web-platform-tests/html/user-activation/resources/activation-hierarchy-sameorigin-grandchild.html @@ -0,0 +1,28 @@ + + + + + + +

Grandchild frame

+ + diff --git a/tests/wpt/web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator_user_agent.https.html b/tests/wpt/web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator_user_agent.https.html index 4c83c7e8a54..0fb9e372b0d 100644 --- a/tests/wpt/web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator_user_agent.https.html +++ b/tests/wpt/web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator_user_agent.https.html @@ -5,7 +5,7 @@ diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/@std/__dir__.headers b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/@std/__dir__.headers deleted file mode 100644 index e7ec0d6699d..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/@std/__dir__.headers +++ /dev/null @@ -1 +0,0 @@ -Content-Type: text/javascript diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/@std/blank b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/@std/blank deleted file mode 100644 index 38e1891bf7d..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/@std/blank +++ /dev/null @@ -1 +0,0 @@ -log.push("relative:@std/blank"); diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/@std/none b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/@std/none deleted file mode 100644 index 69e165cce5e..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/@std/none +++ /dev/null @@ -1 +0,0 @@ -log.push("relative:@std/none"); diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare.sub.tentative.html b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare.sub.tentative.html deleted file mode 100644 index e20424aed8a..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare.sub.tentative.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare/__dir__.headers b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare/__dir__.headers deleted file mode 100644 index e7ec0d6699d..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare/__dir__.headers +++ /dev/null @@ -1 +0,0 @@ -Content-Type: text/javascript diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare/blank b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare/blank deleted file mode 100644 index 841d433acf7..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare/blank +++ /dev/null @@ -1 +0,0 @@ -log.push("relative:bare/blank"); diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare/none b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare/none deleted file mode 100644 index 2aec0d72826..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare/none +++ /dev/null @@ -1 +0,0 @@ -log.push("relative:bare/none"); diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare/std-blank b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare/std-blank deleted file mode 100644 index 5ded98fd382..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare/std-blank +++ /dev/null @@ -1 +0,0 @@ -log.push("relative:bare/std-blank"); diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare/std-none b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare/std-none deleted file mode 100644 index 1437d9ff1e0..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/bare/std-none +++ /dev/null @@ -1 +0,0 @@ -log.push("relative:bare/std-none"); diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/builtin-empty.tentative.html b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/builtin-empty.tentative.html deleted file mode 100644 index 9ede75a4c42..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/builtin-empty.tentative.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/builtin-import-scheme.tentative.html b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/builtin-import-scheme.tentative.html deleted file mode 100644 index d9977ae3535..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/builtin-import-scheme.tentative.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/builtin.tentative.html b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/builtin.tentative.html deleted file mode 100644 index 497bb5c606b..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/builtin.tentative.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/data.sub.tentative.html b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/data.sub.tentative.html deleted file mode 100644 index 0377a788491..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/data.sub.tentative.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/fallback-disallowed.sub.tentative.html b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/fallback-disallowed.sub.tentative.html deleted file mode 100644 index 7efe90eb751..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/fallback-disallowed.sub.tentative.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/fallback.sub.tentative.html b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/fallback.sub.tentative.html deleted file mode 100644 index 45cf6dc1ced..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/fallback.sub.tentative.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/http.sub.tentative.html b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/http.sub.tentative.html deleted file mode 100644 index 7689ae13bb5..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/http.sub.tentative.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/parsing-addresses.tentative.html b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/parsing-addresses.tentative.html deleted file mode 100644 index 0cc92ce3e5e..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/parsing-addresses.tentative.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/parsing-schema.tentative.html b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/parsing-schema.tentative.html deleted file mode 100644 index 9e3bca2935b..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/parsing-schema.tentative.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/parsing-scope-keys.tentative.html b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/parsing-scope-keys.tentative.html deleted file mode 100644 index be23c645d0b..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/parsing-scope-keys.tentative.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/parsing-specifier-keys.tentative.html b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/parsing-specifier-keys.tentative.html deleted file mode 100644 index 7bc2d4799f1..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/parsing-specifier-keys.tentative.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resolving-builtins.tentative.html b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resolving-builtins.tentative.html deleted file mode 100644 index 065cfa30964..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resolving-builtins.tentative.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resolving-not-yet-implemented.tentative.html b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resolving-not-yet-implemented.tentative.html deleted file mode 100644 index 3bdd591fd0c..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resolving-not-yet-implemented.tentative.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resolving-scopes.tentative.html b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resolving-scopes.tentative.html deleted file mode 100644 index 33b49352ccd..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resolving-scopes.tentative.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resolving.tentative.html b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resolving.tentative.html deleted file mode 100644 index 1d24eb2031e..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resolving.tentative.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/helpers/parsing.js b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/helpers/parsing.js deleted file mode 100644 index 3000f782a11..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/helpers/parsing.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; -const { parseFromString } = require('../../lib/parser.js'); - -// Local modifications from upstream: -// Currently warnings and scopes are not checked in expectSpecifierMap(). -exports.expectSpecifierMap = (input, baseURL, output, warnings = []) => { - expect(parseFromString(`{ "imports": ${input} }`, baseURL)) - .toEqual({ imports: output, scopes: {} }); -}; - -exports.expectScopes = (inputArray, baseURL, outputArray, warnings = []) => { - const checkWarnings = testWarningHandler(warnings); - - const inputScopesAsStrings = inputArray.map(scopePrefix => `${JSON.stringify(scopePrefix)}: {}`); - const inputString = `{ "scopes": { ${inputScopesAsStrings.join(', ')} } }`; - - const outputScopesObject = {}; - for (const outputScopePrefix of outputArray) { - outputScopesObject[outputScopePrefix] = {}; - } - - expect(parseFromString(inputString, baseURL)).toEqual({ imports: {}, scopes: outputScopesObject }); - - checkWarnings(); -}; - -exports.expectBad = (input, baseURL, warnings = []) => { - const checkWarnings = testWarningHandler(warnings); - expect(parseFromString(input, baseURL)).toThrow('TypeError'); - checkWarnings(); -}; - -exports.expectWarnings = (input, baseURL, output, warnings = []) => { - const checkWarnings = testWarningHandler(warnings); - expect(parseFromString(input, baseURL)).toEqual(output); - - checkWarnings(); -}; - -function testWarningHandler(expectedWarnings) { - // We don't check warnings on WPT tests, because there are no - // ways to catch console warnings from JavaScript. - return () => {}; -} diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/parsing-addresses.js b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/parsing-addresses.js deleted file mode 100644 index 0f5fc73506b..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/parsing-addresses.js +++ /dev/null @@ -1,351 +0,0 @@ -'use strict'; -const { expectSpecifierMap } = require('./helpers/parsing.js'); -const { BUILT_IN_MODULE_SCHEME } = require('../lib/utils.js'); - -describe('Relative URL-like addresses', () => { - it('should accept strings prefixed with ./, ../, or /', () => { - expectSpecifierMap( - `{ - "dotSlash": "./foo", - "dotDotSlash": "../foo", - "slash": "/foo" - }`, - 'https://base.example/path1/path2/path3', - { - dotSlash: [expect.toMatchURL('https://base.example/path1/path2/foo')], - dotDotSlash: [expect.toMatchURL('https://base.example/path1/foo')], - slash: [expect.toMatchURL('https://base.example/foo')] - } - ); - }); - - it('should not accept strings prefixed with ./, ../, or / for data: base URLs', () => { - expectSpecifierMap( - `{ - "dotSlash": "./foo", - "dotDotSlash": "../foo", - "slash": "/foo" - }`, - 'data:text/html,test', - { - dotSlash: [], - dotDotSlash: [], - slash: [] - }, - [ - `Invalid address "./foo" for the specifier key "dotSlash".`, - `Invalid address "../foo" for the specifier key "dotDotSlash".`, - `Invalid address "/foo" for the specifier key "slash".` - ] - ); - }); - - it('should accept the literal strings ./, ../, or / with no suffix', () => { - expectSpecifierMap( - `{ - "dotSlash": "./", - "dotDotSlash": "../", - "slash": "/" - }`, - 'https://base.example/path1/path2/path3', - { - dotSlash: [expect.toMatchURL('https://base.example/path1/path2/')], - dotDotSlash: [expect.toMatchURL('https://base.example/path1/')], - slash: [expect.toMatchURL('https://base.example/')] - } - ); - }); - - it('should ignore percent-encoded variants of ./, ../, or /', () => { - expectSpecifierMap( - `{ - "dotSlash1": "%2E/", - "dotDotSlash1": "%2E%2E/", - "dotSlash2": ".%2F", - "dotDotSlash2": "..%2F", - "slash2": "%2F", - "dotSlash3": "%2E%2F", - "dotDotSlash3": "%2E%2E%2F" - }`, - 'https://base.example/path1/path2/path3', - { - dotSlash1: [], - dotDotSlash1: [], - dotSlash2: [], - dotDotSlash2: [], - slash2: [], - dotSlash3: [], - dotDotSlash3: [] - }, - [ - `Invalid address "%2E/" for the specifier key "dotSlash1".`, - `Invalid address "%2E%2E/" for the specifier key "dotDotSlash1".`, - `Invalid address ".%2F" for the specifier key "dotSlash2".`, - `Invalid address "..%2F" for the specifier key "dotDotSlash2".`, - `Invalid address "%2F" for the specifier key "slash2".`, - `Invalid address "%2E%2F" for the specifier key "dotSlash3".`, - `Invalid address "%2E%2E%2F" for the specifier key "dotDotSlash3".` - ] - ); - }); -}); - -describe('Built-in module addresses', () => { - it('should accept URLs using the built-in module scheme', () => { - expectSpecifierMap( - `{ - "foo": "${BUILT_IN_MODULE_SCHEME}:foo" - }`, - 'https://base.example/path1/path2/path3', - { - foo: [expect.toMatchURL(`${BUILT_IN_MODULE_SCHEME}:foo`)] - } - ); - }); - - it('should ignore percent-encoded variants of the built-in module scheme', () => { - expectSpecifierMap( - `{ - "foo": "${encodeURIComponent(BUILT_IN_MODULE_SCHEME + ':')}foo" - }`, - 'https://base.example/path1/path2/path3', - { - foo: [] - }, - [`Invalid address "${encodeURIComponent(BUILT_IN_MODULE_SCHEME + ':')}foo" for the specifier key "foo".`] - ); - }); - - it('should allow built-in module URLs that contain "/" or "\\"', () => { - expectSpecifierMap( - `{ - "slashEnd": "${BUILT_IN_MODULE_SCHEME}:foo/", - "slashMiddle": "${BUILT_IN_MODULE_SCHEME}:foo/bar", - "backslash": "${BUILT_IN_MODULE_SCHEME}:foo\\\\baz" - }`, - 'https://base.example/path1/path2/path3', - { - slashEnd: [expect.toMatchURL(`${BUILT_IN_MODULE_SCHEME}:foo/`)], - slashMiddle: [expect.toMatchURL(`${BUILT_IN_MODULE_SCHEME}:foo/bar`)], - backslash: [expect.toMatchURL(`${BUILT_IN_MODULE_SCHEME}:foo\\baz`)] - } - ); - }); -}); - -describe('Absolute URL addresses', () => { - it('should only accept absolute URL addresses with fetch schemes', () => { - expectSpecifierMap( - `{ - "about": "about:good", - "blob": "blob:good", - "data": "data:good", - "file": "file:///good", - "filesystem": "filesystem:good", - "http": "http://good/", - "https": "https://good/", - "ftp": "ftp://good/", - "import": "import:bad", - "mailto": "mailto:bad", - "javascript": "javascript:bad", - "wss": "wss:bad" - }`, - 'https://base.example/path1/path2/path3', - { - about: [expect.toMatchURL('about:good')], - blob: [expect.toMatchURL('blob:good')], - data: [expect.toMatchURL('data:good')], - file: [expect.toMatchURL('file:///good')], - filesystem: [expect.toMatchURL('filesystem:good')], - http: [expect.toMatchURL('http://good/')], - https: [expect.toMatchURL('https://good/')], - ftp: [expect.toMatchURL('ftp://good/')], - import: [], - mailto: [], - javascript: [], - wss: [] - }, - [ - `Invalid address "import:bad" for the specifier key "import".`, - `Invalid address "mailto:bad" for the specifier key "mailto".`, - `Invalid address "javascript:bad" for the specifier key "javascript".`, - `Invalid address "wss:bad" for the specifier key "wss".` - ] - ); - }); - - it('should only accept absolute URL addresses with fetch schemes inside arrays', () => { - expectSpecifierMap( - `{ - "about": ["about:good"], - "blob": ["blob:good"], - "data": ["data:good"], - "file": ["file:///good"], - "filesystem": ["filesystem:good"], - "http": ["http://good/"], - "https": ["https://good/"], - "ftp": ["ftp://good/"], - "import": ["import:bad"], - "mailto": ["mailto:bad"], - "javascript": ["javascript:bad"], - "wss": ["wss:bad"] - }`, - 'https://base.example/path1/path2/path3', - { - about: [expect.toMatchURL('about:good')], - blob: [expect.toMatchURL('blob:good')], - data: [expect.toMatchURL('data:good')], - file: [expect.toMatchURL('file:///good')], - filesystem: [expect.toMatchURL('filesystem:good')], - http: [expect.toMatchURL('http://good/')], - https: [expect.toMatchURL('https://good/')], - ftp: [expect.toMatchURL('ftp://good/')], - import: [], - mailto: [], - javascript: [], - wss: [] - }, - [ - `Invalid address "import:bad" for the specifier key "import".`, - `Invalid address "mailto:bad" for the specifier key "mailto".`, - `Invalid address "javascript:bad" for the specifier key "javascript".`, - `Invalid address "wss:bad" for the specifier key "wss".` - ] - ); - }); - - it('should parse absolute URLs, ignoring unparseable ones', () => { - expectSpecifierMap( - `{ - "unparseable1": "https://ex ample.org/", - "unparseable2": "https://example.com:demo", - "unparseable3": "http://[www.example.com]/", - "invalidButParseable1": "https:example.org", - "invalidButParseable2": "https://///example.com///", - "prettyNormal": "https://example.net", - "percentDecoding": "https://ex%41mple.com/", - "noPercentDecoding": "https://example.com/%41" - }`, - 'https://base.example/path1/path2/path3', - { - unparseable1: [], - unparseable2: [], - unparseable3: [], - invalidButParseable1: [expect.toMatchURL('https://example.org/')], - invalidButParseable2: [expect.toMatchURL('https://example.com///')], - prettyNormal: [expect.toMatchURL('https://example.net/')], - percentDecoding: [expect.toMatchURL('https://example.com/')], - noPercentDecoding: [expect.toMatchURL('https://example.com/%41')] - }, - [ - `Invalid address "https://ex ample.org/" for the specifier key "unparseable1".`, - `Invalid address "https://example.com:demo" for the specifier key "unparseable2".`, - `Invalid address "http://[www.example.com]/" for the specifier key "unparseable3".` - ] - ); - }); - - it('should parse absolute URLs, ignoring unparseable ones inside arrays', () => { - expectSpecifierMap( - `{ - "unparseable1": ["https://ex ample.org/"], - "unparseable2": ["https://example.com:demo"], - "unparseable3": ["http://[www.example.com]/"], - "invalidButParseable1": ["https:example.org"], - "invalidButParseable2": ["https://///example.com///"], - "prettyNormal": ["https://example.net"], - "percentDecoding": ["https://ex%41mple.com/"], - "noPercentDecoding": ["https://example.com/%41"] - }`, - 'https://base.example/path1/path2/path3', - { - unparseable1: [], - unparseable2: [], - unparseable3: [], - invalidButParseable1: [expect.toMatchURL('https://example.org/')], - invalidButParseable2: [expect.toMatchURL('https://example.com///')], - prettyNormal: [expect.toMatchURL('https://example.net/')], - percentDecoding: [expect.toMatchURL('https://example.com/')], - noPercentDecoding: [expect.toMatchURL('https://example.com/%41')] - }, - [ - `Invalid address "https://ex ample.org/" for the specifier key "unparseable1".`, - `Invalid address "https://example.com:demo" for the specifier key "unparseable2".`, - `Invalid address "http://[www.example.com]/" for the specifier key "unparseable3".` - ] - ); - }); -}); - -describe('Failing addresses: mismatched trailing slashes', () => { - it('should warn for the simple case', () => { - expectSpecifierMap( - `{ - "trailer/": "/notrailer", - "${BUILT_IN_MODULE_SCHEME}:trailer/": "/bim-notrailer" - }`, - 'https://base.example/path1/path2/path3', - { - 'trailer/': [], - [`${BUILT_IN_MODULE_SCHEME}:trailer/`]: [] - }, - [ - `Invalid address "https://base.example/notrailer" for package specifier key "trailer/". Package addresses must end with "/".`, - `Invalid address "https://base.example/bim-notrailer" for package specifier key "${BUILT_IN_MODULE_SCHEME}:trailer/". Package addresses must end with "/".` - ] - ); - }); - - it('should warn for a mismatch alone in an array', () => { - expectSpecifierMap( - `{ - "trailer/": ["/notrailer"], - "${BUILT_IN_MODULE_SCHEME}:trailer/": ["/bim-notrailer"] - }`, - 'https://base.example/path1/path2/path3', - { - 'trailer/': [], - [`${BUILT_IN_MODULE_SCHEME}:trailer/`]: [] - }, - [ - `Invalid address "https://base.example/notrailer" for package specifier key "trailer/". Package addresses must end with "/".`, - `Invalid address "https://base.example/bim-notrailer" for package specifier key "${BUILT_IN_MODULE_SCHEME}:trailer/". Package addresses must end with "/".` - ] - ); - }); - - it('should warn for a mismatch alongside non-mismatches in an array', () => { - expectSpecifierMap( - `{ - "trailer/": ["/atrailer/", "/notrailer"], - "${BUILT_IN_MODULE_SCHEME}:trailer/": ["/bim-atrailer/", "/bim-notrailer"] - }`, - 'https://base.example/path1/path2/path3', - { - 'trailer/': [expect.toMatchURL('https://base.example/atrailer/')], - [`${BUILT_IN_MODULE_SCHEME}:trailer/`]: [expect.toMatchURL('https://base.example/bim-atrailer/')] - }, - [ - `Invalid address "https://base.example/notrailer" for package specifier key "trailer/". Package addresses must end with "/".`, - `Invalid address "https://base.example/bim-notrailer" for package specifier key "${BUILT_IN_MODULE_SCHEME}:trailer/". Package addresses must end with "/".` - ] - ); - }); -}); - -describe('Other invalid addresses', () => { - it('should ignore unprefixed strings that are not absolute URLs', () => { - for (const bad of ['bar', '\\bar', '~bar', '#bar', '?bar']) { - expectSpecifierMap( - `{ - "foo": ${JSON.stringify(bad)} - }`, - 'https://base.example/path1/path2/path3', - { - foo: [] - }, - [`Invalid address "${bad}" for the specifier key "foo".`] - ); - } - }); -}); diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/parsing-schema.js b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/parsing-schema.js deleted file mode 100644 index 72b6e625d61..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/parsing-schema.js +++ /dev/null @@ -1,139 +0,0 @@ -'use strict'; -const { parseFromString } = require('../lib/parser.js'); -const { expectBad, expectWarnings, expectSpecifierMap } = require('./helpers/parsing.js'); - -const nonObjectStrings = ['null', 'true', '1', '"foo"', '[]']; - -test('Invalid JSON', () => { - expect(parseFromString('{ imports: {} }', 'https://base.example/')).toThrow('SyntaxError'); -}); - -describe('Mismatching the top-level schema', () => { - it('should throw for top-level non-objects', () => { - for (const nonObject of nonObjectStrings) { - expectBad(nonObject, 'https://base.example/'); - } - }); - - it('should throw if imports is a non-object', () => { - for (const nonObject of nonObjectStrings) { - expectBad(`{ "imports": ${nonObject} }`, 'https://base.example/'); - } - }); - - it('should throw if scopes is a non-object', () => { - for (const nonObject of nonObjectStrings) { - expectBad(`{ "scopes": ${nonObject} }`, 'https://base.example/'); - } - }); - - it('should ignore unspecified top-level entries', () => { - expectWarnings( - `{ - "imports": {}, - "new-feature": {}, - "scops": {} - }`, - 'https://base.example/', - { imports: {}, scopes: {} }, - [ - `Invalid top-level key "new-feature". Only "imports" and "scopes" can be present.`, - `Invalid top-level key "scops". Only "imports" and "scopes" can be present.` - ] - ); - }); -}); - -describe('Mismatching the specifier map schema', () => { - const invalidAddressStrings = ['true', '1', '{}']; - const invalidInsideArrayStrings = ['null', 'true', '1', '{}', '[]']; - - it('should ignore entries where the address is not a string, array, or null', () => { - for (const invalid of invalidAddressStrings) { - expectSpecifierMap( - `{ - "foo": ${invalid}, - "bar": ["https://example.com/"] - }`, - 'https://base.example/', - { - bar: [expect.toMatchURL('https://example.com/')] - }, - [ - `Invalid address ${invalid} for the specifier key "foo". ` + - `Addresses must be strings, arrays, or null.` - ] - ); - } - }); - - it('should ignore entries where the specifier key is an empty string', () => { - expectSpecifierMap( - `{ - "": ["https://example.com/"] - }`, - 'https://base.example/', - {}, - [`Invalid empty string specifier key.`] - ); - }); - - it('should ignore members of an address array that are not strings', () => { - for (const invalid of invalidInsideArrayStrings) { - expectSpecifierMap( - `{ - "foo": ["https://example.com/", ${invalid}], - "bar": ["https://example.com/"] - }`, - 'https://base.example/', - { - foo: [expect.toMatchURL('https://example.com/')], - bar: [expect.toMatchURL('https://example.com/')] - }, - [ - `Invalid address ${invalid} inside the address array for the specifier key "foo". ` + - `Address arrays must only contain strings.` - ] - ); - } - }); - - it('should throw if a scope\'s value is not an object', () => { - for (const invalid of nonObjectStrings) { - expectBad(`{ "scopes": { "https://scope.example/": ${invalid} } }`, 'https://base.example/'); - } - }); -}); - -describe('Normalization', () => { - it('should normalize empty import maps to have imports and scopes keys', () => { - expect(parseFromString(`{}`, 'https://base.example/')) - .toEqual({ imports: {}, scopes: {} }); - }); - - it('should normalize an import map without imports to have imports', () => { - expect(parseFromString(`{ "scopes": {} }`, 'https://base.example/')) - .toEqual({ imports: {}, scopes: {} }); - }); - - it('should normalize an import map without scopes to have scopes', () => { - expect(parseFromString(`{ "imports": {} }`, 'https://base.example/')) - .toEqual({ imports: {}, scopes: {} }); - }); - - it('should normalize addresses to arrays', () => { - expectSpecifierMap( - `{ - "foo": "https://example.com/1", - "bar": ["https://example.com/2"], - "baz": null - }`, - 'https://base.example/', - { - foo: [expect.toMatchURL('https://example.com/1')], - bar: [expect.toMatchURL('https://example.com/2')], - baz: [] - } - ); - }); -}); diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/parsing-scope-keys.js b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/parsing-scope-keys.js deleted file mode 100644 index 4993f3a9a8b..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/parsing-scope-keys.js +++ /dev/null @@ -1,144 +0,0 @@ -'use strict'; -const { expectScopes } = require('./helpers/parsing.js'); - -describe('Relative URL scope keys', () => { - it('should work with no prefix', () => { - expectScopes( - ['foo'], - 'https://base.example/path1/path2/path3', - ['https://base.example/path1/path2/foo'] - ); - }); - - it('should work with ./, ../, and / prefixes', () => { - expectScopes( - ['./foo', '../foo', '/foo'], - 'https://base.example/path1/path2/path3', - [ - 'https://base.example/path1/path2/foo', - 'https://base.example/path1/foo', - 'https://base.example/foo' - ] - ); - }); - - it('should work with /s, ?s, and #s', () => { - expectScopes( - ['foo/bar?baz#qux'], - 'https://base.example/path1/path2/path3', - ['https://base.example/path1/path2/foo/bar?baz#qux'] - ); - }); - - it('should work with an empty string scope key', () => { - expectScopes( - [''], - 'https://base.example/path1/path2/path3', - ['https://base.example/path1/path2/path3'] - ); - }); - - it('should work with / suffixes', () => { - expectScopes( - ['foo/', './foo/', '../foo/', '/foo/', '/foo//'], - 'https://base.example/path1/path2/path3', - [ - 'https://base.example/path1/path2/foo/', - 'https://base.example/path1/path2/foo/', - 'https://base.example/path1/foo/', - 'https://base.example/foo/', - 'https://base.example/foo//' - ] - ); - }); - - it('should deduplicate based on URL parsing rules', () => { - expectScopes( - ['foo/\\', 'foo//', 'foo\\\\'], - 'https://base.example/path1/path2/path3', - ['https://base.example/path1/path2/foo//'] - ); - }); -}); - -describe('Absolute URL scope keys', () => { - it('should accept all absolute URL scope keys, with or without fetch schemes', () => { - expectScopes( - [ - 'about:good', - 'blob:good', - 'data:good', - 'file:///good', - 'filesystem:http://example.com/good/', - 'http://good/', - 'https://good/', - 'ftp://good/', - 'import:bad', - 'mailto:bad', - 'javascript:bad', - 'wss:ba' - ], - 'https://base.example/path1/path2/path3', - [ - 'about:good', - 'blob:good', - 'data:good', - 'file:///good', - 'filesystem:http://example.com/good/', - 'http://good/', - 'https://good/', - 'ftp://good/', - 'import:bad', - 'mailto:bad', - 'javascript:bad', - 'wss://ba/' - ], - [] - ); - }); - - it('should parse absolute URL scope keys, ignoring unparseable ones', () => { - expectScopes( - [ - 'https://ex ample.org/', - 'https://example.com:demo', - 'http://[www.example.com]/', - 'https:example.org', - 'https://///example.com///', - 'https://example.net', - 'https://ex%41mple.com/foo/', - 'https://example.com/%41' - ], - 'https://base.example/path1/path2/path3', - [ - 'https://base.example/path1/path2/example.org', // tricky case! remember we have a base URL - 'https://example.com///', - 'https://example.net/', - 'https://example.com/foo/', - 'https://example.com/%41' - ], - [ - 'Invalid scope "https://ex ample.org/" (parsed against base URL "https://base.example/path1/path2/path3").', - 'Invalid scope "https://example.com:demo" (parsed against base URL "https://base.example/path1/path2/path3").', - 'Invalid scope "http://[www.example.com]/" (parsed against base URL "https://base.example/path1/path2/path3").' - ] - ); - }); - - it('should ignore relative URL scope keys when the base URL is a data: URL', () => { - expectScopes( - [ - './foo', - '../foo', - '/foo' - ], - 'data:text/html,test', - [], - [ - 'Invalid scope "./foo" (parsed against base URL "data:text/html,test").', - 'Invalid scope "../foo" (parsed against base URL "data:text/html,test").', - 'Invalid scope "/foo" (parsed against base URL "data:text/html,test").' - ] - ); - }); -}); diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/parsing-specifier-keys.js b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/parsing-specifier-keys.js deleted file mode 100644 index 9eb423a19eb..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/parsing-specifier-keys.js +++ /dev/null @@ -1,159 +0,0 @@ -'use strict'; -const { expectSpecifierMap } = require('./helpers/parsing.js'); -const { BUILT_IN_MODULE_SCHEME } = require('../lib/utils.js'); - -const BLANK = `${BUILT_IN_MODULE_SCHEME}:blank`; - -describe('Relative URL-like specifier keys', () => { - it('should absolutize strings prefixed with ./, ../, or / into the corresponding URLs', () => { - expectSpecifierMap( - `{ - "./foo": "/dotslash", - "../foo": "/dotdotslash", - "/foo": "/slash" - }`, - 'https://base.example/path1/path2/path3', - { - 'https://base.example/path1/path2/foo': [expect.toMatchURL('https://base.example/dotslash')], - 'https://base.example/path1/foo': [expect.toMatchURL('https://base.example/dotdotslash')], - 'https://base.example/foo': [expect.toMatchURL('https://base.example/slash')] - } - ); - }); - - it('should not absolutize strings prefixed with ./, ../, or / with a data: URL base', () => { - expectSpecifierMap( - `{ - "./foo": "https://example.com/dotslash", - "../foo": "https://example.com/dotdotslash", - "/foo": "https://example.com/slash" - }`, - 'data:text/html,test', - { - './foo': [expect.toMatchURL('https://example.com/dotslash')], - '../foo': [expect.toMatchURL('https://example.com/dotdotslash')], - '/foo': [expect.toMatchURL('https://example.com/slash')] - } - ); - }); - - it('should absolutize the literal strings ./, ../, or / with no suffix', () => { - expectSpecifierMap( - `{ - "./": "/dotslash/", - "../": "/dotdotslash/", - "/": "/slash/" - }`, - 'https://base.example/path1/path2/path3', - { - 'https://base.example/path1/path2/': [expect.toMatchURL('https://base.example/dotslash/')], - 'https://base.example/path1/': [expect.toMatchURL('https://base.example/dotdotslash/')], - 'https://base.example/': [expect.toMatchURL('https://base.example/slash/')] - } - ); - }); - - it('should treat percent-encoded variants of ./, ../, or / as bare specifiers', () => { - expectSpecifierMap( - `{ - "%2E/": "/dotSlash1/", - "%2E%2E/": "/dotDotSlash1/", - ".%2F": "/dotSlash2", - "..%2F": "/dotDotSlash2", - "%2F": "/slash2", - "%2E%2F": "/dotSlash3", - "%2E%2E%2F": "/dotDotSlash3" - }`, - 'https://base.example/path1/path2/path3', - { - '%2E/': [expect.toMatchURL('https://base.example/dotSlash1/')], - '%2E%2E/': [expect.toMatchURL('https://base.example/dotDotSlash1/')], - '.%2F': [expect.toMatchURL('https://base.example/dotSlash2')], - '..%2F': [expect.toMatchURL('https://base.example/dotDotSlash2')], - '%2F': [expect.toMatchURL('https://base.example/slash2')], - '%2E%2F': [expect.toMatchURL('https://base.example/dotSlash3')], - '%2E%2E%2F': [expect.toMatchURL('https://base.example/dotDotSlash3')] - } - ); - }); -}); - -describe('Absolute URL specifier keys', () => { - it('should only accept absolute URL specifier keys with fetch schemes, treating others as bare specifiers', () => { - expectSpecifierMap( - `{ - "about:good": "/about", - "blob:good": "/blob", - "data:good": "/data", - "file:///good": "/file", - "filesystem:good": "/filesystem", - "http://good/": "/http/", - "https://good/": "/https/", - "ftp://good/": "/ftp/", - "import:bad": "/import", - "mailto:bad": "/mailto", - "javascript:bad": "/javascript", - "wss:bad": "/wss" - }`, - 'https://base.example/path1/path2/path3', - { - 'about:good': [expect.toMatchURL('https://base.example/about')], - 'blob:good': [expect.toMatchURL('https://base.example/blob')], - 'data:good': [expect.toMatchURL('https://base.example/data')], - 'file:///good': [expect.toMatchURL('https://base.example/file')], - 'filesystem:good': [expect.toMatchURL('https://base.example/filesystem')], - 'http://good/': [expect.toMatchURL('https://base.example/http/')], - 'https://good/': [expect.toMatchURL('https://base.example/https/')], - 'ftp://good/': [expect.toMatchURL('https://base.example/ftp/')], - 'import:bad': [expect.toMatchURL('https://base.example/import')], - 'mailto:bad': [expect.toMatchURL('https://base.example/mailto')], - 'javascript:bad': [expect.toMatchURL('https://base.example/javascript')], - 'wss:bad': [expect.toMatchURL('https://base.example/wss')] - } - ); - }); - - it('should parse absolute URLs, treating unparseable ones as bare specifiers', () => { - expectSpecifierMap( - `{ - "https://ex ample.org/": "/unparseable1/", - "https://example.com:demo": "/unparseable2", - "http://[www.example.com]/": "/unparseable3/", - "https:example.org": "/invalidButParseable1/", - "https://///example.com///": "/invalidButParseable2/", - "https://example.net": "/prettyNormal/", - "https://ex%41mple.com/": "/percentDecoding/", - "https://example.com/%41": "/noPercentDecoding" - }`, - 'https://base.example/path1/path2/path3', - { - 'https://ex ample.org/': [expect.toMatchURL('https://base.example/unparseable1/')], - 'https://example.com:demo': [expect.toMatchURL('https://base.example/unparseable2')], - 'http://[www.example.com]/': [expect.toMatchURL('https://base.example/unparseable3/')], - 'https://example.org/': [expect.toMatchURL('https://base.example/invalidButParseable1/')], - 'https://example.com///': [expect.toMatchURL('https://base.example/invalidButParseable2/')], - 'https://example.net/': [expect.toMatchURL('https://base.example/prettyNormal/')], - 'https://example.com/': [expect.toMatchURL('https://base.example/percentDecoding/')], - 'https://example.com/%41': [expect.toMatchURL('https://base.example/noPercentDecoding')] - } - ); - }); - - it('should parse built-in module specifier keys, including with a "/"', () => { - expectSpecifierMap( - `{ - "${BLANK}": "/blank", - "${BLANK}/": "/blank/", - "${BLANK}/foo": "/blank/foo", - "${BLANK}\\\\foo": "/blank/backslashfoo" - }`, - 'https://base.example/path1/path2/path3', - { - [BLANK]: [expect.toMatchURL('https://base.example/blank')], - [`${BLANK}/`]: [expect.toMatchURL('https://base.example/blank/')], - [`${BLANK}/foo`]: [expect.toMatchURL('https://base.example/blank/foo')], - [`${BLANK}\\foo`]: [expect.toMatchURL('https://base.example/blank/backslashfoo')] - } - ); - }); -}); diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/resolving-builtins.js b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/resolving-builtins.js deleted file mode 100644 index a9383df843d..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/resolving-builtins.js +++ /dev/null @@ -1,158 +0,0 @@ -'use strict'; -const { URL } = require('url'); -const { parseFromString } = require('../lib/parser.js'); -const { resolve } = require('../lib/resolver.js'); -const { BUILT_IN_MODULE_SCHEME } = require('../lib/utils.js'); - -const mapBaseURL = new URL('https://example.com/app/index.html'); -const scriptURL = new URL('https://example.com/js/app.mjs'); - -const BLANK = `${BUILT_IN_MODULE_SCHEME}:blank`; -const NONE = `${BUILT_IN_MODULE_SCHEME}:none`; - -function makeResolveUnderTest(mapString) { - const map = parseFromString(mapString, mapBaseURL); - return specifier => resolve(specifier, map, scriptURL); -} - -describe('Unmapped built-in module specifiers', () => { - const resolveUnderTest = makeResolveUnderTest(`{}`); - - it(`should resolve "${BLANK}" to "${BLANK}"`, () => { - expect(resolveUnderTest(BLANK)).toMatchURL(BLANK); - }); - - it(`should error resolving "${NONE}"`, () => { - expect(() => resolveUnderTest(NONE)).toThrow(TypeError); - }); -}); - -describe('Remapping built-in module specifiers', () => { - it('should remap built-in modules', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "imports": { - "${BLANK}": "./blank.mjs", - "${NONE}": "./none.mjs" - } - }`); - - expect(resolveUnderTest(BLANK)).toMatchURL('https://example.com/app/blank.mjs'); - expect(resolveUnderTest(NONE)).toMatchURL('https://example.com/app/none.mjs'); - }); - - it('should remap built-in modules with slashes', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "imports": { - "${BLANK}/": "./blank-slash/", - "${BLANK}/foo": "./blank-foo.mjs", - "${NONE}/": "./none-slash/", - "${NONE}/foo": "./none-foo.mjs" - } - }`); - - expect(resolveUnderTest(`${BLANK}/`)).toMatchURL('https://example.com/app/blank-slash/'); - expect(resolveUnderTest(`${BLANK}/foo`)).toMatchURL('https://example.com/app/blank-foo.mjs'); - expect(resolveUnderTest(`${BLANK}/bar`)).toMatchURL('https://example.com/app/blank-slash/bar'); - expect(resolveUnderTest(`${NONE}/`)).toMatchURL('https://example.com/app/none-slash/'); - expect(resolveUnderTest(`${NONE}/foo`)).toMatchURL('https://example.com/app/none-foo.mjs'); - expect(resolveUnderTest(`${NONE}/bar`)).toMatchURL('https://example.com/app/none-slash/bar'); - }); - - it('should remap built-in modules with fallbacks', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "imports": { - "${BLANK}": ["${BLANK}", "./blank.mjs"], - "${NONE}": ["${NONE}", "./none.mjs"] - } - }`); - - expect(resolveUnderTest(BLANK)).toMatchURL(BLANK); - expect(resolveUnderTest(NONE)).toMatchURL('https://example.com/app/none.mjs'); - }); - - it('should remap built-in modules with slashes and fallbacks', () => { - // NOTE: `${BLANK}/for-testing` is not per spec, just for these tests. - // See resolver.js. - const resolveUnderTest = makeResolveUnderTest(`{ - "imports": { - "${BLANK}/": ["${BLANK}/", "./blank/"], - "${BLANK}/for-testing": ["${BLANK}/for-testing", "./blank-for-testing-special"], - "${NONE}/": ["${NONE}/", "./none/"], - "${NONE}/foo": ["${NONE}/foo", "./none-foo-special"] - } - }`); - - // Built-in modules only resolve for exact matches, so this will trigger the fallback. - expect(resolveUnderTest(`${BLANK}/`)).toMatchURL('https://example.com/app/blank/'); - expect(resolveUnderTest(`${BLANK}/foo`)).toMatchURL('https://example.com/app/blank/foo'); - - // This would fall back in a real implementation; it's only because we've gone against - // spec in the reference implementation (to make this testable) that this maps. - expect(resolveUnderTest(`${BLANK}/for-testing`)).toMatchURL(`${BLANK}/for-testing`); - - expect(resolveUnderTest(`${NONE}/`)).toMatchURL('https://example.com/app/none/'); - expect(resolveUnderTest(`${NONE}/bar`)).toMatchURL('https://example.com/app/none/bar'); - expect(resolveUnderTest(`${NONE}/foo`)).toMatchURL('https://example.com/app/none-foo-special'); - }); -}); - -describe('Remapping to built-in modules', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "imports": { - "blank": "${BLANK}", - "/blank": "${BLANK}", - "/blank/": "${BLANK}/", - "/blank-for-testing": "${BLANK}/for-testing", - "none": "${NONE}", - "/none": "${NONE}" - } - }`); - - it(`should remap to "${BLANK}"`, () => { - expect(resolveUnderTest('blank')).toMatchURL(BLANK); - expect(resolveUnderTest('/blank')).toMatchURL(BLANK); - }); - - it(`should fail when remapping to "${BLANK}/"`, () => { - expect(() => resolveUnderTest('/blank/')).toThrow(TypeError); - }); - - it(`should remap to "${BLANK}/for-testing"`, () => { - expect(resolveUnderTest('/blank/for-testing')).toMatchURL(`${BLANK}/for-testing`); - expect(resolveUnderTest('/blank-for-testing')).toMatchURL(`${BLANK}/for-testing`); - }); - - it(`should remap to "${BLANK}" for URL-like specifiers`, () => { - expect(resolveUnderTest('/blank')).toMatchURL(BLANK); - expect(resolveUnderTest('https://example.com/blank')).toMatchURL(BLANK); - expect(resolveUnderTest('https://///example.com/blank')).toMatchURL(BLANK); - }); - - it(`should fail when remapping to "${NONE}"`, () => { - expect(() => resolveUnderTest('none')).toThrow(TypeError); - expect(() => resolveUnderTest('/none')).toThrow(TypeError); - }); -}); - -describe('Fallbacks with built-in module addresses', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "imports": { - "blank": [ - "${BLANK}", - "./blank-fallback.mjs" - ], - "none": [ - "${NONE}", - "./none-fallback.mjs" - ] - } - }`); - - it(`should resolve to "${BLANK}"`, () => { - expect(resolveUnderTest('blank')).toMatchURL(BLANK); - }); - - it(`should fall back past "${NONE}"`, () => { - expect(resolveUnderTest('none')).toMatchURL('https://example.com/app/none-fallback.mjs'); - }); -}); diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/resolving-not-yet-implemented.js b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/resolving-not-yet-implemented.js deleted file mode 100644 index 93d782fdad8..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/resolving-not-yet-implemented.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; -const { URL } = require('url'); -const { parseFromString } = require('../lib/parser.js'); -const { resolve } = require('../lib/resolver.js'); -const { BUILT_IN_MODULE_SCHEME } = require('../lib/utils.js'); - -const mapBaseURL = new URL('https://example.com/app/index.html'); -const scriptURL = new URL('https://example.com/js/app.mjs'); - -const BLANK = `${BUILT_IN_MODULE_SCHEME}:blank`; - -function makeResolveUnderTest(mapString) { - const map = parseFromString(mapString, mapBaseURL); - return specifier => resolve(specifier, map, scriptURL); -} - -describe('Fallbacks that are not [built-in, fetch scheme]', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "imports": { - "bad1": [ - "${BLANK}", - "${BLANK}" - ], - "bad2": [ - "${BLANK}", - "/bad2-1.mjs", - "/bad2-2.mjs" - ], - "bad3": [ - "/bad3-1.mjs", - "/bad3-2.mjs" - ] - } - }`); - - it('should fail for [built-in, built-in]', () => { - expect(() => resolveUnderTest('bad1')).toThrow(/not yet implemented/); - }); - - it('should fail for [built-in, fetch scheme, fetch scheme]', () => { - expect(() => resolveUnderTest('bad2')).toThrow(/not yet implemented/); - }); - - it('should fail for [fetch scheme, fetch scheme]', () => { - expect(() => resolveUnderTest('bad3')).toThrow(/not yet implemented/); - }); -}); diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/resolving-scopes.js b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/resolving-scopes.js deleted file mode 100644 index ca19a668406..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/resolving-scopes.js +++ /dev/null @@ -1,230 +0,0 @@ -'use strict'; -const { URL } = require('url'); -const { parseFromString } = require('../lib/parser.js'); -const { resolve } = require('../lib/resolver.js'); - -const mapBaseURL = new URL('https://example.com/app/index.html'); - -function makeResolveUnderTest(mapString) { - const map = parseFromString(mapString, mapBaseURL); - return (specifier, baseURL) => resolve(specifier, map, baseURL); -} - -describe('Mapped using scope instead of "imports"', () => { - const jsNonDirURL = new URL('https://example.com/js'); - const jsPrefixedURL = new URL('https://example.com/jsiscool'); - const inJSDirURL = new URL('https://example.com/js/app.mjs'); - const topLevelURL = new URL('https://example.com/app.mjs'); - - it('should fail when the mapping is to an empty array', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "scopes": { - "/js/": { - "moment": null, - "lodash": [] - } - } - }`); - - expect(() => resolveUnderTest('moment', inJSDirURL)).toThrow(TypeError); - expect(() => resolveUnderTest('lodash', inJSDirURL)).toThrow(TypeError); - }); - - describe('Exact vs. prefix based matching', () => { - it('should match correctly when both are in the map', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "scopes": { - "/js": { - "moment": "/only-triggered-by-exact/moment", - "moment/": "/only-triggered-by-exact/moment/" - }, - "/js/": { - "moment": "/triggered-by-any-subpath/moment", - "moment/": "/triggered-by-any-subpath/moment/" - } - } - }`); - - expect(resolveUnderTest('moment', jsNonDirURL)).toMatchURL('https://example.com/only-triggered-by-exact/moment'); - expect(resolveUnderTest('moment/foo', jsNonDirURL)).toMatchURL('https://example.com/only-triggered-by-exact/moment/foo'); - - expect(resolveUnderTest('moment', inJSDirURL)).toMatchURL('https://example.com/triggered-by-any-subpath/moment'); - expect(resolveUnderTest('moment/foo', inJSDirURL)).toMatchURL('https://example.com/triggered-by-any-subpath/moment/foo'); - - expect(() => resolveUnderTest('moment', jsPrefixedURL)).toThrow(TypeError); - expect(() => resolveUnderTest('moment/foo', jsPrefixedURL)).toThrow(TypeError); - }); - - it('should match correctly when only an exact match is in the map', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "scopes": { - "/js": { - "moment": "/only-triggered-by-exact/moment", - "moment/": "/only-triggered-by-exact/moment/" - } - } - }`); - - expect(resolveUnderTest('moment', jsNonDirURL)).toMatchURL('https://example.com/only-triggered-by-exact/moment'); - expect(resolveUnderTest('moment/foo', jsNonDirURL)).toMatchURL('https://example.com/only-triggered-by-exact/moment/foo'); - - expect(() => resolveUnderTest('moment', inJSDirURL)).toThrow(TypeError); - expect(() => resolveUnderTest('moment/foo', inJSDirURL)).toThrow(TypeError); - - expect(() => resolveUnderTest('moment', jsPrefixedURL)).toThrow(TypeError); - expect(() => resolveUnderTest('moment/foo', jsPrefixedURL)).toThrow(TypeError); - }); - - it('should match correctly when only a prefix match is in the map', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "scopes": { - "/js/": { - "moment": "/triggered-by-any-subpath/moment", - "moment/": "/triggered-by-any-subpath/moment/" - } - } - }`); - - expect(() => resolveUnderTest('moment', jsNonDirURL)).toThrow(TypeError); - expect(() => resolveUnderTest('moment/foo', jsNonDirURL)).toThrow(TypeError); - - expect(resolveUnderTest('moment', inJSDirURL)).toMatchURL('https://example.com/triggered-by-any-subpath/moment'); - expect(resolveUnderTest('moment/foo', inJSDirURL)).toMatchURL('https://example.com/triggered-by-any-subpath/moment/foo'); - - expect(() => resolveUnderTest('moment', jsPrefixedURL)).toThrow(TypeError); - expect(() => resolveUnderTest('moment/foo', jsPrefixedURL)).toThrow(TypeError); - }); - }); - - describe('Package-like scenarios', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "imports": { - "moment": "/node_modules/moment/src/moment.js", - "moment/": "/node_modules/moment/src/", - "lodash-dot": "./node_modules/lodash-es/lodash.js", - "lodash-dot/": "./node_modules/lodash-es/", - "lodash-dotdot": "../node_modules/lodash-es/lodash.js", - "lodash-dotdot/": "../node_modules/lodash-es/" - }, - "scopes": { - "/": { - "moment": "/node_modules_3/moment/src/moment.js", - "vue": "/node_modules_3/vue/dist/vue.runtime.esm.js" - }, - "/js/": { - "lodash-dot": "./node_modules_2/lodash-es/lodash.js", - "lodash-dot/": "./node_modules_2/lodash-es/", - "lodash-dotdot": "../node_modules_2/lodash-es/lodash.js", - "lodash-dotdot/": "../node_modules_2/lodash-es/" - } - } - }`); - - it('should resolve scoped', () => { - expect(resolveUnderTest('lodash-dot', inJSDirURL)).toMatchURL('https://example.com/app/node_modules_2/lodash-es/lodash.js'); - expect(resolveUnderTest('lodash-dotdot', inJSDirURL)).toMatchURL('https://example.com/node_modules_2/lodash-es/lodash.js'); - expect(resolveUnderTest('lodash-dot/foo', inJSDirURL)).toMatchURL('https://example.com/app/node_modules_2/lodash-es/foo'); - expect(resolveUnderTest('lodash-dotdot/foo', inJSDirURL)).toMatchURL('https://example.com/node_modules_2/lodash-es/foo'); - }); - - it('should apply best scope match', () => { - expect(resolveUnderTest('moment', topLevelURL)).toMatchURL('https://example.com/node_modules_3/moment/src/moment.js'); - expect(resolveUnderTest('moment', inJSDirURL)).toMatchURL('https://example.com/node_modules_3/moment/src/moment.js'); - expect(resolveUnderTest('vue', inJSDirURL)).toMatchURL('https://example.com/node_modules_3/vue/dist/vue.runtime.esm.js'); - }); - - it('should fallback to "imports"', () => { - expect(resolveUnderTest('moment/foo', topLevelURL)).toMatchURL('https://example.com/node_modules/moment/src/foo'); - expect(resolveUnderTest('moment/foo', inJSDirURL)).toMatchURL('https://example.com/node_modules/moment/src/foo'); - expect(resolveUnderTest('lodash-dot', topLevelURL)).toMatchURL('https://example.com/app/node_modules/lodash-es/lodash.js'); - expect(resolveUnderTest('lodash-dotdot', topLevelURL)).toMatchURL('https://example.com/node_modules/lodash-es/lodash.js'); - expect(resolveUnderTest('lodash-dot/foo', topLevelURL)).toMatchURL('https://example.com/app/node_modules/lodash-es/foo'); - expect(resolveUnderTest('lodash-dotdot/foo', topLevelURL)).toMatchURL('https://example.com/node_modules/lodash-es/foo'); - }); - - it('should still fail for package-like specifiers that are not declared', () => { - expect(() => resolveUnderTest('underscore/', inJSDirURL)).toThrow(TypeError); - expect(() => resolveUnderTest('underscore/foo', inJSDirURL)).toThrow(TypeError); - }); - }); - - describe('The scope inheritance example from the README', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "imports": { - "a": "/a-1.mjs", - "b": "/b-1.mjs", - "c": "/c-1.mjs" - }, - "scopes": { - "/scope2/": { - "a": "/a-2.mjs" - }, - "/scope2/scope3/": { - "b": "/b-3.mjs" - } - } - }`); - - const scope1URL = new URL('https://example.com/scope1/foo.mjs'); - const scope2URL = new URL('https://example.com/scope2/foo.mjs'); - const scope3URL = new URL('https://example.com/scope2/scope3/foo.mjs'); - - it('should fall back to "imports" when none match', () => { - expect(resolveUnderTest('a', scope1URL)).toMatchURL('https://example.com/a-1.mjs'); - expect(resolveUnderTest('b', scope1URL)).toMatchURL('https://example.com/b-1.mjs'); - expect(resolveUnderTest('c', scope1URL)).toMatchURL('https://example.com/c-1.mjs'); - }); - - it('should use a direct scope override', () => { - expect(resolveUnderTest('a', scope2URL)).toMatchURL('https://example.com/a-2.mjs'); - expect(resolveUnderTest('b', scope2URL)).toMatchURL('https://example.com/b-1.mjs'); - expect(resolveUnderTest('c', scope2URL)).toMatchURL('https://example.com/c-1.mjs'); - }); - - it('should use an indirect scope override', () => { - expect(resolveUnderTest('a', scope3URL)).toMatchURL('https://example.com/a-2.mjs'); - expect(resolveUnderTest('b', scope3URL)).toMatchURL('https://example.com/b-3.mjs'); - expect(resolveUnderTest('c', scope3URL)).toMatchURL('https://example.com/c-1.mjs'); - }); - }); - - describe('Relative URL scope keys', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "imports": { - "a": "/a-1.mjs", - "b": "/b-1.mjs", - "c": "/c-1.mjs" - }, - "scopes": { - "": { - "a": "/a-empty-string.mjs" - }, - "./": { - "b": "/b-dot-slash.mjs" - }, - "../": { - "c": "/c-dot-dot-slash.mjs" - } - } - }`); - const inSameDirAsMap = new URL('./foo.mjs', mapBaseURL); - const inDirAboveMap = new URL('../foo.mjs', mapBaseURL); - - it('should resolve an empty string scope using the import map URL', () => { - expect(resolveUnderTest('a', mapBaseURL)).toMatchURL('https://example.com/a-empty-string.mjs'); - expect(resolveUnderTest('a', inSameDirAsMap)).toMatchURL('https://example.com/a-1.mjs'); - }); - - it('should resolve a ./ scope using the import map URL\'s directory', () => { - expect(resolveUnderTest('b', mapBaseURL)).toMatchURL('https://example.com/b-dot-slash.mjs'); - expect(resolveUnderTest('b', inSameDirAsMap)).toMatchURL('https://example.com/b-dot-slash.mjs'); - }); - - it('should resolve a ../ scope using the import map URL\'s directory', () => { - expect(resolveUnderTest('c', mapBaseURL)).toMatchURL('https://example.com/c-dot-dot-slash.mjs'); - expect(resolveUnderTest('c', inSameDirAsMap)).toMatchURL('https://example.com/c-dot-dot-slash.mjs'); - expect(resolveUnderTest('c', inDirAboveMap)).toMatchURL('https://example.com/c-dot-dot-slash.mjs'); - }); - }); -}); - diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/resolving.js b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/resolving.js deleted file mode 100644 index 29ee31ccbc9..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/imported/resources/resolving.js +++ /dev/null @@ -1,270 +0,0 @@ -'use strict'; -const { URL } = require('url'); -const { parseFromString } = require('../lib/parser.js'); -const { resolve } = require('../lib/resolver.js'); - -const mapBaseURL = new URL('https://example.com/app/index.html'); -const scriptURL = new URL('https://example.com/js/app.mjs'); - -function makeResolveUnderTest(mapString) { - const map = parseFromString(mapString, mapBaseURL); - return specifier => resolve(specifier, map, scriptURL); -} - -describe('Unmapped', () => { - const resolveUnderTest = makeResolveUnderTest(`{}`); - - it('should resolve ./ specifiers as URLs', () => { - expect(resolveUnderTest('./foo')).toMatchURL('https://example.com/js/foo'); - expect(resolveUnderTest('./foo/bar')).toMatchURL('https://example.com/js/foo/bar'); - expect(resolveUnderTest('./foo/../bar')).toMatchURL('https://example.com/js/bar'); - expect(resolveUnderTest('./foo/../../bar')).toMatchURL('https://example.com/bar'); - }); - - it('should resolve ../ specifiers as URLs', () => { - expect(resolveUnderTest('../foo')).toMatchURL('https://example.com/foo'); - expect(resolveUnderTest('../foo/bar')).toMatchURL('https://example.com/foo/bar'); - expect(resolveUnderTest('../../../foo/bar')).toMatchURL('https://example.com/foo/bar'); - }); - - it('should resolve / specifiers as URLs', () => { - expect(resolveUnderTest('/foo')).toMatchURL('https://example.com/foo'); - expect(resolveUnderTest('/foo/bar')).toMatchURL('https://example.com/foo/bar'); - expect(resolveUnderTest('/../../foo/bar')).toMatchURL('https://example.com/foo/bar'); - expect(resolveUnderTest('/../foo/../bar')).toMatchURL('https://example.com/bar'); - }); - - it('should parse absolute fetch-scheme URLs', () => { - expect(resolveUnderTest('about:good')).toMatchURL('about:good'); - expect(resolveUnderTest('https://example.net')).toMatchURL('https://example.net/'); - expect(resolveUnderTest('https://ex%41mple.com/')).toMatchURL('https://example.com/'); - expect(resolveUnderTest('https:example.org')).toMatchURL('https://example.org/'); - expect(resolveUnderTest('https://///example.com///')).toMatchURL('https://example.com///'); - }); - - it('should fail for absolute non-fetch-scheme URLs', () => { - expect(() => resolveUnderTest('mailto:bad')).toThrow(TypeError); - expect(() => resolveUnderTest('import:bad')).toThrow(TypeError); - expect(() => resolveUnderTest('javascript:bad')).toThrow(TypeError); - expect(() => resolveUnderTest('wss:bad')).toThrow(TypeError); - }); - - it('should fail for strings not parseable as absolute URLs and not starting with ./ ../ or /', () => { - expect(() => resolveUnderTest('foo')).toThrow(TypeError); - expect(() => resolveUnderTest('\\foo')).toThrow(TypeError); - expect(() => resolveUnderTest(':foo')).toThrow(TypeError); - expect(() => resolveUnderTest('@foo')).toThrow(TypeError); - expect(() => resolveUnderTest('%2E/foo')).toThrow(TypeError); - expect(() => resolveUnderTest('%2E%2E/foo')).toThrow(TypeError); - expect(() => resolveUnderTest('.%2Ffoo')).toThrow(TypeError); - expect(() => resolveUnderTest('https://ex ample.org/')).toThrow(TypeError); - expect(() => resolveUnderTest('https://example.com:demo')).toThrow(TypeError); - expect(() => resolveUnderTest('http://[www.example.com]/')).toThrow(TypeError); - }); -}); - -describe('Mapped using the "imports" key only (no scopes)', () => { - it('should fail when the mapping is to an empty array', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "imports": { - "moment": null, - "lodash": [] - } - }`); - - expect(() => resolveUnderTest('moment')).toThrow(TypeError); - expect(() => resolveUnderTest('lodash')).toThrow(TypeError); - }); - - describe('Package-like scenarios', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "imports": { - "moment": "/node_modules/moment/src/moment.js", - "moment/": "/node_modules/moment/src/", - "lodash-dot": "./node_modules/lodash-es/lodash.js", - "lodash-dot/": "./node_modules/lodash-es/", - "lodash-dotdot": "../node_modules/lodash-es/lodash.js", - "lodash-dotdot/": "../node_modules/lodash-es/", - "nowhere/": [] - } - }`); - - it('should work for package main modules', () => { - expect(resolveUnderTest('moment')).toMatchURL('https://example.com/node_modules/moment/src/moment.js'); - expect(resolveUnderTest('lodash-dot')).toMatchURL('https://example.com/app/node_modules/lodash-es/lodash.js'); - expect(resolveUnderTest('lodash-dotdot')).toMatchURL('https://example.com/node_modules/lodash-es/lodash.js'); - }); - - it('should work for package submodules', () => { - expect(resolveUnderTest('moment/foo')).toMatchURL('https://example.com/node_modules/moment/src/foo'); - expect(resolveUnderTest('lodash-dot/foo')).toMatchURL('https://example.com/app/node_modules/lodash-es/foo'); - expect(resolveUnderTest('lodash-dotdot/foo')).toMatchURL('https://example.com/node_modules/lodash-es/foo'); - }); - - it('should work for package names that end in a slash by just passing through', () => { - // TODO: is this the right behavior, or should we throw? - expect(resolveUnderTest('moment/')).toMatchURL('https://example.com/node_modules/moment/src/'); - }); - - it('should still fail for package modules that are not declared', () => { - expect(() => resolveUnderTest('underscore/')).toThrow(TypeError); - expect(() => resolveUnderTest('underscore/foo')).toThrow(TypeError); - }); - - it('should fail for package submodules that map to nowhere', () => { - expect(() => resolveUnderTest('nowhere/foo')).toThrow(TypeError); - }); - }); - - describe('Tricky specifiers', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "imports": { - "package/withslash": "/node_modules/package-with-slash/index.mjs", - "not-a-package": "/lib/not-a-package.mjs", - ".": "/lib/dot.mjs", - "..": "/lib/dotdot.mjs", - "..\\\\": "/lib/dotdotbackslash.mjs", - "%2E": "/lib/percent2e.mjs", - "%2F": "/lib/percent2f.mjs" - } - }`); - - it('should work for explicitly-mapped specifiers that happen to have a slash', () => { - expect(resolveUnderTest('package/withslash')).toMatchURL('https://example.com/node_modules/package-with-slash/index.mjs'); - }); - - it('should work when the specifier has punctuation', () => { - expect(resolveUnderTest('.')).toMatchURL('https://example.com/lib/dot.mjs'); - expect(resolveUnderTest('..')).toMatchURL('https://example.com/lib/dotdot.mjs'); - expect(resolveUnderTest('..\\')).toMatchURL('https://example.com/lib/dotdotbackslash.mjs'); - expect(resolveUnderTest('%2E')).toMatchURL('https://example.com/lib/percent2e.mjs'); - expect(resolveUnderTest('%2F')).toMatchURL('https://example.com/lib/percent2f.mjs'); - }); - - it('should fail for attempting to get a submodule of something not declared with a trailing slash', () => { - expect(() => resolveUnderTest('not-a-package/foo')).toThrow(TypeError); - }); - }); - - describe('URL-like specifiers', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "imports": { - "/node_modules/als-polyfill/index.mjs": "std:kv-storage", - - "/lib/foo.mjs": "./more/bar.mjs", - "./dotrelative/foo.mjs": "/lib/dot.mjs", - "../dotdotrelative/foo.mjs": "/lib/dotdot.mjs", - - "/lib/no.mjs": null, - "./dotrelative/no.mjs": [], - - "/": "/lib/slash-only/", - "./": "/lib/dotslash-only/", - - "/test/": "/lib/url-trailing-slash/", - "./test/": "/lib/url-trailing-slash-dot/", - - "/test": "/lib/test1.mjs", - "../test": "/lib/test2.mjs" - } - }`); - - it('should remap to other URLs', () => { - expect(resolveUnderTest('https://example.com/lib/foo.mjs')).toMatchURL('https://example.com/app/more/bar.mjs'); - expect(resolveUnderTest('https://///example.com/lib/foo.mjs')).toMatchURL('https://example.com/app/more/bar.mjs'); - expect(resolveUnderTest('/lib/foo.mjs')).toMatchURL('https://example.com/app/more/bar.mjs'); - - expect(resolveUnderTest('https://example.com/app/dotrelative/foo.mjs')).toMatchURL('https://example.com/lib/dot.mjs'); - expect(resolveUnderTest('../app/dotrelative/foo.mjs')).toMatchURL('https://example.com/lib/dot.mjs'); - - expect(resolveUnderTest('https://example.com/dotdotrelative/foo.mjs')).toMatchURL('https://example.com/lib/dotdot.mjs'); - expect(resolveUnderTest('../dotdotrelative/foo.mjs')).toMatchURL('https://example.com/lib/dotdot.mjs'); - }); - - it('should fail for URLs that remap to empty arrays', () => { - expect(() => resolveUnderTest('https://example.com/lib/no.mjs')).toThrow(TypeError); - expect(() => resolveUnderTest('/lib/no.mjs')).toThrow(TypeError); - expect(() => resolveUnderTest('../lib/no.mjs')).toThrow(TypeError); - - expect(() => resolveUnderTest('https://example.com/app/dotrelative/no.mjs')).toThrow(TypeError); - expect(() => resolveUnderTest('/app/dotrelative/no.mjs')).toThrow(TypeError); - expect(() => resolveUnderTest('../app/dotrelative/no.mjs')).toThrow(TypeError); - }); - - it('should remap URLs that are just composed from / and .', () => { - expect(resolveUnderTest('https://example.com/')).toMatchURL('https://example.com/lib/slash-only/'); - expect(resolveUnderTest('/')).toMatchURL('https://example.com/lib/slash-only/'); - expect(resolveUnderTest('../')).toMatchURL('https://example.com/lib/slash-only/'); - - expect(resolveUnderTest('https://example.com/app/')).toMatchURL('https://example.com/lib/dotslash-only/'); - expect(resolveUnderTest('/app/')).toMatchURL('https://example.com/lib/dotslash-only/'); - expect(resolveUnderTest('../app/')).toMatchURL('https://example.com/lib/dotslash-only/'); - }); - - it('should remap URLs that are prefix-matched by keys with trailing slashes', () => { - expect(resolveUnderTest('/test/foo.mjs')).toMatchURL('https://example.com/lib/url-trailing-slash/foo.mjs'); - expect(resolveUnderTest('https://example.com/app/test/foo.mjs')).toMatchURL('https://example.com/lib/url-trailing-slash-dot/foo.mjs'); - }); - - it('should use the last entry\'s address when URL-like specifiers parse to the same absolute URL', () => { - expect(resolveUnderTest('/test')).toMatchURL('https://example.com/lib/test2.mjs'); - }); - }); - - describe('Overlapping entries with trailing slashes', () => { - it('should favor the most-specific key (no empty arrays)', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "imports": { - "a": "/1", - "a/": "/2/", - "a/b": "/3", - "a/b/": "/4/" - } - }`); - - expect(resolveUnderTest('a')).toMatchURL('https://example.com/1'); - expect(resolveUnderTest('a/')).toMatchURL('https://example.com/2/'); - expect(resolveUnderTest('a/b')).toMatchURL('https://example.com/3'); - expect(resolveUnderTest('a/b/')).toMatchURL('https://example.com/4/'); - expect(resolveUnderTest('a/b/c')).toMatchURL('https://example.com/4/c'); - }); - - it('should favor the most-specific key when empty arrays are involved for less-specific keys', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "imports": { - "a": [], - "a/": [], - "a/b": "/3", - "a/b/": "/4/" - } - }`); - - expect(() => resolveUnderTest('a')).toThrow(TypeError); - expect(() => resolveUnderTest('a/')).toThrow(TypeError); - expect(() => resolveUnderTest('a/x')).toThrow(TypeError); - expect(resolveUnderTest('a/b')).toMatchURL('https://example.com/3'); - expect(resolveUnderTest('a/b/')).toMatchURL('https://example.com/4/'); - expect(resolveUnderTest('a/b/c')).toMatchURL('https://example.com/4/c'); - expect(() => resolveUnderTest('a/x/c')).toThrow(TypeError); - }); - - it('should favor the most-specific key when empty arrays are involved for more-specific keys', () => { - const resolveUnderTest = makeResolveUnderTest(`{ - "imports": { - "a": "/1", - "a/": "/2/", - "a/b": [], - "a/b/": [] - } - }`); - - expect(resolveUnderTest('a')).toMatchURL('https://example.com/1'); - expect(resolveUnderTest('a/')).toMatchURL('https://example.com/2/'); - expect(resolveUnderTest('a/x')).toMatchURL('https://example.com/2/x'); - expect(() => resolveUnderTest('a/b')).toThrow(TypeError); - expect(() => resolveUnderTest('a/b/')).toThrow(TypeError); - expect(() => resolveUnderTest('a/b/c')).toThrow(TypeError); - expect(resolveUnderTest('a/x/c')).toMatchURL('https://example.com/2/x/c'); - }); - }); -}); diff --git a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/static-import.py b/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/static-import.py deleted file mode 100644 index 8d0f5d9f420..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/builtin-support.tentative/static-import.py +++ /dev/null @@ -1,5 +0,0 @@ -def main(request, response): - return ( - (('Content-Type', 'text/javascript'),), - 'import "{}";\n'.format(request.GET.first('url')) - ) diff --git a/tests/wpt/web-platform-tests/import-maps/resources/jest-test-helper.js b/tests/wpt/web-platform-tests/import-maps/resources/jest-test-helper.js deleted file mode 100644 index 752c987df52..00000000000 --- a/tests/wpt/web-platform-tests/import-maps/resources/jest-test-helper.js +++ /dev/null @@ -1,132 +0,0 @@ -// Hacky glue code to run Jest-based tests as WPT tests. -// TODO(https://github.com/WICG/import-maps/issues/170): Consider better ways -// to write and run tests. - -setup({allow_uncaught_exception : true}); - -const exports = {}; - -function require(name) { - return Object.assign({ - 'URL': URL, - 'parseFromString': parseFromString, - 'resolve': resolve, - 'BUILT_IN_MODULE_SCHEME': 'std' - }, exports); -} - -// Sort keys and then stringify for comparison. -function stringifyImportMap(importMap) { - function getKeys(m) { - if (typeof m !== 'object') - return []; - - let keys = []; - for (const key in m) { - keys.push(key); - keys = keys.concat(getKeys(m[key])); - } - return keys; - } - return JSON.stringify(importMap, getKeys(importMap).sort()); -} - -function expect(v) { - return { - toMatchURL: expected => assert_equals(v, expected), - toThrow: expected => { - if (v.localName === 'iframe') { - // `v` is the result of parseFromString(), and thus toThrow() - // should be examining the error in that iframe. - assert_throws_js(v.contentWindow[expected], () => { throw v.contentWindow.windowError }); - } else if (expected.test && expected.test('not yet implemented')) { - // We override /not yet implemented/ expectation. - assert_throws_js(TypeError, v); - } else { - assert_throws_js(expected, v); - } - }, - toEqual: expected => { - if (v.localName === 'iframe') { - // `v` is the result of parseFromString(), and thus toEqual() is - // expected to compare parsed import maps. - // We sort keys when stringifying for normalization. - const actualParsedImportMap = JSON.parse( - internals.getParsedImportMap(v.contentDocument)); - assert_equals( - stringifyImportMap(actualParsedImportMap), - stringifyImportMap(expected) - ); - } else { - assert_object_equals(v, expected); - } - } - }; -} - -expect.toMatchURL = expected => expected; - -const test_harness_test = test; -test = it; - -let current_message = ''; -function describe(message, f) { - const old = current_message; - if (current_message !== '') { - current_message += ' / '; - } - current_message += message; - f(); - current_message = old; -} -function it(message, f) { - const old = current_message; - if (current_message !== '') { - current_message += ' / '; - } - current_message += message; - test_harness_test(t => t.step_func(f)(), current_message); - current_message = old; -} - -// Creates a new Document (via