Update web-platform-tests to revision ee82278e15570e573d87fb80179ff8231b6db61a

This commit is contained in:
WPT Sync Bot 2018-06-03 21:07:04 -04:00
parent d23bc4f1a4
commit 83e2dc11b0
278 changed files with 13348 additions and 10515 deletions

View file

@ -1,3 +0,0 @@
<!doctype html>
<title> An empty test page </title>
<p> This is test page </p>

View file

@ -1,82 +0,0 @@
<!doctype html>
<html>
<head>
<title>
&lt;embed&gt;'s browsing context is discarded on 'src' 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 embed = document.createElement("embed");
embed.type = "text/html";
embed.src = url1;
let onEmbedLoad = onLoadPromise(embed);
document.body.appendChild(embed);
await onEmbedLoad;
old_windows.push(window[0]);
assert_equals(
window[0].frameElement,
embed,
"<embed> 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 <embed>.");
assert_equals(
window[0],
old_windows[0],
"The first window is that of <embed>'s frame.");
// Now navigate the embed element again.
onEmbedLoad = onLoadPromise(embed);
embed.src = url2;
await onEmbedLoad;
assert_equals(
window[0].frameElement,
iframe,
"<embed>'s previous frame must have been destroyed.");
assert_equals(
window[1].frameElement,
embed,
"<embed>'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 <embed>.");
assert_equals(
old_windows[1],
window[0],
"The old and new window are the same for <iframe>.");
}, "Verify that changing 'src' attribute of an <embed> element discards" +
" the old browsing context and creates a new browsing context.");
</script>
</body>
</html>

View file

@ -10,25 +10,15 @@
<body>
<iframe sandbox="allow-top-navigation allow-scripts"></iframe>
<script>
if (opener) {
// We're the popup (i.e. a top frame). Load into the iframe the page
// trying to modifying the top frame and transmit the result to our
// opener.
onmessage = function(e) {
opener.postMessage(e.data, "*")
}
document.querySelector("iframe").src = "support/iframe-that-performs-top-navigation-on-popup.html";
} else {
// We are the main test page. Open ourselves as a popup, so that we can
// can experiment navigation of the top frame.
async_test(t => {
window.addEventListener("message", t.step_func_done(e => {
assert_equals(e.data, "can navigate");
e.source.close();
}));
window.open(location.href);
}, "Frames with `allow-top-navigation` should be able to navigate the top frame.");
}
// We are the main test page. Open a popup, so that we can
// can experiment navigation of the top frame.
async_test(t => {
window.addEventListener("message", t.step_func_done(e => {
assert_equals(e.data, "can navigate");
e.source.close();
}));
window.open("support/load-into-the-iframe.html");
}, "Frames with `allow-top-navigation` should be able to navigate the top frame.");
</script>
</body>
</html>

View file

@ -8,27 +8,16 @@
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<iframe sandbox="allow-scripts"></iframe>
<script>
if (opener) {
// We're the popup (i.e. a top frame). Load into the iframe the page
// trying to modifying the top frame and transmit the result to our
// opener.
onmessage = function(e) {
opener.postMessage(e.data, "*")
}
document.querySelector("iframe").src = "support/iframe-that-performs-top-navigation-on-popup.html";
} else {
// We are the main test page. Open ourselves as a popup, so that we can
// can experiment navigation of the top frame.
async_test(t => {
window.addEventListener("message", t.step_func_done(e => {
assert_equals(e.data, "cannot navigate");
e.source.close();
}));
window.open(location.href);
}, "Frames without `allow-top-navigation` should not be able to navigate the top frame.");
}
// We are the main test page. Open a popup, so that we can
// can experiment navigation of the top frame.
async_test(t => {
window.addEventListener("message", t.step_func_done(e => {
assert_equals(e.data, "cannot navigate");
e.source.close();
}));
window.open('support/load-into-the-iframe.html');
}, "Frames without `allow-top-navigation` should not be able to navigate the top frame.");
</script>
</body>
</html>

View file

@ -14,25 +14,15 @@
error: allow-top-navigation-by-user-activation will have no effect. -->
<iframe sandbox="allow-top-navigation allow-top-navigation-by-user-activation allow-scripts"></iframe>
<script>
if (opener) {
// We're the popup (i.e. a top frame). Load into the iframe the page
// trying to modifying the top frame and transmit the result to our
// opener.
onmessage = function(e) {
opener.postMessage(e.data, "*")
}
document.querySelector("iframe").src = "support/iframe-that-performs-top-navigation-on-popup.html";
} else {
// We are the main test page. Open ourselves as a popup, so that we can
// can experiment navigation of the top frame.
async_test(t => {
window.addEventListener("message", t.step_func_done(e => {
assert_equals(e.data, "can navigate");
e.source.close();
}));
window.open(location.href);
}, "Frames with `allow-top-navigation` should be able to navigate the top frame even when `allow-top-navigation-by-user-activation` is set.");
}
// We are the main test page. Open a popup, so that we can
// can experiment navigation of the top frame.
async_test(t => {
window.addEventListener("message", t.step_func_done(e => {
assert_equals(e.data, "can navigate");
e.source.close();
}));
window.open("support/load-into-the-iframe.html");
}, "Frames with `allow-top-navigation` should be able to navigate the top frame even when `allow-top-navigation-by-user-activation` is set.");
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<iframe sandbox="allow-scripts"></iframe>
<script>
// We're the popup (i.e. a top frame). Load into the iframe the page
// trying to modifying the top frame and transmit the result to our
// opener.
onmessage = function(e) {
opener.postMessage(e.data, "*")
}
document.querySelector("iframe").src = "iframe-that-performs-top-navigation-on-popup.html";
</script>
</body>
</html>

View file

@ -1,83 +0,0 @@
<!doctype html>
<html>
<head>
<title>
&lt;object&gt;'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>