Update web-platform-tests to revision e8bfc205e36ad699601212cd50083870bad9a75d

This commit is contained in:
Ms2ger 2016-11-14 11:07:09 +01:00
parent 65dd6d4340
commit ccdb0a3458
1428 changed files with 118036 additions and 9786 deletions

View file

@ -0,0 +1,17 @@
<!doctype html>
<meta charset=utf-8>
<title>Append iframe element to its own child document</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id=x></iframe>
<script>
test(function() {
var iframe = document.getElementById('x');
var childWindow = iframe.contentWindow;
assert_equals(childWindow.parent, window);
childWindow.document.body.appendChild(iframe);
assert_equals(childWindow.parent, null);
assert_equals(iframe.contentWindow, null);
assert_equals(childWindow.document.body.firstChild, iframe);
});
</script>

View file

@ -7,9 +7,10 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id="testIframe" src="support/sandbox_allow_script.html" sandbox="allow-same-origin" style="display:none"></iframe>
<div id="log"></div>
<script>
// Set up all our script stuff before the iframe starts loading, so we don't
// miss any messages from it.
var step1 = false;
var t = async_test("iframe_sandbox_allow_scripts");
@ -35,5 +36,11 @@
t.done();
}
setTimeout(run, 500);
// Make sure the iframe loads before we mess with it.
window.addEventListener("load", function() {
// The load event might fire before a message from the child comes in...
// Wait a bit to see if that message does come in.
setTimeout(run, 500);
});
</script>
<iframe id="testIframe" src="support/sandbox_allow_script.html" sandbox="allow-same-origin" style="display:none"></iframe>

View file

@ -19,7 +19,7 @@
assert_equals(e.data.origin, ourOrigin, "Should have escaped the sandbox");
});
document.querySelector("iframe").src = "iframe_sandbox_popups_helper.html";
document.querySelector("iframe").src = "iframe_sandbox_popups_helper-1.html";
});
postMessage("hello", "*");
</script>

View file

@ -0,0 +1,31 @@
<!doctype html>
<meta charset=utf-8>
<title>Check that popups from a sandboxed iframe escape the sandbox if
allow-popups-to-escape-sandbox is used</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<iframe sandbox="allow-scripts allow-popups allow-popups-to-escape-sandbox">
</iframe>
<script>
var t = async_test();
var ourOrigin;
onmessage = t.step_func(function(e) {
assert_equals(e.data, "hello", "This is our origin getter message");
ourOrigin = e.origin;
onmessage = t.step_func_done(function(e) {
assert_equals(e.origin, "null", "It came from a sandboxed iframe");
assert_equals(e.data.data, undefined, "Should have the right message");
assert_equals(e.data.origin, ourOrigin, "Should have escaped the sandbox");
});
var iframe = document.querySelector("iframe");
iframe.onload = function() {
frames[0].postMessage("start", "*");
}
iframe.src = "iframe_sandbox_popups_helper-2.html";
});
addEventListener("load", function() {
postMessage("hello", "*");
});
</script>

View file

@ -0,0 +1,25 @@
<!doctype html>
<meta charset=utf-8>
<title>Check that popups from a sandboxed iframe escape the sandbox if
allow-popups-to-escape-sandbox is used</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<iframe sandbox="allow-scripts allow-popups allow-popups-to-escape-sandbox">
</iframe>
<script>
var t = async_test();
var ourOrigin;
onmessage = t.step_func(function(e) {
assert_equals(e.data, "hello", "This is our origin getter message");
ourOrigin = e.origin;
onmessage = t.step_func_done(function(e) {
assert_equals(e.origin, "null", "It came from a sandboxed iframe");
assert_equals(e.data.data, undefined, "Should have the right message");
assert_equals(e.data.origin, ourOrigin, "Should have escaped the sandbox");
});
document.querySelector("iframe").src = "iframe_sandbox_popups_helper-3.html";
});
postMessage("hello", "*");
</script>

View file

@ -1,6 +1,5 @@
<!DOCTYPE html>
<script>
var popupWin;
if (opener) {
// We're the popup. Send back our state. What we really want to send is
// our origin, but that will come automatically.

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<body>
<script>
if (opener) {
// We're the popup. Send back our state. What we really want to send is
// our origin, but that will come automatically.
opener.postMessage(undefined, "*");
self.close();
} else {
// We're the child. Start listening for messages from our parent and open
// ourselves as the popup when we get the "start" message.
onmessage = function (e) {
if (e.data == "start") {
// Now listen for messages from the thing we plan to open.
onmessage = function(e) {
parent.postMessage({ data: e.data, origin: e.origin }, "*");
}
var a = document.createElement("a");
a.href = location.href;
a.target = "_blank";
document.body.appendChild(a);
a.click();
}
};
}
</script>

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<script>
if (opener) {
// We're the popup. Send back our state. What we really want to send is
// our origin, but that will come automatically.
opener.postMessage(undefined, "*");
self.close();
} else {
// We're the child. Start listening for messages and open ourselves as the
// popup.
onmessage = function (e) {
parent.postMessage({ data: e.data, origin: e.origin }, "*");
};
var popupWin = window.open();
popupWin.location.href = location.href;
}
</script>

View file

@ -12,4 +12,4 @@
});
</script>
<iframe sandbox="allow-scripts allow-popups"
src="iframe_sandbox_popups_helper.html"></iframe>
src="iframe_sandbox_popups_helper-1.html"></iframe>

View file

@ -0,0 +1,18 @@
<!doctype html>
<meta charset=utf-8>
<title>Check that popups from a sandboxed iframe do not escape the sandbox</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
var t = async_test();
onmessage = t.step_func_done(function(e) {
assert_equals(e.origin, "null", "It came from a sandboxed iframe");
assert_equals(e.data.data, undefined, "Should have the right message");
assert_equals(e.data.origin, "null", "Should not have escaped the sandbox");
});
addEventListener("load", function() {
frames[0].postMessage("start", "*");
});
</script>
<iframe sandbox="allow-scripts allow-popups"
src="iframe_sandbox_popups_helper-2.html"></iframe>

View file

@ -0,0 +1,15 @@
<!doctype html>
<meta charset=utf-8>
<title>Check that popups from a sandboxed iframe do not escape the sandbox</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
var t = async_test();
onmessage = t.step_func_done(function(e) {
assert_equals(e.origin, "null", "It came from a sandboxed iframe");
assert_equals(e.data.data, undefined, "Should have the right message");
assert_equals(e.data.origin, "null", "Should not have escaped the sandbox");
});
</script>
<iframe sandbox="allow-scripts allow-popups"
src="iframe_sandbox_popups_helper-3.html"></iframe>