mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
Wrap more of the referrer-policy tests in testharness.js.
This commit is contained in:
parent
bffe2a699e
commit
3cd6df1ef9
30 changed files with 540 additions and 583 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue