Update web-platform-tests to revision 181f8381fe9373e027f4b5ba5d1439843ad2c2e6

This commit is contained in:
WPT Sync Bot 2019-02-21 21:02:15 -05:00
parent 0dda115609
commit 0355b8e70d
105 changed files with 2775 additions and 764 deletions

View file

@ -37,3 +37,6 @@
[Revoke blob URL after creating Request, will fetch] [Revoke blob URL after creating Request, will fetch]
expected: FAIL expected: FAIL
[Revoke blob URL after calling fetch, fetch should succeed]
expected: FAIL

View file

@ -299318,6 +299318,11 @@
{} {}
] ]
], ],
"html/semantics/embedded-content/the-iframe-element/support/download_stash.py": [
[
{}
]
],
"html/semantics/embedded-content/the-iframe-element/support/iframe-that-checks-contentDocument.html": [ "html/semantics/embedded-content/the-iframe-element/support/iframe-that-checks-contentDocument.html": [
[ [
{} {}
@ -299478,6 +299483,11 @@
{} {}
] ]
], ],
"html/semantics/embedded-content/the-iframe-element/support/iframe_sandbox_download_helper.js": [
[
{}
]
],
"html/semantics/embedded-content/the-iframe-element/support/load-into-the-iframe.html": [ "html/semantics/embedded-content/the-iframe-element/support/load-into-the-iframe.html": [
[ [
{} {}
@ -304298,6 +304308,11 @@
{} {}
] ]
], ],
"mixed-content/generic/script.js": [
[
{}
]
],
"mixed-content/generic/template/disclaimer.template": [ "mixed-content/generic/template/disclaimer.template": [
[ [
{} {}
@ -315273,6 +315288,11 @@
{} {}
] ]
], ],
"tools/ci/azure/fyi_hook.yml": [
[
{}
]
],
"tools/ci/azure/install_certs.yml": [ "tools/ci/azure/install_certs.yml": [
[ [
{} {}
@ -322603,6 +322623,21 @@
{} {}
] ]
], ],
"trusted-types/trusted-types-report-only.tentative.https.html.headers": [
[
{}
]
],
"trusted-types/trusted-types-reporting-check-report.https.html.sub.headers": [
[
{}
]
],
"trusted-types/trusted-types-reporting.tentative.https.html.headers": [
[
{}
]
],
"uievents/META.yml": [ "uievents/META.yml": [
[ [
{} {}
@ -348466,6 +348501,12 @@
{} {}
] ]
], ],
"css/css-scroll-snap/scroll-snap-stop-always.html": [
[
"/css/css-scroll-snap/scroll-snap-stop-always.html",
{}
]
],
"css/css-scroll-snap/scroll-snap-type-proximity.html": [ "css/css-scroll-snap/scroll-snap-type-proximity.html": [
[ [
"/css/css-scroll-snap/scroll-snap-type-proximity.html", "/css/css-scroll-snap/scroll-snap-type-proximity.html",
@ -356970,6 +357011,12 @@
{} {}
] ]
], ],
"custom-elements/HTMLElement-attachInternals.html": [
[
"/custom-elements/HTMLElement-attachInternals.html",
{}
]
],
"custom-elements/HTMLElement-constructor.html": [ "custom-elements/HTMLElement-constructor.html": [
[ [
"/custom-elements/HTMLElement-constructor.html", "/custom-elements/HTMLElement-constructor.html",
@ -378228,6 +378275,18 @@
{} {}
] ]
], ],
"html/semantics/embedded-content/the-iframe-element/iframe_sandbox_anchor_download_allow_downloads_without_user_activation.sub.tentative.html": [
[
"/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_anchor_download_allow_downloads_without_user_activation.sub.tentative.html",
{}
]
],
"html/semantics/embedded-content/the-iframe-element/iframe_sandbox_anchor_download_block_downloads_without_user_activation.sub.tentative.html": [
[
"/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_anchor_download_block_downloads_without_user_activation.sub.tentative.html",
{}
]
],
"html/semantics/embedded-content/the-iframe-element/iframe_sandbox_block_modals-1.html": [ "html/semantics/embedded-content/the-iframe-element/iframe_sandbox_block_modals-1.html": [
[ [
"/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_block_modals-1.html", "/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_block_modals-1.html",
@ -378276,6 +378335,18 @@
{} {}
] ]
], ],
"html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigation_download_allow_downloads_without_user_activation.sub.tentative.html": [
[
"/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigation_download_allow_downloads_without_user_activation.sub.tentative.html",
{}
]
],
"html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigation_download_block_downloads_without_user_activation.sub.tentative.html": [
[
"/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigation_download_block_downloads_without_user_activation.sub.tentative.html",
{}
]
],
"html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html": [ "html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html": [
[ [
"/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html", "/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html",
@ -414584,6 +414655,18 @@
{} {}
] ]
], ],
"signed-exchange/reporting/sxg-reporting-navigation-ok.tentative.html": [
[
"/signed-exchange/reporting/sxg-reporting-navigation-ok.tentative.html",
{}
]
],
"signed-exchange/reporting/sxg-reporting-prefetch-ok.tentative.html": [
[
"/signed-exchange/reporting/sxg-reporting-prefetch-ok.tentative.html",
{}
]
],
"signed-exchange/sxg-double-prefetch.tentative.html": [ "signed-exchange/sxg-double-prefetch.tentative.html": [
[ [
"/signed-exchange/sxg-double-prefetch.tentative.html", "/signed-exchange/sxg-double-prefetch.tentative.html",
@ -416582,6 +416665,18 @@
{} {}
] ]
], ],
"svg/geometry/svg-image-intrinsic-size-with-cssstyle-auto-dynamic-image-change.html": [
[
"/svg/geometry/svg-image-intrinsic-size-with-cssstyle-auto-dynamic-image-change.html",
{}
]
],
"svg/geometry/svg-image-intrinsic-size-with-cssstyle-auto.html": [
[
"/svg/geometry/svg-image-intrinsic-size-with-cssstyle-auto.html",
{}
]
],
"svg/historical.html": [ "svg/historical.html": [
[ [
"/svg/historical.html", "/svg/historical.html",
@ -417842,6 +417937,24 @@
{} {}
] ]
], ],
"trusted-types/trusted-types-report-only.tentative.https.html": [
[
"/trusted-types/trusted-types-report-only.tentative.https.html",
{}
]
],
"trusted-types/trusted-types-reporting-check-report.https.html": [
[
"/trusted-types/trusted-types-reporting-check-report.https.html",
{}
]
],
"trusted-types/trusted-types-reporting.tentative.https.html": [
[
"/trusted-types/trusted-types-reporting.tentative.https.html",
{}
]
],
"uievents/click/auxclick_event.html": [ "uievents/click/auxclick_event.html": [
[ [
"/uievents/click/auxclick_event.html", "/uievents/click/auxclick_event.html",
@ -450106,7 +450219,7 @@
}, },
"paths": { "paths": {
".azure-pipelines.yml": [ ".azure-pipelines.yml": [
"cb204cabe288508280622c59b1d30bf18b74c1a1", "b4f71f048b8147ee0acbd5887c79b153faa2dee9",
"support" "support"
], ],
".codecov.yml": [ ".codecov.yml": [
@ -461386,23 +461499,23 @@
"testharness" "testharness"
], ],
"clipboard-apis/async-navigator-clipboard-basics.https.html": [ "clipboard-apis/async-navigator-clipboard-basics.https.html": [
"5a23598fb0bd41dbc854cebb340d6f6ed8db54db", "3c1a0af76c2674960a871f82c908b9044240f967",
"testharness" "testharness"
], ],
"clipboard-apis/async-write-blobtext-read-blobtext-manual.https.html": [ "clipboard-apis/async-write-blobtext-read-blobtext-manual.https.html": [
"f860bf23db2ee381805ed5b4053c309a45954342", "ea6e9369517976642cf158d3273a56f321249813",
"manual" "manual"
], ],
"clipboard-apis/async-write-blobtext-read-text-manual.https.html": [ "clipboard-apis/async-write-blobtext-read-text-manual.https.html": [
"685b6cb603ddeb66e68cd23efe85d744f8a17223", "ecb744a65704a2ff449391f84d6c20e1474a52d5",
"manual" "manual"
], ],
"clipboard-apis/async-write-image-read-image-manual.https.html": [ "clipboard-apis/async-write-image-read-image-manual.https.html": [
"ee90e7e89a8994ba728d673e1da031c21cf38a04", "a8e2956b7e14784d917a2dcf3f5b7e571b81c042",
"manual" "manual"
], ],
"clipboard-apis/async-write-text-read-blobtext-manual.https.html": [ "clipboard-apis/async-write-text-read-blobtext-manual.https.html": [
"69f72db82c07d2bca7446cf65d6d3056bebe24e2", "7e682f1dbdd4f02de5a00addf9be1fbdcc4ca8f0",
"manual" "manual"
], ],
"clipboard-apis/async-write-text-read-text-manual.https.html": [ "clipboard-apis/async-write-text-read-text-manual.https.html": [
@ -575013,6 +575126,10 @@
"fde2211f9253467544376643d2e842c61adfe8be", "fde2211f9253467544376643d2e842c61adfe8be",
"testharness" "testharness"
], ],
"css/css-scroll-snap/scroll-snap-stop-always.html": [
"62446f54632f943eacf7e2bcd4bd1d98d346e97c",
"testharness"
],
"css/css-scroll-snap/scroll-snap-type-proximity.html": [ "css/css-scroll-snap/scroll-snap-type-proximity.html": [
"cfe990c4fcab85898899039f71fa353484558789", "cfe990c4fcab85898899039f71fa353484558789",
"testharness" "testharness"
@ -614573,6 +614690,10 @@
"32613c47e241078fae04ecdd7ee9e5b0236819fc", "32613c47e241078fae04ecdd7ee9e5b0236819fc",
"testharness" "testharness"
], ],
"custom-elements/HTMLElement-attachInternals.html": [
"e537983059054eb6193434bfbeb700226e3c5fb7",
"testharness"
],
"custom-elements/HTMLElement-constructor.html": [ "custom-elements/HTMLElement-constructor.html": [
"a0bfa909bae1e98febaa5ef8eb3170ca30b58c13", "a0bfa909bae1e98febaa5ef8eb3170ca30b58c13",
"testharness" "testharness"
@ -622098,7 +622219,7 @@
"testharness" "testharness"
], ],
"fetch/sec-metadata/img.tentative.https.sub.html": [ "fetch/sec-metadata/img.tentative.https.sub.html": [
"252b220011c553b2b941dbc9fdce427990bb1131", "befc7a973bbe2f751088089533414fa6b2dd8669",
"testharness" "testharness"
], ],
"fetch/sec-metadata/object.tentative.https.sub.html": [ "fetch/sec-metadata/object.tentative.https.sub.html": [
@ -635709,6 +635830,14 @@
"042851bbb492365e9d176aff8d678feb645f1d18", "042851bbb492365e9d176aff8d678feb645f1d18",
"testharness" "testharness"
], ],
"html/semantics/embedded-content/the-iframe-element/iframe_sandbox_anchor_download_allow_downloads_without_user_activation.sub.tentative.html": [
"32409f220f0a273f165741e2d79ca60846d61648",
"testharness"
],
"html/semantics/embedded-content/the-iframe-element/iframe_sandbox_anchor_download_block_downloads_without_user_activation.sub.tentative.html": [
"abd4d7c5e0d76d04cd678b00a153d5a8f10bddf7",
"testharness"
],
"html/semantics/embedded-content/the-iframe-element/iframe_sandbox_block_modals-1.html": [ "html/semantics/embedded-content/the-iframe-element/iframe_sandbox_block_modals-1.html": [
"ce171bfb8e10f90ed581fbcdc0b4e0605d150b88", "ce171bfb8e10f90ed581fbcdc0b4e0605d150b88",
"testharness" "testharness"
@ -635741,6 +635870,14 @@
"12c4e0ca50236caacae89c76da3b81effd7b44be", "12c4e0ca50236caacae89c76da3b81effd7b44be",
"testharness" "testharness"
], ],
"html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigation_download_allow_downloads_without_user_activation.sub.tentative.html": [
"4fee27f9ba92482b85ecbcb7e1abe541fbfe83b9",
"testharness"
],
"html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigation_download_block_downloads_without_user_activation.sub.tentative.html": [
"9b9246c393ec9b4ee3b9762d6d06ea65ff0ff5d1",
"testharness"
],
"html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html": [ "html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html": [
"342d422036426655457bb5e886871a310bb1dd3a", "342d422036426655457bb5e886871a310bb1dd3a",
"testharness" "testharness"
@ -635945,6 +636082,10 @@
"18ecdcb795c33d6ab7bbb43f647947defca5634d", "18ecdcb795c33d6ab7bbb43f647947defca5634d",
"support" "support"
], ],
"html/semantics/embedded-content/the-iframe-element/support/download_stash.py": [
"24e1dfd58f760e1fa99846e0fac063a32a258e58",
"support"
],
"html/semantics/embedded-content/the-iframe-element/support/iframe-that-checks-contentDocument.html": [ "html/semantics/embedded-content/the-iframe-element/support/iframe-that-checks-contentDocument.html": [
"bc35a977e8b27360f75a901d44fedf47ad496e37", "bc35a977e8b27360f75a901d44fedf47ad496e37",
"support" "support"
@ -636073,6 +636214,10 @@
"67733d8101b94e788f670393f624b35b7a9c7876", "67733d8101b94e788f670393f624b35b7a9c7876",
"support" "support"
], ],
"html/semantics/embedded-content/the-iframe-element/support/iframe_sandbox_download_helper.js": [
"7090e7662ca8e2f5cd0e732a8ea3c386abc273b1",
"support"
],
"html/semantics/embedded-content/the-iframe-element/support/load-into-the-iframe.html": [ "html/semantics/embedded-content/the-iframe-element/support/load-into-the-iframe.html": [
"05a80be73745465ddcd65bc5745a674824974590", "05a80be73745465ddcd65bc5745a674824974590",
"support" "support"
@ -643474,7 +643619,7 @@
"support" "support"
], ],
"interfaces/html.idl": [ "interfaces/html.idl": [
"f530f3559b68af565fc07f4372a1444d5036eac2", "641213d1bb6fd47d3cb66f84661b8d658e76b641",
"support" "support"
], ],
"interfaces/image-capture.idl": [ "interfaces/image-capture.idl": [
@ -643542,7 +643687,7 @@
"support" "support"
], ],
"interfaces/netinfo.idl": [ "interfaces/netinfo.idl": [
"a4876c9991069b48ff037e8105f05ebbd31202b1", "729678396884a19874239468075bfd587c621305",
"support" "support"
], ],
"interfaces/notifications.idl": [ "interfaces/notifications.idl": [
@ -643722,7 +643867,7 @@
"support" "support"
], ],
"interfaces/web-nfc.idl": [ "interfaces/web-nfc.idl": [
"913d1fe808adf50f66fa621eb62d12b1b41a3a05", "11a36cde6eb7d2d287310635e867f2fe65f4a4fa",
"support" "support"
], ],
"interfaces/web-share.idl": [ "interfaces/web-share.idl": [
@ -644294,7 +644439,7 @@
"testharness" "testharness"
], ],
"longtask-timing/longtask-in-sibling-iframe.html": [ "longtask-timing/longtask-in-sibling-iframe.html": [
"b8a4270163a1ef4de3a0dfd4aaf82f9404497882", "16f0998c2234f39257694817436b6e6178632433",
"testharness" "testharness"
], ],
"longtask-timing/longtask-tojson.html": [ "longtask-timing/longtask-tojson.html": [
@ -646362,21 +646507,25 @@
"testharness" "testharness"
], ],
"mixed-content/generic/common.js": [ "mixed-content/generic/common.js": [
"63383f87e3a2b5ce9482d9c869ed39438cac6052", "f1574e99360f456640d0c1a2882a54eb98fce17b",
"support" "support"
], ],
"mixed-content/generic/expect.py": [ "mixed-content/generic/expect.py": [
"672a54c3a6ebff3dc16b86b44ec511102eb29501", "2c360c1d9315db12f3463c2d005a111b02b3818a",
"support" "support"
], ],
"mixed-content/generic/mixed-content-test-case.js": [ "mixed-content/generic/mixed-content-test-case.js": [
"8708f5a9357d188014fae8a630a152d1c02e295a", "b2c0bcdea1eea2603d0cc76f626f4dff3ace00bd",
"support" "support"
], ],
"mixed-content/generic/sanity-checker.js": [ "mixed-content/generic/sanity-checker.js": [
"55a103adf0f29c615d40bc47943be1aec25c8f1e", "55a103adf0f29c615d40bc47943be1aec25c8f1e",
"support" "support"
], ],
"mixed-content/generic/script.js": [
"2d1cdf0a4bbdb465c45a47cf676c8e6d23f1ddc0",
"support"
],
"mixed-content/generic/template/disclaimer.template": [ "mixed-content/generic/template/disclaimer.template": [
"66c43ed6f21324d44b1596c09a02fecf53f41323", "66c43ed6f21324d44b1596c09a02fecf53f41323",
"support" "support"
@ -648926,7 +649075,7 @@
"support" "support"
], ],
"network-error-logging/support/nel.sub.js": [ "network-error-logging/support/nel.sub.js": [
"759d0337fa677da751c93146f057b05c53f9fa57", "16aebd54a97cdcd9329c42eba6b4116c40993ca0",
"support" "support"
], ],
"network-error-logging/support/no-policy-pass.png": [ "network-error-logging/support/no-policy-pass.png": [
@ -648946,7 +649095,7 @@
"support" "support"
], ],
"network-error-logging/support/report.py": [ "network-error-logging/support/report.py": [
"49af9fe34ccac87f3dffa7c9da9b4486eb140764", "4bb7e3d248bbff52c042eee6ada3f6df079fb5b6",
"support" "support"
], ],
"network-error-logging/support/subdomains-pass.png": [ "network-error-logging/support/subdomains-pass.png": [
@ -657594,103 +657743,103 @@
"support" "support"
], ],
"referrer-policy/css-integration/child-css/external-import-stylesheet.html": [ "referrer-policy/css-integration/child-css/external-import-stylesheet.html": [
"40f4234ad48d19162cefae933fd0f53a72ff0c19", "6be475e98bc2736a0f1409261d48f8f02a6c9461",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/child-css/internal-import-stylesheet.html": [ "referrer-policy/css-integration/child-css/internal-import-stylesheet.html": [
"30c5ea2903094af38dea9a7a565255d178069178", "37370fdd3710c8459e3f6b19980f4308559ad7f4",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/child-css/processing-instruction.html": [ "referrer-policy/css-integration/child-css/processing-instruction.html": [
"52a0ded42a185ed5ff6f449879e0ce50f8255868", "5362234177418da5eba46bbcbc5e5f62d3366de9",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/css-test-helper.js": [ "referrer-policy/css-integration/css-test-helper.js": [
"788df16a456b83a23de662b710c200042a1e7254", "0afa9e1b87ca7dca7ad4fae541cf68d80c62ec91",
"support" "support"
], ],
"referrer-policy/css-integration/font-face/external-import-stylesheet.html": [ "referrer-policy/css-integration/font-face/external-import-stylesheet.html": [
"80e3587ad62f040f2cfb28645437fcbc0e66b415", "300960d2944d11fa327077ac57df5336b0337296",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/font-face/external-stylesheet.html": [ "referrer-policy/css-integration/font-face/external-stylesheet.html": [
"a91eb3fe758299229040466deb2d1b0263f77197", "45da018cb02e82ac17ec74d5e63747ad2aa972fa",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/font-face/internal-import-stylesheet.html": [ "referrer-policy/css-integration/font-face/internal-import-stylesheet.html": [
"a637082a4ce7dff612b223fc8a4c2195db300013", "dd06b7d7bb1f7a0fccf532e395f32cc2026235de",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/font-face/internal-stylesheet.html": [ "referrer-policy/css-integration/font-face/internal-stylesheet.html": [
"eebd864bc56725b79c1f29c0597466574e2af091", "a0a9067b3b846edcc4acc548c74e6b643116cab3",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/font-face/processing-instruction.html": [ "referrer-policy/css-integration/font-face/processing-instruction.html": [
"bfc42d9fcbe355514c7bf72ac087d7159439824e", "a9d79a33b08e6b10a17495663fb4c7d9337370ef",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/image/external-import-stylesheet.html": [ "referrer-policy/css-integration/image/external-import-stylesheet.html": [
"80c71b0e215b547d664aee8757d70188c012a9c0", "2a7ac43a75466ec6e1c47d57ad14c01453728c3d",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/image/external-stylesheet.html": [ "referrer-policy/css-integration/image/external-stylesheet.html": [
"ba7497b97de6911c149b423bf25305123e97150e", "c763ecbcff781a7e047b1425f7bf993e363721a0",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/image/inline-style.html": [ "referrer-policy/css-integration/image/inline-style.html": [
"758b6d91852f67d4e47726815804a5e366fe534d", "da571afbbc830b7ccdb7b24ced20bf7aa20c9529",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/image/internal-import-stylesheet.html": [ "referrer-policy/css-integration/image/internal-import-stylesheet.html": [
"24aa1858304a2130624589b0a64c6f9ec9cac5a1", "e320e063f2df492e99944328dc3f009cfd9bcbb8",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/image/internal-stylesheet.html": [ "referrer-policy/css-integration/image/internal-stylesheet.html": [
"f4567885e1f1e215487a11f1023d117517cd88b8", "3e2fc109936203732e0b25fbc96e3ac519df559b",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/image/presentation-attribute.html": [ "referrer-policy/css-integration/image/presentation-attribute.html": [
"d0a4d96f84c8e48ea5daf5699c7b04bbc877ba86", "e810df54b8291120b13fb68cbecd9d1a71b1f8ce",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/image/processing-instruction.html": [ "referrer-policy/css-integration/image/processing-instruction.html": [
"926147be489a85164758dcf644c715e4a5c02de6", "e5a1e20af72468994fc6120f1d29e894804c13a8",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/svg/external-stylesheet.html": [ "referrer-policy/css-integration/svg/external-stylesheet.html": [
"148584a0b23bbd900d62e28e679d308aa1b204c9", "dfa6fd073b9b1e2268e1cc66754d7d0e442bdc02",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/svg/inline-style.html": [ "referrer-policy/css-integration/svg/inline-style.html": [
"1f46acb4a3216e3e5ac81afee50b83ba72ef4852", "fd6e4baeae57d1546de2b47766dfa507b23361e1",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/svg/internal-stylesheet.html": [ "referrer-policy/css-integration/svg/internal-stylesheet.html": [
"08be4effa475b232bc2be621dbf24f34ab0e39dd", "228de6d700b96cfc7ae85ff9c7ebb60f20197afd",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/svg/presentation-attribute.html": [ "referrer-policy/css-integration/svg/presentation-attribute.html": [
"edeceb1a785484111858b650da55a6ec965f5b40", "65bb642f5bf3e3a6fdf27a39c55b536365375a23",
"testharness" "testharness"
], ],
"referrer-policy/css-integration/svg/processing-instruction.html": [ "referrer-policy/css-integration/svg/processing-instruction.html": [
"ba0e6673a3871495c226baf8d3c3daf8ae9e138d", "c0e8d4bf8169bf210674d7d9acf7bda994b01bf4",
"testharness" "testharness"
], ],
"referrer-policy/generic/common.js": [ "referrer-policy/generic/common.js": [
"a16691bccb2543ad68b81e9a16fa261d3cce6a9f", "f1574e99360f456640d0c1a2882a54eb98fce17b",
"support" "support"
], ],
"referrer-policy/generic/iframe-inheritance.html": [ "referrer-policy/generic/iframe-inheritance.html": [
"478a7ce6fe6aa13e54dfaa3eb493bdaad7753c38", "6c54c43a81542a8349eebcbd0d35c28fb15d3e23",
"testharness" "testharness"
], ],
"referrer-policy/generic/link-rel-prefetch.html": [ "referrer-policy/generic/link-rel-prefetch.html": [
"54963141b1916688fba7c8c1269a6f310efbb13a", "16452b1d690bd19ac118f34efac385264450569d",
"testharness" "testharness"
], ],
"referrer-policy/generic/multiple-headers-and-values.html": [ "referrer-policy/generic/multiple-headers-and-values.html": [
"682199b917c37b9b11ef0eaa9897ebbfb50f5eb7", "ccbc02bec1bc5bced33bf88b97e4afc49f7949c2",
"testharness" "testharness"
], ],
"referrer-policy/generic/multiple-headers-and-values.html.headers": [ "referrer-policy/generic/multiple-headers-and-values.html.headers": [
@ -657698,7 +657847,7 @@
"support" "support"
], ],
"referrer-policy/generic/multiple-headers-combined.html": [ "referrer-policy/generic/multiple-headers-combined.html": [
"ad02ae84bd7458c13e7621db7eadbd19a82ffbb5", "7def76b9dd1e8754f6c8a243683eaeb4c25989ee",
"testharness" "testharness"
], ],
"referrer-policy/generic/multiple-headers-combined.html.headers": [ "referrer-policy/generic/multiple-headers-combined.html.headers": [
@ -657706,7 +657855,7 @@
"support" "support"
], ],
"referrer-policy/generic/multiple-headers-one-invalid.html": [ "referrer-policy/generic/multiple-headers-one-invalid.html": [
"b1384b14a0e859d8fba0f564e6b9c51333339fc4", "eb6c21731b39ebd310526cc3345be0ac868dd919",
"testharness" "testharness"
], ],
"referrer-policy/generic/multiple-headers-one-invalid.html.headers": [ "referrer-policy/generic/multiple-headers-one-invalid.html.headers": [
@ -657714,7 +657863,7 @@
"support" "support"
], ],
"referrer-policy/generic/multiple-headers-one-unknown-token.html": [ "referrer-policy/generic/multiple-headers-one-unknown-token.html": [
"3273c0dbedfea3c3917ff0e16f29ff2273f32352", "91e216b22a1392867d27db0b02aa318aef65d613",
"testharness" "testharness"
], ],
"referrer-policy/generic/multiple-headers-one-unknown-token.html.headers": [ "referrer-policy/generic/multiple-headers-one-unknown-token.html.headers": [
@ -657722,7 +657871,7 @@
"support" "support"
], ],
"referrer-policy/generic/multiple-headers.html": [ "referrer-policy/generic/multiple-headers.html": [
"5f6a749b4bd2003b1b434b070d436ac1a2d8d6e5", "a74cf60d89a5e4ee4a036613745acea5a83cae25",
"testharness" "testharness"
], ],
"referrer-policy/generic/multiple-headers.html.headers": [ "referrer-policy/generic/multiple-headers.html.headers": [
@ -657730,11 +657879,11 @@
"support" "support"
], ],
"referrer-policy/generic/referrer-policy-test-case.js": [ "referrer-policy/generic/referrer-policy-test-case.js": [
"2385cc2a1c4e51a2855299e42b69ac12362cd699", "2c5c8eb80cc6ea3ed79bd0004365324ce4f1baec",
"support" "support"
], ],
"referrer-policy/generic/sandboxed-iframe-with-opaque-origin.html": [ "referrer-policy/generic/sandboxed-iframe-with-opaque-origin.html": [
"1b2b12bf6910e075338462de577dc4228f52a21f", "73b48f1d5c042cd121a2d3715ac4be70007bbb87",
"testharness" "testharness"
], ],
"referrer-policy/generic/sanity-checker.js": [ "referrer-policy/generic/sanity-checker.js": [
@ -657742,7 +657891,7 @@
"support" "support"
], ],
"referrer-policy/generic/subresource-test/area-navigate.html": [ "referrer-policy/generic/subresource-test/area-navigate.html": [
"3eb824521b7801c518a7b36218075eb3d74bd639", "c601c249d0ff1c226dd495a23bb348010e1c16f2",
"testharness" "testharness"
], ],
"referrer-policy/generic/subresource-test/attr-referrer-invalid-value.html": [ "referrer-policy/generic/subresource-test/attr-referrer-invalid-value.html": [
@ -657750,31 +657899,31 @@
"testharness" "testharness"
], ],
"referrer-policy/generic/subresource-test/fetch-messaging.html": [ "referrer-policy/generic/subresource-test/fetch-messaging.html": [
"edb159d9eb1cf5eed6af249a40f70d9ecd079d68", "4d40245123ff6071aa3db4e96c379ec553866154",
"testharness" "testharness"
], ],
"referrer-policy/generic/subresource-test/iframe-messaging.html": [ "referrer-policy/generic/subresource-test/iframe-messaging.html": [
"606e18b281f6c3498573dc9bfaefefca1390026a", "3072436bc64a11299233132297147a028c9a8065",
"testharness" "testharness"
], ],
"referrer-policy/generic/subresource-test/image-decoding.html": [ "referrer-policy/generic/subresource-test/image-decoding.html": [
"9c50ea6619389dad8ad81c4c2afbeb8030b176db", "b132c06c3f15dbe497e58c1be31aa75c112b2cfb",
"testharness" "testharness"
], ],
"referrer-policy/generic/subresource-test/link-navigate.html": [ "referrer-policy/generic/subresource-test/link-navigate.html": [
"95582f65bac8a3b478cc8cd4fe9b883fb507237f", "583458b535945f77f89879bd56ad0527ffa6df81",
"testharness" "testharness"
], ],
"referrer-policy/generic/subresource-test/script-messaging.html": [ "referrer-policy/generic/subresource-test/script-messaging.html": [
"f73f4406df20694480f82570ed8674fe283ea375", "7bc36dc7abf068116ee457a292cc29c72d7926ef",
"testharness" "testharness"
], ],
"referrer-policy/generic/subresource-test/worker-messaging.html": [ "referrer-policy/generic/subresource-test/worker-messaging.html": [
"fd7591882e91e7265fd740b9018248d21f13b5b9", "9daf6d5f9027a51f5bcac2d2364d6cd8722dcbad",
"testharness" "testharness"
], ],
"referrer-policy/generic/subresource-test/xhr-messaging.html": [ "referrer-policy/generic/subresource-test/xhr-messaging.html": [
"6ef4a9cfd4b98c3562fe7ef6e04eb931073166de", "a0208051206a4cf4b48ba0574c63fea589df1202",
"testharness" "testharness"
], ],
"referrer-policy/generic/subresource/__init__.py": [ "referrer-policy/generic/subresource/__init__.py": [
@ -657902,7 +658051,7 @@
"support" "support"
], ],
"referrer-policy/generic/unsupported-csp-referrer-directive.html": [ "referrer-policy/generic/unsupported-csp-referrer-directive.html": [
"475efa55091778e747fa36030f7b422b89d6d4b9", "40942a8a0358149f1408010b224a4317a1f940ce",
"testharness" "testharness"
], ],
"referrer-policy/no-referrer-when-downgrade/attr-referrer/cross-origin/http-http/a-tag/no-redirect/insecure-protocol.http.html": [ "referrer-policy/no-referrer-when-downgrade/attr-referrer/cross-origin/http-http/a-tag/no-redirect/insecure-protocol.http.html": [
@ -672697,6 +672846,14 @@
"f1167f919ab39a85e38778c39fc64305eecd4921", "f1167f919ab39a85e38778c39fc64305eecd4921",
"testharness" "testharness"
], ],
"signed-exchange/reporting/sxg-reporting-navigation-ok.tentative.html": [
"ee9a50966d8f5581084b3518757ff74a6abed692",
"testharness"
],
"signed-exchange/reporting/sxg-reporting-prefetch-ok.tentative.html": [
"fb5fb58c9f7063c2abd45130ec4bfdf4b6bcc8cb",
"testharness"
],
"signed-exchange/resources/127.0.0.1.sxg.ext": [ "signed-exchange/resources/127.0.0.1.sxg.ext": [
"8cdc25a9a7f36f3313813e967eb9e68f5e546ff6", "8cdc25a9a7f36f3313813e967eb9e68f5e546ff6",
"support" "support"
@ -672742,7 +672899,7 @@
"support" "support"
], ],
"signed-exchange/resources/sxg-util.js": [ "signed-exchange/resources/sxg-util.js": [
"67439c8a6e4f111d0095519a77dc0e6ffd380e2c", "7abb3cf2079087092ac4a7f7332ecf72f9cabd75",
"support" "support"
], ],
"signed-exchange/resources/sxg-version1b2.sxg": [ "signed-exchange/resources/sxg-version1b2.sxg": [
@ -673713,6 +673870,14 @@
"c2ca49341c5ec5d4d96d1541999893053146eecd", "c2ca49341c5ec5d4d96d1541999893053146eecd",
"reftest" "reftest"
], ],
"svg/geometry/svg-image-intrinsic-size-with-cssstyle-auto-dynamic-image-change.html": [
"8d5e2e982e82bd73e45cf86688e637a65f5d6535",
"testharness"
],
"svg/geometry/svg-image-intrinsic-size-with-cssstyle-auto.html": [
"6b49f62296433892913e74d0cc9c6bed7567fe31",
"testharness"
],
"svg/historical.html": [ "svg/historical.html": [
"1b73ca8d2236c7afdb9b331c532c84b6083f2968", "1b73ca8d2236c7afdb9b331c532c84b6083f2968",
"testharness" "testharness"
@ -677401,6 +677566,10 @@
"ba08b7eafabfb1bd03e8cbb8b421a6e85ed5960a", "ba08b7eafabfb1bd03e8cbb8b421a6e85ed5960a",
"support" "support"
], ],
"tools/ci/azure/fyi_hook.yml": [
"bcad6c33dbb64c96c4e85882fa2cb6976265afbb",
"support"
],
"tools/ci/azure/install_certs.yml": [ "tools/ci/azure/install_certs.yml": [
"5682199b3873a279ede0345c60ce37dc280fa2a2", "5682199b3873a279ede0345c60ce37dc280fa2a2",
"support" "support"
@ -682746,7 +682915,7 @@
"support" "support"
], ],
"tools/wptrunner/wptrunner/testrunner.py": [ "tools/wptrunner/wptrunner/testrunner.py": [
"05b3190a5f44ec83311c8df9e72fadea46594b95", "d638d394be2d6f6d8dd0ea07dbd96c7a4a05655f",
"support" "support"
], ],
"tools/wptrunner/wptrunner/tests/__init__.py": [ "tools/wptrunner/wptrunner/tests/__init__.py": [
@ -683194,7 +683363,7 @@
"support" "support"
], ],
"tools/wptserve/wptserve/request.py": [ "tools/wptserve/wptserve/request.py": [
"aa6306a533e2136a2dc5eea33ebeb18706eb1736", "1b1061ba7b7a94e83ed5177cdbe15e61591491a2",
"support" "support"
], ],
"tools/wptserve/wptserve/response.py": [ "tools/wptserve/wptserve/response.py": [
@ -683469,6 +683638,30 @@
"4079f7e9c7933cf9ee195fe0e7a54e0f56f184ab", "4079f7e9c7933cf9ee195fe0e7a54e0f56f184ab",
"support" "support"
], ],
"trusted-types/trusted-types-report-only.tentative.https.html": [
"f33183b4906975f03ebb3f3a21adb63839c89adb",
"testharness"
],
"trusted-types/trusted-types-report-only.tentative.https.html.headers": [
"b38cfae2cb209eec5b8c9e8b0c774262694c1aec",
"support"
],
"trusted-types/trusted-types-reporting-check-report.https.html": [
"111907788d279a722aced631dc19b20afb6f0285",
"testharness"
],
"trusted-types/trusted-types-reporting-check-report.https.html.sub.headers": [
"5830239f5ca4c45ff97f8fa9f53daba82e0e9685",
"support"
],
"trusted-types/trusted-types-reporting.tentative.https.html": [
"3074895ba13f7f734d00898e723b4b604234a9cb",
"testharness"
],
"trusted-types/trusted-types-reporting.tentative.https.html.headers": [
"8093b8474d686fd665c6e835c6d0ed8f337cf2cd",
"support"
],
"uievents/META.yml": [ "uievents/META.yml": [
"2f1ec58efec10e0dd6374aac05cb926c8cffa3f1", "2f1ec58efec10e0dd6374aac05cb926c8cffa3f1",
"support" "support"
@ -684082,7 +684275,7 @@
"support" "support"
], ],
"upgrade-insecure-requests/support/testharness-helper.sub.js": [ "upgrade-insecure-requests/support/testharness-helper.sub.js": [
"8b58eb9560426ce6a67ac4826000134d32d1b7a1", "d7be710dd24b750a0d214fd8d24210c2ab3f9802",
"support" "support"
], ],
"upgrade-insecure-requests/support/worker.js": [ "upgrade-insecure-requests/support/worker.js": [
@ -685650,11 +685843,11 @@
"testharness" "testharness"
], ],
"wasm/jsapi/memory/constructor.any.js": [ "wasm/jsapi/memory/constructor.any.js": [
"11e309fe654f7a46c95c96dae78da2bef1a109f1", "cef713fe0fe74f009e9f8aadd9168e7fa5138eb0",
"testharness" "testharness"
], ],
"wasm/jsapi/memory/grow.any.js": [ "wasm/jsapi/memory/grow.any.js": [
"1ccfb946756fef71b89672dfc86830c620a9e981", "11c41942510b65b62b63468cc332b803445321de",
"testharness" "testharness"
], ],
"wasm/jsapi/memory/toString.any.js": [ "wasm/jsapi/memory/toString.any.js": [
@ -685666,7 +685859,7 @@
"testharness" "testharness"
], ],
"wasm/jsapi/module/customSections.any.js": [ "wasm/jsapi/module/customSections.any.js": [
"04c5abed52435714a18467c419dce17dfcf4073d", "387d4e4a31744d16627484650a35ecc86f992c66",
"testharness" "testharness"
], ],
"wasm/jsapi/module/exports.any.js": [ "wasm/jsapi/module/exports.any.js": [
@ -685914,7 +686107,7 @@
"support" "support"
], ],
"web-animations/README.md": [ "web-animations/README.md": [
"f6efbf977f95bc9ab3cb6a061a841c6d4942250e", "75493ce57b4c242195d9fb56e73154865d6f59bf",
"support" "support"
], ],
"web-animations/animation-model/animation-types/accumulation-per-property.html": [ "web-animations/animation-model/animation-types/accumulation-per-property.html": [
@ -689422,7 +689615,7 @@
"testharness" "testharness"
], ],
"webrtc/RTCRtpSender-transport.https.html": [ "webrtc/RTCRtpSender-transport.https.html": [
"c687911d09d2184f49b4dabded7c95e6cb9d310a", "fb8aaaf8ec3f85879c51ea9bbb0736b1558961b3",
"testharness" "testharness"
], ],
"webrtc/RTCRtpTransceiver-direction.html": [ "webrtc/RTCRtpTransceiver-direction.html": [

View file

@ -74,6 +74,3 @@
[opacity end] [opacity end]
expected: FAIL expected: FAIL
[border-bottom-width end]
expected: FAIL

View file

@ -0,0 +1,13 @@
[HTMLElement-attachInternals.html]
[Successful attachInternals() and the second call.]
expected: FAIL
[attachInternals() throws a NotSupportedError if it is called for a customized built-in element]
expected: FAIL
[If a custom element definition for the local name of the element has disable internals flag, throw a NotSupportedError]
expected: FAIL
[If a custom element definition for the local name of the element doesn't exist, throw an InvalidStateError]
expected: FAIL

View file

@ -32,7 +32,7 @@
[single-byte-decoder.html?XMLHttpRequest] [single-byte-decoder.html?XMLHttpRequest]
expected: TIMEOUT expected: CRASH
[ISO-8859-2: iso_8859-2:1987 (XMLHttpRequest)] [ISO-8859-2: iso_8859-2:1987 (XMLHttpRequest)]
expected: FAIL expected: FAIL

View file

@ -312,9 +312,24 @@
[<iframe>: separate response Content-Type: text/plain */*;charset=gbk] [<iframe>: separate response Content-Type: text/plain */*;charset=gbk]
expected: FAIL expected: FAIL
[<iframe>: separate response Content-Type: text/html */*;charset=gbk]
expected: FAIL
[<iframe>: separate response Content-Type: text/html;x=" text/plain] [<iframe>: separate response Content-Type: text/html;x=" text/plain]
expected: FAIL expected: FAIL
[<iframe>: combined response Content-Type: */* text/html]
expected: FAIL
[<iframe>: separate response Content-Type: text/html;" text/plain]
expected: FAIL
[<iframe>: separate response Content-Type: */* text/html]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;" \\" text/plain]
expected: FAIL
[<iframe>: separate response Content-Type: text/html;" \\" text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;x=" text/plain]
expected: FAIL

View file

@ -11,3 +11,6 @@
[X-Content-Type-Options%3A%20nosniff%0C] [X-Content-Type-Options%3A%20nosniff%0C]
expected: FAIL expected: FAIL
[X-Content-Type-Options%3A%20%22nosniFF%22]
expected: FAIL

View file

@ -1,4 +0,0 @@
[traverse_the_history_1.html]
[Multiple history traversals from the same task]
expected: FAIL

View file

@ -9393,6 +9393,12 @@
[HTMLFormElement interface: document.createElement("form") must inherit property "relList" with the proper type] [HTMLFormElement interface: document.createElement("form") must inherit property "relList" with the proper type]
expected: FAIL expected: FAIL
[HTMLElement interface: operation attachInternals()]
expected: FAIL
[HTMLElement interface: document.createElement("noscript") must inherit property "attachInternals()" with the proper type]
expected: FAIL
[interfaces.https.html?exclude=(Document|Window|HTML.*)] [interfaces.https.html?exclude=(Document|Window|HTML.*)]
[HTML IDL tests] [HTML IDL tests]
@ -10997,3 +11003,21 @@
[External interface: existence and properties of interface prototype object's @@unscopables property] [External interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL expected: FAIL
[ElementInternals interface: existence and properties of interface object]
expected: FAIL
[ElementInternals interface object length]
expected: FAIL
[ElementInternals interface object name]
expected: FAIL
[ElementInternals interface: existence and properties of interface prototype object]
expected: FAIL
[ElementInternals interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[ElementInternals interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL

View file

@ -0,0 +1,4 @@
[iframe_sandbox_anchor_download_allow_downloads_without_user_activation.sub.tentative.html]
[<a download> triggered download in sandbox is allowed by allow-downloads-without-user-activation.]
expected: FAIL

View file

@ -0,0 +1,4 @@
[iframe_sandbox_anchor_download_block_downloads_without_user_activation.sub.tentative.html]
[<a download> triggered download in sandbox is blocked.]
expected: FAIL

View file

@ -0,0 +1,4 @@
[iframe_sandbox_navigation_download_allow_downloads_without_user_activation.sub.tentative.html]
[Navigation resulted download in sandbox is allowed by allow-downloads-without-user-activation.]
expected: FAIL

View file

@ -0,0 +1,4 @@
[iframe_sandbox_navigation_download_block_downloads_without_user_activation.sub.tentative.html]
[Navigation resulted download in sandbox is blocked.]
expected: FAIL

View file

@ -0,0 +1,10 @@
[non-active-document.html]
[DOMParser]
expected: FAIL
[createHTMLDocument]
expected: FAIL
[<template>]
expected: FAIL

View file

@ -44,6 +44,15 @@
[Out-of-range initial value in descriptor: 68719476736] [Out-of-range initial value in descriptor: 68719476736]
expected: FAIL expected: FAIL
[Shared memory without maximum]
expected: FAIL
[Order of evaluation for descriptor (with shared)]
expected: FAIL
[Shared memory]
expected: FAIL
[constructor.any.html] [constructor.any.html]
[Out-of-range maximum value in descriptor: -Infinity] [Out-of-range maximum value in descriptor: -Infinity]
@ -91,3 +100,12 @@
[Out-of-range initial value in descriptor: 68719476736] [Out-of-range initial value in descriptor: 68719476736]
expected: FAIL expected: FAIL
[Shared memory without maximum]
expected: FAIL
[Order of evaluation for descriptor (with shared)]
expected: FAIL
[Shared memory]
expected: FAIL

View file

@ -29,6 +29,9 @@
[Out-of-range argument: Infinity] [Out-of-range argument: Infinity]
expected: FAIL expected: FAIL
[Growing shared memory does not detach old buffer]
expected: FAIL
[grow.any.html] [grow.any.html]
[Out-of-range argument: 68719476736] [Out-of-range argument: 68719476736]
@ -61,3 +64,6 @@
[Out-of-range argument: Infinity] [Out-of-range argument: Infinity]
expected: FAIL expected: FAIL
[Growing shared memory does not detach old buffer]
expected: FAIL

View file

@ -2,8 +2,14 @@
[Missing arguments] [Missing arguments]
expected: FAIL expected: FAIL
[Custom sections with U+FFFD]
expected: FAIL
[customSections.any.worker.html] [customSections.any.worker.html]
[Missing arguments] [Missing arguments]
expected: FAIL expected: FAIL
[Custom sections with U+FFFD]
expected: FAIL

View file

@ -1,5 +0,0 @@
[dedicated-worker-from-blob-url.window.html]
expected: TIMEOUT
[Creating a dedicated worker from a blob URL works immediately before revoking.]
expected: TIMEOUT

View file

@ -1,5 +1,4 @@
[005.html] [005.html]
expected: ERROR
[dedicated worker in shared worker in dedicated worker] [dedicated worker in shared worker in dedicated worker]
expected: FAIL expected: FAIL

View file

@ -1,2 +0,0 @@
[transition_calc_implicit.html]
expected: TIMEOUT

View file

@ -10,9 +10,7 @@
# project is required: # project is required:
# - The "Build pull requests from forks of this repository" setting must be # - The "Build pull requests from forks of this repository" setting must be
# enabled: https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/github#validate-contributions-from-forks # enabled: https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/github#validate-contributions-from-forks
# - A scheduled build needs to be set up for the the epochs/daily branch. # - A scheduled build needs to be set up for one of the epochs/* branches.
# - To get results from scheduled builds into wpt.fyi, a service connection
# named wpt.fyi with URL https://wpt.fyi is needed.
# - Self-hosted agents for Windows 10 are used: # - Self-hosted agents for Windows 10 are used:
# - 'Hosted Windows Client' is the latest Windows 10 # - 'Hosted Windows Client' is the latest Windows 10
# - 'Hosted Windows Client Next' is Windows 10 Insider Preview # - 'Hosted Windows Client Next' is Windows 10 Insider Preview
@ -31,6 +29,10 @@ jobs:
- template: tools/ci/azure/affected_tests.yml - template: tools/ci/azure/affected_tests.yml
parameters: parameters:
artifactName: 'safari-preview-affected-tests' artifactName: 'safari-preview-affected-tests'
- template: tools/ci/azure/fyi_hook.yml
parameters:
dependsOn: affected_safari_preview
artifactName: safari-preview-affected-tests
- job: affected_without_changes_safari_preview - job: affected_without_changes_safari_preview
displayName: 'affected tests without changes (Safari Technology Preview)' displayName: 'affected tests without changes (Safari Technology Preview)'
@ -43,6 +45,10 @@ jobs:
checkoutCommit: 'HEAD^1' checkoutCommit: 'HEAD^1'
affectedRange: 'HEAD@{1}' affectedRange: 'HEAD@{1}'
artifactName: 'safari-preview-affected-tests-without-changes' artifactName: 'safari-preview-affected-tests-without-changes'
- template: tools/ci/azure/fyi_hook.yml
parameters:
dependsOn: affected_without_changes_safari_preview
artifactName: safari-preview-affected-tests-without-changes
# The decision jobs runs `./wpt test-jobs` to determine which jobs to run, # The decision jobs runs `./wpt test-jobs` to determine which jobs to run,
# and all following jobs wait for it to finish and depend on its output. # and all following jobs wait for it to finish and depend on its output.
@ -184,12 +190,18 @@ jobs:
inputs: inputs:
artifactName: 'edge-results' artifactName: 'edge-results'
- template: tools/ci/azure/cleanup_win10.yml - template: tools/ci/azure/cleanup_win10.yml
- template: tools/ci/azure/fyi_hook.yml
parameters:
dependsOn: results_edge
artifactName: edge-results
# All `./wpt run` tests are run from epochs/* branches on a schedule. See # All `./wpt run` tests are run from epochs/* branches on a schedule. See
# documentation at the top of this file for required setup. # documentation at the top of this file for required setup.
- job: results_safari_preview - job: results_safari_preview
displayName: 'all tests (Safari Technology Preview)' displayName: 'all tests (Safari Technology Preview)'
condition: eq(variables['Build.Reason'], 'Schedule') condition: |
or(eq(variables['Build.Reason'], 'Schedule'),
and(eq(variables['Build.Reason'], 'Manual'), variables['run_all_safari_preview']))
strategy: strategy:
parallel: 4 # chosen to make runtime ~2h parallel: 4 # chosen to make runtime ~2h
timeoutInMinutes: 360 timeoutInMinutes: 360
@ -211,3 +223,7 @@ jobs:
displayName: 'Publish results' displayName: 'Publish results'
inputs: inputs:
artifactName: 'safari-preview-results' artifactName: 'safari-preview-results'
- template: tools/ci/azure/fyi_hook.yml
parameters:
dependsOn: results_safari_preview
artifactName: safari-preview-results

View file

@ -11,12 +11,14 @@ test(() => {
assert_equals(navigator.clipboard, navigator.clipboard); assert_equals(navigator.clipboard, navigator.clipboard);
}, "navigator.clipboard exists"); }, "navigator.clipboard exists");
/* clipboard.write(Blob/text) */ /* clipboard.write(text/plain Blob) */
promise_test(async () => { promise_test(async () => {
const blob = new Blob(["hello"], {type: 'text/plain'}); const blob = new Blob(["hello"], {type: 'text/plain'});
await navigator.clipboard.write(blob); await navigator.clipboard.write(blob);
}, "navigator.clipboard.write(Blob) succeeds"); }, "navigator.clipboard.write(text/plain Blob) succeeds");
/* clipboard.write(invalid input) */
promise_test(async t => { promise_test(async t => {
await promise_rejects(t, new TypeError(), await promise_rejects(t, new TypeError(),
@ -45,7 +47,7 @@ promise_test(async t => {
navigator.clipboard.writeText()); navigator.clipboard.writeText());
}, "navigator.clipboard.writeText() fails (expect DOMString)"); }, "navigator.clipboard.writeText() fails (expect DOMString)");
/* clipboard.write(Blob/image) */ /* clipboard.write(image/png Blob) */
promise_test(async () => { promise_test(async () => {
const fetched = await fetch( const fetched = await fetch(
@ -53,15 +55,9 @@ promise_test(async () => {
const image = await fetched.blob(); const image = await fetched.blob();
await navigator.clipboard.write(image); await navigator.clipboard.write(image);
}, "navigator.clipboard.writeImageExperimental(Blob) succeeds"); }, "navigator.clipboard.write(image/png Blob) succeeds");
promise_test(async t => { /* text/plain or image/png Blob clipboard.read() */
await promise_rejects(t, new TypeError(),
navigator.clipboard.write());
}, "navigator.clipboard.writeImageExperimental() fails (expect Blob)");
/* Blob/text or Blob/image clipboard.read() */
promise_test(async () => { promise_test(async () => {
const result = await navigator.clipboard.read(); const result = await navigator.clipboard.read();

View file

@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Async Clipboard write (Blob/text) -> read (Blob/text) tests</title> <title>Async Clipboard write (text/plain Blob) -> read (text/plain Blob) tests</title>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script> <script>
@ -17,7 +17,7 @@ async function readWriteTest(textInput) {
}, "Verify write and read clipboard given text: " + textInput); }, "Verify write and read clipboard given text: " + textInput);
} }
readWriteTest("Clipboard write (Blob/text) -> read (Blob/text) test"); readWriteTest("Clipboard write (text/plain Blob) -> read (text/plain Blob) test");
readWriteTest("non-Latin1 text encoding test データ"); readWriteTest("non-Latin1 text encoding test データ");
</script> </script>
<p> <p>

View file

@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Async Clipboard write (Blob/text) -> readText tests</title> <title>Async Clipboard write (text/plain Blob) -> readText tests</title>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script> <script>
@ -15,7 +15,7 @@ async function readWriteTest(textInput) {
}, "Verify write and read clipboard given text: " + textInput); }, "Verify write and read clipboard given text: " + textInput);
} }
readWriteTest("Clipboard write (Blob/text) -> read text test"); readWriteTest("Clipboard write (text/plain Blob) -> read text test");
readWriteTest("non-Latin1 text encoding test データ"); readWriteTest("non-Latin1 text encoding test データ");
</script> </script>
<p> <p>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<meta charset="utf-8"> <meta charset="utf-8">
<title> <title>
Async Clipboard writeImageExperimental -> readImageExperimental tests Async Clipboard write image/png Blob -> read image/png Blob tests
</title> </title>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>

View file

@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Async Clipboard writeText -> read (Blob/text) tests</title> <title>Async Clipboard writeText -> read (text/plain Blob) tests</title>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script> <script>
@ -15,7 +15,7 @@ async function readWriteTest(textInput) {
}, "Verify write and read clipboard given text: " + textInput); }, "Verify write and read clipboard given text: " + textInput);
} }
readWriteTest("Clipboard write text -> read (Blob/text) test"); readWriteTest("Clipboard write text -> read (text/plain Blob) test");
readWriteTest("non-Latin1 text encoding test データ"); readWriteTest("non-Latin1 text encoding test データ");
</script> </script>
<p> <p>

View file

@ -0,0 +1,71 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-scroll-snap/#scroll-snap-stop" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
div {
position: absolute;
}
#scroller {
width: 400px;
height: 400px;
overflow: scroll;
scroll-snap-type: both mandatory;
}
#space {
left: 0px;
top: 0px;
width: 2100px;
height: 2100px;
}
.target {
width: 50px;
height: 50px;
scroll-snap-align: start;
}
.origin {
left: 0px;
top: 0px;
}
.always-stop {
left: 100px;
top: 0px;
scroll-snap-stop: always;
}
.closer {
left: 200px;
top: 0px;
}
</style>
<div id="scroller">
<div id="space"></div>
<div class="target origin"></div>
<div class="target always-stop"></div>
<div class="target closer"></div>
</div>
<script>
var scroller = document.getElementById("scroller");
test(() => {
scroller.scrollTo(0, 0);
assert_equals(scroller.scrollLeft, 0);
assert_equals(scroller.scrollTop, 0);
scroller.scrollBy(300, 0);
assert_equals(scroller.scrollLeft, 100);
assert_equals(scroller.scrollTop, 0);
}, "A scroll with intended direction and end position should not pass a snap " +
"area with scroll-snap-stop: always.")
test(() => {
scroller.scrollTo(0, 0);
assert_equals(scroller.scrollLeft, 0);
assert_equals(scroller.scrollTop, 0);
scroller.scrollTo(300, 0);
assert_equals(scroller.scrollLeft, 200);
assert_equals(scroller.scrollTop, 0);
}, "A scroll with intended end position should always choose the closest snap " +
"position regardless of the scroll-snap-stop value.")
</script>

View file

@ -0,0 +1,82 @@
<!DOCTYPE html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" content="https://html.spec.whatwg.org/multipage/custom-elements.html#dom-attachinternals">
<div id="container"></div>
<script>
test(() => {
class MyElement1 extends HTMLElement {
}
customElements.define('my-element1', MyElement1);
const container = document.querySelector('#container');
let element = new MyElement1();
assert_true(element.attachInternals() instanceof ElementInternals,
'New - 1st call');
assert_throws('InvalidStateError', () => { element.attachInternals(); },
'New - 2nd call');
element = document.createElement('my-element1');
assert_true(element.attachInternals() instanceof ElementInternals,
'createElement - 1st call');
assert_throws('InvalidStateError', () => { element.attachInternals(); },
'createElement - 2nd call');
container.innerHTML = '<my-element1></my-element1>';
assert_true(container.firstChild.attachInternals() instanceof ElementInternals,
'Parser - 1st call');
assert_throws('InvalidStateError', () => {
container.firstChild.attachInternals();
}, 'Parser - 2nd call');
}, 'Successful attachInternals() and the second call.');
test(() => {
class MyDiv extends HTMLDivElement {}
customElements.define('my-div', MyDiv, { extends: 'div' });
const customizedBuiltin = document.createElement('div', { is: 'my-div'});
assert_throws('NotSupportedError', () => { customizedBuiltin.attachInternals() });
}, 'attachInternals() throws a NotSupportedError if it is called for ' +
'a customized built-in element');
test(() => {
const builtin = document.createElement('div');
assert_throws('InvalidStateError', () => { builtin.attachInternals() });
const doc = document.implementation.createDocument('foo', null);
const span = doc.appendChild(doc.createElementNS('http://www.w3.org/1999/xhtml', 'html:span'));
assert_true(span instanceof HTMLElement);
assert_throws('InvalidStateError', () => { span.attachInternals(); });
const undefinedCustom = document.createElement('undefined-element');
assert_throws('InvalidStateError', () => { undefinedCustom.attachInternals() });
}, 'If a custom element definition for the local name of the element doesn\'t' +
' exist, throw an InvalidStateError');
test(() => {
class MyElement2 extends HTMLElement {
static get disabledFeatures() { return ['internals']; }
}
customElements.define('my-element2', MyElement2);
const container = document.querySelector('#container');
assert_throws('NotSupportedError', () => {
(new MyElement2).attachInternals();
});
assert_throws('NotSupportedError', () => {
document.createElement('my-element2').attachInternals();
});
assert_throws('NotSupportedError', () => {
container.innerHTML = '<my-element2></my-element2>';
container.firstChild.attachInternals();
});
class MyElement3 extends HTMLElement {
static get disabledFeatures() { return ['INTERNALS']; }
}
customElements.define('my-element3', MyElement3);
assert_true((new MyElement3).attachInternals() instanceof ElementInternals);
}, 'If a custom element definition for the local name of the element has ' +
'disable internals flag, throw a NotSupportedError');
</script>
</body>

View file

@ -7,16 +7,18 @@
<script> <script>
// These tests reuse the `referrer-policy` infrastructure to load images that // These tests reuse the `referrer-policy` infrastructure to load images that
// encode their request headers in their pixels. Fun stuff! // encode their request headers in their pixels. Fun stuff!
async_test(t => { promise_test(() =>
loadImageInWindow( loadImageInWindow(
"https://{{host}}:{{ports[https][0]}}/referrer-policy/generic/subresource/image.py", "https://{{host}}:{{ports[https][0]}}/referrer-policy/generic/subresource/image.py",
t.step_func_done(img => { [],
window)
.then(img => {
headers = decodeImageData(extractImageData(img)).headers; headers = decodeImageData(extractImageData(img)).headers;
got = { got = {
"dest": headers["sec-fetch-dest"], "dest": headers["sec-fetch-dest"],
"mode": headers["sec-fetch-mode"], "mode": headers["sec-fetch-mode"],
"site": headers["sec-fetch-site"], "site": headers["sec-fetch-site"],
"user": headers["sec-fetch-user"] "user": headers["sec-fetch-user"]
}; };
assert_header_equals(got, { assert_header_equals(got, {
"dest": "image", "dest": "image",
@ -25,20 +27,20 @@
"mode": "cors", // Because `loadImageInWindow` tacks on `crossorigin` "mode": "cors", // Because `loadImageInWindow` tacks on `crossorigin`
}); });
}), }),
[], "Same-origin image");
window);
}, "Same-origin image");
async_test(t => { promise_test(() =>
loadImageInWindow( loadImageInWindow(
"https://{{hosts[][www]}}:{{ports[https][0]}}/referrer-policy/generic/subresource/image.py", "https://{{hosts[][www]}}:{{ports[https][0]}}/referrer-policy/generic/subresource/image.py",
t.step_func_done(img => { [],
window)
.then(img => {
headers = decodeImageData(extractImageData(img)).headers; headers = decodeImageData(extractImageData(img)).headers;
got = { got = {
"dest": headers["sec-fetch-dest"], "dest": headers["sec-fetch-dest"],
"mode": headers["sec-fetch-mode"], "mode": headers["sec-fetch-mode"],
"site": headers["sec-fetch-site"], "site": headers["sec-fetch-site"],
"user": headers["sec-fetch-user"] "user": headers["sec-fetch-user"]
}; };
assert_header_equals(got, { assert_header_equals(got, {
"dest": "image", "dest": "image",
@ -47,20 +49,20 @@
"mode": "cors", // Because `loadImageInWindow` tacks on `crossorigin` "mode": "cors", // Because `loadImageInWindow` tacks on `crossorigin`
}); });
}), }),
[], "Same-site image");
window);
}, "Same-site image");
async_test(t => { promise_test(() =>
loadImageInWindow( loadImageInWindow(
"https://{{hosts[alt][www]}}:{{ports[https][0]}}/referrer-policy/generic/subresource/image.py", "https://{{hosts[alt][www]}}:{{ports[https][0]}}/referrer-policy/generic/subresource/image.py",
t.step_func_done(img => { [],
window)
.then(img => {
headers = decodeImageData(extractImageData(img)).headers; headers = decodeImageData(extractImageData(img)).headers;
got = { got = {
"dest": headers["sec-fetch-dest"], "dest": headers["sec-fetch-dest"],
"mode": headers["sec-fetch-mode"], "mode": headers["sec-fetch-mode"],
"site": headers["sec-fetch-site"], "site": headers["sec-fetch-site"],
"user": headers["sec-fetch-user"] "user": headers["sec-fetch-user"]
}; };
assert_header_equals(got, { assert_header_equals(got, {
"dest": "image", "dest": "image",
@ -69,7 +71,5 @@
"mode": "cors", // Because `loadImageInWindow` tacks on `crossorigin` "mode": "cors", // Because `loadImageInWindow` tacks on `crossorigin`
}); });
}), }),
[], "Cross-site image");
window);
}, "Cross-site image");
</script> </script>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>&lt;a download&gt; triggered download in sandbox is allowed by allow-downloads-without-user-activation.</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-iframe-sandbox">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-iframe-element">
<script src="/resources/testharness.js"></script>
<script src='/resources/testharnessreport.js'></script>
<script src="support/iframe_sandbox_download_helper.js"></script>
<body>
<script>
"use strict";
async_test(t => {
const token = "{{$id:uuid()}}";
var iframe = document.createElement("iframe");
iframe.srcdoc = "<a>Download</a>";
iframe.sandbox = "allow-same-origin allow-downloads-without-user-activation";
iframe.onload = t.step_func(function () {
iframe.contentWindow.addEventListener(
"unload", t.unreached_func("Unexpected navigation."));
var anchor = iframe.contentDocument.getElementsByTagName('a')[0];
anchor.href = "support/download_stash.py?token=" + token;
anchor.download = null;
anchor.click();
AssertDownloadSuccess(t, token, DownloadVerifyDelay());
});
document.body.appendChild(iframe);
}, "<a download> triggered download in sandbox is allowed by allow-downloads-without-user-activation.");
</script>
</body>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>&lt;a download&gt; triggered download in sandbox is blocked.</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-iframe-sandbox">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-iframe-element">
<script src="/resources/testharness.js"></script>
<script src='/resources/testharnessreport.js'></script>
<script src="support/iframe_sandbox_download_helper.js"></script>
<body>
<script>
"use strict";
async_test(t => {
const token = "{{$id:uuid()}}";
var iframe = document.createElement("iframe");
iframe.srcdoc = "<a>Download</a>";
iframe.sandbox = "allow-same-origin";
iframe.onload = t.step_func(function () {
iframe.contentWindow.addEventListener(
"unload", t.unreached_func("Unexpected navigation."));
var anchor = iframe.contentDocument.getElementsByTagName('a')[0];
anchor.href = "support/download_stash.py?token=" + token;
anchor.download = null;
anchor.click();
AssertDownloadFailure(t, token, DownloadVerifyDelay());
});
document.body.appendChild(iframe);
}, "<a download> triggered download in sandbox is blocked.");
</script>
</body>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Navigation resulted download in sandbox is allowed by allow-downloads-without-user-activation.</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-iframe-sandbox">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-iframe-element">
<script src="/resources/testharness.js"></script>
<script src='/resources/testharnessreport.js'></script>
<script src="support/iframe_sandbox_download_helper.js"></script>
<body>
<script>
"use strict";
async_test(t => {
const token = "{{$id:uuid()}}";
var iframe = document.createElement("iframe");
iframe.srcdoc = "<a>Download</a>";
iframe.sandbox = "allow-same-origin allow-downloads-without-user-activation";
iframe.onload = t.step_func(function () {
iframe.contentWindow.addEventListener(
"unload", t.unreached_func("Unexpected navigation."));
var anchor = iframe.contentDocument.getElementsByTagName('a')[0];
// Set |finish-delay| to let the server stream a response over a period
// of time, so it's able to catch potential download cancellation by
// detecting a socket close.
anchor.href = "support/download_stash.py?token=" + token + "&finish-delay=" + StreamDownloadFinishDelay();
anchor.click();
AssertDownloadSuccess(t, token, StreamDownloadFinishDelay() + DownloadVerifyDelay());
});
document.body.appendChild(iframe);
}, "Navigation resulted download in sandbox is allowed by allow-downloads-without-user-activation.");
</script>
</body>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Navigation resulted download in sandbox is blocked.</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-iframe-sandbox">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-iframe-element">
<script src="/resources/testharness.js"></script>
<script src='/resources/testharnessreport.js'></script>
<script src="support/iframe_sandbox_download_helper.js"></script>
<body>
<script>
"use strict";
async_test(t => {
const token = "{{$id:uuid()}}";
var iframe = document.createElement("iframe");
iframe.srcdoc = "<a>Download</a>";
iframe.sandbox = "allow-same-origin";
iframe.onload = t.step_func(function () {
iframe.contentWindow.addEventListener(
"unload", t.unreached_func("Unexpected navigation."));
var anchor = iframe.contentDocument.getElementsByTagName('a')[0];
// Set |finish-delay| to let the server stream a response over a period
// of time, so it's able to catch potential download cancellation by
// detecting a socket close.
anchor.href = "support/download_stash.py?token=" + token + "&finish-delay=" + StreamDownloadFinishDelay();
anchor.click();
AssertDownloadFailure(t, token, StreamDownloadFinishDelay() + DownloadVerifyDelay());
});
document.body.appendChild(iframe);
}, "Navigation resulted download in sandbox is blocked.");
</script>
</body>

View file

@ -0,0 +1,28 @@
import time
def main(request, response):
token = request.GET["token"]
response.status = 200
response.headers.append("Content-Type", "text/html")
if "verify-token" in request.GET:
if request.server.stash.take(token):
return 'TOKEN_SET'
return 'TOKEN_NOT_SET'
if "finish-delay" not in request.GET:
# <a download>
request.server.stash.put(token, True)
return
# navigation to download
response.headers.append("Content-Disposition", "attachment")
response.write_status_headers()
finish_delay = float(request.GET["finish-delay"]) / 1E3
count = 10
single_delay = finish_delay / count
for i in range(count): # pylint: disable=unused-variable
time.sleep(single_delay)
response.writer.write_content("\n")
if not response.writer.flush():
return
request.server.stash.put(token, True)

View file

@ -0,0 +1,37 @@
function StreamDownloadFinishDelay() {
return 1000;
}
function DownloadVerifyDelay() {
return 1000;
}
function VerifyDownload(test_obj, token, timeout, expect_download) {
var verify_token = test_obj.step_func(function () {
var xhr = new XMLHttpRequest();
xhr.open('GET', 'support/download_stash.py?verify-token&token=' + token);
xhr.onload = test_obj.step_func(function(e) {
if (expect_download) {
if (xhr.response != "TOKEN_SET") {
// Always retry, and rely on the test timeout to conclude that
// download didn't happen and to fail the test.
test_obj.step_timeout(verify_token, DownloadVerifyDelay());
return;
}
} else {
assert_equals(xhr.response, "TOKEN_NOT_SET", "Expect no download to happen, but got one.");
}
test_obj.done();
});
xhr.send();
});
test_obj.step_timeout(verify_token, timeout);
}
function AssertDownloadSuccess(test_obj, token, timeout) {
VerifyDownload(test_obj, token, timeout, true);
}
function AssertDownloadFailure(test_obj, token, timeout) {
VerifyDownload(test_obj, token, timeout, false);
}

View file

@ -114,6 +114,8 @@ interface HTMLElement : Element {
[CEReactions] attribute DOMString autocapitalize; [CEReactions] attribute DOMString autocapitalize;
[CEReactions] attribute [TreatNullAs=EmptyString] DOMString innerText; [CEReactions] attribute [TreatNullAs=EmptyString] DOMString innerText;
ElementInternals attachInternals();
}; };
HTMLElement includes GlobalEventHandlers; HTMLElement includes GlobalEventHandlers;
@ -1410,6 +1412,11 @@ dictionary ElementDefinitionOptions {
DOMString extends; DOMString extends;
}; };
[Exposed=Window]
interface ElementInternals {
};
dictionary FocusOptions { dictionary FocusOptions {
boolean preventScroll = false; boolean preventScroll = false;
}; };

View file

@ -23,7 +23,7 @@ enum EffectiveConnectionType {
}; };
interface mixin NavigatorNetworkInformation { interface mixin NavigatorNetworkInformation {
readonly attribute NetworkInformation connection; [SameObject] readonly attribute NetworkInformation connection;
}; };
Navigator includes NavigatorNetworkInformation; Navigator includes NavigatorNetworkInformation;

View file

@ -3,20 +3,20 @@
// (https://github.com/tidoust/reffy-reports) // (https://github.com/tidoust/reffy-reports)
// Source: Web NFC API (https://w3c.github.io/web-nfc/) // Source: Web NFC API (https://w3c.github.io/web-nfc/)
dictionary NFCMessage { dictionary NDEFMessage {
sequence<NFCRecord> records; sequence<NDEFRecord> records;
USVString url; USVString url;
}; };
typedef (DOMString or unrestricted double or ArrayBuffer or Dictionary) NFCRecordData; typedef (DOMString or unrestricted double or ArrayBuffer or Dictionary) NDEFRecordData;
dictionary NFCRecord { dictionary NDEFRecord {
NFCRecordType recordType; NDEFRecordType recordType;
USVString mediaType; USVString mediaType;
NFCRecordData data; NDEFRecordData data;
}; };
enum NFCRecordType { enum NDEFRecordType {
"empty", "empty",
"text", "text",
"url", "url",
@ -24,11 +24,11 @@ enum NFCRecordType {
"opaque" "opaque"
}; };
typedef (DOMString or ArrayBuffer or NFCMessage) NFCMessageSource; typedef (DOMString or ArrayBuffer or NDEFMessage) NDEFMessageSource;
[Constructor(), SecureContext, Exposed=Window] [Constructor(), SecureContext, Exposed=Window]
interface NFCWriter { interface NFCWriter {
Promise<void> push(NFCMessageSource message, optional NFCPushOptions options); Promise<void> push(NDEFMessageSource message, optional NFCPushOptions options);
}; };
[Constructor(optional NFCReaderOptions options), SecureContext, Exposed=Window] [Constructor(optional NFCReaderOptions options), SecureContext, Exposed=Window]
@ -42,11 +42,11 @@ interface NFCReader : EventTarget {
[Constructor(DOMString type, NFCReadingEventInit readingEventInitDict), SecureContext, Exposed=Window] [Constructor(DOMString type, NFCReadingEventInit readingEventInitDict), SecureContext, Exposed=Window]
interface NFCReadingEvent : Event { interface NFCReadingEvent : Event {
readonly attribute NFCMessage message; readonly attribute NDEFMessage message;
}; };
dictionary NFCReadingEventInit : EventInit { dictionary NFCReadingEventInit : EventInit {
required NFCMessage message; required NDEFMessage message;
}; };
[Constructor(DOMString type, NFCErrorEventInit errorEventInitDict), SecureContext, Exposed=Window] [Constructor(DOMString type, NFCErrorEventInit errorEventInitDict), SecureContext, Exposed=Window]
@ -58,11 +58,18 @@ dictionary NFCErrorEventInit : EventInit {
required DOMException error; required DOMException error;
}; };
enum NDEFCompatibility {
"nfc-forum",
"vendor",
"any"
};
dictionary NFCPushOptions { dictionary NFCPushOptions {
NFCPushTarget target = "any"; NFCPushTarget target = "any";
unrestricted double timeout = Infinity; unrestricted double timeout = Infinity;
boolean ignoreRead = true; boolean ignoreRead = true;
AbortSignal? signal; AbortSignal? signal;
NDEFCompatibility compatibility = "nfc-forum";
}; };
enum NFCPushTarget { enum NFCPushTarget {
@ -73,6 +80,7 @@ enum NFCPushTarget {
dictionary NFCReaderOptions { dictionary NFCReaderOptions {
USVString url = ""; USVString url = "";
NFCRecordType recordType; NDEFRecordType recordType;
USVString mediaType = ""; USVString mediaType = "";
NDEFCompatibility compatibility = "nfc-forum";
}; };

View file

@ -14,6 +14,10 @@
} }
window.addEventListener('message', t.step_func(e => { window.addEventListener('message', t.step_func(e => {
assert_equals(e.data['entryType'], 'longtask'); assert_equals(e.data['entryType'], 'longtask');
// Ignore any long task that may be produced by the top-level frame.
if (e.data['frame-attribution'] === 'same-origin-ancestor')
return;
assert_equals(e.data['frame-attribution'], 'same-origin'); assert_equals(e.data['frame-attribution'], 'same-origin');
assert_equals(e.data['task-attribution'], 'unknown'); assert_equals(e.data['task-attribution'], 'unknown');
assert_equals(e.data['containerId'], 'longtask-iframe-id'); assert_equals(e.data['containerId'], 'longtask-iframe-id');

View file

@ -5,6 +5,20 @@
* method's JSDoc. * method's JSDoc.
*/ */
// The same content is placed as
// - wpt/referrer-policy/generic/common.js and
// - wpt/mixed-content/generic/common.js.
// If you modify either one, please also update the other one.
//
// TODO(https://crbug.com/906850): These two files are going to be merged.
// Currently they are duplicated only to avoid frequent mass modification
// for each step of refactoring, as these file names are hard-coded in
// a large number of generated test files.
function timeoutPromise(t, ms) {
return new Promise(resolve => { t.step_timeout(resolve, ms); });
}
/** /**
* Normalizes the target port for use in a URL. For default ports, this is the * Normalizes the target port for use in a URL. For default ports, this is the
* empty string (omitted port), otherwise it's a colon followed by the port * empty string (omitted port), otherwise it's a colon followed by the port
@ -70,27 +84,66 @@ function setAttributes(el, attrs) {
el.setAttribute(attr, attrs[attr]); el.setAttribute(attr, attrs[attr]);
} }
/** /**
* Binds to success and error events of an object wrapping them into a promise * Binds to success and error events of an object wrapping them into a promise
* available through {@code element.eventPromise}. The success event * available through {@code element.eventPromise}. The success event
* resolves and error event rejects. * resolves and error event rejects.
* This method adds event listeners, and then removes all the added listeners
* when one of listened event is fired.
* @param {object} element An object supporting events on which to bind the * @param {object} element An object supporting events on which to bind the
* promise. * promise.
* @param {string} resolveEventName [="load"] The event name to bind resolve to. * @param {string} resolveEventName [="load"] The event name to bind resolve to.
* @param {string} rejectEventName [="error"] The event name to bind reject to. * @param {string} rejectEventName [="error"] The event name to bind reject to.
*/ */
function bindEvents(element, resolveEventName, rejectEventName) { function bindEvents(element, resolveEventName, rejectEventName) {
element.eventPromise = new Promise(function(resolve, reject) { element.eventPromise =
element.addEventListener(resolveEventName || "load", function (e) { bindEvents2(element, resolveEventName, element, rejectEventName);
resolve(e); }
});
element.addEventListener(rejectEventName || "error", function(e) { // Returns a promise wrapping success and error events of objects.
// This is a variant of bindEvents that can accept separate objects for each
// events and two events to reject, and doesn't set `eventPromise`.
//
// When `resolveObject`'s `resolveEventName` event (default: "load") is
// fired, the promise is resolved with the event.
//
// When `rejectObject`'s `rejectEventName` event (default: "error") or
// `rejectObject2`'s `rejectEventName2` event (default: "error") is
// fired, the promise is rejected.
//
// `rejectObject2` is optional.
function bindEvents2(resolveObject, resolveEventName, rejectObject, rejectEventName, rejectObject2, rejectEventName2) {
return new Promise(function(resolve, reject) {
const actualResolveEventName = resolveEventName || "load";
const actualRejectEventName = rejectEventName || "error";
const actualRejectEventName2 = rejectEventName2 || "error";
const resolveHandler = function(event) {
cleanup();
resolve(event);
};
const rejectHandler = function(event) {
// Chromium starts propagating errors from worker.onerror to // Chromium starts propagating errors from worker.onerror to
// window.onerror. This handles the uncaught exceptions in tests. // window.onerror. This handles the uncaught exceptions in tests.
e.preventDefault(); event.preventDefault();
reject(e); cleanup();
}); reject(event);
};
const cleanup = function() {
resolveObject.removeEventListener(actualResolveEventName, resolveHandler);
rejectObject.removeEventListener(actualRejectEventName, rejectHandler);
if (rejectObject2) {
rejectObject2.removeEventListener(actualRejectEventName2, rejectHandler);
}
};
resolveObject.addEventListener(actualResolveEventName, resolveHandler);
rejectObject.addEventListener(actualRejectEventName, rejectHandler);
if (rejectObject2) {
rejectObject2.addEventListener(actualRejectEventName2, rejectHandler);
}
}); });
} }
@ -149,14 +202,35 @@ function createHelperIframe(name, doBindEvents) {
doBindEvents); doBindEvents);
} }
/**
* requestVia*() functions return promises that are resolved on successful
* requests with objects of the same "type", i.e. objects that contains
* the same sets of keys that are fixed within one category of tests (e.g.
* within wpt/referrer-policy tests).
* wrapResult() (that should be defined outside this file) is used to convert
* the response bodies of subresources into the expected result objects in some
* cases, and in other cases the result objects are constructed more directly.
* TODO(https://crbug.com/906850): Clean up the semantics around this, e.g.
* use (or not use) wrapResult() consistently, unify the arguments, etc.
*/
/** /**
* Creates a new iframe, binds load and error events, sets the src attribute and * Creates a new iframe, binds load and error events, sets the src attribute and
* appends it to {@code document.body} . * appends it to {@code document.body} .
* @param {string} url The src for the iframe. * @param {string} url The src for the iframe.
* @return {Promise} The promise for success/error events. * @return {Promise} The promise for success/error events.
*/ */
function requestViaIframe(url) { function requestViaIframe(url, additionalAttributes) {
return createRequestViaElement("iframe", {"src": url}, document.body); const iframe = createElement(
"iframe",
Object.assign({"src": url}, additionalAttributes),
document.body,
false);
return bindEvents2(window, "message", iframe, "error", window, "error")
.then(event => {
assert_equals(event.source, iframe.contentWindow);
return event.data;
});
} }
/** /**
@ -169,13 +243,122 @@ function requestViaImage(url) {
return createRequestViaElement("img", {"src": url}, document.body); return createRequestViaElement("img", {"src": url}, document.body);
} }
// Helpers for requestViaImageForReferrerPolicy().
function loadImageInWindow(src, attributes, w) {
return new Promise((resolve, reject) => {
var image = new w.Image();
image.crossOrigin = "Anonymous";
image.onload = function() {
resolve(image);
};
// Extend element with attributes. (E.g. "referrerPolicy" or "rel")
if (attributes) {
for (var attr in attributes) {
image[attr] = attributes[attr];
}
}
image.src = src;
w.document.body.appendChild(image)
});
}
function extractImageData(img) {
var canvas = document.createElement("canvas");
var context = canvas.getContext('2d');
context.drawImage(img, 0, 0);
var imgData = context.getImageData(0, 0, img.clientWidth, img.clientHeight);
return imgData.data;
}
function decodeImageData(rgba) {
var rgb = new Uint8ClampedArray(rgba.length);
// RGBA -> RGB.
var rgb_length = 0;
for (var i = 0; i < rgba.length; ++i) {
// Skip alpha component.
if (i % 4 == 3)
continue;
// Zero is the string terminator.
if (rgba[i] == 0)
break;
rgb[rgb_length++] = rgba[i];
}
// Remove trailing nulls from data.
rgb = rgb.subarray(0, rgb_length);
var string_data = (new TextDecoder("ascii")).decode(rgb);
return JSON.parse(string_data);
}
// A variant of requestViaImage for referrer policy tests.
// This tests many patterns of <iframe>s to test referrer policy inheritance.
// TODO(https://crbug.com/906850): Merge this into requestViaImage().
// <iframe>-related code should be moved outside requestViaImage*().
function requestViaImageForReferrerPolicy(url, attributes, referrerPolicy) {
// For images, we'll test:
// - images in a `srcdoc` frame to ensure that it uses the referrer
// policy of its parent,
// - images in a top-level document,
// - and images in a `srcdoc` frame with its own referrer policy to
// override its parent.
var iframeWithoutOwnPolicy = document.createElement('iframe');
var noSrcDocPolicy = new Promise((resolve, reject) => {
iframeWithoutOwnPolicy.srcdoc = "Hello, world.";
iframeWithoutOwnPolicy.onload = resolve;
document.body.appendChild(iframeWithoutOwnPolicy);
})
.then(() => {
var nextUrl = url + "&cache_destroyer2=" + (new Date()).getTime();
return loadImageInWindow(nextUrl, attributes,
iframeWithoutOwnPolicy.contentWindow);
})
.then(function (img) {
return decodeImageData(extractImageData(img));
});
// Give a srcdoc iframe a referrer policy different from the top-level page's policy.
var iframePolicy = (referrerPolicy === "no-referrer") ? "unsafe-url" : "no-referrer";
var iframeWithOwnPolicy = document.createElement('iframe');
var srcDocPolicy = new Promise((resolve, reject) => {
iframeWithOwnPolicy.srcdoc = "<meta name='referrer' content='" + iframePolicy + "'>Hello world.";
iframeWithOwnPolicy.onload = resolve;
document.body.appendChild(iframeWithOwnPolicy);
})
.then(() => {
var nextUrl = url + "&cache_destroyer3=" + (new Date()).getTime();
return loadImageInWindow(nextUrl, null,
iframeWithOwnPolicy.contentWindow);
})
.then(function (img) {
return decodeImageData(extractImageData(img));
});
var pagePolicy = loadImageInWindow(url, attributes, window)
.then(function (img) {
return decodeImageData(extractImageData(img));
});
return Promise.all([noSrcDocPolicy, srcDocPolicy, pagePolicy]).then(values => {
assert_equals(values[0].headers.referer, values[2].headers.referer, "Referrer inside 'srcdoc' without its own policy should be the same as embedder's referrer.");
assert_equals((iframePolicy === "no-referrer" ? undefined : document.location.href), values[1].headers.referer, "Referrer inside 'srcdoc' should use the iframe's policy if it has one");
return wrapResult(values[2]);
});
}
/** /**
* Initiates a new XHR GET request to provided URL. * Initiates a new XHR GET request to provided URL.
* @param {string} url The endpoint URL for the XHR. * @param {string} url The endpoint URL for the XHR.
* @return {Promise} The promise for success/error events. * @return {Promise} The promise for success/error events.
*/ */
function requestViaXhr(url) { function requestViaXhr(url) {
return xhrRequest(url); return xhrRequest(url).then(result => wrapResult(result));
} }
/** /**
@ -184,7 +367,9 @@ function requestViaXhr(url) {
* @return {Promise} The promise for success/error events. * @return {Promise} The promise for success/error events.
*/ */
function requestViaFetch(url) { function requestViaFetch(url) {
return fetch(url); return fetch(url)
.then(res => res.json())
.then(j => wrapResult(j));
} }
function dedicatedWorkerUrlThatFetches(url) { function dedicatedWorkerUrlThatFetches(url) {
@ -213,10 +398,22 @@ function requestViaDedicatedWorker(url, options) {
} catch (e) { } catch (e) {
return Promise.reject(e); return Promise.reject(e);
} }
bindEvents(worker, "message", "error");
worker.postMessage(''); worker.postMessage('');
return bindEvents2(worker, "message", worker, "error")
.then(event => wrapResult(event.data));
}
return worker.eventPromise; function requestViaSharedWorker(url) {
var worker;
try {
worker = new SharedWorker(url);
} catch(e) {
return Promise.reject(e);
}
const promise = bindEvents2(worker.port, "message", worker, "error")
.then(event => wrapResult(event.data));
worker.port.start();
return promise;
} }
// Returns a reference to a worklet object corresponding to a given type. // Returns a reference to a worklet object corresponding to a given type.
@ -251,13 +448,19 @@ function requestViaWorklet(type, url) {
* @return {Promise} The promise for success/error events. * @return {Promise} The promise for success/error events.
*/ */
function requestViaNavigable(navigableElement, url) { function requestViaNavigable(navigableElement, url) {
var iframe = createHelperIframe(guid(), true); var iframe = createHelperIframe(guid(), false);
setAttributes(navigableElement, setAttributes(navigableElement,
{"href": url, {"href": url,
"target": iframe.name}); "target": iframe.name});
navigableElement.click();
return iframe.eventPromise; const promise =
bindEvents2(window, "message", iframe, "error", window, "error")
.then(event => {
assert_equals(event.source, iframe.contentWindow, "event.source");
return event.data;
});
navigableElement.click();
return promise;
} }
/** /**
@ -266,8 +469,11 @@ function requestViaNavigable(navigableElement, url) {
* @param {string} url The URL to navigate to. * @param {string} url The URL to navigate to.
* @return {Promise} The promise for success/error events. * @return {Promise} The promise for success/error events.
*/ */
function requestViaAnchor(url) { function requestViaAnchor(url, additionalAttributes) {
var a = createElement("a", {"innerHTML": "Link to resource"}, document.body); var a = createElement(
"a",
Object.assign({"innerHTML": "Link to resource"}, additionalAttributes),
document.body);
return requestViaNavigable(a, url); return requestViaNavigable(a, url);
} }
@ -278,9 +484,13 @@ function requestViaAnchor(url) {
* @param {string} url The URL to navigate to. * @param {string} url The URL to navigate to.
* @return {Promise} The promise for success/error events. * @return {Promise} The promise for success/error events.
*/ */
function requestViaArea(url) { function requestViaArea(url, additionalAttributes) {
var area = createElement("area", {}, document.body); var area = createElement(
"area",
Object.assign({}, additionalAttributes),
document.body);
// TODO(kristijanburnik): Append to map and add image.
return requestViaNavigable(area, url); return requestViaNavigable(area, url);
} }
@ -290,8 +500,15 @@ function requestViaArea(url) {
* @param {string} url The src URL. * @param {string} url The src URL.
* @return {Promise} The promise for success/error events. * @return {Promise} The promise for success/error events.
*/ */
function requestViaScript(url) { function requestViaScript(url, additionalAttributes) {
return createRequestViaElement("script", {"src": url}, document.body); const script = createElement(
"script",
Object.assign({"src": url}, additionalAttributes),
document.body,
false);
return bindEvents2(window, "message", script, "error", window, "error")
.then(event => wrapResult(event.data));
} }
/** /**
@ -458,7 +675,7 @@ function requestViaWebSocket(url) {
var websocket = new WebSocket(url); var websocket = new WebSocket(url);
websocket.addEventListener("message", function(e) { websocket.addEventListener("message", function(e) {
resolve(JSON.parse(e.data)); resolve(e.data);
}); });
websocket.addEventListener("open", function(e) { websocket.addEventListener("open", function(e) {
@ -468,7 +685,10 @@ function requestViaWebSocket(url) {
websocket.addEventListener("error", function(e) { websocket.addEventListener("error", function(e) {
reject(e) reject(e)
}); });
}); })
.then(data => {
return JSON.parse(data);
});
} }
// SanityChecker does nothing in release mode. See sanity-checker.js for debug // SanityChecker does nothing in release mode. See sanity-checker.js for debug
@ -476,3 +696,4 @@ function requestViaWebSocket(url) {
function SanityChecker() {} function SanityChecker() {}
SanityChecker.prototype.checkScenario = function() {}; SanityChecker.prototype.checkScenario = function() {};
SanityChecker.prototype.setFailTimeout = function(test, timeout) {}; SanityChecker.prototype.setFailTimeout = function(test, timeout) {};
SanityChecker.prototype.checkSubresourceResult = function() {};

View file

@ -83,6 +83,11 @@ def main(request, response):
"mixed-content", "mixed-content",
"generic", "generic",
"worker.js"), "rb").read() "worker.js"), "rb").read()
elif content_type == "text/javascript":
response_data = open(os.path.join(request.doc_root,
"mixed-content",
"generic",
"script.js"), "rb").read()
else: else:
response_data = "/* purged */" response_data = "/* purged */"
elif action == "take": elif action == "take":

View file

@ -3,6 +3,11 @@
* @author burnik@google.com (Kristijan Burnik) * @author burnik@google.com (Kristijan Burnik)
*/ */
function wrapResult(server_data) {
// Currently the returned value is not used in mixed-content tests.
return null;
}
/** /**
* MixedContentTestCase exercises all the tests for checking browser behavior * MixedContentTestCase exercises all the tests for checking browser behavior
* when resources regarded as mixed-content are requested. A single run covers * when resources regarded as mixed-content are requested. A single run covers

View file

@ -0,0 +1 @@
postMessage("", "*");

View file

@ -207,3 +207,28 @@ async function reportExists(expected) {
} }
return false; return false;
} }
/*
* Verifies that reports were uploaded that contains all of the fields in
* expected.
*/
async function reportsExist(expected_reports) {
const timeout = 10;
let reportLocation =
"/network-error-logging/support/report.py?op=retrieve_report&timeout=" +
timeout + "&reportID=" + reportID;
// There must be the report of pass.png, so adding 1.
const min_count = expected_reports.length + 1;
reportLocation += "&min_count=" + min_count;
const response = await fetch(reportLocation);
const json = await response.json();
for (const expected of expected_reports) {
const found = json.some((report) => {
return _isSubsetOf(expected, report);
});
if (!found)
return false;
}
return true;
}

View file

@ -2,12 +2,12 @@ import time
import json import json
import re import re
def retrieve_from_stash(request, key, timeout, default_value): def retrieve_from_stash(request, key, timeout, min_count, default_value):
t0 = time.time() t0 = time.time()
while time.time() - t0 < timeout: while time.time() - t0 < timeout:
time.sleep(0.5) time.sleep(0.5)
value = request.server.stash.take(key=key) value = request.server.stash.take(key=key)
if value is not None: if value is not None and len(value) >= min_count:
request.server.stash.put(key=key, value=value) request.server.stash.put(key=key, value=value)
return json.dumps(value) return json.dumps(value)
@ -34,7 +34,11 @@ def main(request, response):
timeout = float(request.GET.first("timeout")) timeout = float(request.GET.first("timeout"))
except: except:
timeout = 0.5 timeout = 0.5
return [("Content-Type", "application/json")], retrieve_from_stash(request, key, timeout, '[]') try:
min_count = int(request.GET.first("min_count"))
except:
min_count = 1
return [("Content-Type", "application/json")], retrieve_from_stash(request, key, timeout, min_count, '[]')
# append new reports # append new reports
new_reports = json.loads(request.body) new_reports = json.loads(request.body)

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<meta name="referrer" content="origin"> <meta name="referrer" content="origin">
</head> </head>
<body> <body>
@ -16,7 +17,7 @@
<div class="styled"></div> <div class="styled"></div>
<script> <script>
async_test(function(css_test) { promise_test(function(css_test) {
let id = token(); let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port; let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
let css_url = url_prefix + let css_url = url_prefix +
@ -25,19 +26,19 @@
let check_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py" + let check_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py" +
"?id=" + id + "&report-headers"; "?id=" + id + "&report-headers";
let link = document.createElement("link"); return new Promise(resolve => {
link.href = css_url; let link = document.createElement("link");
link.rel = "stylesheet"; link.href = css_url;
link.onload = function() { link.rel = "stylesheet";
css_test.step_timeout(function() { link.onload = resolve;
queryXhr(check_url, function(message) { document.head.appendChild(link);
assert_own_property(message, "headers"); })
assert_equals(message.referrer, undefined); .then(() => timeoutPromise(css_test, 1000))
css_test.done(); .then(() => requestViaXhr(check_url))
}, null, null, css_test); .then(function(message) {
}, 1000); assert_own_property(message, "headers");
}; assert_equals(message.referrer, undefined);
document.head.appendChild(link); });
}, "Child css from external stylesheet."); }, "Child css from external stylesheet.");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<meta name="referrer" content="never"> <meta name="referrer" content="never">
</head> </head>
<body> <body>
@ -16,7 +17,7 @@
<div class="styled"></div> <div class="styled"></div>
<script> <script>
async_test(function(css_test) { promise_test(function(css_test) {
let id = token(); let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port; let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
let css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&import-rule"; let css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&import-rule";
@ -27,14 +28,13 @@
style.type = 'text/css'; style.type = 'text/css';
style.appendChild(document.createTextNode("@import url('" + css_url + "');")); style.appendChild(document.createTextNode("@import url('" + css_url + "');"));
document.head.appendChild(style); document.head.appendChild(style);
css_test.step_timeout(function() { return timeoutPromise(css_test, 1000)
queryXhr(check_url, function(message) { .then(() => requestViaXhr(check_url))
.then(function(message) {
assert_own_property(message, "headers"); assert_own_property(message, "headers");
assert_own_property(message, "referrer"); assert_own_property(message, "referrer");
assert_equals(message.referrer, css_url); assert_equals(message.referrer, css_url);
css_test.done(); });
}, null, null, css_test);
}, 1000);
}, "Child css from internal stylesheet."); }, "Child css from internal stylesheet.");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<meta name="referrer" content="origin"> <meta name="referrer" content="origin">
</head> </head>
<body> <body>
@ -15,7 +16,7 @@
<div class="styled"></div> <div class="styled"></div>
<script> <script>
async_test(function(css_test) { promise_test(function(css_test) {
let id = token(); let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + let url_prefix = location.protocol + "//www1." + location.hostname + ":" +
location.port + location.port +
@ -28,15 +29,14 @@
let processingInstruction = let processingInstruction =
document.createProcessingInstruction( document.createProcessingInstruction(
"xml-stylesheet", "href=\"" +css_url + "\" type=\"text/css\""); "xml-stylesheet", "href=\"" +css_url + "\" type=\"text/css\"");
css_test.step_timeout(function() { document.insertBefore(processingInstruction, document.firstChild);
queryXhr(check_url, function(message) { return timeoutPromise(css_test, 1000)
.then(() => requestViaXhr(check_url))
.then(function(message) {
assert_own_property(message, "headers"); assert_own_property(message, "headers");
assert_own_property(message, "referrer"); assert_own_property(message, "referrer");
assert_equals(message.referrer, expected); assert_equals(message.referrer, expected);
css_test.done(); });
}, null, null, css_test);
}, 1000);
document.insertBefore(processingInstruction, document.firstChild);
}, "Child css via a ProcessingInstruction."); }, "Child css via a ProcessingInstruction.");
</script> </script>

View file

@ -14,41 +14,34 @@ var svg_test_properties = [
'mask-image', 'mask-image',
]; ];
// Schedules async_test's for each of the test properties
// Parameters: // Parameters:
// testProperties: An array of test properties. // testProperties: An array of test properties.
// testDescription: A test description // testDescription: A test description
// testFunction: A function call which sets up the expect result and runs // testFunction: A function call which sets up the expect result and runs
// the actual test // the actual test
function runSvgTests(testProperties, testDescription, testFunction) { function runSvgTests(testProperties, testDescription, testFunction) {
let runNextTest = function () { for (const property of testProperties) {
let property = testProperties.shift();
if (property === undefined) {
return;
}
let current = { let current = {
test: async_test(testDescription + " " + property),
id: token(), id: token(),
property: property, property: property,
}; };
current.test.step(function() { testFunction(current) }); promise_test(t => {
testFunction(current);
let check_url = url_prefix + "svg.py" + "?id=" + current.id + return timeoutPromise(t, 800)
"&report-headers"; .then(() => {
current.test.step_timeout(function() { let check_url = url_prefix + "svg.py" + "?id=" + current.id +
queryXhr(check_url, function(message) { "&report-headers";
assert_own_property(message, "headers"); return requestViaFetch(check_url);
assert_own_property(message, "referrer"); })
assert_equals(message.referrer, current.expected); .then(message => {
current.test.done(); assert_own_property(message, "headers");
}, null, null, current.test); assert_own_property(message, "referrer");
}, 800); assert_equals(message.referrer, current.expected);
}; });
},
add_result_callback(runNextTest); testDescription + " " + property);
runNextTest(); }
} }
function createSvg() { function createSvg() {

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<meta name="referrer" content="never"> <meta name="referrer" content="never">
</head> </head>
<body> <body>
@ -17,7 +18,7 @@
<div class="styled"></div> <div class="styled"></div>
<script> <script>
async_test(function(css_test) { promise_test(function(css_test) {
let id = token(); let id = token();
let css_url = location.protocol + "//www1." + location.hostname + ":" + let css_url = location.protocol + "//www1." + location.hostname + ":" +
location.port + location.port +
@ -29,20 +30,20 @@
let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" + let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
"?id=" + id + "&report-headers" + "&type=font"; "?id=" + id + "&report-headers" + "&type=font";
let link = document.createElement("link"); return new Promise(resolve => {
link.href = css_url; let link = document.createElement("link");
link.rel = "stylesheet"; link.href = css_url;
link.onload = function() { link.rel = "stylesheet";
css_test.step_timeout(function() { link.onload = resolve;
queryXhr(font_url, function(message) { document.head.appendChild(link);
assert_own_property(message, "headers"); })
assert_own_property(message, "referrer"); .then(() => timeoutPromise(css_test, 1000))
assert_equals(message.referrer, css_referrer); .then(() => requestViaXhr(font_url))
css_test.done(); .then(function(message) {
}, null, null, css_test); assert_own_property(message, "headers");
}, 1000); assert_own_property(message, "referrer");
}; assert_equals(message.referrer, css_referrer);
document.head.appendChild(link); });
}, "Font from imported stylesheet (external)."); }, "Font from imported stylesheet (external).");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<meta name="referrer" content="never"> <meta name="referrer" content="never">
</head> </head>
<body> <body>
@ -16,27 +17,27 @@
<div class="styled"></div> <div class="styled"></div>
<script> <script>
async_test(function(css_test) { promise_test(function(css_test) {
let id = token(); let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port; let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
let css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&type=font"; let css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&type=font";
let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" + let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
"?id=" + id + "&report-headers"; "?id=" + id + "&report-headers";
let link = document.createElement("link"); return new Promise(resolve => {
link.href = css_url; let link = document.createElement("link");
link.rel = "stylesheet"; link.href = css_url;
link.onload = function() { link.rel = "stylesheet";
css_test.step_timeout(function() { link.onload = resolve;
queryXhr(font_url, function(message) { document.head.appendChild(link);
assert_own_property(message, "headers"); })
assert_own_property(message, "referrer"); .then(() => timeoutPromise(css_test, 1000))
assert_equals(message.referrer, css_url); .then(() => requestViaXhr(font_url))
css_test.done(); .then(function(message) {
}, null, null, css_test); assert_own_property(message, "headers");
}, 1000); assert_own_property(message, "referrer");
}; assert_equals(message.referrer, css_url);
document.head.appendChild(link); });
}, "Font from external stylesheet."); }, "Font from external stylesheet.");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<meta name="referrer" content="origin"> <meta name="referrer" content="origin">
</head> </head>
<body> <body>
@ -17,7 +18,7 @@
<div class="styled"></div> <div class="styled"></div>
<script> <script>
async_test(function(css_test) { promise_test(function(css_test) {
let id = token(); let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + let url_prefix = location.protocol + "//www1." + location.hostname + ":" +
location.port + "/referrer-policy/generic/subresource/"; location.port + "/referrer-policy/generic/subresource/";
@ -27,14 +28,13 @@
let style = document.createElement("style"); let style = document.createElement("style");
style.textContent = "@import url('" + css_url + "');"; style.textContent = "@import url('" + css_url + "');";
document.head.appendChild(style); document.head.appendChild(style);
css_test.step_timeout(function() { return timeoutPromise(css_test, 1000)
queryXhr(font_url, function(message) { .then(() => requestViaXhr(font_url))
assert_own_property(message, "headers"); .then(function(message) {
assert_own_property(message, "referrer"); assert_own_property(message, "headers");
assert_equals(message.referrer, css_url); assert_own_property(message, "referrer");
css_test.done(); assert_equals(message.referrer, css_url);
}, null, null, css_test); });
}, 1000);
}, "Font from imported stylesheet (internal)."); }, "Font from imported stylesheet (internal).");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<meta name="referrer" content="origin"> <meta name="referrer" content="origin">
</head> </head>
<body> <body>
@ -16,7 +17,7 @@
<div class="styled"></div> <div class="styled"></div>
<script> <script>
async_test(function(css_test) { promise_test(function(css_test) {
let id = token(); let id = token();
let css_url = location.protocol + "//www1." + location.hostname + ":" + let css_url = location.protocol + "//www1." + location.hostname + ":" +
location.port + location.port +
@ -27,14 +28,13 @@
let style = document.createElement("style"); let style = document.createElement("style");
style.textContent = "@font-face { font-family: 'wpt'; font-style: normal; font-weight: normal; src: url(" + css_url + "); format('truetype'); } body { font-family: 'wpt';}"; style.textContent = "@font-face { font-family: 'wpt'; font-style: normal; font-weight: normal; src: url(" + css_url + "); format('truetype'); } body { font-family: 'wpt';}";
document.head.appendChild(style); document.head.appendChild(style);
css_test.step_timeout(function() { return timeoutPromise(css_test, 1000)
queryXhr(font_url, function(message) { .then(() => requestViaXhr(font_url))
assert_own_property(message, "headers"); .then(function(message) {
assert_own_property(message, "referrer"); assert_own_property(message, "headers");
assert_equals(message.referrer, location.origin + "/"); assert_own_property(message, "referrer");
css_test.done(); assert_equals(message.referrer, location.origin + "/");
}, null, null, css_test); });
}, 1000);
}, "Font from internal stylesheet."); }, "Font from internal stylesheet.");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<meta name="referrer" content="never"> <meta name="referrer" content="never">
</head> </head>
<body> <body>
@ -17,7 +18,7 @@
<div class="styled"></div> <div class="styled"></div>
<script> <script>
async_test(function(css_test) { promise_test(function(css_test) {
let id = token(); let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port; let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
let css_url = url_prefix + let css_url = url_prefix +
@ -32,15 +33,14 @@
let processingInstruction = let processingInstruction =
document.createProcessingInstruction( document.createProcessingInstruction(
"xml-stylesheet", "href=\"" + css_url + "\" type=\"text/css\""); "xml-stylesheet", "href=\"" + css_url + "\" type=\"text/css\"");
css_test.step_timeout(function() {
queryXhr(font_url, function(message) {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, expected);
css_test.done();
}, null, null, css_test);
}, 1000);
document.insertBefore(processingInstruction, document.firstChild); document.insertBefore(processingInstruction, document.firstChild);
return timeoutPromise(css_test, 1000)
.then(() => requestViaXhr(font_url))
.then(function(message) {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, expected);
});
}, "Font from external stylesheet (from ProcessingInstruction)."); }, "Font from external stylesheet (from ProcessingInstruction).");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<meta name="referrer" content="never"> <meta name="referrer" content="never">
</head> </head>
<body> <body>
@ -17,7 +18,7 @@
<div class="styled"></div> <div class="styled"></div>
<script> <script>
async_test(function(css_test) { promise_test(function(css_test) {
var id = token(); var id = token();
var css_url = location.protocol + "//www1." + location.hostname + ":" + location.port + var css_url = location.protocol + "//www1." + location.hostname + ":" + location.port +
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
@ -29,20 +30,20 @@
var img_url = url_prefix + "/referrer-policy/generic/subresource/image.py" + var img_url = url_prefix + "/referrer-policy/generic/subresource/image.py" +
"?id=" + id + "&report-headers"; "?id=" + id + "&report-headers";
var link = document.createElement("link"); return new Promise(resolve => {
link.href = css_url; var link = document.createElement("link");
link.rel = "stylesheet"; link.href = css_url;
link.onload = function() { link.rel = "stylesheet";
css_test.step_timeout(function() { link.onload = resolve;
queryXhr(img_url, function(message) { document.head.appendChild(link);
assert_own_property(message, "headers"); })
assert_own_property(message, "referrer"); .then(() => timeoutPromise(css_test, 1000))
assert_equals(message.referrer, css_referrer); .then(() => requestViaXhr(img_url))
css_test.done(); .then(function(message) {
}, null, null, css_test); assert_own_property(message, "headers");
}, 1000); assert_own_property(message, "referrer");
}; assert_equals(message.referrer, css_referrer);
document.head.appendChild(link); });
}, "Image from imported stylesheet (external)."); }, "Image from imported stylesheet (external).");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<meta name="referrer" content="never"> <meta name="referrer" content="never">
</head> </head>
<body> <body>
@ -16,27 +17,27 @@
<div class="styled"></div> <div class="styled"></div>
<script> <script>
async_test(function(css_test) { promise_test(function(css_test) {
var id = token(); var id = token();
var url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port; var url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
var css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id; var css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id;
var img_url = url_prefix + "/referrer-policy/generic/subresource/image.py" + var img_url = url_prefix + "/referrer-policy/generic/subresource/image.py" +
"?id=" + id + "&report-headers"; "?id=" + id + "&report-headers";
var link = document.createElement("link"); return new Promise(resolve => {
link.href = css_url; var link = document.createElement("link");
link.rel = "stylesheet"; link.href = css_url;
link.onload = css_test.step_func(function() { link.rel = "stylesheet";
css_test.step_timeout(function() { link.onload = resolve;
queryXhr(img_url, function(message) { document.head.appendChild(link);
assert_own_property(message, "headers"); })
assert_own_property(message, "referrer"); .then(() => timeoutPromise(css_test, 1000))
assert_equals(message.referrer, css_url); .then(() => requestViaXhr(img_url))
css_test.done(); .then(function(message) {
}, null, null, css_test); assert_own_property(message, "headers");
}, 1000); assert_own_property(message, "referrer");
}); assert_equals(message.referrer, css_url);
document.head.appendChild(link); });
}, "Image from external stylesheet."); }, "Image from external stylesheet.");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<meta name="referrer" content="origin"> <meta name="referrer" content="origin">
</head> </head>
<body> <body>
@ -16,21 +17,20 @@
<div class="styled"></div> <div class="styled"></div>
<script> <script>
async_test(function(css_test) { promise_test(function(css_test) {
var id = token(); var id = token();
var css_url = location.protocol + "//www1." + location.hostname + ":" + location.port + "/referrer-policy/generic/subresource/image.py" + "?id=" + id; var css_url = location.protocol + "//www1." + location.hostname + ":" + location.port + "/referrer-policy/generic/subresource/image.py" + "?id=" + id;
var img_url = css_url + "&report-headers"; var img_url = css_url + "&report-headers";
var div = document.querySelector("div.styled"); var div = document.querySelector("div.styled");
div.style = "content:url(" + css_url + ")"; div.style = "content:url(" + css_url + ")";
css_test.step_timeout(function() { return timeoutPromise(css_test, 1000)
queryXhr(img_url, function(message) { .then(() => requestViaXhr(img_url))
assert_own_property(message, "headers"); .then(function(message) {
assert_own_property(message, "referrer"); assert_own_property(message, "headers");
assert_equals(message.referrer, location.origin + "/"); assert_own_property(message, "referrer");
css_test.done(); assert_equals(message.referrer, location.origin + "/");
}, null, null, css_test); });
}, 1000);
}, "Image from inline styles."); }, "Image from inline styles.");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<meta name="referrer" content="origin"> <meta name="referrer" content="origin">
</head> </head>
<body> <body>
@ -17,7 +18,7 @@
<div class="styled"></div> <div class="styled"></div>
<script> <script>
async_test(function(css_test) { promise_test(function(css_test) {
var id = token(); var id = token();
var url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port + "/referrer-policy/generic/subresource/"; var url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port + "/referrer-policy/generic/subresource/";
var css_url = url_prefix + "stylesheet.py?id=" + id; var css_url = url_prefix + "stylesheet.py?id=" + id;
@ -27,14 +28,13 @@
style.type = 'text/css'; style.type = 'text/css';
style.appendChild(document.createTextNode("@import url('" + css_url + "');")); style.appendChild(document.createTextNode("@import url('" + css_url + "');"));
document.head.appendChild(style); document.head.appendChild(style);
css_test.step_timeout(function() { return timeoutPromise(css_test, 1000)
queryXhr(img_url, function(message) { .then(() => requestViaXhr(img_url))
assert_own_property(message, "headers"); .then(function(message) {
assert_own_property(message, "referrer"); assert_own_property(message, "headers");
assert_equals(message.referrer, css_url); assert_own_property(message, "referrer");
css_test.done(); assert_equals(message.referrer, css_url);
}, null, null, css_test); });
}, 1000);
}, "Image from imported stylesheet (internal)."); }, "Image from imported stylesheet (internal).");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<meta name="referrer" content="origin"> <meta name="referrer" content="origin">
</head> </head>
<body> <body>
@ -16,7 +17,7 @@
<div class="styled"></div> <div class="styled"></div>
<script> <script>
async_test(function(css_test) { promise_test(function(css_test) {
var id = token(); var id = token();
var css_url = location.protocol + "//www1." + location.hostname + ":" + location.port + "/referrer-policy/generic/subresource/image.py" + "?id=" + id; var css_url = location.protocol + "//www1." + location.hostname + ":" + location.port + "/referrer-policy/generic/subresource/image.py" + "?id=" + id;
var img_url = css_url + "&report-headers"; var img_url = css_url + "&report-headers";
@ -25,14 +26,13 @@
style.type = 'text/css'; style.type = 'text/css';
style.appendChild(document.createTextNode("div.styled::before { content:url(" + css_url + ")}")); style.appendChild(document.createTextNode("div.styled::before { content:url(" + css_url + ")}"));
document.head.appendChild(style); document.head.appendChild(style);
css_test.step_timeout(function() { return timeoutPromise(css_test, 1000)
queryXhr(img_url, function(message) { .then(() => requestViaXhr(img_url))
assert_own_property(message, "headers"); .then(function(message) {
assert_own_property(message, "referrer"); assert_own_property(message, "headers");
assert_equals(message.referrer, location.origin + "/"); assert_own_property(message, "referrer");
css_test.done(); assert_equals(message.referrer, location.origin + "/");
}, null, null, css_test); });
}, 1000);
}, "Image from internal stylesheet."); }, "Image from internal stylesheet.");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<meta name="referrer" content="origin"> <meta name="referrer" content="origin">
</head> </head>
<body> <body>
@ -14,20 +15,19 @@
the referrer and referrer policy from the document.</p> the referrer and referrer policy from the document.</p>
<script> <script>
async_test(function(css_test) { promise_test(function(css_test) {
var id = token(); var id = token();
var css_url = location.protocol + "//www1." + location.hostname + ":" + location.port + "/referrer-policy/generic/subresource/image.py" + "?id=" + id; var css_url = location.protocol + "//www1." + location.hostname + ":" + location.port + "/referrer-policy/generic/subresource/image.py" + "?id=" + id;
var img_url = css_url + "&report-headers"; var img_url = css_url + "&report-headers";
document.body.background = css_url; document.body.background = css_url;
css_test.step_timeout(function() { return timeoutPromise(css_test, 1000)
queryXhr(img_url, function(message) { .then(() => requestViaXhr(img_url))
assert_own_property(message, "headers"); .then(function(message) {
assert_own_property(message, "referrer"); assert_own_property(message, "headers");
assert_equals(message.referrer, location.origin + "/"); assert_own_property(message, "referrer");
css_test.done(); assert_equals(message.referrer, location.origin + "/");
}, null, null, css_test); });
}, 1000);
}, "Image from presentation attributes."); }, "Image from presentation attributes.");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<meta name="referrer" content="never"> <meta name="referrer" content="never">
</head> </head>
<body> <body>
@ -17,7 +18,7 @@
<div class="styled"></div> <div class="styled"></div>
<script> <script>
async_test(function(css_test) { promise_test(function(css_test) {
var id = token(); var id = token();
var url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port; var url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
var css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id; var css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id;
@ -25,15 +26,14 @@
"?id=" + id + "&report-headers"; "?id=" + id + "&report-headers";
var processingInstruction = document.createProcessingInstruction("xml-stylesheet", "href=\"" + css_url + "\" type=\"text/css\""); var processingInstruction = document.createProcessingInstruction("xml-stylesheet", "href=\"" + css_url + "\" type=\"text/css\"");
css_test.step_timeout(function() {
queryXhr(img_url, function(message) {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, css_url);
css_test.done();
}, null, null, css_test);
}, 1000);
document.insertBefore(processingInstruction, document.firstChild); document.insertBefore(processingInstruction, document.firstChild);
return timeoutPromise(css_test, 1000)
.then(() => requestViaXhr(img_url))
.then(function(message) {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, css_url);
});
}, "Image from external stylesheet (from ProcessingInstruction)."); }, "Image from external stylesheet (from ProcessingInstruction).");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<!-- Helper functions for referrer-policy css tests. --> <!-- Helper functions for referrer-policy css tests. -->
<script src="/referrer-policy/css-integration/css-test-helper.js"></script> <script src="/referrer-policy/css-integration/css-test-helper.js"></script>
<meta name="referrer" content="never"> <meta name="referrer" content="never">

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<!-- Helper functions for referrer-policy css tests. --> <!-- Helper functions for referrer-policy css tests. -->
<script src="/referrer-policy/css-integration/css-test-helper.js"></script> <script src="/referrer-policy/css-integration/css-test-helper.js"></script>
<meta name="referrer" content="origin"> <meta name="referrer" content="origin">

View file

@ -7,6 +7,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<!-- Helper functions for referrer-policy css tests. --> <!-- Helper functions for referrer-policy css tests. -->
<script src="/referrer-policy/css-integration/css-test-helper.js"></script> <script src="/referrer-policy/css-integration/css-test-helper.js"></script>
<meta name="referrer" content="origin"> <meta name="referrer" content="origin">

View file

@ -8,6 +8,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<!-- Helper functions for referrer-policy css tests. --> <!-- Helper functions for referrer-policy css tests. -->
<script src="/referrer-policy/css-integration/css-test-helper.js"></script> <script src="/referrer-policy/css-integration/css-test-helper.js"></script>
<meta name="referrer" content="origin"> <meta name="referrer" content="origin">

View file

@ -8,6 +8,7 @@
<script src="/common/utils.js"></script> <script src="/common/utils.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<!-- Helper functions for referrer-policy css tests. --> <!-- Helper functions for referrer-policy css tests. -->
<script src="/referrer-policy/css-integration/css-test-helper.js"></script> <script src="/referrer-policy/css-integration/css-test-helper.js"></script>
<meta name="referrer" content="origin"> <meta name="referrer" content="origin">

View file

@ -1,54 +1,267 @@
// NOTE: This method only strips the fragment and is not in accordance to the /**
// recommended draft specification: * @fileoverview Utilities for mixed-content in Web Platform Tests.
// https://w3c.github.io/webappsec/specs/referrer-policy/#null * @author burnik@google.com (Kristijan Burnik)
// TODO(kristijanburnik): Implement this helper as defined by spec once added * Disclaimer: Some methods of other authors are annotated in the corresponding
// scenarios for URLs containing username/password/etc. * method's JSDoc.
function stripUrlForUseAsReferrer(url) { */
return url.replace(/#.*$/, "");
// The same content is placed as
// - wpt/referrer-policy/generic/common.js and
// - wpt/mixed-content/generic/common.js.
// If you modify either one, please also update the other one.
//
// TODO(https://crbug.com/906850): These two files are going to be merged.
// Currently they are duplicated only to avoid frequent mass modification
// for each step of refactoring, as these file names are hard-coded in
// a large number of generated test files.
function timeoutPromise(t, ms) {
return new Promise(resolve => { t.step_timeout(resolve, ms); });
} }
function parseUrlQueryString(queryString) { /**
var queries = queryString.replace(/^\?/, "").split("&"); * Normalizes the target port for use in a URL. For default ports, this is the
var params = {}; * empty string (omitted port), otherwise it's a colon followed by the port
* number. Ports 80, 443 and an empty string are regarded as default ports.
for (var i in queries) { * @param {number} targetPort The port to use
var kvp = queries[i].split("="); * @return {string} The port portion for using as part of a URL.
params[kvp[0]] = kvp[1]; */
} function getNormalizedPort(targetPort) {
return ([80, 443, ""].indexOf(targetPort) >= 0) ? "" : ":" + targetPort;
return params;
};
function appendIframeToBody(url, attributes) {
var iframe = document.createElement("iframe");
iframe.src = url;
// Extend element with attributes. (E.g. "referrerPolicy" or "rel")
if (attributes) {
for (var attr in attributes) {
iframe[attr] = attributes[attr];
}
}
document.body.appendChild(iframe);
return iframe;
} }
function loadImageInWindow(src, callback, attributes, w) { /**
var image = new w.Image(); * Creates a GUID.
image.crossOrigin = "Anonymous"; * See: https://en.wikipedia.org/wiki/Globally_unique_identifier
image.onload = function() { * Original author: broofa (http://www.broofa.com/)
callback(image); * Sourced from: http://stackoverflow.com/a/2117523/4949715
} * @return {string} A pseudo-random GUID.
*/
function guid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
// Extend element with attributes. (E.g. "referrerPolicy" or "rel") /**
if (attributes) { * Initiates a new XHR via GET.
for (var attr in attributes) { * @param {string} url The endpoint URL for the XHR.
image[attr] = attributes[attr]; * @param {string} responseType Optional - how should the response be parsed.
* Default is "json".
* See: https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsetype
* @return {Promise} A promise wrapping the success and error events.
*/
function xhrRequest(url, responseType) {
return new Promise(function(resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = responseType || "json";
xhr.addEventListener("error", function() {
reject(Error("Network Error"));
});
xhr.addEventListener("load", function() {
if (xhr.status != 200)
reject(Error(xhr.statusText));
else
resolve(xhr.response);
});
xhr.send();
});
}
/**
* Sets attributes on a given DOM element.
* @param {DOMElement} element The element on which to set the attributes.
* @param {object} An object with keys (serving as attribute names) and values.
*/
function setAttributes(el, attrs) {
attrs = attrs || {}
for (var attr in attrs)
el.setAttribute(attr, attrs[attr]);
}
/**
* Binds to success and error events of an object wrapping them into a promise
* available through {@code element.eventPromise}. The success event
* resolves and error event rejects.
* This method adds event listeners, and then removes all the added listeners
* when one of listened event is fired.
* @param {object} element An object supporting events on which to bind the
* promise.
* @param {string} resolveEventName [="load"] The event name to bind resolve to.
* @param {string} rejectEventName [="error"] The event name to bind reject to.
*/
function bindEvents(element, resolveEventName, rejectEventName) {
element.eventPromise =
bindEvents2(element, resolveEventName, element, rejectEventName);
}
// Returns a promise wrapping success and error events of objects.
// This is a variant of bindEvents that can accept separate objects for each
// events and two events to reject, and doesn't set `eventPromise`.
//
// When `resolveObject`'s `resolveEventName` event (default: "load") is
// fired, the promise is resolved with the event.
//
// When `rejectObject`'s `rejectEventName` event (default: "error") or
// `rejectObject2`'s `rejectEventName2` event (default: "error") is
// fired, the promise is rejected.
//
// `rejectObject2` is optional.
function bindEvents2(resolveObject, resolveEventName, rejectObject, rejectEventName, rejectObject2, rejectEventName2) {
return new Promise(function(resolve, reject) {
const actualResolveEventName = resolveEventName || "load";
const actualRejectEventName = rejectEventName || "error";
const actualRejectEventName2 = rejectEventName2 || "error";
const resolveHandler = function(event) {
cleanup();
resolve(event);
};
const rejectHandler = function(event) {
// Chromium starts propagating errors from worker.onerror to
// window.onerror. This handles the uncaught exceptions in tests.
event.preventDefault();
cleanup();
reject(event);
};
const cleanup = function() {
resolveObject.removeEventListener(actualResolveEventName, resolveHandler);
rejectObject.removeEventListener(actualRejectEventName, rejectHandler);
if (rejectObject2) {
rejectObject2.removeEventListener(actualRejectEventName2, rejectHandler);
}
};
resolveObject.addEventListener(actualResolveEventName, resolveHandler);
rejectObject.addEventListener(actualRejectEventName, rejectHandler);
if (rejectObject2) {
rejectObject2.addEventListener(actualRejectEventName2, rejectHandler);
} }
} });
}
image.src = src; /**
w.document.body.appendChild(image) * Creates a new DOM element.
* @param {string} tagName The type of the DOM element.
* @param {object} attrs A JSON with attributes to apply to the element.
* @param {DOMElement} parent Optional - an existing DOM element to append to
* If not provided, the returned element will remain orphaned.
* @param {boolean} doBindEvents Optional - Whether to bind to load and error
* events and provide the promise wrapping the events via the element's
* {@code eventPromise} property. Default value evaluates to false.
* @return {DOMElement} The newly created DOM element.
*/
function createElement(tagName, attrs, parentNode, doBindEvents) {
var element = document.createElement(tagName);
if (doBindEvents)
bindEvents(element);
// We set the attributes after binding to events to catch any
// event-triggering attribute changes. E.g. form submission.
//
// But be careful with images: unlike other elements they will start the load
// as soon as the attr is set, even if not in the document yet, and sometimes
// complete it synchronously, so the append doesn't have the effect we want.
// So for images, we want to set the attrs after appending, whereas for other
// elements we want to do it before appending.
var isImg = (tagName == "img");
if (!isImg)
setAttributes(element, attrs);
if (parentNode)
parentNode.appendChild(element);
if (isImg)
setAttributes(element, attrs);
return element;
}
function createRequestViaElement(tagName, attrs, parentNode) {
return createElement(tagName, attrs, parentNode, true).eventPromise;
}
/**
* Creates a new empty iframe and appends it to {@code document.body} .
* @param {string} name The name and ID of the new iframe.
* @param {boolean} doBindEvents Whether to bind load and error events.
* @return {DOMElement} The newly created iframe.
*/
function createHelperIframe(name, doBindEvents) {
return createElement("iframe",
{"name": name, "id": name},
document.body,
doBindEvents);
}
/**
* requestVia*() functions return promises that are resolved on successful
* requests with objects of the same "type", i.e. objects that contains
* the same sets of keys that are fixed within one category of tests (e.g.
* within wpt/referrer-policy tests).
* wrapResult() (that should be defined outside this file) is used to convert
* the response bodies of subresources into the expected result objects in some
* cases, and in other cases the result objects are constructed more directly.
* TODO(https://crbug.com/906850): Clean up the semantics around this, e.g.
* use (or not use) wrapResult() consistently, unify the arguments, etc.
*/
/**
* Creates a new iframe, binds load and error events, sets the src attribute and
* appends it to {@code document.body} .
* @param {string} url The src for the iframe.
* @return {Promise} The promise for success/error events.
*/
function requestViaIframe(url, additionalAttributes) {
const iframe = createElement(
"iframe",
Object.assign({"src": url}, additionalAttributes),
document.body,
false);
return bindEvents2(window, "message", iframe, "error", window, "error")
.then(event => {
assert_equals(event.source, iframe.contentWindow);
return event.data;
});
}
/**
* Creates a new image, binds load and error events, sets the src attribute and
* appends it to {@code document.body} .
* @param {string} url The src for the image.
* @return {Promise} The promise for success/error events.
*/
function requestViaImage(url) {
return createRequestViaElement("img", {"src": url}, document.body);
}
// Helpers for requestViaImageForReferrerPolicy().
function loadImageInWindow(src, attributes, w) {
return new Promise((resolve, reject) => {
var image = new w.Image();
image.crossOrigin = "Anonymous";
image.onload = function() {
resolve(image);
};
// Extend element with attributes. (E.g. "referrerPolicy" or "rel")
if (attributes) {
for (var attr in attributes) {
image[attr] = attributes[attr];
}
}
image.src = src;
w.document.body.appendChild(image)
});
} }
function extractImageData(img) { function extractImageData(img) {
@ -83,35 +296,11 @@ function decodeImageData(rgba) {
return JSON.parse(string_data); return JSON.parse(string_data);
} }
function normalizePort(targetPort) { // A variant of requestViaImage for referrer policy tests.
var defaultPorts = [80, 443]; // This tests many patterns of <iframe>s to test referrer policy inheritance.
var isDefaultPortForProtocol = (defaultPorts.indexOf(targetPort) >= 0); // TODO(https://crbug.com/906850): Merge this into requestViaImage().
// <iframe>-related code should be moved outside requestViaImage*().
return (targetPort == "" || isDefaultPortForProtocol) ? function requestViaImageForReferrerPolicy(url, attributes, referrerPolicy) {
"" : ":" + targetPort;
}
function wrapResult(url, server_data) {
return {
location: url,
referrer: server_data.headers.referer,
headers: server_data.headers
}
}
function queryIframe(url, callback, attributes, referrer_policy, test) {
var iframe = appendIframeToBody(url, attributes);
var listener = test.step_func(function(event) {
if (event.source != iframe.contentWindow)
return;
callback(event.data, url);
window.removeEventListener("message", listener);
});
window.addEventListener("message", listener);
}
function queryImage(url, callback, attributes, referrerPolicy, test) {
// For images, we'll test: // For images, we'll test:
// - images in a `srcdoc` frame to ensure that it uses the referrer // - images in a `srcdoc` frame to ensure that it uses the referrer
// policy of its parent, // policy of its parent,
@ -119,148 +308,392 @@ function queryImage(url, callback, attributes, referrerPolicy, test) {
// - and images in a `srcdoc` frame with its own referrer policy to // - and images in a `srcdoc` frame with its own referrer policy to
// override its parent. // override its parent.
var iframeWithoutOwnPolicy = document.createElement('iframe');
var noSrcDocPolicy = new Promise((resolve, reject) => { var noSrcDocPolicy = new Promise((resolve, reject) => {
var iframeWithoutOwnPolicy = document.createElement('iframe'); iframeWithoutOwnPolicy.srcdoc = "Hello, world.";
iframeWithoutOwnPolicy.srcdoc = "Hello, world."; iframeWithoutOwnPolicy.onload = resolve;
iframeWithoutOwnPolicy.onload = test.step_func(function () { document.body.appendChild(iframeWithoutOwnPolicy);
var nextUrl = url + "&cache_destroyer2=" + (new Date()).getTime(); })
loadImageInWindow(nextUrl, test.step_func(function (img) { .then(() => {
resolve(decodeImageData(extractImageData(img))); var nextUrl = url + "&cache_destroyer2=" + (new Date()).getTime();
}), attributes, iframeWithoutOwnPolicy.contentWindow); return loadImageInWindow(nextUrl, attributes,
}); iframeWithoutOwnPolicy.contentWindow);
document.body.appendChild(iframeWithoutOwnPolicy); })
}); .then(function (img) {
return decodeImageData(extractImageData(img));
});
// Give a srcdoc iframe a referrer policy different from the top-level page's policy. // Give a srcdoc iframe a referrer policy different from the top-level page's policy.
var iframePolicy = (referrerPolicy === "no-referrer") ? "unsafe-url" : "no-referrer"; var iframePolicy = (referrerPolicy === "no-referrer") ? "unsafe-url" : "no-referrer";
var iframeWithOwnPolicy = document.createElement('iframe');
var srcDocPolicy = new Promise((resolve, reject) => { var srcDocPolicy = new Promise((resolve, reject) => {
var iframeWithOwnPolicy = document.createElement('iframe'); iframeWithOwnPolicy.srcdoc = "<meta name='referrer' content='" + iframePolicy + "'>Hello world.";
iframeWithOwnPolicy.srcdoc = "<meta name='referrer' content='" + iframePolicy + "'>Hello world."; iframeWithOwnPolicy.onload = resolve;
document.body.appendChild(iframeWithOwnPolicy);
})
.then(() => {
var nextUrl = url + "&cache_destroyer3=" + (new Date()).getTime();
return loadImageInWindow(nextUrl, null,
iframeWithOwnPolicy.contentWindow);
})
.then(function (img) {
return decodeImageData(extractImageData(img));
});
iframeWithOwnPolicy.onload = test.step_func(function () { var pagePolicy = loadImageInWindow(url, attributes, window)
var nextUrl = url + "&cache_destroyer3=" + (new Date()).getTime(); .then(function (img) {
loadImageInWindow(nextUrl, test.step_func(function (img) { return decodeImageData(extractImageData(img));
resolve(decodeImageData(extractImageData(img))); });
}), null, iframeWithOwnPolicy.contentWindow);
});
document.body.appendChild(iframeWithOwnPolicy);
});
var pagePolicy = new Promise((resolve, reject) => { return Promise.all([noSrcDocPolicy, srcDocPolicy, pagePolicy]).then(values => {
loadImageInWindow(url, test.step_func(function (img) {
resolve(decodeImageData(extractImageData(img)));
}), attributes, window);
});
Promise.all([noSrcDocPolicy, srcDocPolicy, pagePolicy]).then(test.step_func(values => {
assert_equals(values[0].headers.referer, values[2].headers.referer, "Referrer inside 'srcdoc' without its own policy should be the same as embedder's referrer."); assert_equals(values[0].headers.referer, values[2].headers.referer, "Referrer inside 'srcdoc' without its own policy should be the same as embedder's referrer.");
assert_equals((iframePolicy === "no-referrer" ? undefined : document.location.href), values[1].headers.referer, "Referrer inside 'srcdoc' should use the iframe's policy if it has one"); assert_equals((iframePolicy === "no-referrer" ? undefined : document.location.href), values[1].headers.referer, "Referrer inside 'srcdoc' should use the iframe's policy if it has one");
callback(wrapResult(url, values[2]), url); return wrapResult(values[2]);
}));
}
function queryXhr(url, callback, attributes, referrer_policy, test) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onreadystatechange = test.step_func(function(e) {
if (xhr.readyState == 4 && xhr.status == 200) {
var server_data = JSON.parse(xhr.responseText);
callback(wrapResult(url, server_data), url);
}
});
xhr.send();
}
function queryWorker(url, callback, attributes, referrer_policy, test) {
var worker = new Worker(url);
worker.onmessage = test.step_func(function(event) {
var server_data = event.data;
callback(wrapResult(url, server_data), url);
}); });
} }
function queryModuleWorkerTopLevel(url, callback, attributes, referrer_policy, test) { /**
var worker = new Worker(url, {type: "module"}); * Initiates a new XHR GET request to provided URL.
worker.onmessage = test.step_func(function(event) { * @param {string} url The endpoint URL for the XHR.
var server_data = event.data; * @return {Promise} The promise for success/error events.
callback(wrapResult(url, server_data), url); */
}); function requestViaXhr(url) {
return xhrRequest(url).then(result => wrapResult(result));
} }
function querySharedWorker(url, callback, attributes, referrer_policy, test) { /**
var worker = new SharedWorker(url); * Initiates a new GET request to provided URL via the Fetch API.
worker.port.onmessage = test.step_func(function(event) { * @param {string} url The endpoint URL for the Fetch.
var server_data = event.data; * @return {Promise} The promise for success/error events.
callback(wrapResult(url, server_data), url); */
}); function requestViaFetch(url) {
return fetch(url)
.then(res => res.json())
.then(j => wrapResult(j));
} }
function queryFetch(url, callback, attributes, referrer_policy, test) { function dedicatedWorkerUrlThatFetches(url) {
fetch(url).then(test.step_func(function(response) { return `data:text/javascript,
response.json().then(test.step_func(function(server_data) { fetch('${url}')
callback(wrapResult(url, server_data), url); .then(() => postMessage(''),
})); () => postMessage(''));`;
})
);
} }
function queryNavigable(element, url, callback, attributes, test) { function workerUrlThatImports(url) {
var navigable = element return `data:text/javascript,import '${url}';`;
navigable.href = url; }
navigable.target = "helper-iframe";
var helperIframe = document.createElement("iframe") /**
helperIframe.name = "helper-iframe" * Creates a new Worker, binds message and error events wrapping them into.
document.body.appendChild(helperIframe) * {@code worker.eventPromise} and posts an empty string message to start
* the worker.
// Extend element with attributes. (E.g. "referrer_policy" or "rel") * @param {string} url The endpoint URL for the worker script.
if (attributes) { * @param {object} options The options for Worker constructor.
for (var attr in attributes) { * @return {Promise} The promise for success/error events.
navigable[attr] = attributes[attr]; */
} function requestViaDedicatedWorker(url, options) {
var worker;
try {
worker = new Worker(url, options);
} catch (e) {
return Promise.reject(e);
} }
worker.postMessage('');
var listener = test.step_func(function(event) { return bindEvents2(worker, "message", worker, "error")
if (event.source != helperIframe.contentWindow) .then(event => wrapResult(event.data));
return;
callback(event.data, url);
window.removeEventListener("message", listener);
});
window.addEventListener("message", listener);
navigable.click();
} }
function queryLink(url, callback, attributes, referrer_policy, test) { function requestViaSharedWorker(url) {
var a = document.createElement("a"); var worker;
a.innerHTML = "Link to subresource"; try {
document.body.appendChild(a); worker = new SharedWorker(url);
queryNavigable(a, url, callback, attributes, test) } catch(e) {
return Promise.reject(e);
}
const promise = bindEvents2(worker.port, "message", worker, "error")
.then(event => wrapResult(event.data));
worker.port.start();
return promise;
} }
function queryAreaLink(url, callback, attributes, referrer_policy, test) { // Returns a reference to a worklet object corresponding to a given type.
var area = document.createElement("area"); function get_worklet(type) {
if (type == 'animation')
return CSS.animationWorklet;
if (type == 'layout')
return CSS.layoutWorklet;
if (type == 'paint')
return CSS.paintWorklet;
if (type == 'audio')
return new OfflineAudioContext(2,44100*40,44100).audioWorklet;
assert_unreached('unknown worklet type is passed.');
return undefined;
}
function requestViaWorklet(type, url) {
try {
return get_worklet(type).addModule(url);
} catch (e) {
return Promise.reject(e);
}
}
/**
* Sets the href attribute on a navigable DOM element and performs a navigation
* by clicking it. To avoid navigating away from the current execution
* context, a target attribute is set to point to a new helper iframe.
* @param {DOMElement} navigableElement The navigable DOMElement
* @param {string} url The href for the navigable element.
* @return {Promise} The promise for success/error events.
*/
function requestViaNavigable(navigableElement, url) {
var iframe = createHelperIframe(guid(), false);
setAttributes(navigableElement,
{"href": url,
"target": iframe.name});
const promise =
bindEvents2(window, "message", iframe, "error", window, "error")
.then(event => {
assert_equals(event.source, iframe.contentWindow, "event.source");
return event.data;
});
navigableElement.click();
return promise;
}
/**
* Creates a new anchor element, appends it to {@code document.body} and
* performs the navigation.
* @param {string} url The URL to navigate to.
* @return {Promise} The promise for success/error events.
*/
function requestViaAnchor(url, additionalAttributes) {
var a = createElement(
"a",
Object.assign({"innerHTML": "Link to resource"}, additionalAttributes),
document.body);
return requestViaNavigable(a, url);
}
/**
* Creates a new area element, appends it to {@code document.body} and performs
* the navigation.
* @param {string} url The URL to navigate to.
* @return {Promise} The promise for success/error events.
*/
function requestViaArea(url, additionalAttributes) {
var area = createElement(
"area",
Object.assign({}, additionalAttributes),
document.body);
// TODO(kristijanburnik): Append to map and add image. // TODO(kristijanburnik): Append to map and add image.
document.body.appendChild(area); return requestViaNavigable(area, url);
queryNavigable(area, url, callback, attributes, test)
} }
function queryScript(url, callback, attributes, referrer_policy, test) { /**
var script = document.createElement("script"); * Creates a new script element, sets the src to url, and appends it to
script.src = url; * {@code document.body}.
script.referrerPolicy = referrer_policy; * @param {string} url The src URL.
* @return {Promise} The promise for success/error events.
*/
function requestViaScript(url, additionalAttributes) {
const script = createElement(
"script",
Object.assign({"src": url}, additionalAttributes),
document.body,
false);
var listener = test.step_func(function(event) { return bindEvents2(window, "message", script, "error", window, "error")
var server_data = event.data; .then(event => wrapResult(event.data));
callback(wrapResult(url, server_data), url); }
window.removeEventListener("message", listener);
/**
* Creates a new form element, sets attributes, appends it to
* {@code document.body} and submits the form.
* @param {string} url The URL to submit to.
* @return {Promise} The promise for success/error events.
*/
function requestViaForm(url) {
var iframe = createHelperIframe(guid());
var form = createElement("form",
{"action": url,
"method": "POST",
"target": iframe.name},
document.body);
bindEvents(iframe);
form.submit();
return iframe.eventPromise;
}
/**
* Creates a new link element for a stylesheet, binds load and error events,
* sets the href to url and appends it to {@code document.head}.
* @param {string} url The URL for a stylesheet.
* @return {Promise} The promise for success/error events.
*/
function requestViaLinkStylesheet(url) {
return createRequestViaElement("link",
{"rel": "stylesheet", "href": url},
document.head);
}
/**
* Creates a new link element for a prefetch, binds load and error events, sets
* the href to url and appends it to {@code document.head}.
* @param {string} url The URL of a resource to prefetch.
* @return {Promise} The promise for success/error events.
*/
function requestViaLinkPrefetch(url) {
var link = document.createElement('link');
if (link.relList && link.relList.supports && link.relList.supports("prefetch")) {
return createRequestViaElement("link",
{"rel": "prefetch", "href": url},
document.head);
} else {
return Promise.reject("This browser does not support 'prefetch'.");
}
}
/**
* Initiates a new beacon request.
* @param {string} url The URL of a resource to prefetch.
* @return {Promise} The promise for success/error events.
*/
async function requestViaSendBeacon(url) {
function wait(ms) {
return new Promise(resolve => step_timeout(resolve, ms));
}
if (!navigator.sendBeacon(url)) {
// If mixed-content check fails, it should return false.
throw new Error('sendBeacon() fails.');
}
// We don't have a means to see the result of sendBeacon() request
// for sure. Let's wait for a while and let the generic test function
// ask the server for the result.
await wait(500);
return 'allowed';
}
/**
* Creates a new media element with a child source element, binds loadeddata and
* error events, sets attributes and appends to document.body.
* @param {string} type The type of the media element (audio/video/picture).
* @param {object} media_attrs The attributes for the media element.
* @param {object} source_attrs The attributes for the child source element.
* @return {DOMElement} The newly created media element.
*/
function createMediaElement(type, media_attrs, source_attrs) {
var mediaElement = createElement(type, {});
var sourceElement = createElement("source", {});
mediaElement.eventPromise = new Promise(function(resolve, reject) {
mediaElement.addEventListener("loadeddata", function (e) {
resolve(e);
});
// Safari doesn't fire an `error` event when blocking mixed content.
mediaElement.addEventListener("stalled", function(e) {
reject(e);
});
sourceElement.addEventListener("error", function(e) {
reject(e);
});
}); });
window.addEventListener("message", listener);
document.body.appendChild(script); setAttributes(mediaElement, media_attrs);
setAttributes(sourceElement, source_attrs);
mediaElement.appendChild(sourceElement);
document.body.appendChild(mediaElement);
return mediaElement;
} }
// SanityChecker does nothing in release mode. /**
* Creates a new video element, binds loadeddata and error events, sets
* attributes and source URL and appends to {@code document.body}.
* @param {string} url The URL of the video.
* @return {Promise} The promise for success/error events.
*/
function requestViaVideo(url) {
return createMediaElement("video",
{},
{"src": url}).eventPromise;
}
/**
* Creates a new audio element, binds loadeddata and error events, sets
* attributes and source URL and appends to {@code document.body}.
* @param {string} url The URL of the audio.
* @return {Promise} The promise for success/error events.
*/
function requestViaAudio(url) {
return createMediaElement("audio",
{},
{"type": "audio/wav", "src": url}).eventPromise;
}
/**
* Creates a new picture element, binds loadeddata and error events, sets
* attributes and source URL and appends to {@code document.body}. Also
* creates new image element appending it to the picture
* @param {string} url The URL of the image for the source and image elements.
* @return {Promise} The promise for success/error events.
*/
function requestViaPicture(url) {
var picture = createMediaElement("picture", {}, {"srcset": url,
"type": "image/png"});
return createRequestViaElement("img", {"src": url}, picture);
}
/**
* Creates a new object element, binds load and error events, sets the data to
* url, and appends it to {@code document.body}.
* @param {string} url The data URL.
* @return {Promise} The promise for success/error events.
*/
function requestViaObject(url) {
return createRequestViaElement("object", {"data": url, "type": "text/html"}, document.body);
}
/**
* Creates a new WebSocket pointing to {@code url} and sends a message string
* "echo". The {@code message} and {@code error} events are triggering the
* returned promise resolve/reject events.
* @param {string} url The URL for WebSocket to connect to.
* @return {Promise} The promise for success/error events.
*/
function requestViaWebSocket(url) {
return new Promise(function(resolve, reject) {
var websocket = new WebSocket(url);
websocket.addEventListener("message", function(e) {
resolve(e.data);
});
websocket.addEventListener("open", function(e) {
websocket.send("echo");
});
websocket.addEventListener("error", function(e) {
reject(e)
});
})
.then(data => {
return JSON.parse(data);
});
}
// SanityChecker does nothing in release mode. See sanity-checker.js for debug
// mode.
function SanityChecker() {} function SanityChecker() {}
SanityChecker.prototype.checkScenario = function() {}; SanityChecker.prototype.checkScenario = function() {};
SanityChecker.prototype.setFailTimeout = function(test, timeout) {};
SanityChecker.prototype.checkSubresourceResult = function() {}; SanityChecker.prototype.checkSubresourceResult = function() {};

View file

@ -8,6 +8,7 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
<meta name="referrer" content="origin"> <meta name="referrer" content="origin">
</head> </head>
<body onload="runTest()"> <body onload="runTest()">
@ -25,11 +26,15 @@
document.body.appendChild(iframe); document.body.appendChild(iframe);
iframe.contentDocument.write(` iframe.contentDocument.write(`
<script src = "/referrer-policy/generic/common.js"></` + `script> <script src = "/referrer-policy/generic/common.js"></` + `script>
<script src = "/referrer-policy/generic/referrer-policy-test-case.js"></` + `script>
<script> <script>
var urlPath = "/referrer-policy/generic/subresource/xhr.py"; var urlPath = "/referrer-policy/generic/subresource/xhr.py";
var url = "${location.protocol}//www1.${location.hostname}:${location.port}" + urlPath; var url = "${location.protocol}//www1.${location.hostname}:${location.port}" + urlPath;
queryXhr(url, (msg) => { requestViaXhr(url).then((msg) => {
parent.postMessage({referrer: msg.referrer}, "*")}); parent.postMessage({referrer: msg.referrer}, "*")})
.catch((e) => {
parent.postMessage({referrer: "FAILURE"}, "*");
});
</` + "script>"); </` + "script>");
} }
</script> </script>

View file

@ -14,18 +14,14 @@
and referrer policy from the document.</p> and referrer policy from the document.</p>
<script> <script>
var prefetch_test = async_test("Prefetched image.");
var img_url = "/referrer-policy/generic/subresource/image.py"; var img_url = "/referrer-policy/generic/subresource/image.py";
prefetch_test.step_timeout( promise_test((t) => timeoutPromise(t, 1000)
function() { .then(() => loadImageInWindow(img_url, null, window))
loadImageInWindow(img_url, function (img) { .then(function (img) {
var message = decodeImageData(extractImageData(img)); var message = decodeImageData(extractImageData(img));
prefetch_test.step(function() { assert_equals(message.headers.referer, document.location.origin + "/")}); assert_equals(message.headers.referer, document.location.origin + "/");
prefetch_test.done(); }),
}, null, window); "Prefetched image.");
},
1000);
</script> </script>
<div id="log"></div> <div id="log"></div>

View file

@ -6,6 +6,7 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
</head> </head>
<body> <body>
<h1>Referrer Policy: multiple Referrer-Policy header and header values are allowed</h1> <h1>Referrer Policy: multiple Referrer-Policy header and header values are allowed</h1>
@ -14,14 +15,15 @@
<pre id="received_message">Running...</pre> <pre id="received_message">Running...</pre>
<script> <script>
var test = async_test("Image uses the last recognized Referrer-Policy header value"); promise_test(() => {
var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime(); var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime();
var url = location.protocol + "//www1." + location.hostname + ":" + location.port + var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
urlPath; urlPath;
queryImage(url, test.step_func(function(message) { return requestViaImageForReferrerPolicy(url, null, 'no-referrer')
assert_equals(message.referrer, document.location.origin + "/"); .then(function(message) {
test.done(); assert_equals(message.referrer, document.location.origin + "/");
}), null, 'no-referrer', test); });
}, "Image uses the last recognized Referrer-Policy header value");
</script> </script>
<div id="log"></div> <div id="log"></div>

View file

@ -6,6 +6,7 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
</head> </head>
<body> <body>
<h1>Referrer Policy: multiple Referrer-Policy header values are allowed</h1> <h1>Referrer Policy: multiple Referrer-Policy header values are allowed</h1>
@ -14,14 +15,15 @@
<pre id="received_message">Running...</pre> <pre id="received_message">Running...</pre>
<script> <script>
var test = async_test("Image uses the last recognized Referrer-Policy header value"); promise_test(() => {
var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime(); var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime();
var url = location.protocol + "//www1." + location.hostname + ":" + location.port + var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
urlPath; urlPath;
queryImage(url, test.step_func(function(message) { return requestViaImageForReferrerPolicy(url, null, 'no-referrer')
assert_equals(message.referrer, document.location.origin + "/"); .then(function(message) {
test.done(); assert_equals(message.referrer, document.location.origin + "/");
}), null, 'no-referrer', test); });
}, "Image uses the last recognized Referrer-Policy header value");
</script> </script>
<div id="log"></div> <div id="log"></div>

View file

@ -6,6 +6,7 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
</head> </head>
<body> <body>
<h1>Referrer Policy: multiple Referrer-Policy headers with one invalid</h1> <h1>Referrer Policy: multiple Referrer-Policy headers with one invalid</h1>
@ -14,14 +15,15 @@
<pre id="received_message">Running...</pre> <pre id="received_message">Running...</pre>
<script> <script>
var test = async_test("Referrer policy header parsing fails if one header is invalid"); promise_test(() => {
var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime(); var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime();
var url = location.protocol + "//www1." + location.hostname + ":" + location.port + var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
urlPath; urlPath;
queryImage(url, test.step_func(function(message) { return requestViaImageForReferrerPolicy(url, null, 'no-referrer')
assert_equals(message.referrer, document.location.href); .then(function(message) {
test.done(); assert_equals(message.referrer, document.location.href);
}), null, 'no-referrer', test); });
}, "Referrer policy header parsing fails if one header is invalid");
</script> </script>
<div id="log"></div> <div id="log"></div>

View file

@ -6,6 +6,7 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
</head> </head>
<body> <body>
<h1>Referrer Policy: multiple Referrer-Policy headers with one invalid</h1> <h1>Referrer Policy: multiple Referrer-Policy headers with one invalid</h1>
@ -14,14 +15,15 @@
<pre id="received_message">Running...</pre> <pre id="received_message">Running...</pre>
<script> <script>
var test = async_test("Image uses last recognized referrer policy token from Referrer-Policy headers"); promise_test(() => {
var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime(); var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime();
var url = location.protocol + "//www1." + location.hostname + ":" + location.port + var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
urlPath; urlPath;
queryImage(url, test.step_func(function(message) { return requestViaImageForReferrerPolicy(url, null, 'no-referrer')
assert_equals(message.referrer, document.location.origin + "/"); .then(function(message) {
test.done(); assert_equals(message.referrer, document.location.origin + "/");
}), null, 'no-referrer', test); });
}, "Image uses last recognized referrer policy token from Referrer-Policy headers");
</script> </script>
<div id="log"></div> <div id="log"></div>

View file

@ -6,6 +6,7 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
</head> </head>
<body> <body>
<h1>Referrer Policy: multiple Referrer-Policy headers are allowed</h1> <h1>Referrer Policy: multiple Referrer-Policy headers are allowed</h1>
@ -14,14 +15,15 @@
<pre id="received_message">Running...</pre> <pre id="received_message">Running...</pre>
<script> <script>
var test = async_test("Image uses the last recognized Referrer-Policy header"); promise_test(() => {
var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime(); var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime();
var url = location.protocol + "//www1." + location.hostname + ":" + location.port + var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
urlPath; urlPath;
queryImage(url, test.step_func(function(message) { return requestViaImageForReferrerPolicy(url, null, 'no-referrer')
assert_equals(message.referrer, document.location.origin + "/"); .then(function(message) {
test.done(); assert_equals(message.referrer, document.location.origin + "/");
}), null, 'no-referrer', test); });
}, "Image uses the last recognized Referrer-Policy header");
</script> </script>
<div id="log"></div> <div id="log"></div>

View file

@ -1,3 +1,27 @@
function wrapResult(server_data) {
return {
referrer: server_data.headers.referer,
headers: server_data.headers
}
}
// NOTE: This method only strips the fragment and is not in accordance to the
// recommended draft specification:
// https://w3c.github.io/webappsec/specs/referrer-policy/#null
// TODO(kristijanburnik): Implement this helper as defined by spec once added
// scenarios for URLs containing username/password/etc.
function stripUrlForUseAsReferrer(url) {
return url.replace(/#.*$/, "");
}
function normalizePort(targetPort) {
var defaultPorts = [80, 443];
var isDefaultPortForProtocol = (defaultPorts.indexOf(targetPort) >= 0);
return (targetPort == "" || isDefaultPortForProtocol) ?
"" : ":" + targetPort;
}
function ReferrerPolicyTestCase(scenario, testDescription, sanityChecker) { function ReferrerPolicyTestCase(scenario, testDescription, sanityChecker) {
// Pass and skip rest of the test if browser does not support fetch. // Pass and skip rest of the test if browser does not support fetch.
if (scenario.subresource == "fetch-request" && !window.fetch) { if (scenario.subresource == "fetch-request" && !window.fetch) {
@ -14,16 +38,16 @@ function ReferrerPolicyTestCase(scenario, testDescription, sanityChecker) {
sanityChecker.checkScenario(scenario); sanityChecker.checkScenario(scenario);
var subresourceInvoker = { var subresourceInvoker = {
"a-tag": queryLink, "a-tag": requestViaAnchor,
"area-tag": queryAreaLink, "area-tag": requestViaArea,
"fetch-request": queryFetch, "fetch-request": requestViaFetch,
"iframe-tag": queryIframe, "iframe-tag": requestViaIframe,
"img-tag": queryImage, "img-tag": requestViaImageForReferrerPolicy,
"script-tag": queryScript, "script-tag": requestViaScript,
"worker-request": queryWorker, "worker-request": url => requestViaDedicatedWorker(url, {}),
"module-worker": queryModuleWorkerTopLevel, "module-worker": url => requestViaDedicatedWorker(url, {type: "module"}),
"shared-worker": querySharedWorker, "shared-worker": requestViaSharedWorker,
"xhr-request": queryXhr "xhr-request": requestViaXhr
}; };
var referrerUrlResolver = { var referrerUrlResolver = {
@ -41,8 +65,6 @@ function ReferrerPolicyTestCase(scenario, testDescription, sanityChecker) {
var t = { var t = {
_scenario: scenario, _scenario: scenario,
_testDescription: testDescription, _testDescription: testDescription,
_subresourceUrl: null,
_expectedReferrerUrl: null,
_constructSubresourceUrl: function() { _constructSubresourceUrl: function() {
// TODO(kristijanburnik): We should assert that these two domains are // TODO(kristijanburnik): We should assert that these two domains are
// different. E.g. If someone runs the tets over www, this would fail. // different. E.g. If someone runs the tets over www, this would fail.
@ -60,19 +82,20 @@ function ReferrerPolicyTestCase(scenario, testDescription, sanityChecker) {
var targetPort = portForProtocol[t._scenario.target_protocol]; var targetPort = portForProtocol[t._scenario.target_protocol];
t._subresourceUrl = t._scenario.target_protocol + "://" + return t._scenario.target_protocol + "://" +
domainForOrigin[t._scenario.origin] + domainForOrigin[t._scenario.origin] +
normalizePort(targetPort) + normalizePort(targetPort) +
t._scenario["subresource_path"] + t._scenario["subresource_path"] +
"?redirection=" + t._scenario["redirection"] + "?redirection=" + t._scenario["redirection"] +
"&cache_destroyer=" + (new Date()).getTime(); "&cache_destroyer=" + (new Date()).getTime();
}, },
_constructExpectedReferrerUrl: function() { _constructExpectedReferrerUrl: function() {
t._expectedReferrerUrl = referrerUrlResolver[t._scenario.referrer_url](); return referrerUrlResolver[t._scenario.referrer_url]();
}, },
_invokeSubresource: function(callback, test) { // Returns a promise.
_invokeSubresource: function(resourceRequestUrl) {
var invoker = subresourceInvoker[t._scenario.subresource]; var invoker = subresourceInvoker[t._scenario.subresource];
// Depending on the delivery method, extend the subresource element with // Depending on the delivery method, extend the subresource element with
// these attributes. // these attributes.
@ -84,43 +107,35 @@ function ReferrerPolicyTestCase(scenario, testDescription, sanityChecker) {
var delivery_method = t._scenario.delivery_method; var delivery_method = t._scenario.delivery_method;
if (delivery_method in elementAttributesForDeliveryMethod) { if (delivery_method in elementAttributesForDeliveryMethod) {
invoker(t._subresourceUrl, return invoker(resourceRequestUrl,
callback, elementAttributesForDeliveryMethod[delivery_method],
elementAttributesForDeliveryMethod[delivery_method], t._scenario.referrer_policy);
t._scenario.referrer_policy,
test);
} else { } else {
invoker(t._subresourceUrl, callback, null, t._scenario.referrer_policy, test); return invoker(resourceRequestUrl, {}, t._scenario.referrer_policy);
} }
}, },
start: function() { start: function() {
async_test(function(test) { promise_test(test => {
const resourceRequestUrl = t._constructSubresourceUrl();
const expectedReferrerUrl = t._constructExpectedReferrerUrl();
return t._invokeSubresource(resourceRequestUrl)
.then(result => {
// Check if the result is in valid format. NOOP in release.
sanityChecker.checkSubresourceResult(
test, t._scenario, resourceRequestUrl, result);
t._constructSubresourceUrl(); // Check the reported URL.
t._constructExpectedReferrerUrl(); assert_equals(result.referrer,
expectedReferrerUrl,
t._invokeSubresource(test.step_func(function(result) { "Reported Referrer URL is '" +
// Check if the result is in valid format. NOOP in release. t._scenario.referrer_url + "'.");
sanityChecker.checkSubresourceResult( assert_equals(result.headers.referer,
test, t._scenario, t._subresourceUrl, result); expectedReferrerUrl,
"Reported Referrer URL from HTTP header is '" +
// Check the reported URL. expectedReferrerUrl + "'");
test.step(function() { });
assert_equals(result.referrer, }, t._testDescription);
t._expectedReferrerUrl,
"Reported Referrer URL is '" +
t._scenario.referrer_url + "'.");
assert_equals(result.headers.referer,
t._expectedReferrerUrl,
"Reported Referrer URL from HTTP header is '" +
t._expectedReferrerUrl + "'");
}, "Reported Referrer URL is as expected: " + t._scenario.referrer_url);
test.done();
}), test);
}, t._testDescription);
} }
} }

View file

@ -8,6 +8,7 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
</head> </head>
<body> <body>
<h1>Referrer Policy: A document with an opaque origin doesn't send referrers</h1> <h1>Referrer Policy: A document with an opaque origin doesn't send referrers</h1>
@ -26,12 +27,16 @@
iframe.srcdoc = ` iframe.srcdoc = `
<meta name = "referrer" content = "always"> <meta name = "referrer" content = "always">
<script src = "/referrer-policy/generic/common.js"></` + `script> <script src = "/referrer-policy/generic/common.js"></` + `script>
<script src = "/referrer-policy/generic/referrer-policy-test-case.js"></` + `script>
<script> <script>
var urlPath = "/referrer-policy/generic/subresource/xhr.py"; var urlPath = "/referrer-policy/generic/subresource/xhr.py";
var url = "${location.protocol}//www1.${location.hostname}:${location.port}" + urlPath; var url = "${location.protocol}//www1.${location.hostname}:${location.port}" + urlPath;
queryXhr(url, (msg) => { requestViaXhr(url).then((msg) => {
parent.postMessage({referrer: msg.referrer, description: "${description}"}, "*") parent.postMessage({referrer: msg.referrer, description: "${description}"}, "*")
}, null, null, test); })
.catch((e) => {
parent.postMessage({referrer: "FAILURE", description: "${description}"}, "*")
});
</` + "script>"; </` + "script>";
document.body.appendChild(iframe); document.body.appendChild(iframe);
}, description); }, description);

View file

@ -7,6 +7,7 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
</head> </head>
<body> <body>
<h1>Area Link messaging - cross-origin Area Link navigation</h1> <h1>Area Link messaging - cross-origin Area Link navigation</h1>
@ -16,21 +17,22 @@
<pre id="received_message">Running...</pre> <pre id="received_message">Running...</pre>
<script> <script>
async_test(function(messaging_test) { promise_test(function() {
var urlPath = '/referrer-policy/generic/subresource/document.py'; var urlPath = '/referrer-policy/generic/subresource/document.py';
var url = location.protocol + "//www1." + location.hostname + ":" + location.port + var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
urlPath; urlPath;
queryAreaLink(url, function(message) { return requestViaArea(url)
var pre = document.getElementById('received_message') .then(function(message) {
var headers = message.headers; var pre = document.getElementById('received_message')
pre.innerHTML = ""; var headers = message.headers;
pre.innerHTML += url + ":\n\n"; pre.innerHTML = "";
pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n" pre.innerHTML += url + ":\n\n";
assert_own_property(headers, "host") pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
assert_own_property(headers, "connection") assert_own_property(headers, "host")
messaging_test.done(); assert_own_property(headers, "connection")
}, null, null, messaging_test); });
}, "Area is responding with HTTP headers"); },
"Area is responding with HTTP headers");
</script> </script>
<div id="log"></div> <div id="log"></div>

View file

@ -7,6 +7,7 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
</head> </head>
<body> <body>
<h1>Fetch messaging - same-origin Fetch request</h1> <h1>Fetch messaging - same-origin Fetch request</h1>
@ -20,26 +21,21 @@
assert_true(!!window.fetch, "Fetch is not supported by this browser."); assert_true(!!window.fetch, "Fetch is not supported by this browser.");
}, "Fetch is supported by the browser."); }, "Fetch is supported by the browser.");
(function() { promise_test(function() {
if (!window.fetch)
return;
async_test(function(fetch_test) {
var urlPath = '/referrer-policy/generic/subresource/xhr.py'; var urlPath = '/referrer-policy/generic/subresource/xhr.py';
var url = location.protocol + "//" + location.hostname + ":" + var url = location.protocol + "//" + location.hostname + ":" +
location.port + urlPath; location.port + urlPath;
queryFetch(url, function(message) { return requestViaFetch(url)
var pre = document.getElementById('received_message') .then(function(message) {
var headers = message.headers; var pre = document.getElementById('received_message')
pre.innerHTML = ""; var headers = message.headers;
pre.innerHTML += url + ":\n\n"; pre.innerHTML = "";
pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"; pre.innerHTML += url + ":\n\n";
assert_own_property(headers, "host") pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n";
assert_own_property(headers, "connection") assert_own_property(headers, "host")
fetch_test.done(); assert_own_property(headers, "connection")
}, null, null, fetch_test); });
}, "Fetch is responding with HTTP headers"); }, "Fetch is responding with HTTP headers");
})();
</script> </script>
<div id="log"></div> <div id="log"></div>

View file

@ -7,6 +7,7 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
</head> </head>
<body> <body>
<h1>Iframe messaging - cross-origin iframe request</h1> <h1>Iframe messaging - cross-origin iframe request</h1>
@ -16,20 +17,20 @@
<pre id="received_message">Running...</pre> <pre id="received_message">Running...</pre>
<script> <script>
async_test(function(messaging_test) { promise_test(function() {
var urlPath = '/referrer-policy/generic/subresource/document.py'; var urlPath = '/referrer-policy/generic/subresource/document.py';
var url = location.protocol + "//www1." + location.hostname + ":" + location.port + var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
urlPath; urlPath;
queryIframe(url, function(message) { return requestViaIframe(url)
var pre = document.getElementById('received_message') .then(function(message) {
var headers = message.headers; var pre = document.getElementById('received_message')
pre.innerHTML = ""; var headers = message.headers;
pre.innerHTML += url + ":\n\n"; pre.innerHTML = "";
pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n" pre.innerHTML += url + ":\n\n";
assert_own_property(headers, "host") pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
assert_own_property(headers, "connection") assert_own_property(headers, "host")
messaging_test.done(); assert_own_property(headers, "connection")
}, null, null, messaging_test); });
}, "Iframe is responding with HTTP headers"); }, "Iframe is responding with HTTP headers");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
</head> </head>
<body> <body>
<h1>Image decoding - cross-origin image request</h1> <h1>Image decoding - cross-origin image request</h1>
@ -16,20 +17,20 @@
<pre id="received_message">Running...</pre> <pre id="received_message">Running...</pre>
<script> <script>
async_test(function(messaging_test) { promise_test(function() {
var urlPath = '/referrer-policy/generic/subresource/image.py'; var urlPath = '/referrer-policy/generic/subresource/image.py';
var url = location.protocol + "//www1." + location.hostname + ":" + location.port + var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
urlPath + "?cache_destroyer=" + (new Date()).getTime(); urlPath + "?cache_destroyer=" + (new Date()).getTime();
queryImage(url, function(message) { return requestViaImageForReferrerPolicy(url, undefined, "always")
var pre = document.getElementById('received_message') .then(function(message) {
var headers = message.headers; var pre = document.getElementById('received_message')
pre.innerHTML = ""; var headers = message.headers;
pre.innerHTML += url + ":\n\n"; pre.innerHTML = "";
pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n" pre.innerHTML += url + ":\n\n";
assert_own_property(headers, "host") pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
assert_own_property(headers, "connection") assert_own_property(headers, "host")
messaging_test.done(); assert_own_property(headers, "connection")
}, null, "always", messaging_test); });
}, "Image is encoding headers as JSON."); }, "Image is encoding headers as JSON.");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
</head> </head>
<body> <body>
<h1>Link messaging - cross-origin Link navigation</h1> <h1>Link messaging - cross-origin Link navigation</h1>
@ -16,20 +17,20 @@
<pre id="received_message">Running...</pre> <pre id="received_message">Running...</pre>
<script> <script>
async_test(function(messaging_test) { promise_test(function() {
var urlPath = '/referrer-policy/generic/subresource/document.py'; var urlPath = '/referrer-policy/generic/subresource/document.py';
var url = location.protocol + "//www1." + location.hostname + ":" + location.port + var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
urlPath; urlPath;
queryLink(url, function(message) { return requestViaAnchor(url)
var pre = document.getElementById('received_message') .then(function(message) {
var headers = message.headers; var pre = document.getElementById('received_message')
pre.innerHTML = ""; var headers = message.headers;
pre.innerHTML += url + ":\n\n"; pre.innerHTML = "";
pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n" pre.innerHTML += url + ":\n\n";
assert_own_property(headers, "host") pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
assert_own_property(headers, "connection") assert_own_property(headers, "host")
messaging_test.done(); assert_own_property(headers, "connection")
}, null, null, messaging_test); });
}, "Link is responding with HTTP headers"); }, "Link is responding with HTTP headers");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
</head> </head>
<body> <body>
<h1>Script messaging - cross-origin Script request</h1> <h1>Script messaging - cross-origin Script request</h1>
@ -16,20 +17,20 @@
<pre id="received_message">Running...</pre> <pre id="received_message">Running...</pre>
<script> <script>
async_test(function(messaging_test) { promise_test(function() {
var urlPath = '/referrer-policy/generic/subresource/script.py'; var urlPath = '/referrer-policy/generic/subresource/script.py';
var url = location.protocol + "//www1." + location.hostname + ":" + location.port + var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
urlPath; urlPath;
queryScript(url, function(message) { return requestViaScript(url)
var pre = document.getElementById('received_message') .then(function(message) {
var headers = message.headers; var pre = document.getElementById('received_message')
pre.innerHTML = ""; var headers = message.headers;
pre.innerHTML += url + ":\n\n"; pre.innerHTML = "";
pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n" pre.innerHTML += url + ":\n\n";
assert_own_property(headers, "host") pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
assert_own_property(headers, "connection") assert_own_property(headers, "host")
messaging_test.done(); assert_own_property(headers, "connection")
}, null, null, messaging_test); });
}, "Script is responding with HTTP headers"); }, "Script is responding with HTTP headers");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
</head> </head>
<body> <body>
<h1>Worker messaging - same-origin Worker request</h1> <h1>Worker messaging - same-origin Worker request</h1>
@ -16,20 +17,20 @@
<pre id="received_message">Running...</pre> <pre id="received_message">Running...</pre>
<script> <script>
async_test(function(messaging_test) { promise_test(function() {
var urlPath = '/referrer-policy/generic/subresource/worker.py'; var urlPath = '/referrer-policy/generic/subresource/worker.py';
var url = location.protocol + "//" + location.hostname + ":" + var url = location.protocol + "//" + location.hostname + ":" +
location.port + urlPath; location.port + urlPath;
queryWorker(url, function(message) { return requestViaDedicatedWorker(url, {})
var pre = document.getElementById('received_message') .then(function(message) {
var headers = message.headers; var pre = document.getElementById('received_message')
pre.innerHTML = ""; var headers = message.headers;
pre.innerHTML += url + ":\n\n"; pre.innerHTML = "";
pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n" pre.innerHTML += url + ":\n\n";
assert_own_property(headers, "host") pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
assert_own_property(headers, "connection") assert_own_property(headers, "host")
messaging_test.done(); assert_own_property(headers, "connection")
}, null, null, messaging_test); });
}, "Worker is responding with HTTP headers"); }, "Worker is responding with HTTP headers");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
</head> </head>
<body> <body>
<h1>XHR messaging - cross-origin XHR request</h1> <h1>XHR messaging - cross-origin XHR request</h1>
@ -16,20 +17,20 @@
<pre id="received_message">Running...</pre> <pre id="received_message">Running...</pre>
<script> <script>
async_test(function(messaging_test) { promise_test(function() {
var urlPath = '/referrer-policy/generic/subresource/xhr.py'; var urlPath = '/referrer-policy/generic/subresource/xhr.py';
var url = location.protocol + "//www1." + location.hostname + ":" + location.port + var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
urlPath; urlPath;
queryXhr(url, function(message) { return requestViaXhr(url)
var pre = document.getElementById('received_message') .then(function(message) {
var headers = message.headers; var pre = document.getElementById('received_message')
pre.innerHTML = ""; var headers = message.headers;
pre.innerHTML += url + ":\n\n"; pre.innerHTML = "";
pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n" pre.innerHTML += url + ":\n\n";
assert_own_property(headers, "host") pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
assert_own_property(headers, "connection") assert_own_property(headers, "host")
messaging_test.done(); assert_own_property(headers, "connection")
}, null, null, messaging_test); });
}, "XHR is responding with HTTP headers"); }, "XHR is responding with HTTP headers");
</script> </script>

View file

@ -7,6 +7,7 @@
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<!-- Common global functions for referrer-policy tests. --> <!-- Common global functions for referrer-policy tests. -->
<script src="/referrer-policy/generic/common.js"></script> <script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js"></script>
</head> </head>
<body> <body>
<h1>Referrer Policy: CSP 'referrer' directive should not be supported</h1> <h1>Referrer Policy: CSP 'referrer' directive should not be supported</h1>
@ -15,14 +16,14 @@
<pre id="received_message">Running...</pre> <pre id="received_message">Running...</pre>
<script> <script>
async_test(function(test) { promise_test(function() {
var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime(); var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime();
var url = location.protocol + "//www1." + location.hostname + ":" + location.port + var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
urlPath; urlPath;
queryImage(url, function(message) { return requestViaImageForReferrerPolicy(url, null, 'always')
assert_equals(message.referrer, document.location.href); .then(function(message) {
test.done(); assert_equals(message.referrer, document.location.href);
}, null, 'always', test); });
}, "Image has a referrer despite CSP 'referrer' directive"); }, "Image has a referrer despite CSP 'referrer' directive");
</script> </script>

View file

@ -0,0 +1,59 @@
<!DOCTYPE html>
<title>SXG reporting test of ok for navigation</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="/network-error-logging/support/nel.sub.js"></script>
<script src="../resources/sxg-util.js"></script>
<body>
<script>
const alt_origin = get_host_info().HTTPS_NOTSAMESITE_ORIGIN;
const test_origin = get_host_info().HTTPS_ORIGIN;
nel_test(async t => {
await fetchResourceWithBasicPolicy();
const sxg_url = alt_origin + '/signed-exchange/resources/sxg/sxg-location.sxg?navigation';
const cert_url = test_origin + '/signed-exchange/resources/127.0.0.1.sxg.pem.cbor';
const message = await openSXGInIframeAndWaitForMessage(t, sxg_url);
assert_equals(message.location,
innerURLOrigin() + '/signed-exchange/resources/inner-url.html');
assert_false(message.is_fallback);
assert_true(await reportsExist([
{
url: sxg_url,
user_agent: navigator.userAgent,
type: "network-error",
body: {
phase: "sxg",
type: "ok",
status_code: 200,
referrer: location.href,
sxg: {
outer_url: sxg_url,
inner_url:
innerURLOrigin() + '/signed-exchange/resources/inner-url.html',
cert_url: [cert_url]
}
},
metadata: {
content_type: "application/reports+json",
},
},
{
url: sxg_url,
user_agent: navigator.userAgent,
type: "network-error",
body: {
phase: "application",
type: "ok",
status_code: 200,
referrer: location.href,
},
metadata: {
content_type: "application/reports+json",
},
},
]));
}, 'SXG success report must be sent for navigation.');
</script>
</body>

View file

@ -0,0 +1,56 @@
<!DOCTYPE html>
<title>SXG reporting test of ok for prefetch</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="/network-error-logging/support/nel.sub.js"></script>
<script src="../resources/sxg-util.js"></script>
<body>
<script>
const alt_origin = get_host_info().HTTPS_NOTSAMESITE_ORIGIN;
const test_origin = get_host_info().HTTPS_ORIGIN;
nel_test(async t => {
await fetchResourceWithBasicPolicy();
const sxg_url = alt_origin + '/signed-exchange/resources/sxg/sxg-location.sxg?prefetch';
const cert_url = test_origin + '/signed-exchange/resources/127.0.0.1.sxg.pem.cbor';
addPrefetch(sxg_url);
assert_true(await reportsExist([
{
url: sxg_url,
user_agent: navigator.userAgent,
type: "network-error",
body: {
phase: "sxg",
type: "ok",
status_code: 200,
referrer: location.href,
sxg: {
outer_url: sxg_url,
inner_url:
innerURLOrigin() + '/signed-exchange/resources/inner-url.html',
cert_url: [cert_url]
}
},
metadata: {
content_type: "application/reports+json",
},
},
{
url: sxg_url,
user_agent: navigator.userAgent,
type: "network-error",
body: {
phase: "application",
type: "ok",
status_code: 200,
referrer: location.href,
},
metadata: {
content_type: "application/reports+json",
},
},
]));
}, 'SXG success report must be sent for prefetching.');
</script>
</body>

View file

@ -65,3 +65,10 @@ function runReferrerTests(test_cases) {
}, 'Referrer of SignedHTTPExchange test : ' + JSON.stringify(test_case)); }, 'Referrer of SignedHTTPExchange test : ' + JSON.stringify(test_case));
} }
} }
function addPrefetch(url) {
const link = document.createElement('link');
link.rel = 'prefetch';
link.href = url;
document.body.appendChild(link);
}

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<title>Test <svg:image>'s sizing with css size as auto, with dynamic image change</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#geometry-Sizing"/>
<link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#embedded-Placement"/>
<svg height="0">
<image width="128" height="128" xlink:href="/images/green-256x256.png" style="width:auto; height:auto"/>
</svg>
<script>
async_test(function(t) {
var image = document.querySelector('image');
window.onload = t.step_func(function() {
var rectBBox = image.getBBox();
assert_equals(rectBBox.width, 256);
assert_equals(rectBBox.height, 256);
image.setAttributeNS("http://www.w3.org/1999/xlink","href","data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='64' height='64'></svg>");
image.onload = t.step_func_done(function() {
var rectBBox = image.getBBox();
assert_equals(rectBBox.width, 64);
assert_equals(rectBBox.height, 64);
});
});
});
</script>

View file

@ -0,0 +1,93 @@
<!DOCTYPE html>
<title><svg:image> 'auto' sizing </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#geometry-Sizing"/>
<link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#embedded-Placement"/>
<svg height="0">
<image width="64" height="64" xlink:href="/images/green-256x256.png" />
<image width="128" height="64" xlink:href="/images/green-256x256.png" style="width:auto"/>
<image width="64" height="128" xlink:href="/images/green-256x256.png" style="height:auto"/>
<image width="128" height="64" xlink:href="/images/green-256x256.png" style="width:auto; height:auto"/>
<image width="50" height="50"
xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>"/>
<image width="50" height="50"
xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100'></svg>" style='width:auto; height:auto'/>
<image width="50" height="50"
xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100'></svg>" style='width:auto;'/>
<image xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100'></svg>" style='width:auto;'/>
<image height="50"
xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100'></svg>" style='width:auto;'/>
<image width="50"
xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100'></svg>" style='height:auto;'/>
<image width="200" height="200"
xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>" style='width:auto; height:auto'/>
<image height="200"
xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>" style='width:auto; height:auto'/>
<image width="200"
xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>" style='width:auto; height:auto'/>
<image xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>"/>
<image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 100'></svg>"/>
<image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 100'></svg>" style='width:auto'/>
<image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 100'></svg>" style='height:auto'/>
<image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 100'></svg>" style='width:auto; height:auto'/>
<image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' viewBox='0 0 400 100'></svg>"/>
<image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' viewBox='0 0 400 100'></svg>" style='width:auto'/>
<image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' viewBox='0 0 400 100'></svg>" style='height:auto'/>
<image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' viewBox='0 0 400 100'></svg>" style='width:auto; height:auto'/>
<image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' height='100' viewBox='0 0 400 100'></svg>"/>
<image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' height='100' viewBox='0 0 400 100'></svg>" style='width:auto'/>
<image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' height='100' viewBox='0 0 400 100'></svg>" style='height:auto'/>
<image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' height='100' viewBox='0 0 400 100'></svg>" style='width:auto; height:auto'/>
<image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100' viewBox='0 0 400 100'></svg>"/>
<image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100' viewBox='0 0 400 100'></svg>" style='width:auto'/>
<image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100' viewBox='0 0 400 100'></svg>" style='height:auto'/>
<image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100' viewBox='0 0 400 100'></svg>" style='width:auto; height:auto'/>
</svg>
<script>
var expectedBoxes = [
{ dimensions: [64, 64], description: "256x256 png image, attributes width='64' height='64'"},
{ dimensions: [64, 64], description: "256x256 png image, attributes width='128' height='64' and CSS 'width:auto'"},
{ dimensions: [64, 64], description: "256x256 png image, attributes width='64' height='128' and CSS 'height:auto'"},
{ dimensions: [256, 256], description: "256x256 png image, attributes width='64' height='64' and CSS 'width:auto; height:auto'"},
{ dimensions: [50, 50], description: "default sized svg image, attributes width='50' height='50'"},
{ dimensions: [200, 100], description: "200x100 svg image, attributes width='50' height='50' and CSS 'width:auto; height:auto'"},
{ dimensions: [100, 50], description: "200x100 svg image, attributes width='50' height='50' and CSS 'width:auto'"},
{ dimensions: [200, 100], description: "200x100 svg image, without attributes width and height and CSS 'width:auto'"},
{ dimensions: [100, 50], description: "200x100 svg image, attributes height='50' and 'width:auto'"},
{ dimensions: [50, 25], description: "200x100 svg image, attributes width='50' and CSS height:auto"},
{ dimensions: [300, 150], description: "default sized svg image, attributes width='200' height='200' and CSS 'width:auto; height:auto'"},
{ dimensions: [300, 150], description: "default sized svg image, attributes height='200' and CSS 'width:auto; height:auto'"},
{ dimensions: [300, 150], description: "default sized svg image, attributes width='200' and CSS 'width:auto; height:auto'"},
{ dimensions: [300, 150], description: "default sized svg image, without attributes width and height, no css width/height specified"},
{ dimensions: [60, 60], description: "default sized svg image viewBox='0 0 400 100', attributes width='60' height='60' and no css width/height specified"},
{ dimensions: [240, 60], description: "default sized svg image viewBox='0 0 400 100', attributes width='60' height='60' and CSS 'width:auto'"},
{ dimensions: [60, 15], description: "default sized svg image viewBox='0 0 400 100', attributes width='60' height='60' and CSS 'height:auto'"},
{ dimensions: [300, 75], description: "default sized svg image viewBox='0 0 400 100', attributes width='60' height='60' and CSS 'width:auto; height:auto'"},
{ dimensions: [60, 60], description: "svg image width='200' viewBox='0 0 400 100', attributes width='60' height='60' and no css width/height specified"},
{ dimensions: [240, 60], description: "svg image width='200' viewBox='0 0 400 100', attributes width='60' height='60' and CSS 'width:auto'"},
{ dimensions: [60, 15], description: "svg image width='200' viewBox='0 0 400 100', attributes width='60' height='60' and CSS 'height:auto'"},
{ dimensions: [200, 50], description: "svg image width='200' viewBox='0 0 400 100', attributes width='60' height='60' and CSS 'width:auto; height:auto'"},
{ dimensions: [60, 60], description: "svg image height='100' viewBox='0 0 400 100', attributes width='60' height='60' and no css width/height specified"},
{ dimensions: [240, 60], description: "svg image height='100' viewBox='0 0 400 100', attributes width='60' height='60' and CSS 'width:auto'"},
{ dimensions: [60, 15], description: "svg image height='100' viewBox='0 0 400 100', attributes width='60' height='60' and CSS 'height:auto'"},
{ dimensions: [400, 100], description: "svg image height='100' viewBox='0 0 400 100', attributes width='60' height='60' and CSS 'width:auto; height:auto'"},
{ dimensions: [60, 60], description: "200x100 svg image viewBox='0 0 400 100', attributes width='60' height='60' and no css width/height specified"},
{ dimensions: [120, 60], description: "200x100 svg image viewBox='0 0 400 100', attributes width='60' height='60' and CSS 'width:auto'"},
{ dimensions: [60, 30], description: "200x100 svg image viewBox='0 0 400 100', attributes width='60' height='60' and CSS 'height:auto'"},
{ dimensions: [200, 100], description: "200x100 svg image viewBox='0 0 400 100', attributes width='60' height='60' and CSS 'width:auto; height:auto'"},
];
var images = document.getElementsByTagName('image');
for (var i = 0, length = images.length; i < length; ++i) {
async_test(function(t) {
var image = images[i];
image.expectedBox = expectedBoxes[i];
image.onload = t.step_func_done(function() {
var rectBBox = image.getBBox();
assert_equals(rectBBox.width, image.expectedBox.dimensions[0]);
assert_equals(rectBBox.height, image.expectedBox.dimensions[1]);
});
}, document.title + ' with ' + expectedBoxes[i].description);
}
</script>

View file

@ -0,0 +1,18 @@
# This job is used to get a run into wpt.fyi and staging.wpt.fyi, by notifying
# them with the build number and artifact to use.
parameters:
dependsOn: ''
artifactName: ''
jobs:
- job: ${{ parameters.dependsOn }}_hook
displayName: 'wpt.fyi hook: ${{ parameters.artifactName }}'
dependsOn: ${{ parameters.dependsOn }}
pool:
vmImage: 'ubuntu-16.04'
steps:
- script: curl -s -S https://wpt.fyi/api/checks/azure/$(Build.BuildId)?artifact=${{ parameters.artifactName }}
displayName: 'Invoke wpt.fyi hook'
- script: curl -s -S https://staging.wpt.fyi/api/checks/azure/$(Build.BuildId)?artifact=${{ parameters.artifactName }}
displayName: 'Invoke staging.wpt.fyi hook'

View file

@ -639,7 +639,6 @@ class TestRunnerManager(threading.Thread):
# We are starting a new group of tests, so force a restart # We are starting a new group of tests, so force a restart
restart = True restart = True
else: else:
test = test
test_group = self.state.test_group test_group = self.state.test_group
group_metadata = self.state.group_metadata group_metadata = self.state.group_metadata
if restart: if restart:

View file

@ -593,9 +593,7 @@ class MultiDict(dict):
values = [values] values = [values]
for value in values: for value in values:
if value.filename: if not value.filename:
value = value
else:
value = value.value value = value.value
self.add(key, value) self.add(key, value)
return self return self

View file

@ -0,0 +1,89 @@
<!DOCTYPE html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/content-security-policy/support/testharness-helper.js"></script>
</head>
<body>
<!-- Some elements for the tests to act on. -->
<a id="anchor" href="#">anchor</a>
<div id="div"></div>
<script id="script-src" src=""></script>
<script id="script"></script>
<script>
// CSP insists the "trusted-types: ..." directives are deliverd as headers
// (rather than as "<meta http-equiv" tags). This test assumes the following
// headers are set in the .headers file:
//
// Content-Security-Policy-Report-Only: trusted-types ...; report-uri ...
// Return function that returns a promise that resolves on the given
// violation report.
function expect_violation(filter) {
return new Promise((resolve, reject) => {
function handler(e) {
if (e.originalPolicy.includes(filter)) {
document.removeEventListener("securitypolicyviolation", handler);
e.stopPropagation();
resolve(e);
}
}
document.addEventListener("securitypolicyviolation", handler);
});
}
// A sample policy we use to test TrustedTypes.createPolicy behaviour.
const id = x => x;
const policy = TrustedTypes.createPolicy("two", {
createHTML: id,
createScriptURL: id,
createURL: id,
createScript: id,
});
promise_test(t => {
let p = expect_violation("trusted-types two");
document.getElementById("anchor").href = "#abc";
assert_true(document.getElementById("anchor").href.endsWith("#abc"));
return p;
}, "Trusted Type violation report-only: assign string to url");
promise_test(t => {
let p = expect_violation("trusted-types two");
document.getElementById("div").innerHTML = "abc";
assert_equals(document.getElementById("div").textContent, "abc");
return p;
}, "Trusted Type violation report-only: assign string to html");
promise_test(t => {
let p = expect_violation("trusted-types two");
document.getElementById("script-src").src = "#";
assert_true(document.getElementById("script-src").src.endsWith("#"));
return p;
}, "Trusted Type violation report-only: assign string to script.src");
promise_test(t => {
let p = expect_violation("trusted-types two");
document.getElementById("script").innerHTML = "con" + "sole.log('Hello');";
assert_true(document.getElementById("script").textContent.startsWith("consol"));
return p;
}, "Trusted Type violation report-only: assign string to script content");
promise_test(t => {
let p = expect_violation("trusted-types two");
document.getElementById("anchor").href = "#def";
return p.then(report => {
assert_equals(report.documentURI, "" + window.location);
assert_equals(report.disposition, "report");
assert_equals(report.effectiveDirective, "trusted-types");
assert_equals(report.violatedDirective, "trusted-types");
assert_true(report.originalPolicy.startsWith("trusted-types two;"));
});
}, "Trusted Type violation report: check report contents");
</script>
</body>

View file

@ -0,0 +1 @@
Content-Security-Policy-Report-Only: trusted-types two; report-uri /content-security-policy/resources/dummy-report.php

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<title>Check Trusted Type violation reports</title>
<!-- We assume these HTTP headers are set on the request:
Set-Cookie: trusted-types-reporting-check-report={{$id:uuid()}}; Path=/trusted-types/
Content-Security-Policy-Report-Only: \
trusted-types one two; \
report-uri ../content-security-policy/support/report.py?op=put&reportID={{$id}}
-->
</head>
<body>
<script>
TrustedTypes.createPolicy("three", {});
</script>
<script async defer src='../content-security-policy/support/checkReport.sub.js?reportField=violated-directive&reportValue=trusted-types'></script>
</body>
</html>

View file

@ -0,0 +1,6 @@
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0, false
Pragma: no-cache
Set-Cookie: trusted-types-reporting-check-report={{$id:uuid()}}; Path=/trusted-types/
Content-Security-Policy-Report-Only: trusted-types one two; report-uri ../content-security-policy/support/report.py?op=put&reportID={{$id}}

View file

@ -0,0 +1,143 @@
<!DOCTYPE html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/content-security-policy/support/testharness-helper.js"></script>
</head>
<body>
<script>
// CSP insists the "trusted-types: ..." directives are deliverd as headers
// (rather than as "<meta http-equiv" tags). This test assumes the following
// headers are set in the .headers file:
//
// Content-Security-Policy: trusted-types one
// Content-Security-Policy-Report-Only: trusted-types two; report-uri ...
// Content-Security-Policy: plugin-types bla/blubb
//
// The last rule is there so we can provoke a CSP violation report at will.
// The intent is that in order to test that a violation has *not* been thrown
// (and without resorting to abominations like timeouts), we force a *another*
// CSP violation (by violating the img-src rule) and when that event is
// processed we can we sure that an earlier event - if it indeed occurred -
// must have already been processed.
const url = "" + document.location;
// Return function that returns a promise that resolves on the given
// violation report.
//
// filter_arg - iff function, call it with the event object.
// Else, string-ify and compare against event.originalPolicy.
function promise_violation(filter_arg) {
return _ => new Promise((resolve, reject) => {
function handler(e) {
let matches = (filter_arg instanceof Function)
? filter_arg(e)
: (e.originalPolicy.includes(filter_arg));
if (matches) {
document.removeEventListener("securitypolicyviolation", handler);
e.stopPropagation();
resolve(e);
}
}
document.addEventListener("securitypolicyviolation", handler);
});
}
// Like assert_throws, but we don't care about the exact error. We just want
// to run the code and continue.
function expect_throws(fn) {
try { fn(); assert_unreached(); } catch (err) { /* ignore */ }
}
// A sample policy we use to test TrustedTypes.createPolicy behaviour.
const id = x => x;
const a_policy = {
createHTML: id,
createScriptURL: id,
createURL: id,
createScript: id,
};
// Provoke/wait for a CSP violation, in order to be sure that all previous
// CSP violations have been delivered.
function promise_flush() {
return promise_violation("plugin-types bla/blubb");
}
function flush() {
expect_throws(_ => {
var o = document.createElement('object');
o.type = "application/x-shockwave-flash";
document.body.appendChild(o);
});
}
promise_test(t => {
let p = Promise.resolve()
.then(promise_violation("trusted-types one"))
.then(promise_violation("trusted-types two"))
.then(promise_flush());
expect_throws(_ => TrustedTypes.createPolicy("three", a_policy));
flush();
return p;
}, "Trusted Type violation report: creating a forbidden policy.");
promise_test(t => {
let p = promise_flush()();
expect_throws(_ => TrustedTypes.createPolicy("two", a_policy));
flush();
return p;
}, "Trusted Type violation report: creating a report-only-forbidden policy.");
promise_test(t => {
let p = Promise.resolve()
.then(promise_violation("trusted-types two"))
.then(promise_flush());
TrustedTypes.createPolicy("one", a_policy, {exposed: true});
flush();
return p;
}, "Trusted Type violation report: creating a forbidden-but-not-reported policy.");
promise_test(t => {
let p = promise_violation("trusted-types two")();
expect_throws(_ => document.getElementById("anchor").href = url);
return p;
}, "Trusted Type violation report: assign string to url");
promise_test(t => {
let p = promise_violation("trusted-types two")();
expect_throws(_ => document.getElementById("div").innerHTML = "abc");
return p;
}, "Trusted Type violation report: assign string to html");
// In the following tests, we rely on the previous tests to have successfully
// created an exposed, no-op policy "one". Let's briefly test that.
promise_test(t => {
assert_true(!!TrustedTypes.getExposedPolicy("one"));
return Promise.resolve();
}, "By now, the \"one\" policy should have been created.");
promise_test(t => {
let p = promise_flush()();
document.getElementById("anchor").href =
TrustedTypes.getExposedPolicy("one").createURL("#");
flush();
return p;
}, "Trusted Type violation report: assign trusted URL to url; no report");
promise_test(t => {
let p = promise_flush()();
document.getElementById("div").innerHTML =
TrustedTypes.getExposedPolicy("one").createHTML("abc");
flush();
return p;
}, "Trusted Type violation report: assign trusted HTML to html; no report");
</script>
<!-- Some elements for the tests to act on. -->
<a id="anchor" href="">anchor</a>
<div id="div"></div>
</body>

View file

@ -0,0 +1,4 @@
Content-Security-Policy: trusted-types one
Content-Security-Policy-Report-Only: trusted-types two; report-uri /content-security-policy/resources/dummy-report.php
Content-Security-Policy: plugin-types bla/blubb

View file

@ -1,3 +1,9 @@
// Used by /mixed-content/generic/common.js.
function wrapResult(server_data) {
// Currently the returned value is not used in mixed-content tests.
return null;
}
const Host = { const Host = {
SAME_ORIGIN: "same-origin", SAME_ORIGIN: "same-origin",
CROSS_ORIGIN: "cross-origin", CROSS_ORIGIN: "cross-origin",

Some files were not shown because too many files have changed in this diff Show more