mirror of
https://github.com/servo/servo.git
synced 2025-09-01 10:38:25 +01:00
Update web-platform-tests to revision 3cb5a99e5521936fb8819de8aaba806050b84184
This commit is contained in:
parent
1d2c0ba0bc
commit
c700482629
204 changed files with 5112 additions and 1445 deletions
|
@ -0,0 +1,22 @@
|
|||
<!doctype html>
|
||||
<title>API availability following history traversal</title>
|
||||
<meta charset=utf-8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<p>Test requires popup blocker disabled</p>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
var hasNavigated = false;
|
||||
var child;
|
||||
t.step(function() {
|
||||
child = window.open("resources/api-availability-1.html");
|
||||
t.add_cleanup(function() {
|
||||
child.close();
|
||||
});
|
||||
});
|
||||
navigate = t.step_func(function() {
|
||||
hasNavigated = true;
|
||||
child.location = child.location.href.replace("api-availability-1.html", "api-availability-2.html");
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,31 @@
|
|||
<!doctype html>
|
||||
<title>API availability following history traversal - 1</title>
|
||||
<script>
|
||||
var controller = opener;
|
||||
var t = controller.t;
|
||||
var assert_not_equals = controller.assert_not_equals;
|
||||
|
||||
t.step(function() {
|
||||
// If this document is discarded as a result of navigation, then this script
|
||||
// will be executed a second time. The semantics this test intends to verify
|
||||
// cannot be observed under these conditions, the discarding is not itself a
|
||||
// violation. Silently pass the test in that case.
|
||||
if (controller.hasNavigated) {
|
||||
t.done();
|
||||
return;
|
||||
}
|
||||
|
||||
t.step_timeout(function() {
|
||||
assert_not_equals(window.history, null, 'history');
|
||||
assert_not_equals(window.localStorage, null, 'localStorage');
|
||||
assert_not_equals(window.location, null, 'location');
|
||||
assert_not_equals(window.navigator, null, 'navigator');
|
||||
assert_not_equals(window.opener, null, 'opener');
|
||||
assert_not_equals(window.sessionStorage, null, 'sessionStorage');
|
||||
|
||||
t.done();
|
||||
}, 1000);
|
||||
|
||||
controller.navigate();
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
<!doctype html>
|
||||
<title>API availability following history traversal - 2</title>
|
||||
<body onload="history.back()"></body>
|
|
@ -23,6 +23,8 @@
|
|||
var frameWin = document.getElementById("srcdoc-iframe").contentWindow;
|
||||
assert_equals(frameWin.location.href, "about:srcdoc");
|
||||
assert_equals(frameWin.scrollY, 0, "Should not have scrolled yet");
|
||||
frameWin.location.hash = "";
|
||||
assert_equals(frameWin.location.href, "about:srcdoc#", "Setting an empty hash should result in an empty fragment, not no fragment.");
|
||||
frameWin.location.hash = "test";
|
||||
assert_equals(frameWin.location.href, "about:srcdoc#test");
|
||||
assert_true(frameWin.scrollY > frameWin.innerHeight,
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
const SAME_ORIGIN = {origin: get_host_info().HTTP_ORIGIN, name: "SAME_ORIGIN"};
|
||||
const SAME_SITE = {origin: get_host_info().HTTP_REMOTE_ORIGIN, name: "SAME_SITE"};
|
||||
const CROSS_ORIGIN = {origin: get_host_info().HTTP_NOTSAMESITE_ORIGIN, name: "CROSS_ORIGIN"}
|
||||
|
||||
function coop_test(t, host, coop, channelName, hasOpener) {
|
||||
let bc = new BroadcastChannel(channelName);
|
||||
bc.onmessage = t.step_func_done((event) => {
|
||||
let payload = event.data;
|
||||
assert_equals(payload.name, hasOpener ? channelName : "");
|
||||
assert_equals(payload.opener, hasOpener);
|
||||
});
|
||||
|
||||
let w = window.open(`${host.origin}/html/cross-origin-opener/resources/coop_window.py?path=window.sub.html&coop=${escape(coop)}&channel=${channelName}`, channelName);
|
||||
|
||||
// w will be closed by its postback iframe. When out of process,
|
||||
// window.close() does not work.
|
||||
t.add_cleanup(() => w.close());
|
||||
}
|
||||
|
||||
function run_coop_tests(mainTest, testArray) {
|
||||
for (let test of tests) {
|
||||
async_test(t => {
|
||||
coop_test(t, test[0], test[1],
|
||||
`${mainTest}_to_${test[0].name}_${test[1].replace(/ /g,"-")}`,
|
||||
test[2]);
|
||||
}, `${mainTest} document opening popup to ${test[0].origin} with COOP: "${test[1]}"`);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
|
||||
<script src="common.sub.js"></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script>
|
||||
|
||||
let tests = [
|
||||
// popup Origin, popup COOP, expect opener
|
||||
[SAME_ORIGIN, "", true],
|
||||
[SAME_ORIGIN, "jibberish", true],
|
||||
[SAME_ORIGIN, "same-site", false],
|
||||
[SAME_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[SAME_ORIGIN, "same-origin", false],
|
||||
[SAME_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[SAME_SITE, "", true],
|
||||
[SAME_SITE, "jibberish", true],
|
||||
[SAME_SITE, "same-site", false],
|
||||
[SAME_SITE, "same-site unsafe-allow-outgoing", false],
|
||||
[SAME_SITE, "same-origin", false],
|
||||
[SAME_SITE, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[CROSS_ORIGIN, "", true],
|
||||
[CROSS_ORIGIN, "jibberish", true],
|
||||
[CROSS_ORIGIN, "same-site", false],
|
||||
[CROSS_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[CROSS_ORIGIN, "same-origin", false],
|
||||
[CROSS_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
];
|
||||
|
||||
run_coop_tests("null", tests);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
|
||||
<script src="common.sub.js"></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script>
|
||||
|
||||
let tests = [
|
||||
// popup Origin, popup COOP, expect opener
|
||||
[SAME_ORIGIN, "", false],
|
||||
[SAME_ORIGIN, "jibberish", false],
|
||||
[SAME_ORIGIN, "same-site", false],
|
||||
[SAME_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[SAME_ORIGIN, "same-origin", true],
|
||||
[SAME_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[SAME_SITE, "", false],
|
||||
[SAME_SITE, "jibberish", false],
|
||||
[SAME_SITE, "same-site", false],
|
||||
[SAME_SITE, "same-site unsafe-allow-outgoing", false],
|
||||
[SAME_SITE, "same-origin", false],
|
||||
[SAME_SITE, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[CROSS_ORIGIN, "", false],
|
||||
[CROSS_ORIGIN, "jibberish", false],
|
||||
[CROSS_ORIGIN, "same-site", false],
|
||||
[CROSS_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[CROSS_ORIGIN, "same-origin", false],
|
||||
[CROSS_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
];
|
||||
|
||||
run_coop_tests("same-origin", tests);
|
||||
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
Cross-Origin-Opener-Policy: same-origin
|
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
|
||||
<script src="common.sub.js"></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script>
|
||||
|
||||
let tests = [
|
||||
// popup Origin, popup COOP, expect opener
|
||||
[SAME_ORIGIN, "", true],
|
||||
[SAME_ORIGIN, "jibberish", true],
|
||||
[SAME_ORIGIN, "same-site", false],
|
||||
[SAME_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[SAME_ORIGIN, "same-origin", false],
|
||||
[SAME_ORIGIN, "same-origin unsafe-allow-outgoing", true],
|
||||
|
||||
[SAME_SITE, "", true],
|
||||
[SAME_SITE, "jibberish", true],
|
||||
[SAME_SITE, "same-site", false],
|
||||
[SAME_SITE, "same-site unsafe-allow-outgoing", false],
|
||||
[SAME_SITE, "same-origin", false],
|
||||
[SAME_SITE, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[CROSS_ORIGIN, "", true],
|
||||
[CROSS_ORIGIN, "jibberish", true],
|
||||
[CROSS_ORIGIN, "same-site", false],
|
||||
[CROSS_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[CROSS_ORIGIN, "same-origin", false],
|
||||
[CROSS_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
];
|
||||
|
||||
run_coop_tests("same-origin_unsafe-allow-outgoing", tests);
|
||||
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
Cross-Origin-Opener-Policy: same-origin unsafe-allow-outgoing
|
|
@ -1,26 +0,0 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
const CHANNEL_NAME = "new_window_same_site";
|
||||
|
||||
async_test(t => {
|
||||
let w = window.open(`${get_host_info().HTTP_REMOTE_ORIGIN}/html/cross-origin-opener/resources/window.sub.html?channel=${CHANNEL_NAME}`, "window_name", "height=200,width=250");
|
||||
|
||||
// w will be closed by its postback iframe. When out of process,
|
||||
// window.close() does not work.
|
||||
t.add_cleanup(() => w.close());
|
||||
|
||||
let bc = new BroadcastChannel(CHANNEL_NAME);
|
||||
bc.onmessage = t.step_func_done((event) => {
|
||||
let payload = event.data;
|
||||
assert_equals(payload.name, "window_name");
|
||||
assert_equals(payload.opener, true);
|
||||
});
|
||||
}, "same-site policy works");
|
||||
|
||||
</script>
|
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
|
||||
<script src="common.sub.js"></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script>
|
||||
|
||||
let tests = [
|
||||
// popup Origin, popup COOP, expect opener
|
||||
[SAME_ORIGIN, "", false],
|
||||
[SAME_ORIGIN, "jibberish", false],
|
||||
[SAME_ORIGIN, "same-site", true],
|
||||
[SAME_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[SAME_ORIGIN, "same-origin", false],
|
||||
[SAME_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[SAME_SITE, "", false],
|
||||
[SAME_SITE, "jibberish", false],
|
||||
[SAME_SITE, "same-site", true],
|
||||
[SAME_SITE, "same-site unsafe-allow-outgoing", false],
|
||||
[SAME_SITE, "same-origin", false],
|
||||
[SAME_SITE, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[CROSS_ORIGIN, "", false],
|
||||
[CROSS_ORIGIN, "jibberish", false],
|
||||
[CROSS_ORIGIN, "same-site", false],
|
||||
[CROSS_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[CROSS_ORIGIN, "same-origin", false],
|
||||
[CROSS_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
];
|
||||
|
||||
run_coop_tests("same-site", tests);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
|
||||
<script src="common.sub.js"></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script>
|
||||
|
||||
let tests = [
|
||||
// popup Origin, popup COOP, expect opener
|
||||
[SAME_ORIGIN, "", true],
|
||||
[SAME_ORIGIN, "jibberish", true],
|
||||
[SAME_ORIGIN, "same-site", false],
|
||||
[SAME_ORIGIN, "same-site unsafe-allow-outgoing", true],
|
||||
[SAME_ORIGIN, "same-origin", false],
|
||||
[SAME_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[SAME_SITE, "", true],
|
||||
[SAME_SITE, "jibberish", true],
|
||||
[SAME_SITE, "same-site", false],
|
||||
[SAME_SITE, "same-site unsafe-allow-outgoing", true],
|
||||
[SAME_SITE, "same-origin", false],
|
||||
[SAME_SITE, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[CROSS_ORIGIN, "", true],
|
||||
[CROSS_ORIGIN, "jibberish", true],
|
||||
[CROSS_ORIGIN, "same-site", false],
|
||||
[CROSS_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[CROSS_ORIGIN, "same-origin", false],
|
||||
[CROSS_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
];
|
||||
|
||||
run_coop_tests("same-site_unsafe-allow-outgoing", tests);
|
||||
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
Cross-Origin-Opener-Policy: same-site unsafe-allow-outgoing
|
|
@ -0,0 +1,10 @@
|
|||
import urllib
|
||||
import os.path
|
||||
|
||||
def main(request, response):
|
||||
coop = request.GET.first('coop')
|
||||
if coop:
|
||||
response.headers.set('Cross-Origin-Opener-Policy', urllib.unquote(coop))
|
||||
|
||||
path = os.path.join(os.path.dirname(__file__), request.GET.first('path'))
|
||||
response.content = open(path, mode='rb').read()
|
|
@ -2,17 +2,17 @@
|
|||
<meta charset=utf-8>
|
||||
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
<div id="status"> </div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.onload = () => {
|
||||
let payload = { name: self.name, opener: !!self.opener };
|
||||
iframe.contentWindow.postMessage(payload, "*");
|
||||
};
|
||||
let channelName = new URL(location).searchParams.get("channel");
|
||||
iframe.src = `${get_host_info().HTTP_ORIGIN}/html/cross-origin-opener/resources/postback.sub.html?channel=${channelName}`;
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
window.addEventListener('load', function() {
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.onload = () => {
|
||||
let payload = { name: self.name, opener: !!self.opener };
|
||||
iframe.contentWindow.postMessage(payload, "*");
|
||||
};
|
||||
let channelName = new URL(location).searchParams.get("channel");
|
||||
iframe.src = `${get_host_info().HTTP_ORIGIN}/html/cross-origin-opener/resources/postback.sub.html?channel=${channelName}`;
|
||||
document.body.appendChild(iframe);
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue