implement opener, disowning

This commit is contained in:
Gregory Terzian 2018-06-02 20:56:00 +08:00
parent f408b798c4
commit 21bf5a3a4b
32 changed files with 273 additions and 143 deletions

View file

@ -279733,6 +279733,11 @@
{}
]
],
"html/browsers/windows/auxiliary-browsing-contexts/resources/opener-setter.html": [
[
{}
]
],
"html/browsers/windows/browsing-context-names/resources/choose-_parent-001-iframe-1.html": [
[
{}
@ -352032,6 +352037,12 @@
{}
]
],
"html/browsers/windows/auxiliary-browsing-contexts/opener-setter.html": [
[
"/html/browsers/windows/auxiliary-browsing-contexts/opener-setter.html",
{}
]
],
"html/browsers/windows/auxiliary-browsing-contexts/opener-setter.window.js": [
[
"/html/browsers/windows/auxiliary-browsing-contexts/opener-setter.window.html",
@ -587647,6 +587658,10 @@
"f82aa6f0abe0d16a8b132e531d165988af0af99f",
"testharness"
],
"html/browsers/windows/auxiliary-browsing-contexts/opener-setter.html": [
"85c52e0b42e19bdd78dda120320d66ddbb2103b4",
"testharness"
],
"html/browsers/windows/auxiliary-browsing-contexts/opener-setter.window.js": [
"6d540ce97c94bff5845023098d0960d51dad62b4",
"testharness"
@ -587675,6 +587690,10 @@
"6f43a5188c790577c4a1a03da270317eedba0fb0",
"support"
],
"html/browsers/windows/auxiliary-browsing-contexts/resources/opener-setter.html": [
"4112dae0cee66138a309b202a8d09d6b256c6d4d",
"support"
],
"html/browsers/windows/browsing-context-names/choose-_blank-001.html": [
"a1416f2eb8437a8824a26a0e2e6aa6fdede37ffa",
"testharness"

View file

@ -0,0 +1,3 @@
[005.html]
type: testharness
expected: ERROR

View file

@ -2,4 +2,3 @@
type: testharness
[Link with onclick javascript url and href navigation ]
expected: FAIL

View file

@ -1,5 +1,5 @@
[opener-closed.html]
type: testharness
expected: TIMEOUT
expected: CRASH
[An auxiliary browsing context should report `null` for `window.opener` when that browsing context is discarded]
expected: TIMEOUT
expected: CRASH

View file

@ -1,5 +0,0 @@
[opener-multiple.html]
type: testharness
expected: TIMEOUT
[An auxiliary browsing context should be able to open another auxiliary browsing context]
expected: TIMEOUT

View file

@ -1,6 +0,0 @@
[opener-noreferrer.html]
type: testharness
expected: TIMEOUT
[Auxiliary browsing context created with `rel="noreferrer"` should report `window.opener` `null`]
expected: TIMEOUT

View file

@ -1,22 +0,0 @@
[opener-setter.window.html]
[Setting window.opener to undefined]
expected: FAIL
[Setting window.opener to 42]
expected: FAIL
[Setting window.opener to function () { return "hi" }]
expected: FAIL
[Setting window.opener to hi]
expected: FAIL
[Setting window.opener to [object Object\]]
expected: FAIL
[Setting window.opener to ]
expected: FAIL
[Setting window.opener to Symbol()]
expected: FAIL

View file

@ -1,7 +0,0 @@
[opener.html]
type: testharness
expected: TIMEOUT
[Newly-created auxiliary browsing context should report `window.opener`]
expected: TIMEOUT
[Browsing context created with `window.open` should report `window.opener`]
expected: FAIL

View file

@ -1,8 +0,0 @@
[choose-_blank-001.html]
type: testharness
[window.open into `_blank` should create a new browsing context each time]
expected: FAIL
[`_blank` should be ASCII case-insensitive]
expected: FAIL

View file

@ -1,6 +0,0 @@
[choose-_blank-002.html]
type: testharness
expected: TIMEOUT
[Context for opened noreferrer link targeted to "_blank" should not have opener reference]
expected: TIMEOUT

View file

@ -1,6 +0,0 @@
[choose-_blank-003.html]
type: testharness
expected: TIMEOUT
[Context created by link targeting "_blank" should retain opener reference]
expected: TIMEOUT

View file

@ -1,6 +0,0 @@
[choose-_parent-001.html]
type: testharness
expected: TIMEOUT
[The parent browsing context must be chosen if the given name is `_parent`]
expected: TIMEOUT

View file

@ -1,6 +0,0 @@
[choose-_parent-002.html]
type: testharness
expected: ERROR
[choosing _parent context: multiple nested contexts]
expected: FAIL

View file

@ -1,6 +0,0 @@
[choose-_parent-003.html]
type: testharness
expected: ERROR
[_parent should reuse window.parent context]
expected: FAIL

View file

@ -1,6 +0,0 @@
[choose-_parent-004.html]
type: testharness
expected: TIMEOUT
[choosing _parent context should be case-insensitive]
expected: TIMEOUT

View file

@ -1,6 +0,0 @@
[choose-_self-002.html]
type: testharness
expected: TIMEOUT
[choosing _self context should be case-insensitive]
expected: TIMEOUT

View file

@ -1,5 +0,0 @@
[choose-_top-001.html]
type: testharness
[Should choose current browsing context for "_top" if current is top]
expected: FAIL

View file

@ -1,5 +0,0 @@
[choose-_top-002.html]
type: testharness
[Should choose top browsing context for "_top" if current is not top]
expected: FAIL

View file

@ -1,5 +0,0 @@
[choose-_top-003.html]
type: testharness
[choosing _top context should be case-insensitive]
expected: FAIL

View file

@ -1,6 +0,0 @@
[noreferrer-null-opener.html]
type: testharness
expected: TIMEOUT
[rel=noreferrer nullifies window.opener]
expected: TIMEOUT

View file

@ -1,5 +1,4 @@
[targeting-cross-origin-nested-browsing-contexts.html]
type: testharness
expected: TIMEOUT
[Targeting nested browsing contexts]
expected: FAIL

View file

@ -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>

View file

@ -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>