mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +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
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 + "&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 + "&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>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 + "&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 + "&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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 = "<meta name='referrer' content='" + iframePolicy + "'>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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,26 +13,28 @@
|
|||
<h1>Referrer Policy: A document with an opaque origin doesn't send referrers</h1>
|
||||
<script>
|
||||
function testSandboxedIframe(description, sandboxAttributes, expectedReferrer) {
|
||||
var test = async_test(description);
|
||||
window.addEventListener("message", test.step_func((msg) => {
|
||||
if (msg.data.description === description) {
|
||||
assert_equals(msg.data.referrer, expectedReferrer);
|
||||
test.done();
|
||||
}
|
||||
}));
|
||||
async_test(function(test) {
|
||||
window.addEventListener("message", test.step_func((msg) => {
|
||||
if (msg.data.description === description) {
|
||||
assert_equals(msg.data.referrer, expectedReferrer);
|
||||
test.done();
|
||||
}
|
||||
}));
|
||||
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.sandbox = sandboxAttributes;
|
||||
iframe.srcdoc = `
|
||||
<meta name = "referrer" content = "always">
|
||||
<script src = "/referrer-policy/generic/common.js"></` + `script>
|
||||
<script>
|
||||
var urlPath = "/referrer-policy/generic/subresource/xhr.py";
|
||||
var url = "${location.protocol}//www1.${location.hostname}:${location.port}" + urlPath;
|
||||
queryXhr(url, (msg) => {
|
||||
parent.postMessage({referrer: msg.referrer, description: "${description}"}, "*")});
|
||||
</` + "script>";
|
||||
document.body.appendChild(iframe);
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.sandbox = sandboxAttributes;
|
||||
iframe.srcdoc = `
|
||||
<meta name = "referrer" content = "always">
|
||||
<script src = "/referrer-policy/generic/common.js"></` + `script>
|
||||
<script>
|
||||
var urlPath = "/referrer-policy/generic/subresource/xhr.py";
|
||||
var url = "${location.protocol}//www1.${location.hostname}:${location.port}" + urlPath;
|
||||
queryXhr(url, (msg) => {
|
||||
parent.postMessage({referrer: msg.referrer, description: "${description}"}, "*")
|
||||
}, null, null, test);
|
||||
</` + "script>";
|
||||
document.body.appendChild(iframe);
|
||||
}, description);
|
||||
}
|
||||
|
||||
testSandboxedIframe("Sandboxed iframe with opaque origin doesn't send referrers.", "allow-scripts", undefined);
|
||||
|
|
|
@ -16,22 +16,21 @@
|
|||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var messaging_test = async_test("Area is responding with HTTP headers");
|
||||
var urlPath = '/referrer-policy/generic/subresource/document.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryAreaLink(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"
|
||||
messaging_test.step(function() {
|
||||
async_test(function(messaging_test) {
|
||||
var urlPath = '/referrer-policy/generic/subresource/document.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryAreaLink(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")
|
||||
});
|
||||
messaging_test.done();
|
||||
});
|
||||
messaging_test.done();
|
||||
}, null, null, messaging_test);
|
||||
}, "Area is responding with HTTP headers");
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
|
|
|
@ -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");
|
||||
})();
|
||||
</script>
|
||||
|
||||
|
|
|
@ -16,22 +16,21 @@
|
|||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var messaging_test = async_test("Iframe is responding with HTTP headers");
|
||||
var urlPath = '/referrer-policy/generic/subresource/document.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryIframe(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"
|
||||
messaging_test.step(function() {
|
||||
async_test(function(messaging_test) {
|
||||
var urlPath = '/referrer-policy/generic/subresource/document.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryIframe(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")
|
||||
});
|
||||
messaging_test.done();
|
||||
});
|
||||
messaging_test.done();
|
||||
}, null, null, messaging_test);
|
||||
}, "Iframe is responding with HTTP headers");
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
|
|
|
@ -16,22 +16,21 @@
|
|||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var messaging_test = async_test("Image is encoding headers as JSON.");
|
||||
var urlPath = '/referrer-policy/generic/subresource/image.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath + "?cache_destroyer=" + (new Date()).getTime();
|
||||
queryImage(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"
|
||||
messaging_test.step(function() {
|
||||
async_test(function(messaging_test) {
|
||||
var urlPath = '/referrer-policy/generic/subresource/image.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath + "?cache_destroyer=" + (new Date()).getTime();
|
||||
queryImage(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")
|
||||
});
|
||||
messaging_test.done();
|
||||
}, null, "always", messaging_test);
|
||||
messaging_test.done();
|
||||
}, null, "always", messaging_test);
|
||||
}, "Image is encoding headers as JSON.");
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
|
|
|
@ -16,22 +16,21 @@
|
|||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var messaging_test = async_test("Link is responding with HTTP headers");
|
||||
var urlPath = '/referrer-policy/generic/subresource/document.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryLink(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"
|
||||
messaging_test.step(function() {
|
||||
async_test(function(messaging_test) {
|
||||
var urlPath = '/referrer-policy/generic/subresource/document.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryLink(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")
|
||||
});
|
||||
messaging_test.done();
|
||||
});
|
||||
messaging_test.done();
|
||||
}, null, null, messaging_test);
|
||||
}, "Link is responding with HTTP headers");
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
|
|
|
@ -16,22 +16,21 @@
|
|||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var messaging_test = async_test("Script is responding with HTTP headers");
|
||||
var urlPath = '/referrer-policy/generic/subresource/script.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryScript(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"
|
||||
messaging_test.step(function() {
|
||||
async_test(function(messaging_test) {
|
||||
var urlPath = '/referrer-policy/generic/subresource/script.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryScript(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")
|
||||
});
|
||||
messaging_test.done();
|
||||
});
|
||||
messaging_test.done();
|
||||
}, null, null, messaging_test);
|
||||
}, "Script is responding with HTTP headers");
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
|
|
|
@ -16,22 +16,21 @@
|
|||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var messaging_test = async_test("Worker is responding with HTTP headers");
|
||||
var urlPath = '/referrer-policy/generic/subresource/worker.py';
|
||||
var url = location.protocol + "//" + location.hostname + ":" +
|
||||
location.port + urlPath;
|
||||
queryWorker(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"
|
||||
messaging_test.step(function() {
|
||||
async_test(function(messaging_test) {
|
||||
var urlPath = '/referrer-policy/generic/subresource/worker.py';
|
||||
var url = location.protocol + "//" + location.hostname + ":" +
|
||||
location.port + urlPath;
|
||||
queryWorker(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")
|
||||
});
|
||||
messaging_test.done();
|
||||
});
|
||||
messaging_test.done();
|
||||
}, null, null, messaging_test);
|
||||
}, "Worker is responding with HTTP headers");
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
|
|
|
@ -16,22 +16,21 @@
|
|||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var messaging_test = async_test("XHR is responding with HTTP headers");
|
||||
var urlPath = '/referrer-policy/generic/subresource/xhr.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryXhr(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"
|
||||
messaging_test.step(function() {
|
||||
async_test(function(messaging_test) {
|
||||
var urlPath = '/referrer-policy/generic/subresource/xhr.py';
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryXhr(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")
|
||||
});
|
||||
messaging_test.done();
|
||||
});
|
||||
messaging_test.done();
|
||||
}, null, null, messaging_test);
|
||||
}, "XHR is responding with HTTP headers");
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
|
|
|
@ -15,14 +15,15 @@
|
|||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var test = async_test("Image has a referrer despite CSP 'referrer' directive");
|
||||
var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime();
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryImage(url, test.step_func(function(message) {
|
||||
assert_equals(message.referrer, document.location.href);
|
||||
test.done();
|
||||
}), null, 'always', test);
|
||||
async_test(function(test) {
|
||||
var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime();
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryImage(url, function(message) {
|
||||
assert_equals(message.referrer, document.location.href);
|
||||
test.done();
|
||||
}, null, 'always', test);
|
||||
}, "Image has a referrer despite CSP 'referrer' directive");
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue