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

@ -16,31 +16,29 @@
<div class="styled"></div>
<script>
let css_test = async_test("Child css from external stylesheet.");
let id = token();
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" + "&referrer-policy=no-referrer";
let check_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py" +
"?id=" + id + "&report-headers";
async_test(function(css_test) {
let id = token();
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" + "&referrer-policy=no-referrer";
let check_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py" +
"?id=" + id + "&report-headers";
let link = document.createElement("link");
link.href = css_url;
link.rel = "stylesheet";
link.onload = function() {
css_test.step_timeout(
queryXhr.bind(this, check_url,
function(message) {
css_test.step(function() {
assert_own_property(message, "headers");
assert_equals(message.referrer, undefined);
});
css_test.done();
}),
1000);
};
document.head.appendChild(link);
let link = document.createElement("link");
link.href = css_url;
link.rel = "stylesheet";
link.onload = function() {
css_test.step_timeout(function() {
queryXhr(check_url, function(message) {
assert_own_property(message, "headers");
assert_equals(message.referrer, undefined);
css_test.done();
}, null, null, css_test);
}, 1000);
};
document.head.appendChild(link);
}, "Child css from external stylesheet.");
</script>
<div id="log"></div>

View file

@ -16,28 +16,26 @@
<div class="styled"></div>
<script>
let css_test = async_test("Child css from internal stylesheet.");
let id = token();
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 check_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py" +
"?id=" + id + "&report-headers";
async_test(function(css_test) {
let id = token();
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 check_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py" +
"?id=" + id + "&report-headers";
let style = document.createElement("style");
style.type = 'text/css';
style.appendChild(document.createTextNode("@import url('" + css_url + "');"));
document.head.appendChild(style);
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, css_url);
});
css_test.done();
}),
1000);
let 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(check_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);
}, "Child css from internal stylesheet.");
</script>
<div id="log"></div>

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>

View file

@ -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);

View file

@ -17,35 +17,33 @@
<div class="styled"></div>
<script>
let css_test = async_test("Font from imported stylesheet (external).");
let id = token();
let css_url = location.protocol + "//www1." + location.hostname + ":" +
location.port +
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
"&import-rule" + "&type=font";
let url_prefix = location.protocol + "//" + location.hostname + ":" + location.port;
let css_referrer = url_prefix +
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&type=font";
let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
"?id=" + id + "&report-headers" + "&type=font";
async_test(function(css_test) {
let id = token();
let css_url = location.protocol + "//www1." + location.hostname + ":" +
location.port +
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
"&import-rule" + "&type=font";
let url_prefix = location.protocol + "//" + location.hostname + ":" + location.port;
let css_referrer = url_prefix +
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&type=font";
let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
"?id=" + id + "&report-headers" + "&type=font";
let link = document.createElement("link");
link.href = css_url;
link.rel = "stylesheet";
link.onload = function() {
css_test.step_timeout(
queryXhr.bind(this, font_url,
function(message) {
css_test.step(function() {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, css_referrer);
});
css_test.done();
}),
1000);
};
document.head.appendChild(link);
let link = document.createElement("link");
link.href = css_url;
link.rel = "stylesheet";
link.onload = function() {
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_referrer);
css_test.done();
}, null, null, css_test);
}, 1000);
};
document.head.appendChild(link);
}, "Font from imported stylesheet (external).");
</script>
<div id="log"></div>

View file

@ -16,30 +16,28 @@
<div class="styled"></div>
<script>
let css_test = async_test("Font from external stylesheet.");
let id = token();
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 font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
"?id=" + id + "&report-headers";
async_test(function(css_test) {
let id = token();
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 font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
"?id=" + id + "&report-headers";
let link = document.createElement("link");
link.href = css_url;
link.rel = "stylesheet";
link.onload = function() {
css_test.step_timeout(
queryXhr.bind(this, font_url,
function(message) {
css_test.step(function() {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, css_url);
});
css_test.done();
}),
1000);
};
document.head.appendChild(link);
let link = document.createElement("link");
link.href = css_url;
link.rel = "stylesheet";
link.onload = function() {
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);
};
document.head.appendChild(link);
}, "Font from external stylesheet.");
</script>
<div id="log"></div>

View file

@ -17,28 +17,26 @@
<div class="styled"></div>
<script>
let css_test = async_test("Font from imported stylesheet (internal).");
let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" +
location.port + "/referrer-policy/generic/subresource/";
let css_url = url_prefix + "stylesheet.py?id=" + id + "&type=font";
let font_url = url_prefix + "font.py?report-headers&id=" + id;
async_test(function(css_test) {
let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" +
location.port + "/referrer-policy/generic/subresource/";
let css_url = url_prefix + "stylesheet.py?id=" + id + "&type=font";
let font_url = url_prefix + "font.py?report-headers&id=" + id;
let style = document.createElement("style");
style.textContent = "@import url('" + css_url + "');";
document.head.appendChild(style);
css_test.step_timeout(
queryXhr.bind(this, font_url,
function(message) {
css_test.step(function() {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, css_url);
});
css_test.done();
}),
1000);
</script>
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).");
</script>
<div id="log"></div>
</body>

View file

@ -16,29 +16,27 @@
<div class="styled"></div>
<script>
let css_test = async_test("Font from internal stylesheet.");
let id = token();
let css_url = location.protocol + "//www1." + location.hostname + ":" +
location.port +
"/referrer-policy/generic/subresource/font.py" + "?id=" +
id + "&type=font";
let font_url = css_url + "&report-headers";
async_test(function(css_test) {
let id = token();
let css_url = location.protocol + "//www1." + location.hostname + ":" +
location.port +
"/referrer-policy/generic/subresource/font.py" + "?id=" +
id + "&type=font";
let font_url = css_url + "&report-headers";
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(
queryXhr.bind(this, font_url,
function(message) {
css_test.step(function() {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, location.origin + "/");
});
css_test.done();
}),
1000);
</script>
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.");
</script>
<div id="log"></div>
</body>

View file

@ -17,33 +17,31 @@
<div class="styled"></div>
<script>
let css_test = async_test("Font from external stylesheet (from ProcessingInstruction).");
let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
let css_url = url_prefix +
"/referrer-policy/generic/subresource/stylesheet.py?id=" +
id + "&amp;type=font";
let expected = url_prefix +
"/referrer-policy/generic/subresource/stylesheet.py?id=" +
id + "&type=font";
let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
"?id=" + id + "&report-headers";
async_test(function(css_test) {
let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
let css_url = url_prefix +
"/referrer-policy/generic/subresource/stylesheet.py?id=" +
id + "&amp;type=font";
let expected = url_prefix +
"/referrer-policy/generic/subresource/stylesheet.py?id=" +
id + "&type=font";
let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
"?id=" + id + "&report-headers";
let processingInstruction =
document.createProcessingInstruction(
"xml-stylesheet", "href=\"" + css_url + "\" type=\"text/css\"");
css_test.step_timeout(
queryXhr.bind(this, font_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(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);
}, "Font from external stylesheet (from ProcessingInstruction).");
</script>
<div id="log"></div>

View file

@ -17,35 +17,33 @@
<div class="styled"></div>
<script>
var css_test = async_test("Image from imported stylesheet (external).");
var id = token();
var css_url = location.protocol + "//www1." + location.hostname + ":" + location.port +
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
"&import-rule" + "&type=image";
var url_prefix = location.protocol + "//" + location.hostname + ":" + location.port;
var css_referrer = url_prefix +
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
"&type=image";
var img_url = url_prefix + "/referrer-policy/generic/subresource/image.py" +
"?id=" + id + "&report-headers";
async_test(function(css_test) {
var id = token();
var css_url = location.protocol + "//www1." + location.hostname + ":" + location.port +
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
"&import-rule" + "&type=image";
var url_prefix = location.protocol + "//" + location.hostname + ":" + location.port;
var css_referrer = url_prefix +
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
"&type=image";
var img_url = url_prefix + "/referrer-policy/generic/subresource/image.py" +
"?id=" + id + "&report-headers";
var link = document.createElement("link");
link.href = css_url;
link.rel = "stylesheet";
link.onload = function() {
css_test.step_timeout(
queryXhr.bind(this, img_url,
function(message) {
css_test.step(function() {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, css_referrer);
});
css_test.done();
}),
1000);
};
document.head.appendChild(link);
var link = document.createElement("link");
link.href = css_url;
link.rel = "stylesheet";
link.onload = function() {
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_referrer);
css_test.done();
}, null, null, css_test);
}, 1000);
};
document.head.appendChild(link);
}, "Image from imported stylesheet (external).");
</script>
<div id="log"></div>

View file

@ -16,30 +16,28 @@
<div class="styled"></div>
<script>
var css_test = async_test("Image from external stylesheet.");
var id = token();
var url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
var css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id;
var img_url = url_prefix + "/referrer-policy/generic/subresource/image.py" +
"?id=" + id + "&report-headers";
async_test(function(css_test) {
var id = token();
var url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
var css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id;
var img_url = url_prefix + "/referrer-policy/generic/subresource/image.py" +
"?id=" + id + "&report-headers";
var link = document.createElement("link");
link.href = css_url;
link.rel = "stylesheet";
link.onload = function() {
css_test.step_timeout(
queryXhr.bind(this, img_url,
function(message) {
css_test.step(function() {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, css_url);
});
css_test.done();
}),
1000);
};
document.head.appendChild(link);
var link = document.createElement("link");
link.href = css_url;
link.rel = "stylesheet";
link.onload = css_test.step_func(function() {
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.head.appendChild(link);
}, "Image from external stylesheet.");
</script>
<div id="log"></div>

View file

@ -16,25 +16,23 @@
<div class="styled"></div>
<script>
var css_test = async_test("Image from inline styles.");
var id = token();
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";
async_test(function(css_test) {
var id = token();
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 div = document.querySelector("div.styled");
div.style = "content:url(" + css_url + ")";
css_test.step_timeout(
queryXhr.bind(this, img_url,
function(message) {
css_test.step(function() {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, location.origin + "/");
});
css_test.done();
}),
1000);
</script>
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.");
</script>
<div id="log"></div>
</body>

View file

@ -17,28 +17,26 @@
<div class="styled"></div>
<script>
var css_test = async_test("Image from imported stylesheet (internal).");
var id = token();
var url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port + "/referrer-policy/generic/subresource/";
var css_url = url_prefix + "stylesheet.py?id=" + id;
var img_url = url_prefix + "image.py?report-headers&id=" + id;
async_test(function(css_test) {
var id = token();
var url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port + "/referrer-policy/generic/subresource/";
var css_url = url_prefix + "stylesheet.py?id=" + id;
var img_url = url_prefix + "image.py?report-headers&id=" + id;
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(
queryXhr.bind(this, img_url,
function(message) {
css_test.step(function() {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, css_url);
});
css_test.done();
}),
1000);
</script>
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).");
</script>
<div id="log"></div>
</body>

View file

@ -16,27 +16,25 @@
<div class="styled"></div>
<script>
var css_test = async_test("Image from internal stylesheet.");
var id = token();
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";
async_test(function(css_test) {
var id = token();
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 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(
queryXhr.bind(this, img_url,
function(message) {
css_test.step(function() {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, location.origin + "/");
});
css_test.done();
}),
1000);
</script>
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.");
</script>
<div id="log"></div>
</body>

View file

@ -14,24 +14,22 @@
the referrer and referrer policy from the document.</p>
<script>
var css_test = async_test("Image from presentation attributes.");
var id = token();
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";
async_test(function(css_test) {
var id = token();
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";
document.body.background = css_url;
css_test.step_timeout(
queryXhr.bind(this, img_url,
function(message) {
css_test.step(function() {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, location.origin + "/");
});
css_test.done();
}),
1000);
</script>
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.");
</script>
<div id="log"></div>
</body>

View file

@ -17,26 +17,24 @@
<div class="styled"></div>
<script>
var css_test = async_test("Image from external stylesheet (from ProcessingInstruction).");
var id = token();
var url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
var css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id;
var img_url = url_prefix + "/referrer-policy/generic/subresource/image.py" +
"?id=" + id + "&report-headers";
async_test(function(css_test) {
var id = token();
var url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
var css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id;
var img_url = url_prefix + "/referrer-policy/generic/subresource/image.py" +
"?id=" + id + "&report-headers";
var processingInstruction = document.createProcessingInstruction("xml-stylesheet", "href=\"" + css_url + "\" type=\"text/css\"");
css_test.step_timeout(
queryXhr.bind(this, img_url,
function(message) {
css_test.step(function() {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, css_url);
});
css_test.done();
}),
1000);
document.insertBefore(processingInstruction, document.firstChild);
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);
}, "Image from external stylesheet (from ProcessingInstruction).");
</script>
<div id="log"></div>