mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +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
|
@ -1,8 +0,0 @@
|
|||
<!doctype html>
|
||||
001-1
|
||||
<script>
|
||||
if (window.opener !== null) {
|
||||
window.opener.postMessage("FAIL", "*");
|
||||
}
|
||||
window.close();
|
||||
</script>
|
|
@ -1,22 +0,0 @@
|
|||
<!doctype html>
|
||||
<title>Link with target=_blank, rel=noreferrer</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<a href="001-1.html" rel="noreferrer" target="_blank">Link</a>
|
||||
<script>
|
||||
var t = async_test();
|
||||
var a;
|
||||
t.step(function() {
|
||||
a = document.getElementsByTagName("a")[0];
|
||||
a.click();
|
||||
//This is a bit hacky; if the test passes there isn't a link back to the parent
|
||||
//window so we have to pass on a timeout. But opening the link could be slow in
|
||||
//some cases, so there is some possibility of false passes
|
||||
setTimeout(t.step_func(function() {
|
||||
t.done();
|
||||
}), 1000);
|
||||
});
|
||||
|
||||
onmessage = t.step_func(function() {assert_unreached("Opened window had a reference to opener")});
|
||||
</script>
|
|
@ -1,8 +0,0 @@
|
|||
<!doctype html>
|
||||
002-1
|
||||
<script>
|
||||
if (window.opener !== null) {
|
||||
window.opener.postMessage("PASS", "*");
|
||||
}
|
||||
window.close();
|
||||
</script>
|
|
@ -1,25 +0,0 @@
|
|||
<!doctype html>
|
||||
<title>Link with target=_blank, no rel</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<a href="002-1.html" target="_blank">Link</a>
|
||||
<script>
|
||||
var a;
|
||||
async_test(function(t) {
|
||||
a = document.getElementsByTagName("a")[0];
|
||||
a.click();
|
||||
|
||||
// This is a bit hacky; if the test fails there isn't a link back to the parent
|
||||
// window so we have to pass on a timeout. But opening the link could be slow in
|
||||
// some cases, so there is some possibility of false fails
|
||||
step_timeout(t.step_func(function() {
|
||||
assert_unreached("Failed to get callback from opened window");
|
||||
}), 5000);
|
||||
|
||||
onmessage = t.step_func(function(e) {
|
||||
assert_equals(e.data, "PASS");
|
||||
t.done()
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -1,25 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: Choose browsing context - the given name is same as an existing browsing context's name</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<iframe src="existing.html" style="display:none"></iframe>
|
||||
<iframe name="existWin" style="display:none"></iframe>
|
||||
<script>
|
||||
|
||||
var t = async_test("The browsing context must be chosen if the given name is same as its name");
|
||||
|
||||
window.addEventListener("message", function (e) {
|
||||
t.step(function() {
|
||||
assert_equals(e.data.name, "existWin", "The browsing context name should be 'existWin'.");
|
||||
});
|
||||
t.done();
|
||||
}, false);
|
||||
|
||||
frames[0].onload = t.step_func(function(e) {
|
||||
frames[0].do_test();
|
||||
});
|
||||
|
||||
</script>
|
|
@ -1,20 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: Choose browsing context - the given name is '_parent'</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<iframe src="parent1.html" name="parentWin" style="display:none"></iframe>
|
||||
<script>
|
||||
|
||||
var t = async_test("The parent browsing context must be chosen if the given name is '_parent'");
|
||||
|
||||
window.addEventListener("message", function (e) {
|
||||
t.step(function() {
|
||||
assert_equals(e.data.name, "parentWin", "The browsing context name should be 'parentWin'.");
|
||||
});
|
||||
t.done();
|
||||
}, false);
|
||||
|
||||
</script>
|
|
@ -1,20 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: Choose browsing context - the given name is '_self'</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<iframe src="self1.html" style="display:none"></iframe>
|
||||
<script>
|
||||
|
||||
var t = async_test("The current browsing context must be chosen if the given name is '_self'");
|
||||
|
||||
window.addEventListener("message", function (e) {
|
||||
t.step(function () {
|
||||
assert_equals(e.data.name, "selfWin1", "The browsing context name should be 'selfWin1'.");
|
||||
});
|
||||
t.done();
|
||||
}, false);
|
||||
|
||||
</script>
|
|
@ -1,20 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: Choose browsing context - the given name is empty string</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<iframe src="self2.html" style="display:none"></iframe>
|
||||
<script>
|
||||
|
||||
var t = async_test("The current browsing context must be chosen if the given name is empty string");
|
||||
|
||||
window.addEventListener("message", function (e) {
|
||||
t.step(function () {
|
||||
assert_equals(e.data.name, "selfWin2", "The browsing context name should be 'selfWin2'.");
|
||||
});
|
||||
t.done();
|
||||
}, false);
|
||||
|
||||
</script>
|
|
@ -1,26 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: Browsing context - Default name</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<iframe src="message.html" style="display:none"></iframe>
|
||||
<script>
|
||||
|
||||
test(function () {
|
||||
assert_equals(window.frames[0].name, "", "The browsing context should not have a default name.");
|
||||
}, "A embedded browsing context has no default name");
|
||||
|
||||
test(function () {
|
||||
var win = window.open("about:blank", "_blank");
|
||||
assert_equals(win.name, "", "The browsing context should not have a name.");
|
||||
win.close();
|
||||
}, "A browsing context which is opened by window.open() method with '_blank' parameter has no default name");
|
||||
|
||||
//This test must be run when the current browsing context's name is not set
|
||||
test(function () {
|
||||
assert_equals(window.name, "", "The browsing context should not have a name.");
|
||||
}, "A browsing context has no default name");
|
||||
|
||||
</script>
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: Browsing context - `_blank` name keyword</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(t => {
|
||||
var window1 = window.open('about:blank', '_blank');
|
||||
var window2 = window.open('about:blank', '_blank');
|
||||
var window3 = window.open('about:blank', '_blank');
|
||||
t.add_cleanup(() => {
|
||||
window1.close();
|
||||
window2.close();
|
||||
window3.close();
|
||||
});
|
||||
assert_not_equals(window1, window2);
|
||||
assert_not_equals(window2, window3);
|
||||
assert_not_equals(window1, window3);
|
||||
}, 'window.open into `_blank` should create a new browsing context each time');
|
||||
|
||||
test(t => {
|
||||
var window1 = window.open('about:blank', '_bLAnk');
|
||||
var window2 = window.open('about:blank', '_bLAnk');
|
||||
var window3 = window.open('about:blank', '_bLAnk');
|
||||
t.add_cleanup(() => {
|
||||
window1.close();
|
||||
window2.close();
|
||||
window3.close();
|
||||
});
|
||||
assert_not_equals(window1, window2);
|
||||
assert_not_equals(window2, window3);
|
||||
assert_not_equals(window1, window3);
|
||||
}, '`_blank` should be ASCII case-insensitive');
|
||||
</script>
|
|
@ -0,0 +1,21 @@
|
|||
<!doctype html>
|
||||
<title>Link with target=_blank, rel=noreferrer</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<div id="log"></div>
|
||||
<a href="resources/report-has-opener.html" rel="noreferrer" target="_blank">Link</a>
|
||||
<script>
|
||||
var prefixedStorage;
|
||||
setup (() => prefixedStorage = new PrefixedLocalStorageTest());
|
||||
|
||||
async_test(t => {
|
||||
t.add_cleanup(() => prefixedStorage.cleanup());
|
||||
var a = document.getElementsByTagName('a')[0];
|
||||
a.href = prefixedStorage.url(a.href);
|
||||
prefixedStorage.onSet('hasOpener', t.step_func_done(e => {
|
||||
assert_equals(e.newValue, 'false');
|
||||
}));
|
||||
a.click();
|
||||
}, 'Context for opened noreferrer link targeted to "_blank" should not have opener reference');
|
||||
</script>
|
|
@ -0,0 +1,20 @@
|
|||
<!doctype html>
|
||||
<title>Link with target=_blank, no rel</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<div id="log"></div>
|
||||
<a href="resources/report-has-opener.html" target="_blank">Link</a>
|
||||
<script>
|
||||
var prefixedStorage;
|
||||
setup(() => prefixedStorage = new PrefixedLocalStorageTest());
|
||||
async_test(t => {
|
||||
t.add_cleanup(() => prefixedStorage.cleanup());
|
||||
prefixedStorage.onSet('hasOpener', t.step_func_done(e => {
|
||||
assert_equals(e.newValue, 'true');
|
||||
}));
|
||||
var a = document.getElementsByTagName('a')[0];
|
||||
a.href = prefixedStorage.url(a.href);
|
||||
a.click();
|
||||
}, 'Context created by link targeting "_blank" should retain opener reference');
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: Choose browsing context - '_parent'</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(t => {
|
||||
window.addEventListener('message', t.step_func_done(e => {
|
||||
assert_equals(e.data.name, 'parentWin');
|
||||
}));
|
||||
}, 'The parent browsing context must be chosen if the given name is `_parent`');
|
||||
</script>
|
||||
<iframe id="embedded" src="resources/choose-_parent-001-iframe-1.html" name="parentWin" style="display:none"></iframe>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: Choose browsing context - '_parent' (nested contexts)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(t => {
|
||||
var topWindow;
|
||||
t.add_cleanup(() => topWindow.close());
|
||||
window.addEventListener('message', t.step_func_done(e => {
|
||||
assert_equals(e.data.name, 'iframeParent');
|
||||
assert_false(e.data.isTop, 'window.parent is not top');
|
||||
}));
|
||||
topWindow = window.open('resources/choose-_parent-002-window.html', '_blank');
|
||||
}, 'choosing _parent context: multiple nested contexts');
|
||||
</script>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: Choose browsing context - '_parent' (via window.open)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(t => {
|
||||
var topWindow;
|
||||
t.add_cleanup(() => topWindow.close());
|
||||
window.addEventListener('message', t.step_func_done(e => {
|
||||
assert_equals(e.data.name, 'parentTopReplace');
|
||||
assert_equals(e.data.isTop, true);
|
||||
}));
|
||||
topWindow = window.open('resources/choose-_parent-003-window.html', 'parentTopReplace');
|
||||
}, '_parent should reuse window.parent context');
|
||||
</script>
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: Choose browsing context - '_parent' (case-sensitivity)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
|
||||
<script>
|
||||
var prefixedStorage;
|
||||
var iframe;
|
||||
setup(() => prefixedStorage = new PrefixedLocalStorageTest());
|
||||
|
||||
async_test(t => {
|
||||
t.add_cleanup(() => prefixedStorage.cleanup());
|
||||
var testFunc = (function (t) {
|
||||
var completed = 0;
|
||||
var testCount = 2;
|
||||
return function (actual, expected) {
|
||||
assert_equals(actual, expected);
|
||||
if (++completed >= testCount) {
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
}(t));
|
||||
|
||||
prefixedStorage.onSet('isTop', t.step_func(e => {
|
||||
testFunc(e.newValue, 'false');
|
||||
}));
|
||||
prefixedStorage.onSet('name', t.step_func(e => {
|
||||
testFunc(e.newValue, 'parentWin');
|
||||
}));
|
||||
iframe = document.createElement('iframe');
|
||||
iframe.src = prefixedStorage.url('resources/choose-_parent-004-iframe-1.html');
|
||||
iframe.name = 'parentWin';
|
||||
document.body.appendChild(iframe);
|
||||
}, 'choosing _parent context should be case-insensitive');
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: Choose browsing context - the given name is '_self'</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<iframe src="resources/choose-_self-001-iframe.html" style="display:none"></iframe>
|
||||
<script>
|
||||
async_test(t => {
|
||||
window.addEventListener('message', t.step_func_done(e => {
|
||||
assert_equals(e.data.name, 'myownself');
|
||||
}), false);
|
||||
}, 'The current browsing context must be chosen if the given name is "_self"');
|
||||
</script>
|
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: Choose browsing context - '_self' (case-sensitivity)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
|
||||
<script>
|
||||
var prefixedStorage;
|
||||
setup(() => prefixedStorage = new PrefixedLocalStorageTest());
|
||||
|
||||
async_test(t => {
|
||||
var iframe;
|
||||
|
||||
var testFunc = (function (t) {
|
||||
var completed = 0;
|
||||
var testCount = 2;
|
||||
return function (actual, expected) {
|
||||
assert_equals(actual, expected);
|
||||
if (++completed >= testCount) {
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
}(t));
|
||||
|
||||
t.add_cleanup(() => prefixedStorage.cleanup());
|
||||
|
||||
prefixedStorage.onSet('isTop', t.step_func(e => {
|
||||
testFunc(e.newValue, 'false');
|
||||
}));
|
||||
prefixedStorage.onSet('name', t.step_func(e => {
|
||||
testFunc(e.newValue, 'testWin');
|
||||
}));
|
||||
|
||||
iframe = document.createElement('iframe');
|
||||
iframe.name = 'testWin';
|
||||
iframe.src = prefixedStorage.url('resources/choose-_self-002-iframe.html');
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
}, 'choosing _self context should be case-insensitive');
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
|
@ -0,0 +1,34 @@
|
|||
<!doctype html>
|
||||
<title>HTML Test: Browsing context name - _top (current is top)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var prefixedStorage;
|
||||
setup (() => prefixedStorage = new PrefixedLocalStorageTest());
|
||||
|
||||
async_test(t => {
|
||||
t.add_cleanup(() => prefixedStorage.cleanup());
|
||||
|
||||
var testFunc = (function (t) {
|
||||
var completed = 0;
|
||||
var testCount = 2;
|
||||
return function (actual, expected) {
|
||||
assert_equals(actual, expected);
|
||||
if (++completed >= testCount) {
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
}(t));
|
||||
|
||||
prefixedStorage.onSet('isTop', t.step_func(e => {
|
||||
testFunc(e.newValue, 'true');
|
||||
}));
|
||||
prefixedStorage.onSet('name', t.step_func(e => {
|
||||
testFunc(e.newValue, 'topWin1');
|
||||
}));
|
||||
|
||||
window.open(prefixedStorage.url('resources/open-in-_top.html'), '_blank');
|
||||
}, 'Should choose current browsing context for "_top" if current is top');
|
||||
</script>
|
|
@ -0,0 +1,33 @@
|
|||
<!doctype html>
|
||||
<title>HTML Test: Browsing context name - _top</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var prefixedStorage;
|
||||
setup (() => prefixedStorage = new PrefixedLocalStorageTest());
|
||||
|
||||
async_test(t => {
|
||||
t.add_cleanup(() => prefixedStorage.cleanup());
|
||||
|
||||
var testFunc = (function (t) {
|
||||
var completed = 0;
|
||||
var testCount = 2;
|
||||
return function (actual, expected) {
|
||||
assert_equals(actual, expected);
|
||||
if (++completed >= testCount) {
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
}(t));
|
||||
|
||||
prefixedStorage.onSet('isTop', t.step_func(e => {
|
||||
testFunc(e.newValue, 'true');
|
||||
}));
|
||||
prefixedStorage.onSet('name', t.step_func(e => {
|
||||
testFunc(e.newValue, 'topWin2');
|
||||
}));
|
||||
window.open(prefixedStorage.url('resources/choose-_top-002-window.html'), '_blank');
|
||||
}, 'Should choose top browsing context for "_top" if current is not top');
|
||||
</script>
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: Choose browsing context - '_top' (case-sensitivity)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
|
||||
<script>
|
||||
var prefixedStorage;
|
||||
setup(() => prefixedStorage = new PrefixedLocalStorageTest());
|
||||
|
||||
async_test(t => {
|
||||
var testFunc = (function (t) {
|
||||
var completed = 0;
|
||||
var testCount = 2;
|
||||
return function (actual, expected) {
|
||||
assert_equals(actual, expected);
|
||||
if (++completed >= testCount) {
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
}(t));
|
||||
|
||||
t.add_cleanup(() => prefixedStorage.cleanup());
|
||||
|
||||
prefixedStorage.onSet('isTop', t.step_func(e => {
|
||||
testFunc(e.newValue, 'true');
|
||||
}));
|
||||
prefixedStorage.onSet('name', t.step_func(e => {
|
||||
testFunc(e.newValue, 'topWin');
|
||||
}));
|
||||
|
||||
window.open(prefixedStorage.url('resources/choose-_top-003-iframe-1.html'), '_blank');
|
||||
}, 'choosing _top context should be case-insensitive');
|
||||
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: Browsing context - Default name</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<iframe src="/common/blank.html" style="display:none"></iframe>
|
||||
<object id="obj" type="text/html" data="about:blank"></object>
|
||||
<embed id="embedded" type="image/svg+xml" src="/images/green.svg" width="0" height="0" />
|
||||
<script>
|
||||
test(t => {
|
||||
assert_equals(window.frames[0].name, "");
|
||||
assert_equals(document.getElementById("embedded").name, "");
|
||||
assert_equals(window["obj"].name, "");
|
||||
}, "A embedded browsing context has empty-string default name");
|
||||
|
||||
test(t => {
|
||||
var win = window.open("about:blank", "_blank");
|
||||
assert_equals(win.name, "");
|
||||
win.close();
|
||||
}, "A browsing context which is opened by window.open() method with '_blank' parameter has empty-string default name");
|
||||
</script>
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: Browsing context names - empty string</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(t => {
|
||||
window.addEventListener('message', t.step_func_done(e => {
|
||||
assert_equals(e.data.isTop, false);
|
||||
assert_equals(e.data.name, 'hellothere', 'Empty-string browsing context should choose current context');
|
||||
}), false);
|
||||
}, 'The current browsing context must be chosen if the given name is empty string');
|
||||
</script>
|
||||
<iframe name="hellothere" src="resources/choose-default-002-iframe.html"></iframe>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: Choose browsing context - the given name is same as an existing browsing context's name</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<iframe src="resources/choose-existing-001-iframe.html" style="display:none"></iframe>
|
||||
<iframe name="iExist" style="display:none"></iframe>
|
||||
<script>
|
||||
async_test(t => {
|
||||
window.addEventListener('message', t.step_func_done(e => {
|
||||
assert_equals(e.data.name, 'iExist');
|
||||
}), false);
|
||||
|
||||
}, 'An existing browsing context must be chosen if the given name is the same as its name');
|
||||
</script>
|
|
@ -2,4 +2,4 @@
|
|||
<meta charset="utf-8">
|
||||
<title>HTML Test: browsing context name - parent</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<iframe src="parent2.html"></iframe>
|
||||
<iframe src="open-in-_parent.html"></iframe>
|
|
@ -0,0 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: browsing context name - parent: nested context</title>
|
||||
<iframe name="iframeChild" src="open-in-_parent.html"></iframe>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: browsing context name - parent: top-level context</title>
|
||||
<iframe name="iframeParent" src="choose-_parent-002-iframe.html"></iframe>
|
||||
<script>
|
||||
// Relay a message from child context to opener context
|
||||
window.addEventListener('message', e => {
|
||||
if (window.opener) {
|
||||
window.opener.postMessage(e.data, '*');
|
||||
}
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: browsing context name - parent</title>
|
||||
<script>
|
||||
window.open("post-to-opener.html", "_parent");
|
||||
</script>
|
|
@ -0,0 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: browsing context name - parent: top-level context (gets replaced)</title>
|
||||
<iframe name="iframeOpener" src="choose-_parent-003-iframe.html"></iframe>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: browsing context name - parent</title>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<body>
|
||||
<script>
|
||||
var prefixedStorage = new PrefixedLocalStorageResource({
|
||||
close_on_cleanup: true
|
||||
});
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.src = prefixedStorage.url('choose-_parent-004-iframe-2.html');
|
||||
document.body.appendChild(iframe);
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: browsing context name - parent (case-insensitive)</title>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<script>
|
||||
var prefixedStorage = new PrefixedLocalStorageResource();
|
||||
window.open(prefixedStorage.url('report-is-top.html'), '_pARent');
|
||||
|
||||
</script>
|
|
@ -3,9 +3,7 @@
|
|||
<title>HTML Test: browsing context name - self</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script>
|
||||
|
||||
window.name = "selfWin2";
|
||||
var win = window.open("message.html", "");
|
||||
window.name = 'myownself';
|
||||
var win = window.open('post-to-top.html', '_self');
|
||||
win.close();
|
||||
|
||||
</script>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: browsing context name - self (case-insensitive)</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<script>
|
||||
var prefixedStorage = new PrefixedLocalStorageResource({
|
||||
close_on_cleanup: true
|
||||
});
|
||||
var win = window.open(prefixedStorage.url('report-is-top.html'), '_sElF');
|
||||
</script>
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<title>HTML Test: browsing context name - _top</title>
|
||||
<body>
|
||||
<script>
|
||||
var prefixedStorage = new PrefixedLocalStorageResource({
|
||||
close_on_cleanup:true
|
||||
});
|
||||
window.name = 'topWin2';
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.src = prefixedStorage.url('open-in-_top.html');
|
||||
// Append iframe that will open another document into `_top` (this context)
|
||||
document.body.appendChild(iframe);
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: browsing context name - top (case-insensitive)</title>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<body>
|
||||
</body>
|
||||
<script>
|
||||
var prefixedStorage = new PrefixedLocalStorageResource({
|
||||
close_on_cleanup: true
|
||||
});
|
||||
window.name = 'topWin';
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.src = prefixedStorage.url('choose-_top-003-iframe-2.html');
|
||||
document.body.appendChild(iframe);
|
||||
</script>
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: browsing context name - top (case-insensitive)</title>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<script>
|
||||
var prefixedStorage = new PrefixedLocalStorageResource({
|
||||
close_on_cleanup: true
|
||||
});
|
||||
window.open(prefixedStorage.url("report-is-top.html"), "_ToP");
|
||||
</script>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: browsing context name - Empty string</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<body onload="followLink()">
|
||||
</body>
|
||||
<script>
|
||||
function followLink() {
|
||||
var a = document.createElement('a');
|
||||
a.href = 'post-to-top.html';
|
||||
a.target = ''; // Target is empty string
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
}
|
||||
</script>
|
||||
</html>
|
|
@ -3,9 +3,5 @@
|
|||
<title>This is a test page</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script>
|
||||
|
||||
function do_test() {
|
||||
window.open("message.html", "existWin");
|
||||
}
|
||||
|
||||
window.open("post-to-top.html", "iExist");
|
||||
</script>
|
|
@ -4,6 +4,6 @@
|
|||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script>
|
||||
|
||||
window.open("message.html", "_parent");
|
||||
window.open("post-to-top.html", "_parent");
|
||||
|
||||
</script>
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<title>HTML Test: browsing context name - _top</title>
|
||||
<script>
|
||||
var prefixedStorage = new PrefixedLocalStorageResource();
|
||||
window.name = 'topWin1';
|
||||
window.open(prefixedStorage.url('report-is-top.html'), '_top');
|
||||
</script>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: post window's name to top browsing context</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script>
|
||||
if (window.opener) {
|
||||
window.opener.postMessage({
|
||||
name: window.name,
|
||||
isTop: (window.top === window)
|
||||
}, "*");
|
||||
}
|
||||
</script>
|
|
@ -3,7 +3,8 @@
|
|||
<title>HTML Test: post window's name to top browsing context</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script>
|
||||
|
||||
top.postMessage({name: window.name}, "*");
|
||||
|
||||
top.postMessage({
|
||||
name: window.name,
|
||||
isTop: (window.top === window)
|
||||
}, "*");
|
||||
</script>
|
|
@ -0,0 +1,8 @@
|
|||
<!doctype html>
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<script>
|
||||
var prefixedStorage = new PrefixedLocalStorageResource({
|
||||
close_on_cleanup: true
|
||||
});
|
||||
prefixedStorage.setItem('hasOpener', window.opener !== null);
|
||||
</script>
|
|
@ -0,0 +1,10 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<script src="/common/PrefixedLocalStorage.js"></script>
|
||||
<script>
|
||||
var prefixedStorage = new PrefixedLocalStorageResource({
|
||||
close_on_cleanup: true
|
||||
});
|
||||
prefixedStorage.setItem('isTop', window === window.top);
|
||||
prefixedStorage.setItem('name', window.name);
|
||||
</script>
|
|
@ -1,11 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML Test: browsing context name - self</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script>
|
||||
|
||||
window.name = "selfWin1";
|
||||
var win = window.open("message.html", "_self");
|
||||
win.close();
|
||||
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue