mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Update web-platform-tests to revision 7da6acfd668e66adae5ab4e2d389810d3b1460be
This commit is contained in:
parent
50db64a20e
commit
bae87d193d
307 changed files with 35826 additions and 209 deletions
|
@ -0,0 +1,51 @@
|
|||
<!doctype html>
|
||||
<title>window.length</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var iframe;
|
||||
var subframe;
|
||||
var other_window;
|
||||
test(function() {assert_equals(window.length, 0)}, "No child browsing contexts");
|
||||
test(function() {
|
||||
iframe = document.createElement("iframe");
|
||||
assert_equals(window.length, 0)
|
||||
}, "iframe not inserted into the document");
|
||||
|
||||
test(function() {
|
||||
document.body.appendChild(iframe);
|
||||
assert_equals(window.length, 1)
|
||||
}, "One iframe inserted into the document");
|
||||
|
||||
test(function() {
|
||||
subframe = document.createElement("iframe");
|
||||
iframe.contentDocument.body.appendChild(subframe);
|
||||
assert_equals(window.length, 1);
|
||||
}, "Child browsing context has a child browsing context");
|
||||
|
||||
test(function() {
|
||||
try {
|
||||
assert_equals(iframe.contentWindow.length, 1);
|
||||
} finally {
|
||||
subframe.parentNode.removeChild(subframe);
|
||||
}
|
||||
}, "window.length in child frame");
|
||||
|
||||
test(function() {
|
||||
iframe.parentNode.removeChild(iframe);
|
||||
other_window = window.open();
|
||||
assert_equals(window.length, 0);
|
||||
assert_equals(other_window.length, 0);
|
||||
}, "Opened window")
|
||||
|
||||
test(function() {
|
||||
other_window.document.body.appendChild(iframe);
|
||||
try {
|
||||
assert_equals(other_window.length, 1);
|
||||
} finally {
|
||||
other_window.close();
|
||||
}
|
||||
}, "Iframe in opened window")
|
||||
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
opener.callback()
|
|
@ -0,0 +1,6 @@
|
|||
<!doctype html>
|
||||
<script>
|
||||
onbeforeunload = function() {
|
||||
opener.callback();
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,13 @@
|
|||
<!doctype html>
|
||||
<title>Running beforeunload handler in window.close()</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
var w = window.open("close_beforeunload-1.html");
|
||||
setTimeout(function() {
|
||||
w.close();
|
||||
}, 1000);
|
||||
callback = function() {t.done()}
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
<!doctype html>
|
|
@ -0,0 +1,18 @@
|
|||
<!doctype html>
|
||||
<title>Running defer script in window.close()</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test(undefined, {timeout:4000});
|
||||
t.step(function() {
|
||||
var w = window.open("close_script_defer-1.html");
|
||||
w.document.open()
|
||||
w.document.write("<script defer src='callback.js'><\/script>")
|
||||
setTimeout(function() {
|
||||
w.close();
|
||||
}, 1000);
|
||||
})
|
||||
setTimeout(function() {t.done();}, 1000)
|
||||
callback = t.step(function() {assert_unreached()})
|
||||
</script>
|
|
@ -0,0 +1,6 @@
|
|||
<!doctype html>
|
||||
<script>
|
||||
onunload = function() {
|
||||
opener.callback();
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,13 @@
|
|||
<!doctype html>
|
||||
<title>Running unload handler in window.close()</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
var w = window.open("close_unload-1.html");
|
||||
setTimeout(function() {
|
||||
w.close();
|
||||
}, 1000);
|
||||
callback = function() {t.done()}
|
||||
</script>
|
|
@ -0,0 +1,2 @@
|
|||
<!doctype html>
|
||||
<p>Now open a new tab and navigate to <a href="001-2.html">001-2</a></p>
|
|
@ -0,0 +1,16 @@
|
|||
<!doctype html>
|
||||
<script>
|
||||
var result = "FAIL";
|
||||
if (opener != null) {
|
||||
result = "FAIL (did you open this page in a new tab?)";
|
||||
} else {
|
||||
var w = window.open("", "test_name");
|
||||
if (w.location.href !== "about:blank") {
|
||||
result = "FAIL (didn't open an about:blank browsing context)";
|
||||
} else {
|
||||
w.close();
|
||||
result = "PASS";
|
||||
}
|
||||
document.write(result);
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
<!doctype html>
|
||||
<title>Accessing named windows from outside the unit of related browsing contexts</title>
|
||||
<a href="001-1.html" target="test_name">Click here</a>
|
|
@ -0,0 +1,8 @@
|
|||
<!doctype html>
|
||||
<p>Now open a new tab and navigate to <a></a></p>
|
||||
<script>
|
||||
href = window.location.href.replace("http://", "http://www.").replace("002-1.html", "002-2.html");
|
||||
var a = document.getElementsByTagName("a")[0];
|
||||
a.href = href;
|
||||
a.textContent = href;
|
||||
</script>
|
|
@ -0,0 +1,16 @@
|
|||
<!doctype html>
|
||||
<script>
|
||||
var result = "FAIL";
|
||||
if (opener != null) {
|
||||
result = "FAIL (did you open this page in a new tab?)";
|
||||
} else {
|
||||
var w = window.open("", "test_name");
|
||||
if (w.location.href !== "about:blank") {
|
||||
result = "FAIL (didn't open an about:blank browsing context)";
|
||||
} else {
|
||||
w.close();
|
||||
result = "PASS";
|
||||
}
|
||||
document.write(result);
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
<!doctype html>
|
||||
<title>Accessing different-origin named windows from outside the unit of related browsing contexts</title>
|
||||
<a href="002-1.html" target="test_name">Click here</a>
|
|
@ -0,0 +1,20 @@
|
|||
<!doctype html>
|
||||
<iframe></iframe>
|
||||
<script>
|
||||
var t = opener.t;
|
||||
|
||||
onload = t.step_func(function() {
|
||||
setTimeout(t.step_func(function() {
|
||||
var history_length = history.length;
|
||||
var iframe = document.getElementsByTagName("iframe")[0];
|
||||
iframe.onload = t.step_func(function() {
|
||||
opener.assert_equals(history.length, history_length + 1);
|
||||
iframe.parentNode.removeChild(iframe);
|
||||
opener.assert_equals(history.length, history_length);
|
||||
t.done();
|
||||
window.close();
|
||||
});
|
||||
iframe.src = "discard_iframe_history_1-2.html;";
|
||||
}), 100);
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,2 @@
|
|||
<!doctype html>
|
||||
Filler text
|
|
@ -0,0 +1,10 @@
|
|||
<!doctype html>
|
||||
<title>Removing iframe from document removes it from history</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
var w = window.open("discard_iframe_history_1-1.html");
|
||||
</script>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<!doctype html>
|
||||
<iframe></iframe>
|
||||
<script>
|
||||
var t = opener.t;
|
||||
|
||||
onload = t.step_func(function() {
|
||||
setTimeout(t.step_func(function() {
|
||||
var history_length = history.length;
|
||||
var iframe = document.getElementsByTagName("iframe")[0];
|
||||
iframe.onload = t.step_func(function() {
|
||||
setTimeout(t.step_func(function() {
|
||||
opener.assert_equals(history.length, history_length + 1, "History length before iframe removal");
|
||||
document.body.innerHTML = "";
|
||||
opener.assert_equals(history.length, history_length, "History length after iframe removal");
|
||||
t.done();
|
||||
window.close();
|
||||
}), 100);
|
||||
});
|
||||
iframe.src = "discard_iframe_history_1-2.html";
|
||||
}), 100);
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,10 @@
|
|||
<!doctype html>
|
||||
<title>Removing iframe from document via innerHTML removes it from history</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
var w = window.open("discard_iframe_history_2-1.html");
|
||||
</script>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<script>
|
||||
history_lengths = [];
|
||||
|
||||
var t = opener.t;
|
||||
|
||||
push_length = t.step_func(function () {
|
||||
history_lengths.push(history.length)
|
||||
});
|
||||
|
||||
do_test = t.step_func(function () {
|
||||
try {
|
||||
var start_length = history_lengths[0];
|
||||
expected = [start_length, start_length + 1, start_length];
|
||||
opener.assert_array_equals(history_lengths, expected);
|
||||
t.done();
|
||||
} finally {
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<iframe src="discard_iframe_history_3-2.html"></iframe>
|
|
@ -0,0 +1,4 @@
|
|||
<a href="discard_iframe_history_3-3.html" onclick="parent.push_length()">Click me</a>
|
||||
<script>
|
||||
onload = function() {setTimeout(parent.t.step_func(function() {document.links[0].click()}), 100)}
|
||||
</script>
|
|
@ -0,0 +1,4 @@
|
|||
<button onclick="var p = parent; p.push_length(); frameElement.parentNode.removeChild(frameElement); p.push_length(); p.do_test();">Click me</button>
|
||||
<script>
|
||||
onload = function() {setTimeout(parent.t.step_func(function() {document.getElementsByTagName("button")[0].click()}), 100)}
|
||||
</script>
|
|
@ -0,0 +1,9 @@
|
|||
<!doctype html>
|
||||
<title>Removing iframe from document removes it from history</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test(undefined);
|
||||
var w = window.open("discard_iframe_history_3-1.html");
|
||||
</script>
|
|
@ -0,0 +1,21 @@
|
|||
<script>
|
||||
history_lengths = [];
|
||||
|
||||
var t = opener.t;
|
||||
|
||||
push_length = t.step_func(function () {
|
||||
history_lengths.push(history.length)
|
||||
});
|
||||
|
||||
do_test = t.step_func(function () {
|
||||
try {
|
||||
var start_length = history_lengths[0];
|
||||
expected = [start_length, start_length + 1, start_length];
|
||||
opener.assert_array_equals(history_lengths, expected);
|
||||
t.done();
|
||||
} finally {
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<iframe src="discard_iframe_history_4-2.html"></iframe>
|
|
@ -0,0 +1,4 @@
|
|||
<a href="discard_iframe_history_4-3.html" onclick="parent.push_length()">Click me</a>
|
||||
<script>
|
||||
onload = function() {setTimeout(parent.t.step_func(function() {document.links[0].click()}), 100)}
|
||||
</script>
|
|
@ -0,0 +1,4 @@
|
|||
<button onclick="var p = parent; p.push_length(); frameElement.parentNode.innerHTML = ''; p.push_length(); p.do_test();">Click me</button>
|
||||
<script>
|
||||
onload = function() {setTimeout(parent.t.step_func(function() {document.getElementsByTagName("button")[0].click()}), 100)}
|
||||
</script>
|
|
@ -0,0 +1,9 @@
|
|||
<!doctype html>
|
||||
<title>Removing iframe from document removes it from history</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
var w = window.open("discard_iframe_history_4-1.html");
|
||||
</script>
|
|
@ -0,0 +1,27 @@
|
|||
<!doctype html>
|
||||
<iframe></iframe>
|
||||
<script>
|
||||
var t = opener.t;
|
||||
var iframe = document.getElementsByTagName("iframe")[0];
|
||||
var history_length;
|
||||
|
||||
function load_frame(src) {
|
||||
history_length = history.length;
|
||||
iframe.src = src;
|
||||
var button = document.getElementsByTagName("button")[0];
|
||||
button.parentNode.removeChild(button);
|
||||
}
|
||||
|
||||
remove_frame = t.step_func(function() {
|
||||
try {
|
||||
opener.assert_equals(history.length, history_length + 1, "History length after loading page in iframe");
|
||||
iframe.parentNode.removeChild(iframe);
|
||||
opener.assert_equals(history.length, history_length, "History length after removing iframe");
|
||||
t.done();
|
||||
} finally {
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
<button onclick="load_frame('discard_iframe_history_1-2.html')">Click here</button>
|
|
@ -0,0 +1,2 @@
|
|||
<!doctype html>
|
||||
<button onclick="parent.remove_frame()">Click here</button>
|
|
@ -0,0 +1,10 @@
|
|||
<!doctype html>
|
||||
<title>Removing iframe from document removes it from history</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
setup({timeout:3600000})
|
||||
var t = async_test(undefined, {timeout:3600000});
|
||||
var w = window.open("discard_iframe_history_1-1.html");
|
||||
</script>
|
|
@ -0,0 +1,19 @@
|
|||
<script>
|
||||
history_lengths = [];
|
||||
|
||||
function push_length() {
|
||||
history_lengths.push(history.length)
|
||||
}
|
||||
|
||||
do_test = opener.t.step_func(function () {
|
||||
try {
|
||||
var start_length = history_lengths[0];
|
||||
expected = [start_length, start_length + 1, start_length];
|
||||
opener.assert_array_equals(history_lengths, expected);
|
||||
opener.t.done();
|
||||
} finally {
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<iframe src="discard_iframe_history_2-2.html"></iframe>
|
|
@ -0,0 +1 @@
|
|||
<a href="discard_iframe_history_2-3.html" onclick="parent.push_length()">Click me</a>
|
|
@ -0,0 +1 @@
|
|||
<button onclick="var p = parent; p.push_length(); frameElement.parentNode.removeChild(frameElement); p.push_length(); p.do_test();">Click me</button>
|
|
@ -0,0 +1,10 @@
|
|||
<!doctype html>
|
||||
<title>Removing iframe from document removes it from history</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
setup({timeout:3600000})
|
||||
var t = async_test(undefined, {timeout:3600000});
|
||||
var w = window.open("discard_iframe_history_2-1.html");
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue