diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index e3a1ebe61ed..24650ba5d95 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -650073,67 +650073,67 @@ "support" ], "referrer-policy/css-integration/child-css/external-import-stylesheet.html": [ - "a2d3e8ced0412b97422847d4d81c1403cf9ae52c", + "40f4234ad48d19162cefae933fd0f53a72ff0c19", "testharness" ], "referrer-policy/css-integration/child-css/internal-import-stylesheet.html": [ - "aebf5031484b799989d6b6a9dd72a5bc28575214", + "30c5ea2903094af38dea9a7a565255d178069178", "testharness" ], "referrer-policy/css-integration/child-css/processing-instruction.html": [ - "b6333e2c7b248c3f3b863bd06f1c99abd472f162", + "52a0ded42a185ed5ff6f449879e0ce50f8255868", "testharness" ], "referrer-policy/css-integration/css-test-helper.js": [ - "f5886dbbcbe358438dfbac45c5a0127e9e990ad4", + "788df16a456b83a23de662b710c200042a1e7254", "support" ], "referrer-policy/css-integration/font-face/external-import-stylesheet.html": [ - "c344c56c5bf322f35e8d8c74427d80391e6637d3", + "80e3587ad62f040f2cfb28645437fcbc0e66b415", "testharness" ], "referrer-policy/css-integration/font-face/external-stylesheet.html": [ - "24e4bb99900a556cb0b44144a25c9f8249224eb7", + "a91eb3fe758299229040466deb2d1b0263f77197", "testharness" ], "referrer-policy/css-integration/font-face/internal-import-stylesheet.html": [ - "54e2383423cab8679635d05c256c32e27a94c024", + "a637082a4ce7dff612b223fc8a4c2195db300013", "testharness" ], "referrer-policy/css-integration/font-face/internal-stylesheet.html": [ - "b3869bcebdcdadea3e50d7e8713c853d46ba4816", + "eebd864bc56725b79c1f29c0597466574e2af091", "testharness" ], "referrer-policy/css-integration/font-face/processing-instruction.html": [ - "89ee918e24e14b8ea5d35a7dfaf09610eb89ee11", + "bfc42d9fcbe355514c7bf72ac087d7159439824e", "testharness" ], "referrer-policy/css-integration/image/external-import-stylesheet.html": [ - "0023af31b17ee883e6e9fe6cdd8f09b8eacf83d1", + "80c71b0e215b547d664aee8757d70188c012a9c0", "testharness" ], "referrer-policy/css-integration/image/external-stylesheet.html": [ - "d14769db4a1221bb6e220aa594c4a3b6bab97aa1", + "ba7497b97de6911c149b423bf25305123e97150e", "testharness" ], "referrer-policy/css-integration/image/inline-style.html": [ - "42128ae062093c0e8feb5d90ab62a6cb281cf8e9", + "758b6d91852f67d4e47726815804a5e366fe534d", "testharness" ], "referrer-policy/css-integration/image/internal-import-stylesheet.html": [ - "90003547f4d4e2048cc33f7125d756d42507140d", + "24aa1858304a2130624589b0a64c6f9ec9cac5a1", "testharness" ], "referrer-policy/css-integration/image/internal-stylesheet.html": [ - "943108d66e4b273a6d3be30b2ea8a0edb0490c7b", + "f4567885e1f1e215487a11f1023d117517cd88b8", "testharness" ], "referrer-policy/css-integration/image/presentation-attribute.html": [ - "78401d3ec16866f1e51618bdb5cb028f5eea8490", + "d0a4d96f84c8e48ea5daf5699c7b04bbc877ba86", "testharness" ], "referrer-policy/css-integration/image/processing-instruction.html": [ - "1ca18547dd54c4707250f400999a041f16f77ddf", + "926147be489a85164758dcf644c715e4a5c02de6", "testharness" ], "referrer-policy/css-integration/svg/external-stylesheet.html": [ @@ -650157,7 +650157,7 @@ "testharness" ], "referrer-policy/generic/common.js": [ - "f9bbe42b914c46822ec8b74aacd849789723dd72", + "a16691bccb2543ad68b81e9a16fa261d3cce6a9f", "support" ], "referrer-policy/generic/iframe-inheritance.html": [ @@ -650209,11 +650209,11 @@ "support" ], "referrer-policy/generic/referrer-policy-test-case.js": [ - "4641683cd850da86279dcd062aaf868d346aa2bd", + "2385cc2a1c4e51a2855299e42b69ac12362cd699", "support" ], "referrer-policy/generic/sandboxed-iframe-with-opaque-origin.html": [ - "8fee77f836378ec137c3bf0d554f4def83a5caba", + "1b2b12bf6910e075338462de577dc4228f52a21f", "testharness" ], "referrer-policy/generic/sanity-checker.js": [ @@ -650221,7 +650221,7 @@ "support" ], "referrer-policy/generic/subresource-test/area-navigate.html": [ - "bca7e479fa2ca41505bc73cf74c6e518efa7e947", + "3eb824521b7801c518a7b36218075eb3d74bd639", "testharness" ], "referrer-policy/generic/subresource-test/attr-referrer-invalid-value.html": [ @@ -650229,31 +650229,31 @@ "testharness" ], "referrer-policy/generic/subresource-test/fetch-messaging.html": [ - "046b29e9a3e94753c1a552732b0f44d2883a011d", + "edb159d9eb1cf5eed6af249a40f70d9ecd079d68", "testharness" ], "referrer-policy/generic/subresource-test/iframe-messaging.html": [ - "a3e55707c26f95624baaa54b8778d641cd756d72", + "606e18b281f6c3498573dc9bfaefefca1390026a", "testharness" ], "referrer-policy/generic/subresource-test/image-decoding.html": [ - "448f12b1348fa77aaaebd52b2c3ee6ae9c73a5f6", + "9c50ea6619389dad8ad81c4c2afbeb8030b176db", "testharness" ], "referrer-policy/generic/subresource-test/link-navigate.html": [ - "45e502004d4b640d0b2194e48d060b8d3cc3f120", + "95582f65bac8a3b478cc8cd4fe9b883fb507237f", "testharness" ], "referrer-policy/generic/subresource-test/script-messaging.html": [ - "09c5db6193fed52c60edc2526609c3d501c45da8", + "f73f4406df20694480f82570ed8674fe283ea375", "testharness" ], "referrer-policy/generic/subresource-test/worker-messaging.html": [ - "6d34366b943ad2b3b15f08179a58ef5227c675d0", + "fd7591882e91e7265fd740b9018248d21f13b5b9", "testharness" ], "referrer-policy/generic/subresource-test/xhr-messaging.html": [ - "09f69140098a16bd66a117cf6187fedc862d9233", + "6ef4a9cfd4b98c3562fe7ef6e04eb931073166de", "testharness" ], "referrer-policy/generic/subresource/__init__.py": [ @@ -650381,7 +650381,7 @@ "support" ], "referrer-policy/generic/unsupported-csp-referrer-directive.html": [ - "9627d16559903b5202f842f3c3355a2e7005f65c", + "475efa55091778e747fa36030f7b422b89d6d4b9", "testharness" ], "referrer-policy/no-referrer-when-downgrade/attr-referrer/cross-origin/http-http/a-tag/no-redirect/insecure-protocol.http.html": [ diff --git a/tests/wpt/metadata/referrer-policy/generic/unsupported-csp-referrer-directive.html.ini b/tests/wpt/metadata/referrer-policy/generic/unsupported-csp-referrer-directive.html.ini deleted file mode 100644 index c2b0313db96..00000000000 --- a/tests/wpt/metadata/referrer-policy/generic/unsupported-csp-referrer-directive.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[unsupported-csp-referrer-directive.html] - type: testharness - disabled: https://github.com/servo/servo/issues/4767 diff --git a/tests/wpt/web-platform-tests/referrer-policy/css-integration/child-css/external-import-stylesheet.html b/tests/wpt/web-platform-tests/referrer-policy/css-integration/child-css/external-import-stylesheet.html index a2d3e8ced04..40f4234ad48 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/css-integration/child-css/external-import-stylesheet.html +++ b/tests/wpt/web-platform-tests/referrer-policy/css-integration/child-css/external-import-stylesheet.html @@ -16,31 +16,29 @@
diff --git a/tests/wpt/web-platform-tests/referrer-policy/css-integration/child-css/internal-import-stylesheet.html b/tests/wpt/web-platform-tests/referrer-policy/css-integration/child-css/internal-import-stylesheet.html index aebf5031484..30c5ea29030 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/css-integration/child-css/internal-import-stylesheet.html +++ b/tests/wpt/web-platform-tests/referrer-policy/css-integration/child-css/internal-import-stylesheet.html @@ -16,28 +16,26 @@
diff --git a/tests/wpt/web-platform-tests/referrer-policy/css-integration/child-css/processing-instruction.html b/tests/wpt/web-platform-tests/referrer-policy/css-integration/child-css/processing-instruction.html index b6333e2c7b2..52a0ded42a1 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/css-integration/child-css/processing-instruction.html +++ b/tests/wpt/web-platform-tests/referrer-policy/css-integration/child-css/processing-instruction.html @@ -15,31 +15,29 @@
diff --git a/tests/wpt/web-platform-tests/referrer-policy/css-integration/css-test-helper.js b/tests/wpt/web-platform-tests/referrer-policy/css-integration/css-test-helper.js index f5886dbbcbe..788df16a456 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/css-integration/css-test-helper.js +++ b/tests/wpt/web-platform-tests/referrer-policy/css-integration/css-test-helper.js @@ -33,22 +33,18 @@ function runSvgTests(testProperties, testDescription, testFunction) { property: property, }; - testFunction(current); + current.test.step(function() { testFunction(current) }); let check_url = url_prefix + "svg.py" + "?id=" + current.id + "&report-headers"; - current.test.step_timeout( - queryXhr.bind(this, check_url, - function(message) { - current.test.step(function() { - assert_own_property(message, "headers"); - assert_own_property(message, "referrer"); - assert_equals(message.referrer, current.expected); - }); - current.test.done(); - }), - 800); - + current.test.step_timeout(function() { + queryXhr(check_url, function(message) { + assert_own_property(message, "headers"); + assert_own_property(message, "referrer"); + assert_equals(message.referrer, current.expected); + current.test.done(); + }, null, null, current.test); + }, 800); }; add_result_callback(runNextTest); diff --git a/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/external-import-stylesheet.html b/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/external-import-stylesheet.html index c344c56c5bf..80e3587ad62 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/external-import-stylesheet.html +++ b/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/external-import-stylesheet.html @@ -17,35 +17,33 @@
diff --git a/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/external-stylesheet.html b/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/external-stylesheet.html index 24e4bb99900..a91eb3fe758 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/external-stylesheet.html +++ b/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/external-stylesheet.html @@ -16,30 +16,28 @@
diff --git a/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/internal-import-stylesheet.html b/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/internal-import-stylesheet.html index 54e2383423c..a637082a4ce 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/internal-import-stylesheet.html +++ b/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/internal-import-stylesheet.html @@ -17,28 +17,26 @@
+ let style = document.createElement("style"); + style.textContent = "@import url('" + css_url + "');"; + document.head.appendChild(style); + css_test.step_timeout(function() { + queryXhr(font_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); + }, "Font from imported stylesheet (internal)."); +
diff --git a/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/internal-stylesheet.html b/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/internal-stylesheet.html index b3869bcebdc..eebd864bc56 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/internal-stylesheet.html +++ b/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/internal-stylesheet.html @@ -16,29 +16,27 @@
+ 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';}"; + document.head.appendChild(style); + css_test.step_timeout(function() { + queryXhr(font_url, function(message) { + assert_own_property(message, "headers"); + assert_own_property(message, "referrer"); + assert_equals(message.referrer, location.origin + "/"); + css_test.done(); + }, null, null, css_test); + }, 1000); + }, "Font from internal stylesheet."); +
diff --git a/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/processing-instruction.html b/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/processing-instruction.html index 89ee918e24e..bfc42d9fcbe 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/processing-instruction.html +++ b/tests/wpt/web-platform-tests/referrer-policy/css-integration/font-face/processing-instruction.html @@ -17,33 +17,31 @@
diff --git a/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/external-import-stylesheet.html b/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/external-import-stylesheet.html index 0023af31b17..80c71b0e215 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/external-import-stylesheet.html +++ b/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/external-import-stylesheet.html @@ -17,35 +17,33 @@
diff --git a/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/external-stylesheet.html b/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/external-stylesheet.html index d14769db4a1..ba7497b97de 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/external-stylesheet.html +++ b/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/external-stylesheet.html @@ -16,30 +16,28 @@
diff --git a/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/inline-style.html b/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/inline-style.html index 42128ae0620..758b6d91852 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/inline-style.html +++ b/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/inline-style.html @@ -16,25 +16,23 @@
+ var div = document.querySelector("div.styled"); + div.style = "content:url(" + css_url + ")"; + css_test.step_timeout(function() { + queryXhr(img_url, function(message) { + assert_own_property(message, "headers"); + assert_own_property(message, "referrer"); + assert_equals(message.referrer, location.origin + "/"); + css_test.done(); + }, null, null, css_test); + }, 1000); + }, "Image from inline styles."); +
diff --git a/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/internal-import-stylesheet.html b/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/internal-import-stylesheet.html index 90003547f4d..24aa1858304 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/internal-import-stylesheet.html +++ b/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/internal-import-stylesheet.html @@ -17,28 +17,26 @@
+ var style = document.createElement("style"); + style.type = 'text/css'; + style.appendChild(document.createTextNode("@import url('" + css_url + "');")); + document.head.appendChild(style); + 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); + }, "Image from imported stylesheet (internal)."); +
diff --git a/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/internal-stylesheet.html b/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/internal-stylesheet.html index 943108d66e4..f4567885e1f 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/internal-stylesheet.html +++ b/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/internal-stylesheet.html @@ -16,27 +16,25 @@
+ var style = document.createElement("style"); + style.type = 'text/css'; + style.appendChild(document.createTextNode("div.styled::before { content:url(" + css_url + ")}")); + document.head.appendChild(style); + css_test.step_timeout(function() { + queryXhr(img_url, function(message) { + assert_own_property(message, "headers"); + assert_own_property(message, "referrer"); + assert_equals(message.referrer, location.origin + "/"); + css_test.done(); + }, null, null, css_test); + }, 1000); + }, "Image from internal stylesheet."); +
diff --git a/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/presentation-attribute.html b/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/presentation-attribute.html index 78401d3ec16..d0a4d96f84c 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/presentation-attribute.html +++ b/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/presentation-attribute.html @@ -14,24 +14,22 @@ the referrer and referrer policy from the document.

+ document.body.background = css_url; + css_test.step_timeout(function() { + queryXhr(img_url, function(message) { + assert_own_property(message, "headers"); + assert_own_property(message, "referrer"); + assert_equals(message.referrer, location.origin + "/"); + css_test.done(); + }, null, null, css_test); + }, 1000); + }, "Image from presentation attributes."); +
diff --git a/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/processing-instruction.html b/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/processing-instruction.html index 1ca18547dd5..926147be489 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/processing-instruction.html +++ b/tests/wpt/web-platform-tests/referrer-policy/css-integration/image/processing-instruction.html @@ -17,26 +17,24 @@
diff --git a/tests/wpt/web-platform-tests/referrer-policy/generic/common.js b/tests/wpt/web-platform-tests/referrer-policy/generic/common.js index f9bbe42b914..a16691bccb2 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/generic/common.js +++ b/tests/wpt/web-platform-tests/referrer-policy/generic/common.js @@ -99,15 +99,15 @@ function wrapResult(url, server_data) { } } -function queryIframe(url, callback, referrer_policy) { - var iframe = appendIframeToBody(url, referrer_policy); - var listener = function(event) { +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); } @@ -122,12 +122,12 @@ function queryImage(url, callback, attributes, referrerPolicy, test) { var noSrcDocPolicy = new Promise((resolve, reject) => { var iframeWithoutOwnPolicy = document.createElement('iframe'); iframeWithoutOwnPolicy.srcdoc = "Hello, world."; - iframeWithoutOwnPolicy.onload = function () { + iframeWithoutOwnPolicy.onload = test.step_func(function () { var nextUrl = url + "&cache_destroyer2=" + (new Date()).getTime(); - loadImageInWindow(nextUrl, function (img) { + loadImageInWindow(nextUrl, test.step_func(function (img) { resolve(decodeImageData(extractImageData(img))); - }, attributes, iframeWithoutOwnPolicy.contentWindow); - }; + }), attributes, iframeWithoutOwnPolicy.contentWindow); + }); document.body.appendChild(iframeWithoutOwnPolicy); }); @@ -137,19 +137,19 @@ function queryImage(url, callback, attributes, referrerPolicy, test) { var iframeWithOwnPolicy = document.createElement('iframe'); iframeWithOwnPolicy.srcdoc = "Hello world."; - iframeWithOwnPolicy.onload = function () { + iframeWithOwnPolicy.onload = test.step_func(function () { var nextUrl = url + "&cache_destroyer3=" + (new Date()).getTime(); - loadImageInWindow(nextUrl, function (img) { + loadImageInWindow(nextUrl, test.step_func(function (img) { resolve(decodeImageData(extractImageData(img))); - }, null, iframeWithOwnPolicy.contentWindow); - }; + }), null, iframeWithOwnPolicy.contentWindow); + }); document.body.appendChild(iframeWithOwnPolicy); }); var pagePolicy = new Promise((resolve, reject) => { - loadImageInWindow(url, function (img) { + loadImageInWindow(url, test.step_func(function (img) { resolve(decodeImageData(extractImageData(img))); - }, attributes, window); + }), attributes, window); }); Promise.all([noSrcDocPolicy, srcDocPolicy, pagePolicy]).then(test.step_func(values => { @@ -159,52 +159,52 @@ function queryImage(url, callback, attributes, referrerPolicy, test) { })); } -function queryXhr(url, callback) { +function queryXhr(url, callback, attributes, referrer_policy, test) { var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); - xhr.onreadystatechange = function(e) { - if (this.readyState == 4 && this.status == 200) { - var server_data = JSON.parse(this.responseText); + 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) { +function queryWorker(url, callback, attributes, referrer_policy, test) { var worker = new Worker(url); - worker.onmessage = function(event) { + worker.onmessage = test.step_func(function(event) { var server_data = event.data; callback(wrapResult(url, server_data), url); - }; + }); } -function queryModuleWorkerTopLevel(url, callback) { +function queryModuleWorkerTopLevel(url, callback, attributes, referrer_policy, test) { var worker = new Worker(url, {type: "module"}); - worker.onmessage = function(event) { + worker.onmessage = test.step_func(function(event) { var server_data = event.data; callback(wrapResult(url, server_data), url); - }; + }); } -function querySharedWorker(url, callback) { +function querySharedWorker(url, callback, attributes, referrer_policy, test) { var worker = new SharedWorker(url); - worker.port.onmessage = function(event) { + worker.port.onmessage = test.step_func(function(event) { var server_data = event.data; callback(wrapResult(url, server_data), url); - }; + }); } -function queryFetch(url, callback) { - fetch(url).then(function(response) { - response.json().then(function(server_data) { +function queryFetch(url, callback, attributes, referrer_policy, test) { + fetch(url).then(test.step_func(function(response) { + response.json().then(test.step_func(function(server_data) { callback(wrapResult(url, server_data), url); - }); - } + })); + }) ); } -function queryNavigable(element, url, callback, attributes) { +function queryNavigable(element, url, callback, attributes, test) { var navigable = element navigable.href = url; navigable.target = "helper-iframe"; @@ -220,42 +220,41 @@ function queryNavigable(element, url, callback, attributes) { } } - var listener = function(event) { + var listener = test.step_func(function(event) { if (event.source != helperIframe.contentWindow) return; - callback(event.data, url); window.removeEventListener("message", listener); - } + }); window.addEventListener("message", listener); navigable.click(); } -function queryLink(url, callback, referrer_policy) { +function queryLink(url, callback, attributes, referrer_policy, test) { var a = document.createElement("a"); a.innerHTML = "Link to subresource"; document.body.appendChild(a); - queryNavigable(a, url, callback, referrer_policy) + queryNavigable(a, url, callback, attributes, test) } -function queryAreaLink(url, callback, referrer_policy) { +function queryAreaLink(url, callback, attributes, referrer_policy, test) { var area = document.createElement("area"); // TODO(kristijanburnik): Append to map and add image. document.body.appendChild(area); - queryNavigable(area, url, callback, referrer_policy) + queryNavigable(area, url, callback, attributes, test) } -function queryScript(url, callback, attributes, referrer_policy) { +function queryScript(url, callback, attributes, referrer_policy, test) { var script = document.createElement("script"); script.src = url; script.referrerPolicy = referrer_policy; - var listener = function(event) { + var listener = test.step_func(function(event) { var server_data = event.data; callback(wrapResult(url, server_data), url); window.removeEventListener("message", listener); - } + }); window.addEventListener("message", listener); document.body.appendChild(script); diff --git a/tests/wpt/web-platform-tests/referrer-policy/generic/referrer-policy-test-case.js b/tests/wpt/web-platform-tests/referrer-policy/generic/referrer-policy-test-case.js index 4641683cd85..2385cc2a1c4 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/generic/referrer-policy-test-case.js +++ b/tests/wpt/web-platform-tests/referrer-policy/generic/referrer-policy-test-case.js @@ -96,31 +96,31 @@ function ReferrerPolicyTestCase(scenario, testDescription, sanityChecker) { }, start: function() { - t._constructSubresourceUrl(); - t._constructExpectedReferrerUrl(); + async_test(function(test) { - var test = async_test(t._testDescription); + t._constructSubresourceUrl(); + t._constructExpectedReferrerUrl(); - t._invokeSubresource(function(result) { - // Check if the result is in valid format. NOOP in release. - sanityChecker.checkSubresourceResult( - test, t._scenario, t._subresourceUrl, result); + t._invokeSubresource(test.step_func(function(result) { + // Check if the result is in valid format. NOOP in release. + sanityChecker.checkSubresourceResult( + test, t._scenario, t._subresourceUrl, result); - // Check the reported URL. - test.step(function() { - assert_equals(result.referrer, - 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); + // Check the reported URL. + test.step(function() { + assert_equals(result.referrer, + 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); } } diff --git a/tests/wpt/web-platform-tests/referrer-policy/generic/sandboxed-iframe-with-opaque-origin.html b/tests/wpt/web-platform-tests/referrer-policy/generic/sandboxed-iframe-with-opaque-origin.html index 8fee77f8363..1b2b12bf691 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/generic/sandboxed-iframe-with-opaque-origin.html +++ b/tests/wpt/web-platform-tests/referrer-policy/generic/sandboxed-iframe-with-opaque-origin.html @@ -13,26 +13,28 @@

Referrer Policy: A document with an opaque origin doesn't send referrers

diff --git a/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/fetch-messaging.html b/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/fetch-messaging.html index 046b29e9a3e..edb159d9eb1 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/fetch-messaging.html +++ b/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/fetch-messaging.html @@ -24,22 +24,21 @@ if (!window.fetch) return; - var fetch_test = async_test("Fetch is responding with HTTP headers"); - var urlPath = '/referrer-policy/generic/subresource/xhr.py'; - var url = location.protocol + "//" + location.hostname + ":" + - location.port + urlPath; - queryFetch(url, function(message) { - var pre = document.getElementById('received_message') - var headers = message.headers; - pre.innerHTML = ""; - pre.innerHTML += url + ":\n\n"; - pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"; - fetch_test.step(function() { + async_test(function(fetch_test) { + var urlPath = '/referrer-policy/generic/subresource/xhr.py'; + var url = location.protocol + "//" + location.hostname + ":" + + location.port + urlPath; + queryFetch(url, function(message) { + var pre = document.getElementById('received_message') + var headers = message.headers; + pre.innerHTML = ""; + pre.innerHTML += url + ":\n\n"; + pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"; assert_own_property(headers, "host") assert_own_property(headers, "connection") - }); - fetch_test.done(); - }); + fetch_test.done(); + }, null, null, fetch_test); + }, "Fetch is responding with HTTP headers"); })(); diff --git a/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/iframe-messaging.html b/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/iframe-messaging.html index a3e55707c26..606e18b281f 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/iframe-messaging.html +++ b/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/iframe-messaging.html @@ -16,22 +16,21 @@
Running...
diff --git a/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/image-decoding.html b/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/image-decoding.html index 448f12b1348..9c50ea66193 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/image-decoding.html +++ b/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/image-decoding.html @@ -16,22 +16,21 @@
Running...
diff --git a/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/link-navigate.html b/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/link-navigate.html index 45e502004d4..95582f65bac 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/link-navigate.html +++ b/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/link-navigate.html @@ -16,22 +16,21 @@
Running...
diff --git a/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/script-messaging.html b/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/script-messaging.html index 09c5db6193f..f73f4406df2 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/script-messaging.html +++ b/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/script-messaging.html @@ -16,22 +16,21 @@
Running...
diff --git a/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/worker-messaging.html b/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/worker-messaging.html index 6d34366b943..fd7591882e9 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/worker-messaging.html +++ b/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/worker-messaging.html @@ -16,22 +16,21 @@
Running...
diff --git a/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/xhr-messaging.html b/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/xhr-messaging.html index 09f69140098..6ef4a9cfd4b 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/xhr-messaging.html +++ b/tests/wpt/web-platform-tests/referrer-policy/generic/subresource-test/xhr-messaging.html @@ -16,22 +16,21 @@
Running...
diff --git a/tests/wpt/web-platform-tests/referrer-policy/generic/unsupported-csp-referrer-directive.html b/tests/wpt/web-platform-tests/referrer-policy/generic/unsupported-csp-referrer-directive.html index 9627d165599..475efa55091 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/generic/unsupported-csp-referrer-directive.html +++ b/tests/wpt/web-platform-tests/referrer-policy/generic/unsupported-csp-referrer-directive.html @@ -15,14 +15,15 @@
Running...