Update web-platform-tests to revision 58eb04cecbbec2e18531ab440225e38944a9c444

This commit is contained in:
Josh Matthews 2017-04-17 12:06:02 +10:00 committed by Anthony Ramine
parent 25e8bf69e6
commit 665817d2a6
35333 changed files with 1818077 additions and 16036 deletions

View file

@ -0,0 +1,24 @@
<html>
<head>
<style>
iframe { width: 400px; height: 300px;}
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({explicit_timeout: true});
async_test(function(t) {
window.addEventListener("message", t.step_func_done(function(e) {
assert_equals(e.data, "BLOCKED", "The message should say 'BLOCKED'.");
}));
}, "The sandboxed iframe should post a message saying the top navigation was blocked when no user gesture.");
</script>
</head>
<body>
<p>This tests that an iframe in sandbox with 'allow-top-navigation-by-user-activation'
can navigate the top level page, if it is trigged by a user gesture.</p>
<p>Click on the button in the iframe and it should navigate the top page.</p>
<iframe id="i" sandbox="allow-scripts allow-top-navigation-by-user-activation" src="support/iframe-that-performs-top-navigation.html"></iframe>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!doctype html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(function(t) {
window.addEventListener("message", t.step_func_done(function(e) {
assert_equals(e.data, "PASS", "The message should say 'PASS' instead of 'FAIL'");
}));
}, "The sandboxed iframe should post a message saying the test was in the state of 'PASS'.");
</script>
</head>
<body>
<p>This tests that an iframe in sandbox with 'allow-top-navigation-by-user-activation'
cannot navigate its top level page, if it is not trigged by a user gesture.</p>
<iframe sandbox='allow-top-navigation-by-user-activation allow-scripts' src="support/iframe-that-performs-top-navigation-without-user-gesture-failed.html"></iframe>
</body>
</html>

View file

@ -0,0 +1,16 @@
<html>
<body>
The top navigation from this iframe should be blocked. This text should appear.
<script>
window.onload = function()
{
try {
top.location = "navigation-changed-iframe.html";
top.postMessage("FAIL", "*");
} catch(e) {
top.postMessage("PASS", "*");
}
}
</script>
</body>
</html>

View file

@ -0,0 +1,20 @@
<html>
<head>
<script>
function performTest()
{
try {
top.location = "navigation-changed-iframe.html";
} catch(e) {
top.postMessage("BLOCKED", "*");
}
}
</script>
</head>
<body onload="performTest();">
<p>This doc tried to navigate the top page when loaded, which should fail since it's not trigged by user activation while in a sandboxed frame with 'allow-top-navigtaion-by-user-activation'. <br> <br>
Click the button below, the top navigation should succeed with a new page saying "PASSED: Navigation succeeded." in browsers supporting the 'allow-top-navigtaion-by-user-activation' iframe@sandbox keyword (eg., Chrome v58+); Otherwise, the top navigation should fail.
</p>
<button id="b" onclick="performTest();">Navigate the top page</button>
</body>
</html>

View file

@ -0,0 +1,14 @@
<html>
<head>
<script>
function fireSentinel()
{
document.getElementsByTagName('h4')[0].innerHTML = document.domain;
}
</script>
</head>
<body onload="fireSentinel();">
<h4>DOMAIN</h4>
<p>PASSED: Navigation succeeded.</p>
</body>
</html>