mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Update web-platform-tests to revision 155daf0c385420faf208b8bd5e319e244ec7f9cc
This commit is contained in:
parent
4e6b100c7e
commit
e9bdf87a27
768 changed files with 5782 additions and 26218 deletions
|
@ -0,0 +1,83 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
<object>'s browsing context is discarded on 'data' attribute change.
|
||||
</title>
|
||||
<link rel="author" title="Ehsan Karamad" href="ekaramad@chromium.org">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
let url1 = "../resources/test_page.html";
|
||||
let url2 = "../resources/should-load.html";
|
||||
function onLoadPromise(el) {
|
||||
return new Promise((resolve) => {
|
||||
function onLoad() {
|
||||
resolve();
|
||||
el.removeEventListener("load", onLoad);
|
||||
}
|
||||
el.addEventListener("load", onLoad);
|
||||
});
|
||||
}
|
||||
|
||||
promise_test(async() => {
|
||||
let old_windows = [];
|
||||
|
||||
let object = document.createElement("object");
|
||||
object.type = "text/html";
|
||||
object.data = url1;
|
||||
let onObjectLoad = onLoadPromise(object);
|
||||
document.body.appendChild(object);
|
||||
await onObjectLoad;
|
||||
old_windows.push(window[0]);
|
||||
assert_equals(
|
||||
window[0].frameElement,
|
||||
object,
|
||||
"<object> is attached and loaded with html content.");
|
||||
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.src = url1;
|
||||
let onIframeLoad = onLoadPromise(iframe);
|
||||
document.body.appendChild(iframe);
|
||||
await onIframeLoad;
|
||||
old_windows.push(window[1]);
|
||||
assert_equals(
|
||||
window[1].frameElement,
|
||||
iframe,
|
||||
"<iframe> is attached and loaded with html content after <object>.");
|
||||
assert_equals(
|
||||
window[0],
|
||||
old_windows[0],
|
||||
"The first window is that of <object>'s frame.");
|
||||
|
||||
// Now navigate the object element again.
|
||||
onObjectLoad = onLoadPromise(object);
|
||||
object.data = url2;
|
||||
await onObjectLoad;
|
||||
assert_equals(
|
||||
window[0].frameElement,
|
||||
iframe,
|
||||
"<object>'s previous frame must have been destroyed.");
|
||||
|
||||
assert_equals(
|
||||
window[1].frameElement,
|
||||
object,
|
||||
"<object>'s new window should be appended after navigation.");
|
||||
|
||||
assert_not_equals(
|
||||
old_windows[0],
|
||||
window[1],
|
||||
"The old window and new window are different for <object>.");
|
||||
|
||||
assert_equals(
|
||||
old_windows[1],
|
||||
window[0],
|
||||
"The old and new window are the same for <iframe>.");
|
||||
|
||||
}, "Verify that changing 'data' attribute of an <object> element discards" +
|
||||
" the old browsing context and creates a new browsing context.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue