mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
implement opener, disowning
This commit is contained in:
parent
f408b798c4
commit
21bf5a3a4b
32 changed files with 273 additions and 143 deletions
|
@ -0,0 +1,32 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Auxiliary Browing Contexts: window.opener setter</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/opener-setter.html'),
|
||||
'iShouldSetOpenerToNull');
|
||||
}, 'Auxiliary browsing context created via `window.open` and setting `window.opener` to `null` should report `window.opener` `null`');
|
||||
async_test(t => {
|
||||
t.add_cleanup(() => prefixedLocalStorage.cleanup());
|
||||
prefixedLocalStorage.onSet('openerIsTest', t.step_func_done(e => {
|
||||
assert_equals(e.newValue, 'true');
|
||||
}));
|
||||
window.open(prefixedLocalStorage.url('resources/opener-setter.html'),
|
||||
'iShouldSetOpenerToTest');
|
||||
}, 'Auxiliary browsing context created via `window.open` and setting `window.opener` to `test` should report `test`');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,23 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<html>
|
||||
<p>This window should set the window.opener attribute</p>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<script>
|
||||
var prefixedLocalStorage = new PrefixedLocalStorageResource({
|
||||
close_on_cleanup: true
|
||||
});
|
||||
function checkOpener () {
|
||||
if (window.name == 'iShouldSetOpenerToNull') {
|
||||
window.opener = null;
|
||||
return prefixedLocalStorage.setItem('openerIsNull', window.opener === null);
|
||||
}
|
||||
if (window.name == 'iShouldSetOpenerToTest') {
|
||||
window.opener = 'test';
|
||||
return prefixedLocalStorage.setItem('openerIsTest', window.opener === "test");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<body onload="checkOpener()">
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue