Update web-platform-tests to revision 8a2ceb5f18911302b7a5c1cd2791f4ab50ad4326

This commit is contained in:
Josh Matthews 2017-10-12 09:25:50 -04:00
parent 462c272380
commit 1f531f66ea
5377 changed files with 174916 additions and 84369 deletions

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Check that sandboxed iframe can perform navigation on the top frame
when allow-top-navigation is set</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<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.");
}
</script>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Check that sandboxed iframe cannot perform navigation on the top
frame when allow-top-navigation is not set</title>
<script src="/resources/testharness.js"></script>
<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.");
}
</script>
</body>
</html>

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Check that sandboxed iframe can perform navigation on the top frame
when allow-top-navigation is set (even when
allow-top-navigation-by-user-activation is set)</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<!-- Specifying both allow-top-navigation and
allow-top-navigation-by-user-activation is a document conformance
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.");
}
</script>
</body>
</html>

View file

@ -0,0 +1,12 @@
<!doctype html>
<meta charset="utf-8">
<title>Check that sandboxed iframe can not navigate their ancestors</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.data, "can not navigate", "Should have the right message");
});
</script>
<iframe sandbox="allow-scripts" src="support/iframe-tried-to-be-navigated-by-its-child.html"></iframe>

View file

@ -0,0 +1,12 @@
<!doctype html>
<meta charset="utf-8">
<title>Check that unsandboxed iframe can navigate their ancestors</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.data, "can navigate", "Should have the right message");
});
</script>
<iframe src="support/iframe-tried-to-be-navigated-by-its-child.html"></iframe>

View file

@ -0,0 +1,12 @@
<!doctype html>
<meta charset="utf-8">
<title>Check that sandboxed iframe can navigate their descendants</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.data, "can navigate", "Should have the right message");
});
</script>
<iframe sandbox="allow-scripts" src="support/iframe-trying-to-navigate-its-child.html"></iframe>

View file

@ -0,0 +1,12 @@
<!doctype html>
<meta charset="utf-8">
<title>Check that sandboxed iframe can navigate itself</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.data, "can navigate", "Should have the right message");
});
</script>
<iframe sandbox="allow-scripts" src="support/iframe-trying-to-navigate-itself.html"></iframe>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: Allow script execution inside iframe with sandbox attribute when sandbox="allow-scripts".</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-scripts-browsing-context-flag" />
<meta name="assert" content="Allow script execution inside iframe with sandbox attribute when sandbox='allow-scripts'." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("Allow script execution inside iframe with sandbox attribute when sandbox='allow-scripts'.");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "script ran");
});
t.done();
}
var timer = setTimeout(callback, 8000);
window.addEventListener("message", callback, false);
</script>
<iframe src="support/iframe_sandbox_001.htm" sandbox="allow-scripts" style="display: none"></iframe>
<div id=log></div>
</body>
</html>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: Allow autoplay for HTML5 Video inside iframe with sandbox attribute if sandbox='allow-scripts'.</title>
<meta name=timeout content=long>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
async_test(function (t) {
var callback = t.step_func_done(function(event) {
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "play event fired");
});
window.addEventListener("message", callback, false);
}, "Allow autoplay for HTML5 Video inside iframe with sandbox attribute if sandbox='allow-scripts'.");
</script>
<iframe src="support/iframe_sandbox_002.htm" sandbox="allow-scripts" style="display: none"></iframe>
<div id=log></div>
</body>
</html>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: Block autofocus on form control inside iframe with sandbox attribute.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-automatic-features-browsing-context-flag" />
<meta name="assert" content="Block autofocus on form control inside iframe with sandbox attribute." />
<script src="support/sandbox_helper.js" type="text/javascript"></script>
</head>
<body>
<pre>Description: Block autofocus on form controls inside iframe with sandbox attribute.</pre>
<table id='testtable' border='1'>
<tr>
<td>Test Result</td>
<td>Test Assertion</td>
</tr>
<tr>
<td id='test_0_result'>Manual</td>
<td id='test_0_assertion'>Test passes if caret (text cursor) is not on the textbox in the below iframe.</td>
</tr>
</table>
<br />
<div id="testframe">
<pre>iframe with sandbox</pre>
<iframe src="support/iframe_sandbox_003.htm" sandbox style="height: 100px; width: 400px;"></iframe>
</div>
<script type="text/javascript">
DisableTestForNonSupportingBrowsers();
</script>
</body>
</html>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: Block plugins inside iframe with sandbox attribute.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-plugins-browsing-context-flag" />
<meta name="assert" content="Block plugins inside iframe with sandbox attribute." />
<script src="support/sandbox_helper.js" type="text/javascript"></script>
</head>
<body>
<pre>Description: Block plugins inside iframe with sandbox attribute.</pre>
<table id='testtable' border='1'>
<tr>
<td>Test Result</td>
<td>Test Assertion</td>
</tr>
<tr>
<td id='test_0_result'>Manual</td>
<td id='test_0_assertion'>Test passes if you DO NOT see the 'Sample PDF For Testing' pdf below or 'FAIL'.<br>
Test requires that a pdf plugin has been installed!</td>
</tr>
</table>
<br />
<div id="testframe">
<pre>iframe with sandbox</pre>
<iframe sandbox src="support/iframe_sandbox_004.htm" height="400" width ="600"></iframe>
</div>
<script type="text/javascript">
DisableTestForNonSupportingBrowsers();
</script>
</body>
</html>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: Block script execution inside iframe with sandbox attribute.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-scripts-browsing-context-flag" />
<meta name="assert" content="Block script execution inside iframe with sandbox attribute." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("Block script execution inside iframe with sandbox attribute.");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_true(!event);
});
t.done();
}
var timer = setTimeout(callback, 4000);
window.addEventListener("message", callback, false);
</script>
<iframe src="support/iframe_sandbox_001.htm" sandbox style="display: none"></iframe>
<div id=log></div>
</body>
</html>

View file

@ -0,0 +1,37 @@
<!DOCTYPE HTML>
<html>
<head>
<title>HTML5 Sandbox: Allow form submission inside sandbox iframe when sandbox='allow-forms'</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-forms-browsing-context-flag" />
<meta name="assert" content="Allow form submission inside sandbox iframe when sandbox='allow-forms'." />
<script src="support/sandbox_helper.js" type="text/javascript"></script>
</head>
<body>
<pre>Description: Allow form submission inside iframe with sandbox attribute if sandbox='allow-forms'.</pre>
<table id='testtable' border='1'>
<tr>
<td>Test Result</td>
<td>Test Assertion</td>
</tr>
<tr>
<td id='test_0_result'>Manual</td>
<td id='test_0_assertion'>
<div>Steps:</div>
<div>1. Click button "Submit Form".</div>
<br />
<div>Test passes if there is no red on the page and if the word "PASS" appears in the below iframe after following the above steps.</div>
</td>
</tr>
</table>
<br />
<div id="testframe">
<pre>iframe with sandbox="allow-forms"</pre>
<iframe src="support/iframe_sandbox_006.htm" sandbox="allow-forms" style="height: 100px; width: 300px;"></iframe>
</div>
<script type="text/javascript">
DisableTestForNonSupportingBrowsers();
</script>
</body>
</html>

View file

@ -0,0 +1,37 @@
<!DOCTYPE HTML>
<html>
<head>
<title>HTML5 Sandbox: Block form submission inside sandbox iframe</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-forms-browsing-context-flag" />
<meta name="assert" content="Block form submission inside sandbox iframe." />
<script src="support/sandbox_helper.js" type="text/javascript"></script>
</head>
<body>
<pre>Description: Block form submission inside iframe with sandbox attribute.</pre>
<table id='testtable' border='1'>
<tr>
<td>Test Result</td>
<td>Test Assertion</td>
</tr>
<tr>
<td id='test_0_result'>Manual</td>
<td id='test_0_assertion'>
<div>Steps:</div>
<div>1. Click button "Submit Form".</div>
<br />
<div>Test passes if there is no red on the page and there is no navigation in the below iframe after following the above steps.</div>
</td>
</tr>
</table>
<br />
<div id="testframe">
<pre>iframe with sandbox="allow-scripts allow-same-origin allow-top-navigation"</pre>
<iframe src="support/iframe_sandbox_007.htm" sandbox="allow-scripts allow-same-origin allow-top-navigation" style="height: 100px; width: 300px;"></iframe>
</div>
<script type="text/javascript">
DisableTestForNonSupportingBrowsers();
</script>
</body>
</html>

View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: Allow sandboxed iframe content to navigate the sandboxed browsing context itself.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-navigation-browsing-context-flag" />
<meta name="assert" content="Allow sandboxed iframe content to navigate the sandboxed browsing context itself." />
<script src="support/sandbox_helper.js" type="text/javascript"></script>
</head>
<body>
<pre>Description: Allow sandboxed iframe content to navigate the sandboxed browsing context itself.</pre>
<table id='testtable' border='1'>
<tr>
<td>Test Result</td>
<td>Test Assertion</td>
</tr>
<tr>
<td id='test_0_result'>Manual</td>
<td id='test_0_assertion'>
<div>Steps:</div>
<div>1. Click link "Click here to perform self navigation".</div>
<br />
<div>Test passes if there is no red on the page and the word "PASS" appears in the below iframe after following the above steps.</div>
</td>
</tr>
</table>
<br />
<div id="testframe">
<pre>iframe with sandbox=""</pre>
<iframe id="iframe1" name="iframe1" src="support/iframe_sandbox_008.htm" sandbox="" style="height: 100px; width: 350px;"></iframe>
</div>
<script type="text/javascript">
DisableTestForNonSupportingBrowsers();
</script>
</body>
</html>

View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: Block window.open() API inside iframe with sandbox attribute.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-navigation-browsing-context-flag" />
<meta name="assert" content="Block window.open() API inside iframe with sandbox attribute." />
<script src="support/sandbox_helper.js" type="text/javascript"></script>
</head>
<body>
<pre>Description: Block window.open() API inside iframe with sandbox attribute.</pre>
<table id='testtable' border='1'>
<tr>
<td>Test Result</td>
<td>Test Assertion</td>
</tr>
<tr>
<td id='test_0_result'>Manual</td>
<td id='test_0_assertion'>
<div>Steps:</div>
<div>1. Click button "Click here to call window.open() API".</div>
<br />
<div>Test passes if there is no red on the page and no new window opens. The user agent may offer the user the option of allowing a new window to open.</div>
</td>
</tr>
</table>
<br />
<div id="testframe">
<pre>iframe with sandbox="allow-scripts allow-same-origin allow-forms allow-top-navigation"</pre>
<iframe src="support/iframe_sandbox_010.htm" sandbox="allow-scripts allow-same-origin allow-forms allow-top-navigation" style="height: 100px; width: 450px;"></iframe>
</div>
<script type="text/javascript">
DisableTestForNonSupportingBrowsers();
</script>
</body>
</html>

View file

@ -0,0 +1,65 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: iframe sandbox attribute value support DOMTokenList interface.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#the-iframe-element" />
<meta name="assert" content="iframe sandbox attribute value support DOMTokenList interface." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<iframe id="iframe1" src="about:blank" sandbox="allow-scripts allow-same-origin allow-forms" style="display : none"></iframe>
<script type="text/javascript">
test(function() {
var iframeEle = document.getElementById("iframe1");
assert_equals(iframeEle.sandbox.length, 3)
}, "DOMTokenList length")
test(function() {
var iframeEle = document.getElementById("iframe1");
assert_equals(iframeEle.sandbox.item(1), "allow-same-origin")
}, "DOMTokenList item(index)")
test(function() {
var iframeEle = document.getElementById("iframe1");
assert_true(iframeEle.sandbox.contains("allow-forms"))
}, "DOMTokenList contains(DomString)")
test(function() {
var iframeEle = document.getElementById("iframe1");
iframeEle.sandbox.add("ALLOW-SANDBOX");
assert_true(iframeEle.sandbox.contains("ALLOW-SANDBOX"))
}, "DOMTokenList add(DomString)")
test(function() {
var iframeEle = document.getElementById("iframe1");
iframeEle.sandbox.remove("ALLOW-SANDBOX");
assert_false(iframeEle.sandbox.contains("ALLOW-SANDBOX"))
}, "DOMTokenList remove(DomString)")
test(function() {
var iframeEle = document.getElementById("iframe1");
iframeEle.sandbox.remove("ALLOW-SANDBOX");
assert_true(
iframeEle.sandbox.toggle("allow-top-navigation") && iframeEle.sandbox.contains("allow-top-navigation") &&
!iframeEle.sandbox.toggle("allow-top-navigation") && !iframeEle.sandbox.contains("allow-top-navigation")
)
}, "DOMTokenList toggle(DomString) - Returns true if token is now present (it was added); returns false if it is not (it was removed).")
test(function() {
var iframeEle = document.getElementById("iframe1");
assert_equals(iframeEle.sandbox.value, iframeEle.sandbox.toString())
}, "DOMTokenList sandbox.toString()")
test(function() {
var iframeEle = document.getElementById("iframe1");
iframeEle.sandbox.remove("ALLOW-SANDBOX");
assert_true(iframeEle.sandbox.contains("allow-scripts") != iframeEle.sandbox.contains("Allow-SCRIPTS"))
}, "DOMTokenList case sensitivity")
</script>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: value of sandbox attribute must be an unordered set of unique space-separated tokens.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
<meta name="assert" content="value of sandbox attribute must be an unordered set of unique space-separated tokens." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("value of sandbox attribute must be an unordered set of unique space-separated tokens.");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "cookies are R/W");
});
t.done();
}
var timer = setTimeout(callback, 4000);
window.addEventListener("message", callback, false);
</script>
<div id=log></div>
<iframe style="display:none" src="support/iframe_sandbox_012.htm" sandbox=" Allow-Scripts Allow-Same-Origin "></iframe>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: value of sandbox attribute must be an unordered set of unique space-separated tokens.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
<meta name="assert" content="value of sandbox attribute must be an unordered set of unique space-separated tokens." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("value of sandbox attribute must be an unordered set of unique space-separated tokens.");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "cookies are R/W");
});
t.done();
}
var timer = setTimeout(callback, 4000);
window.addEventListener("message", callback, false);
</script>
<div id=log></div>
<iframe style="display:none" src="support/iframe_sandbox_012.htm" sandbox="
allow-scripts
allow-same-origin
"></iframe>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: value of sandbox attribute must be an unordered set of unique space-separated tokens.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
<meta name="assert" content="value of sandbox attribute must be an unordered set of unique space-separated tokens." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("value of sandbox attribute must be an unordered set of unique space-separated tokens.");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "cookies are R/W");
});
t.done();
}
var timer = setTimeout(callback, 4000);
window.addEventListener("message", callback, false);
</script>
<div id=log></div>
<iframe style="display:none" src="support/iframe_sandbox_012.htm" sandbox=" allow-scripts allow-same-origin "></iframe>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: value of sandbox attribute must be an unordered set of unique space-separated tokens.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
<meta name="assert" content="value of sandbox attribute must be an unordered set of unique space-separated tokens." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("value of sandbox attribute must be an unordered set of unique space-separated tokens.");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "cookies are R/W");
});
t.done();
}
var timer = setTimeout(callback, 4000);
window.addEventListener("message", callback, false);
</script>
<div id=log></div>
<iframe style="display:none" src="support/iframe_sandbox_012.htm" sandbox="&#32ALLOW-SCRIPTS&#32allow-same-origin&#32"></iframe>
</body>
</html>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: value of sandbox attribute must be an unordered set of unique space-separated tokens.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
<meta name="assert" content="value of sandbox attribute must be an unordered set of unique space-separated tokens." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("value of sandbox attribute must be an unordered set of unique space-separated tokens.");
function callback(event)
{
t.step(function() {
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "cookies are R/W");
});
t.done();
}
window.addEventListener("message", callback, false);
</script>
<div id=log></div>
<iframe style="display:none" src="support/iframe_sandbox_012.htm" sandbox="&#13ALLOW-SCRIPTS&#13allow-same-origin&#13"></iframe>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: value of sandbox attribute must be an unordered set of unique space-separated tokens.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
<meta name="assert" content="value of sandbox attribute must be an unordered set of unique space-separated tokens." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("value of sandbox attribute must be an unordered set of unique space-separated tokens.");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "cookies are R/W");
});
t.done();
}
var timer = setTimeout(callback, 4000);
window.addEventListener("message", callback, false);
</script>
<div id=log></div>
<iframe style="display:none" src="support/iframe_sandbox_012.htm" sandbox="&#12ALLOW-SCRIPTS&#12allow-same-origin&#12"></iframe>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: value of sandbox attribute must be an unordered set of unique space-separated tokens.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
<meta name="assert" content="value of sandbox attribute must be an unordered set of unique space-separated tokens." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("value of sandbox attribute must be an unordered set of unique space-separated tokens.");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "cookies are R/W");
});
t.done();
}
var timer = setTimeout(callback, 4000);
window.addEventListener("message", callback, false);
</script>
<div id=log></div>
<iframe style="display:none" src="support/iframe_sandbox_012.htm" sandbox="&#10ALLOW-SCRIPTS&#10allow-same-origin&#10"></iframe>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: value of sandbox attribute must be an unordered set of unique space-separated tokens.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
<meta name="assert" content="value of sandbox attribute must be an unordered set of unique space-separated tokens." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("value of sandbox attribute must be an unordered set of unique space-separated tokens.");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "cookies are R/W");
});
t.done();
}
var timer = setTimeout(callback, 4000);
window.addEventListener("message", callback, false);
</script>
<div id=log></div>
<iframe style="display:none" src="support/iframe_sandbox_012.htm" sandbox="&#9ALLOW-SCRIPTS&#9allow-same-origin&#9"></iframe>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: Nested iframes cannot have less sandbox restrictions than their most restrictive ancestor iframe.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
<meta name="assert" content="Nested iframes cannot have less sandbox restrictions than their most restrictive ancestor iframe." />
<script src="support/sandbox_helper.js" type="text/javascript"></script>
</head>
<body>
<pre>Description: Nested iframes cannot have less sandbox restrictions than their most restrictive ancestor iframe.</pre>
<div>This test is to verify script is blocked inside nested iframes if the top-most sandbox iframe has no 'allow-scripts' token.</div>
<br />
<table id='testtable' border='1'>
<tr>
<td>Test Result</td>
<td>Test Assertion</td>
</tr>
<tr>
<td id='test_0_result'>Manual</td>
<td id='test_0_assertion'>Test passes if there is no red on the page.</td>
</tr>
</table>
<br />
<div id="testframe">
<div style="font-weight:bold">Top-most iframe with sandbox=""</div>
<iframe id="iframe1" name="iframe1" src="support/iframe_sandbox_020.htm" sandbox="" style="height: 330px; width: 400px;"></iframe>
</div>
<script type="text/javascript">
DisableTestForNonSupportingBrowsers();
</script>
</body>
</html>

View file

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: Nested iframes cannot have less sandbox restrictions than their most restrictive ancestor iframe.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
<meta name="assert" content="Nested iframes cannot have less sandbox restrictions than their most restrictive ancestor iframe." />
<script src="support/sandbox_helper.js" type="text/javascript"></script>
</head>
<body>
<pre>Description: Nested iframes cannot have less sandbox restrictions than their most restrictive ancestor iframe.</pre>
<div>This test is to verify script is allowed inside nested iframes if any of the conditions below are true</div>
<div>1. both parent sandbox and child sandbox have 'allow-scripts' token.</div>
<div>2. parent sandbox has 'allow-scripts' token and nested child iframe has no sandbox attribute.</div>
<div>3. parent iframe has no sandbox attribute and child iframe has sandbox='allow-scripts' token.</div>
<div>4. both parent and child iframes have no sandbox attribute.</div>
<br />
<table id='testtable' border='1'>
<tr>
<td>Test Result</td>
<td>Test Assertion</td>
</tr>
<tr>
<td id='test_0_result'>Manual</td>
<td id='test_0_assertion'>Test passes if there is no red on the page.</td>
</tr>
</table>
<br />
<div id="testframe">
<div style="float: left; border: 1px solid; padding: 5px;">
<div style="font-weight: bold">Top-most iframe with sandbox="allow-scripts"</div>
<iframe id="iframe1" src="support/iframe_sandbox_021.htm" sandbox="allow-scripts" style="height: 330px; width: 400px;"></iframe>
</div>
<div style="float: left; border: 1px solid; padding: 5px; margin-left: 20px;">
<div style="font-weight: bold">Top-most iframe without sandbox attribute</div>
<iframe id="iframe2" src="support/iframe_sandbox_021.htm" style="height: 330px; width: 400px;"></iframe>
</div>
</div>
<script type="text/javascript">
DisableTestForNonSupportingBrowsers();
</script>
</body>
</html>

View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: allow sandbox iframe to navigate their top-level browsing context if sandbox="allow-top-navigation".</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-scripts-browsing-context-flag" />
<meta name="assert" content="Allow sandbox iframe to navigate their top-level browsing context if sandbox='allow-top-navigation'." />
<script src="support/sandbox_helper.js" type="text/javascript"></script>
</head>
<body>
<pre>Description: Allow sandbox iframe to navigate its top-level browsing context if sandbox='allow-top-navigation'.</pre>
<table id='testtable' border='1'>
<tr>
<td>Test Result</td>
<td>Test Assertion</td>
</tr>
<tr>
<td id='test_0_result'>Manual</td>
<td id='test_0_assertion'>
<div>Steps:</div>
<div>1. Click link "Open the link in top window".</div>
<br />
<div>Test passes if there is no red on the page and no top-level navigation after following the above steps.</div>
</td>
</tr>
</table>
<br />
<div id="testframe">
<pre>iframe with sandbox="allow-top-navigation"</pre>
<iframe src="support/iframe_sandbox_022.htm" sandbox="allow-top-navigation" style="height: 100px; width: 450px;"></iframe>
</div>
<script type="text/javascript">
DisableTestForNonSupportingBrowsers();
</script>
</body>
</html>

View file

@ -0,0 +1,33 @@
<!DOCTYPE HTML>
<html>
<head>
<title>HTML5 Sandbox: Allow sandbox iframe to access other content from the same origin if sandbox="allow-same-origin".</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
<meta name="assert" content=" Allow sandbox iframe to access other content from the same origin if sandbox='allow-same-origin'." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("Allow sandbox iframe to access other content from the same origin if sandbox='allow-same-origin'");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "window.parent.document");
});
t.done();
}
var timer = setTimeout(callback, 4000);
window.addEventListener("message", callback, false);
</script>
<iframe src="support/iframe_sandbox_023.htm" sandbox="allow-scripts allow-same-origin" style="display:none"></iframe>
<div id=log></div>
</body>
</html>

View file

@ -0,0 +1,32 @@
<!DOCTYPE HTML>
<html>
<head>
<title>HTML5 Sandbox: document.cookie access is allowed inside iframe with sandbox="allow-same-origin".</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
<meta name="assert" content="document.cookie access is allowed inside iframe with sandbox='allow-same-origin'." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("document.cookie access is allowed inside iframe with sandbox='allow-same-origin'.");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "cookies are R/W");
});
t.done();
}
var timer = setTimeout(callback, 4000);
window.addEventListener("message", callback, false);
</script>
<div id=log></div>
<iframe src="support/iframe_sandbox_024.htm" sandbox="allow-scripts allow-same-origin" style="display:none"></iframe>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: Allow parent content to access sandbox child iframe content when sandbox='allow-same-origin</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
<meta name="assert" content="Allow parent content to access sandbox child iframe content when sandbox='allow-same-origin'" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("Allow parent content to access sandbox child iframe content when sandbox='allow-same-origin'");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(document.getElementById('sandboxIframe').contentDocument.title, "Page with a message");
});
t.done();
}
</script>
<div id=log></div>
<iframe id='sandboxIframe' src="support/standalone-iframe-content.htm" sandbox="allow-same-origin" onload="callback()" style="display : none"></iframe>
</body>
</html>

View file

@ -0,0 +1,32 @@
<!DOCTYPE HTML>
<html>
<head>
<title>HTML5 Sandbox: Allow localStorage and sessionStorage access inside iframe with sandbox='allow-same-origin allow-scripts'.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
<meta name="assert" content="Allow localStorage and sessionStorage access inside iframe with sandbox='allow-same-origin allow-scripts'." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("Allow localStorage and sessionStorage access inside iframe with sandbox='allow-same-origin allow-scripts'");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "access to window.localStorage and window.sessionStorage");
});
t.done();
}
var timer = setTimeout(callback, 4000);
window.addEventListener("message", callback, false);
</script>
<div id=log></div>
<iframe src="support/iframe_sandbox_026.htm" sandbox="allow-scripts allow-same-origin" style="display : none"></iframe>
</body>
</html>

View file

@ -0,0 +1,32 @@
<!DOCTYPE HTML>
<html>
<head>
<title>HTML5 Sandbox: Allow XMLHttpRequest inside iframe with the sandbox attribute if sandbox='allow-same-origin'.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
<meta name="assert" content="Allow XMLHttpRequest in an iframe with the sandbox attribute if sandbox='allow-same-origin'." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("Allow XMLHttpRequest in an iframe with the sandbox attribute if sandbox='allow-same-origin'.");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "access to window.XMLHttpRequest");
});
t.done();
}
var timer = setTimeout(callback, 4000);
window.addEventListener("message", callback, false);
</script>
<div id=log></div>
<iframe src="support/iframe_sandbox_027.htm" sandbox="allow-scripts allow-same-origin" style="display : none"></iframe>
</body>
</html>

View file

@ -0,0 +1,33 @@
<!DOCTYPE HTML>
<html>
<head>
<title>HTML5 Sandbox: Block sandbox iframe from accessing other content from the same origin.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
<meta name="assert" content="Block sandbox iframe from accessing other content from the same origin." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("Block sandbox iframe from accessing other content from the same origin.");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "!window.parent.document");
});
t.done();
}
var timer = setTimeout(callback, 4000);
window.addEventListener("message", callback, false);
</script>
<iframe src="support/iframe_sandbox_028.htm" sandbox="allow-scripts" style="display:none"></iframe>
<div id=log></div>
</body>
</html>

View file

@ -0,0 +1,32 @@
<!DOCTYPE HTML>
<html>
<head>
<title>HTML5 Sandbox: Block document.cookie inside iframe with the sandbox attribute.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
<meta name="assert" content="Block document.cookie inside iframe with the sandbox attribute." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("Block document.cookie inside iframe with the sandbox attribute.");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "cookies are not R/W");
});
t.done();
}
var timer = setTimeout(callback, 4000);
window.addEventListener("message", callback, false);
</script>
<div id=log></div>
<iframe src="support/iframe_sandbox_029.htm" sandbox="allow-scripts" style="display:none"></iframe>
</body>
</html>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Sandbox: Block parent content to access sandbox child iframe content when sandbox attribute exists</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
<meta name="assert" content="Block parent content to access sandbox child iframe content when sandbox attribute exists" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("Block parent content to access sandbox child iframe content when sandbox attribute exists");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
try { document.getElementById('sandboxIframe').contentDocument.title; assert_true(false);}
catch(e) {assert_true(true);}
});
t.done();
}
</script>
<div id=log></div>
<iframe id='sandboxIframe' src="support/standalone-iframe-content.htm" sandbox onload="callback()" style="display : none"></iframe>
</body>
</html>

View file

@ -0,0 +1,32 @@
<!DOCTYPE HTML>
<html>
<head>
<title>HTML5 Sandbox: Block localStorage and sessionStorage inside iframe with the sandbox attribute.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
<meta name="assert" content="Block localStorage and sessionStorage inside iframe with the sandbox attribute." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("Block localStorage and sessionStorage inside iframe with the sandbox attribute.");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "no access to window.localStorage and window.sessionStorage");
});
t.done();
}
var timer = setTimeout(callback, 4000);
window.addEventListener("message", callback, false);
</script>
<div id=log></div>
<iframe src="support/iframe_sandbox_031.htm" sandbox="allow-scripts" style="display : none"></iframe>
</body>
</html>

View file

@ -0,0 +1,32 @@
<!DOCTYPE HTML>
<html>
<head>
<title>HTML5 Sandbox: Block XMLHttpRequest in an iframe with the sandbox attribute.</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
<meta name="assert" content="Block XMLHttpRequest inside sandbox iframe." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script type="text/javascript">
var t = async_test("Block XMLHttpRequest in an iframe with the sandbox attribute.");
function callback(event)
{
t.step(function(){
assert_true('sandbox' in document.createElement('iframe'));
assert_equals(event.data, "no access to window.XMLHttpRequest");
});
t.done();
}
var timer = setTimeout(callback, 4000);
window.addEventListener("message", callback, false);
</script>
<div id=log></div>
<iframe src="support/iframe_sandbox_032.htm" sandbox="allow-scripts" style="display : none"></iframe>
</body>
</html>

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<body>
<script>
window.onload = function() {
try {
top.location = "data:text/html,\u003c!DOCTYPE html\u003e\u003cscript\u003eopener.postMessage('can navigate', '*');\u003c/script\u003e";
} catch(e) {
top.postMessage("cannot navigate", "*");
}
}
</script>
</body>
</html>

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<p>This is a frame that tries to navigate its parent.</p>
<script>
window.onload = function() {
try {
parent.location.href = "data:text/html,\u003c!DOCTYPE html\u003e\u003cp\u003eIf this message appears, then this frame has been navigated by its child.\u003c/p\u003e\u003cscript\u003eparent.postMessage('can navigate', '*');\u003c/script\u003e";
} catch(e) {
parent.parent.postMessage("can not navigate", "*");
}
}
</script>

View file

@ -0,0 +1,4 @@
<!DOCTYPE html>
<p>If this message appears, then this frame has not been navigated by its child.</p>
<iframe src="iframe-that-tries-to-navigate-parent-and-sends-result-to-grandparent.html">
</iframe>

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<iframe src="data:text/html,If this message appears, then this frame has not been navigated by its parent."></iframe>
<script>
window.onload = function() {
try {
document.querySelector("iframe").contentWindow.location.href = "data:text/html,\u003c!DOCTYPE html\u003e\u003cp\u003eIf this message appears, then this frame has been navigated by its parent.\u003c/p\u003e\u003cscript\u003eparent.parent.postMessage('can navigate', '*');\u003c/script\u003e";
} catch(e) {
parent.postMessage("can not navigate", "*");
}
}
</script>

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<p>If this message appears, then this frame has not been navigated.</p>
<script>
window.onload = function() {
try {
location.href = "data:text/html,\u003c!DOCTYPE html\u003e\u003cp\u003eIf this message appears, then this frame has been navigated.\u003c/p\u003e\u003cscript\u003eparent.postMessage('can navigate', '*');\u003c/script\u003e";
} catch(e) {
parent.postMessage("can not navigate", "*");
}
}
</script>

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Page with script</title>
</head>
<body>
<script type="text/javascript">
parent.window.postMessage("script ran", "*");
</script>
</body>
</html>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML5 video with autoplay attribute.</title>
<script src="/common/media.js"></script>
</head>
<body>
<script>
function do_play(event) {
parent.window.postMessage("play event fired", "*");
}
document.write(
"<video id='video0' src='" + getVideoURI("/media/green-at-15") + "'" +
" autoplay onplay='do_play(event);'>"
);
</script>
Your browser does not support HTML5 video.
</video>
</body>
</html>

View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title>autofocus on form control</title>
</head>
<body>
<div>Below form control has autofocus attribute set.</div><br />
<form action="">
<span>Textbox: </span><input autofocus="autofocus" type="text" name="movie" />
</form>
</body>
</html>

View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>object tag</title>
</head>
<body>
<object width="400" height="600" data="sandbox.pdf">
</object>
</body>
</html>

View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title>Form submission</title>
</head>
<body>
<form id="form1" action="standalone-pass.htm">
<span>Name: </span><input type="text" name="name" value="browser" /><br />
<input id="submitButton" type="submit" value="Submit Form" />
</form>
</body>
</html>

View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title>Form submission</title>
</head>
<body>
<form id="form1" action="standalone-fail.htm">
<span>Name: </span><input type="text" name="name" value="browser" /><br />
<input id="submitButton" type="submit" value="Submit Form" />
</form>
</body>
</html>

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Page with hyperlink and target set to self</title>
</head>
<body>
<a id="hyperlink" href="standalone-pass.htm" target="_self">Click here to perform self navigation</a>
</body>
</html>

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Page with window.open()</title>
</head>
<body>
<button type="button" onclick="javascript:window.open('standalone-fail.htm')">Click here to call window.open() API</button>
</body>
</html>

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>Page with access to document.cookie</title>
</head>
<body>
<script type="text/javascript">
cookie = document.cookie;
document.cookie = "name=browser";
parent.window.postMessage("cookies are R/W", "*");
</script>
</body>
</html>

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<title>Page with iframes</title>
</head>
<body>
<table cellpadding="5" cellspacing="10">
<tr>
<td>
<span>child iframe with sandbox="allow-scripts" attribute</span><br />
<iframe id="Iframe1" src="iframe_sandbox_020a.htm" sandbox="allow-scripts" style="height: 50px; width: 250px;"></iframe>
</td>
</tr>
<tr>
<td>
<span>child iframe with sandbox="" attribute</span><br />
<iframe id="Iframe2" src="iframe_sandbox_020a.htm" sandbox="" style="height: 50px; width: 250px;"></iframe>
</td>
</tr>
<tr>
<td>
<span>child iframe without sandbox attribute</span><br />
<iframe id="Iframe3" src="iframe_sandbox_020a.htm" style="height: 50px; width: 250px;"></iframe>
</td>
</tr>
</table>
</body>
</html>

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>Page with script</title>
</head>
<body>
<div>Script Execution: <span id="scriptExecute" style="Color: Green">Blocked</span></div>
<script type="text/javascript">
document.getElementById("scriptExecute").innerHTML = "Not Blocked";
document.getElementById("scriptExecute").style.color = "Red";
</script>
</body>
</html>

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<title>Page with iframes</title>
</head>
<body>
<table cellpadding="5" cellspacing="10">
<tr>
<td>
<span>child iframe with sandbox="allow-scripts" attribute</span><br />
<iframe id="Iframe1" src="iframe_sandbox_021a.htm" sandbox="allow-scripts" style="height: 50px; width: 250px;"></iframe>
</td>
</tr>
<tr>
<td>
<span>child iframe with sandbox="" attribute</span><br />
<iframe id="Iframe2" src="iframe_sandbox_020a.htm" sandbox="" style="height: 50px; width: 250px;"></iframe>
</td>
</tr>
<tr>
<td>
<span>child iframe without sandbox attribute</span><br />
<iframe id="Iframe3" src="iframe_sandbox_021a.htm" style="height: 50px; width: 250px;"></iframe>
</td>
</tr>
</table>
</body>
</html>

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>Page with script</title>
</head>
<body>
<div>Script Execution: <span id="scriptExecute" style="Color: Red">Blocked</span></div>
<script type="text/javascript">
document.getElementById("scriptExecute").innerHTML = "Allowed";
document.getElementById("scriptExecute").style.color = "Green";
</script>
</body>
</html>

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>target=_top</title>
</head>
<body>
<div>hyperlink with target=_top</div>
<br />
<a href="standalone-pass.htm" target="_top">Open the link in top window</a>
</body>
</html>

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head><title>Access parent dom</title>
</head>
<body>
<script type="text/javascript">
if (window.parent.document)
{
parent.window.postMessage("window.parent.document", "*");
}else{
parent.window.postMessage("!window.parent.document", "*");
}
</script>
</body>
</html>

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head><title>Page with access to document.cookie</title>
</head>
<body>
<div>Cookie Read: <span id="readCookie"></span></div>
<script type="text/javascript">
cookie = document.cookie;
document.cookie = "name=browser";
parent.window.postMessage("cookies are R/W", "*");
</script>
</body>
</html>

View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head><title>Page with access to localStorage and sessionStorage</title>
</head>
<body>
<script type="text/javascript">
if (window.localStorage && window.sessionStorage) {
parent.window.postMessage("access to window.localStorage and window.sessionStorage", "*");
}
</script>
</body>
</html>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head><title>XMLHttpRequest</title>
</head>
<body>
<script type="text/javascript">
xhrRequest = new XMLHttpRequest();
xhrRequest.onreadystatechange = function () {
if (xhrRequest.readyState == 4 && xhrRequest.status == 200) {
//xhr successful
parent.window.postMessage("access to window.XMLHttpRequest", "*");
}
}
xhrRequest.open("GET", "standalone-pass.htm", true);
xhrRequest.send();
</script>
</body>
</html>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head><title>Access parent dom</title>
</head>
<body>
<script type="text/javascript">
try
{
if (window.parent.document)
{
parent.window.postMessage("window.parent.document", "*");
}
}
catch(e)
{
parent.window.postMessage("!window.parent.document", "*");
}
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head><title>Page with access to document.cookie</title>
</head>
<body>
<div>Cookie Read: <span id="readCookie"></span></div>
<script type="text/javascript">
try
{
cookie = document.cookie;
document.cookie = "name=browser";
parent.window.postMessage("cookies are R/W", "*");
}catch(e)
{
parent.window.postMessage("cookies are not R/W", "*");
}
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head><title>Page with access to localStorage and sessionStorage</title>
</head>
<body>
<script type="text/javascript">
try
{
if (window.localStorage && window.sessionStorage) {
parent.window.postMessage("access to window.localStorage and window.sessionStorage", "*");
}
}
catch(e)
{
parent.window.postMessage("no access to window.localStorage and window.sessionStorage", "*");
}
</script>
</body>
</html>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head><title>XMLHttpRequest</title>
</head>
<body>
<script type="text/javascript">
try
{
xhrRequest = new XMLHttpRequest();
xhrRequest.onreadystatechange = function () {
if (xhrRequest.readyState == 4 && xhrRequest.status == 200) {
//xhr successful
parent.window.postMessage("access to window.XMLHttpRequest", "*");
}
}
xhrRequest.open("GET", "standalone-pass.htm", true);
xhrRequest.send();
}catch(e){}
parent.window.postMessage("no access to window.XMLHttpRequest", "*");
</script>
</body>
</html>

View file

@ -0,0 +1,14 @@
function IsSandboxSupported() {
if ('sandbox' in document.createElement('iframe')) {
return true;
}
return false;
}
function DisableTestForNonSupportingBrowsers() {
//check if sandbox is supported by the browser
if (!IsSandboxSupported()) {
document.getElementById('testframe').innerHTML = "FAIL: Your browser does not support the sandbox attribute on the iframe element.";
document.getElementById('testframe').style.color = "Red";
}
}

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Page with FAIL message</title>
</head>
<body>
<div style="color: Red">FAIL!!!</div>
</body>
</html>

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Page with a message</title>
</head>
<body>
<div>Hello World.</div>
</body>
</html>

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Page with PASS message</title>
</head>
<body>
<div style="color: Green">PASS!!!</div>
</body>
</html>