mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +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
|
@ -21,7 +21,7 @@ function on_load() {
|
|||
"The frameElement attribute should be the embed element.");
|
||||
assert_equals(document.getElementById("fr4").contentWindow[0].frameElement,
|
||||
document.getElementById("fr4").contentDocument.getElementById("f1"),
|
||||
"The frameElement attribute should be the frame element in 'test.html'.");
|
||||
"The frameElement attribute should be the frame element in 'resources/frameElement-nested-frame.html'.");
|
||||
});
|
||||
t1.done();
|
||||
|
||||
|
@ -50,19 +50,19 @@ function on_load() {
|
|||
<body onload="on_load()">
|
||||
<div id="log"></div>
|
||||
<iframe id="fr1"></iframe>
|
||||
<iframe id="fr2" src="test.html"></iframe> <!-- cross origin -->
|
||||
<iframe id="fr2" src="resources/frameElement-nested-frame.html"></iframe> <!-- cross origin -->
|
||||
<iframe id="fr3" src="" style="display:none"></iframe>
|
||||
<object id="obj" name="win2" type="text/html" data="about:blank"></object>
|
||||
<embed id="emb" name="win3" type="image/svg+xml" src="/images/green.svg" />
|
||||
<iframe id="fr4" src="test.html"></iframe> <!-- same origin -->
|
||||
<iframe id="fr5" src="testcase3.html"></iframe> <!-- cross origin -->
|
||||
<iframe id="fr4" src="resources/frameElement-nested-frame.html"></iframe> <!-- same origin -->
|
||||
<iframe id="fr5" src="resources/frameElement-window-post.html"></iframe> <!-- cross origin -->
|
||||
<script>
|
||||
|
||||
setup(function () {
|
||||
var src_base = get_host_info().HTTP_REMOTE_ORIGIN;
|
||||
src_base += document.location.pathname.substring(0, document.location.pathname.lastIndexOf("/") + 1);
|
||||
document.getElementById("fr2").src = src_base + "test.html";
|
||||
document.getElementById("fr5").src = src_base + "testcase3.html";
|
||||
document.getElementById("fr2").src = src_base + "/resources/frameElement-nested-frame.html";
|
||||
document.getElementById("fr5").src = src_base + "/resources/frameElement-window-post.html";
|
||||
});
|
||||
|
||||
test(function () {
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<script>
|
||||
if (window.opener) {
|
||||
window.opener.postMessage({
|
||||
"parent_isTop": (window.parent === window)
|
||||
}, "*");
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,66 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>window.parent: `null`</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(t => {
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.onload = t.step_func_done(() => {
|
||||
var iWindow = iframe.contentWindow;
|
||||
assert_equals(iWindow.parent, window);
|
||||
document.body.removeChild(iframe);
|
||||
assert_equals(iWindow.parent, null);
|
||||
});
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
}, '`window.parent` is null when browsing context container element removed');
|
||||
|
||||
async_test(t => {
|
||||
var iframe = document.createElement('iframe');
|
||||
var iframe2, removedEl;
|
||||
|
||||
var testFunc = t.step_func(() => {
|
||||
var frameWindow = iframe.contentWindow;
|
||||
var frame2Window = iframe2.contentWindow;
|
||||
|
||||
assert_equals(frameWindow.parent, window);
|
||||
assert_equals(frame2Window.parent, frameWindow);
|
||||
|
||||
iframe.removeEventListener('load', nestFrame);
|
||||
iframe2.removeEventListener('load', testFunc);
|
||||
removedEl = document.body.removeChild(iframe);
|
||||
|
||||
assert_equals(frameWindow.parent, null);
|
||||
assert_equals(frame2Window.parent, null);
|
||||
|
||||
removedEl.addEventListener('load', t.step_func_done(() => {
|
||||
// reattached iframe's browsing context will report window.parent again
|
||||
assert_equals(removedEl.contentWindow.parent, window);
|
||||
// The following window s are no longer referenced by active browsing contexts
|
||||
assert_equals(frameWindow.parent, null);
|
||||
assert_equals(frame2Window.parent, null);
|
||||
// Per #the-iframe-element, reattaching a removed iframe will result in the
|
||||
// browser creating a new browsing context once again, with a fresh
|
||||
// document in our case, so the second iframe or any other elements
|
||||
// previously added to iframe.contentDocument will be gone
|
||||
assert_equals(removedEl.contentDocument.querySelector('iframe'), null);
|
||||
assert_equals(removedEl.contentDocument.querySelector('hr'), null);
|
||||
}));
|
||||
document.body.appendChild(removedEl);
|
||||
});
|
||||
|
||||
var nestFrame = function () {
|
||||
iframe.contentDocument.body.appendChild(document.createElement('hr'));
|
||||
iframe2 = iframe.contentDocument.createElement('iframe');
|
||||
// Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1229707
|
||||
iframe2.src = '/common/blank.html';
|
||||
iframe2.addEventListener('load', testFunc);
|
||||
iframe.contentDocument.body.appendChild(iframe2);
|
||||
};
|
||||
|
||||
iframe.addEventListener('load', nestFrame);
|
||||
document.body.appendChild(iframe);
|
||||
}, '`window.parent` null when parent browsing context container removed');
|
||||
</script>
|
|
@ -0,0 +1,44 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>window.parent</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_equals(window, parent)
|
||||
}, '`window.parent` for top-level browsing context');
|
||||
|
||||
async_test(t => {
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.onload = t.step_func_done(function () {
|
||||
var iWindow = iframe.contentWindow;
|
||||
assert_equals(iWindow.parent, window);
|
||||
});
|
||||
document.body.appendChild(iframe);
|
||||
}, '`window.parent` on single nested browsing context');
|
||||
|
||||
async_test(t => {
|
||||
var iframe = document.createElement('iframe');
|
||||
var iframe2;
|
||||
|
||||
var testFunc = t.step_func_done(function () {
|
||||
var frameWindow = iframe.contentWindow;
|
||||
var frame2Window = iframe2.contentWindow;
|
||||
assert_equals(frameWindow.parent, window);
|
||||
assert_equals(frame2Window.parent, frameWindow);
|
||||
assert_false(frame2Window.parent === window);
|
||||
});
|
||||
|
||||
var nestFrame = function () {
|
||||
iframe2 = iframe.contentDocument.createElement('iframe');
|
||||
// Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1229707
|
||||
iframe2.src = '/common/blank.html';
|
||||
iframe2.addEventListener('load', testFunc);
|
||||
iframe.contentDocument.body.appendChild(iframe2);
|
||||
};
|
||||
|
||||
iframe.addEventListener('load', nestFrame);
|
||||
document.body.appendChild(iframe);
|
||||
}, '`window.parent` for multiple nested browsing contexts');
|
||||
</script>
|
|
@ -0,0 +1,66 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>window.top: `null`</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function (t) {
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.onload = t.step_func_done(() => {
|
||||
var iWindow = iframe.contentWindow;
|
||||
/**
|
||||
* `top` should return the top-level browsing context but will return
|
||||
* `null` if none exists, such as when any of the BC's ancestor browsing
|
||||
* context container's document elements are disconnected/removed.
|
||||
*/
|
||||
assert_equals(iWindow.top, window);
|
||||
document.body.removeChild(iframe);
|
||||
assert_equals(iWindow.top, null);
|
||||
});
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
}, '`window.top` is null when browsing context container element removed');
|
||||
|
||||
async_test(t => {
|
||||
var iframe = document.createElement('iframe');
|
||||
var iframe2, removedEl;
|
||||
|
||||
var testFunc = t.step_func(() => {
|
||||
var frameWindow = iframe.contentWindow;
|
||||
var frame2Window = iframe2.contentWindow;
|
||||
|
||||
assert_equals(frameWindow.top, window);
|
||||
assert_equals(frame2Window.top, window);
|
||||
|
||||
iframe.removeEventListener('load', nestFrame);
|
||||
iframe2.removeEventListener('load', testFunc);
|
||||
|
||||
removedEl = document.body.removeChild(iframe);
|
||||
|
||||
assert_equals(frameWindow.top, null);
|
||||
assert_equals(frame2Window.top, null);
|
||||
|
||||
removedEl.addEventListener('load', t.step_func_done(() => {
|
||||
// reattached iframe's browsing context will report window.top
|
||||
assert_equals(removedEl.contentWindow.top, window);
|
||||
// removed/re-added iframes will have new browsing context / window
|
||||
assert_equals(frameWindow.top, null);
|
||||
assert_equals(frame2Window.top, null);
|
||||
}));
|
||||
|
||||
document.body.appendChild(removedEl);
|
||||
});
|
||||
|
||||
var nestFrame = function () {
|
||||
iframe2 = iframe.contentDocument.createElement('iframe');
|
||||
// Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1229707
|
||||
iframe2.src = '/common/blank.html';
|
||||
iframe2.addEventListener('load', testFunc);
|
||||
iframe.contentDocument.body.appendChild(iframe2);
|
||||
};
|
||||
|
||||
iframe.addEventListener('load', nestFrame);
|
||||
document.body.appendChild(iframe);
|
||||
}, '`window.top`null when any ancestor browsing context container removed');
|
||||
</script>
|
|
@ -43,6 +43,8 @@ t2.step(function() {
|
|||
var doc = iframe.contentDocument;
|
||||
iframe2 = document.createElement("iframe");
|
||||
//iframe2.src = "data:text/html,"
|
||||
// Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1229707
|
||||
iframe2.src = '/common/blank.html';
|
||||
|
||||
iframe2.onload = t2.step_func(
|
||||
function() {
|
Loading…
Add table
Add a link
Reference in a new issue