mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Update web-platform-tests to revision 58eb04cecbbec2e18531ab440225e38944a9c444
This commit is contained in:
parent
25e8bf69e6
commit
665817d2a6
35333 changed files with 1818077 additions and 16036 deletions
|
@ -0,0 +1,31 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<html>
|
||||
<head>
|
||||
<title>Auxiliary Browing Contexts: window.opener when Opener Removed/Closed</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var prefixedLocalStorage;
|
||||
setup (() => prefixedLocalStorage = new PrefixedLocalStorageTest());
|
||||
async_test(t => {
|
||||
t.add_cleanup (() => prefixedLocalStorage.cleanup());
|
||||
var a = document.createElement('a');
|
||||
a.href = prefixedLocalStorage.url('resources/open-closer.html');
|
||||
a.target = '_blank';
|
||||
prefixedLocalStorage.onSet('openerIsNull', t.step_func_done(e => {
|
||||
// The window for this auxiliary browsing context's opener
|
||||
// has been closed and discarded, so the aux browsing context
|
||||
// should now report `null` for `window.opener`
|
||||
assert_equals(e.newValue, 'true');
|
||||
}));
|
||||
document.body.append(a);
|
||||
a.click();
|
||||
}, 'An auxiliary browsing context should report `null` for `window.opener` when that browsing context is discarded');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,35 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Auxiliary Browing Contexts: window.opener, multiple</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var prefixedLocalStorage;
|
||||
setup (() => prefixedLocalStorage = new PrefixedLocalStorageTest());
|
||||
async_test(t => {
|
||||
t.add_cleanup (() => prefixedLocalStorage.cleanup());
|
||||
var a = document.createElement('a');
|
||||
a.href = prefixedLocalStorage.url('resources/multiple-opener.html');
|
||||
a.target = 'multipleOpener';
|
||||
window.name = 'topOpener';
|
||||
document.body.appendChild(a);
|
||||
window.addEventListener('message', t.step_func_done(e => {
|
||||
var aux1 = e.data.aux1; // First opened context
|
||||
var aux2 = e.data.aux2; // Context opened by first-opened context
|
||||
assert_equals(aux1.name, 'multipleOpener');
|
||||
assert_equals(aux1.openerName, window.name);
|
||||
assert_equals(aux1.isTop, true);
|
||||
assert_equals(aux2.name, 'multipleOpenee');
|
||||
assert_equals(aux2.openerName, aux1.name);
|
||||
assert_equals(aux2.isTop, true);
|
||||
}));
|
||||
a.click();
|
||||
}, 'An auxiliary browsing context should be able to open another auxiliary browsing context');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,25 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Auxiliary Browing Contexts: window.opener noopener</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var prefixedLocalStorage;
|
||||
setup(() => prefixedLocalStorage = new PrefixedLocalStorageTest());
|
||||
async_test(t => {
|
||||
t.add_cleanup(() => prefixedLocalStorage.cleanup());
|
||||
prefixedLocalStorage.onSet('openerIsNull', t.step_func_done(e => {
|
||||
assert_equals(e.newValue, 'true');
|
||||
}));
|
||||
window.open(prefixedLocalStorage.url('resources/no-opener.html'),
|
||||
'iShouldNotHaveAnOpener',
|
||||
'noopener');
|
||||
}, 'Auxiliary browsing context created via `window.open` setting `noopener` should report `window.opener` `null`');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,29 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Auxiliary Browing Contexts: window.opener noreferrer</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var prefixedLocalStorage;
|
||||
setup(() => prefixedLocalStorage = new PrefixedLocalStorageTest());
|
||||
async_test(t => {
|
||||
t.add_cleanup(() => prefixedLocalStorage.cleanup());
|
||||
var a = document.createElement('a');
|
||||
a.href = prefixedLocalStorage.url('resources/no-opener.html');
|
||||
a.target = '_blank';
|
||||
a.rel = 'noreferrer';
|
||||
window.name = 'topWindow';
|
||||
document.body.appendChild(a);
|
||||
prefixedLocalStorage.onSet('openerIsNull', t.step_func_done(e => {
|
||||
assert_equals(e.newValue, 'true');
|
||||
}));
|
||||
a.click();
|
||||
}, 'Auxiliary browsing context created with `rel="noreferrer"` should report `window.opener` `null`');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,55 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Auxiliary Browing Contexts: window.opener</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var prefixedLocalStorage;
|
||||
setup (() => {
|
||||
window.name = 'topWindow';
|
||||
prefixedLocalStorage = new PrefixedLocalStorageTest();
|
||||
});
|
||||
|
||||
function cleanup () {
|
||||
prefixedLocalStorage.setItem('closeAll', 'true');
|
||||
prefixedLocalStorage.clear();
|
||||
}
|
||||
|
||||
function testOpener (t, target) {
|
||||
t.add_cleanup(cleanup);
|
||||
window.addEventListener('message', t.step_func(e => {
|
||||
if (e.data.name === target) {
|
||||
// The opener IDL attribute...must return the WindowProxy object of the
|
||||
// browsing context from which the current browsing context was created
|
||||
assert_equals(e.data.openerName, 'topWindow');
|
||||
// Auxiliary browsing contexts are always top-level browsing contexts
|
||||
assert_equals(e.data.isTop, true);
|
||||
t.done();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
async_test(t => {
|
||||
var target = 'windowOpenerA';
|
||||
var a = document.createElement('a');
|
||||
a.href = prefixedLocalStorage.url('resources/message-window-opener.html');
|
||||
a.target = target;
|
||||
document.body.appendChild(a);
|
||||
testOpener(t, target);
|
||||
a.click();
|
||||
}, 'Newly-created auxiliary browsing context should report `window.opener`');
|
||||
|
||||
async_test(t => {
|
||||
var target = 'windowOpenerB';
|
||||
testOpener(t, target);
|
||||
window.open(prefixedLocalStorage.url('resources/message-window-opener.html'),
|
||||
target);
|
||||
}, 'Browsing context created with `window.open` should report `window.opener`');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,30 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<html>
|
||||
<body onload="closeOpener()">
|
||||
<p>This window should close its opener.</p>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<script>
|
||||
var prefixedLocalStorage = new PrefixedLocalStorageResource({
|
||||
close_on_cleanup: true
|
||||
});
|
||||
var prefixedLocalStorage = new PrefixedLocalStorageResource({
|
||||
close_on_cleanup: true
|
||||
});
|
||||
function closeOpener () {
|
||||
if (window.opener) {
|
||||
window.opener.close();
|
||||
|
||||
// Give the browsing context a chance to dispose of itself
|
||||
function waitForContextDiscard () {
|
||||
if (window.opener === null) {
|
||||
return prefixedLocalStorage.setItem('openerIsNull', 'true');
|
||||
}
|
||||
return setTimeout(waitForContextDiscard, 0);
|
||||
}
|
||||
waitForContextDiscard();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,14 @@
|
|||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<script>
|
||||
var prefixedLocalStorage = new PrefixedLocalStorageResource({
|
||||
close_on_cleanup: true
|
||||
});
|
||||
|
||||
if (window.opener) {
|
||||
window.opener.postMessage ({
|
||||
name : window.name,
|
||||
openerName: window.opener.name,
|
||||
isTop : window.top === window
|
||||
}, '*');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,32 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<body onload="openNested()">
|
||||
<script>
|
||||
var prefixedLocalStorage = new PrefixedLocalStorageResource({
|
||||
close_on_cleanup: true
|
||||
});
|
||||
function openNested () {
|
||||
// Listen for message from opened context and pass through to this
|
||||
// context's opener
|
||||
window.addEventListener('message', (e) => {
|
||||
if (window.opener) {
|
||||
window.opener.postMessage({
|
||||
aux2: e.data, // From multipleOpenee
|
||||
aux1: { // This context
|
||||
name : window.name,
|
||||
openerName : window.opener.name,
|
||||
isTop : window.top === window
|
||||
}
|
||||
}, '*');
|
||||
}
|
||||
});
|
||||
var a = document.createElement('a');
|
||||
a.target = 'multipleOpenee';
|
||||
a.href = prefixedLocalStorage.url('message-window-opener.html');
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,16 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<html>
|
||||
<p>This window should have no opener.</p>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<script>
|
||||
var prefixedLocalStorage = new PrefixedLocalStorageResource({
|
||||
close_on_cleanup: true
|
||||
});
|
||||
function checkOpener () {
|
||||
return prefixedLocalStorage.setItem('openerIsNull', window.opener === null);
|
||||
}
|
||||
</script>
|
||||
<body onload="checkOpener()">
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,17 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<html>
|
||||
<body onload="openAuxiliary()">
|
||||
<a target="_blank">Open auxiliary context that will close this window (its opener)</a>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<script>
|
||||
function openAuxiliary () {
|
||||
var prefixedLocalStorage = new PrefixedLocalStorageResource();
|
||||
var a = document.body.querySelector('a');
|
||||
a.href = prefixedLocalStorage.url('close-opener.html');
|
||||
document.body.append(a);
|
||||
a.click();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue