Wrap more of the referrer-policy tests in testharness.js.

This commit is contained in:
Josh Matthews 2018-12-20 16:14:15 -05:00
parent bffe2a699e
commit 3cd6df1ef9
30 changed files with 540 additions and 583 deletions

View file

@ -15,31 +15,29 @@
<div class="styled"></div>
<script>
let css_test = async_test("Child css via a ProcessingInstruction.");
let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" +
location.port +
"/referrer-policy/generic/subresource/stylesheet.py?id=" +
id;
let css_url = url_prefix + "&amp;import-rule";
let expected = url_prefix + "&import-rule";
let check_url = url_prefix + "&report-headers";
async_test(function(css_test) {
let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" +
location.port +
"/referrer-policy/generic/subresource/stylesheet.py?id=" +
id;
let css_url = url_prefix + "&amp;import-rule";
let expected = url_prefix + "&import-rule";
let check_url = url_prefix + "&report-headers";
let processingInstruction =
document.createProcessingInstruction(
"xml-stylesheet", "href=\"" +css_url + "\" type=\"text/css\"");
css_test.step_timeout(
queryXhr.bind(this, check_url,
function(message) {
css_test.step(function() {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, expected);
});
css_test.done();
}),
1000);
document.insertBefore(processingInstruction, document.firstChild);
let processingInstruction =
document.createProcessingInstruction(
"xml-stylesheet", "href=\"" +css_url + "\" type=\"text/css\"");
css_test.step_timeout(function() {
queryXhr(check_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);
}, "Child css via a ProcessingInstruction.");
</script>
<div id="log"></div>