зеркало из https://github.com/mozilla/gecko-dev.git
Bug 849791 - Frame DocShells do not inherit sandbox flags from their parents - tests (r=bz)
This commit is contained in:
Родитель
d0fead5075
Коммит
b835ef8582
|
@ -282,6 +282,9 @@ MOCHITEST_FILES = \
|
|||
file_iframe_sandbox_a_if7.html \
|
||||
file_iframe_sandbox_a_if8.html \
|
||||
file_iframe_sandbox_a_if9.html \
|
||||
file_iframe_sandbox_a_if10.html \
|
||||
file_iframe_sandbox_a_if11.html \
|
||||
file_iframe_sandbox_a_if12.html \
|
||||
test_iframe_sandbox_same_origin.html \
|
||||
file_iframe_sandbox_b_if1.html \
|
||||
file_iframe_sandbox_b_if2.html \
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 341604</title>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<frameset>
|
||||
<frame src="file_iframe_sandbox_a_if11.html">
|
||||
</frameset>
|
||||
</html>
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 341604</title>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script>
|
||||
function doStuff() {
|
||||
try {
|
||||
window.parent.parent.ok_wrapper(false, "a frame inside a sandboxed iframe should NOT be same origin with the iframe's parent");
|
||||
}
|
||||
catch (e) {
|
||||
window.parent.parent.postMessage({ok: true, desc: "a frame inside a sandboxed iframe is not same origin with the iframe's parent"}, "*");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<frameset>
|
||||
<frame onload='doStuff()' src="file_iframe_sandbox_a_if12.html">
|
||||
</frameset>
|
||||
I'm a <frame> inside an iframe which is sandboxed with 'allow-scripts'
|
||||
</html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 341604</title>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<script>
|
||||
function doStuff() {
|
||||
try {
|
||||
window.parent.parent.parent.ok_wrapper(false, "a frame inside a frame inside a sandboxed iframe should NOT be same origin with the iframe's parent");
|
||||
}
|
||||
catch (e) {
|
||||
dump("caught some e if12\n");
|
||||
window.parent.parent.parent.postMessage({ok: true, desc: "a frame inside a frame inside a sandboxed iframe is not same origin with the iframe's parent"}, "*");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<body onload='doStuff()'>
|
||||
I'm a <frame> inside a <frame> inside an iframe which is sandboxed with 'allow-scripts'
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -38,9 +38,9 @@ function ok_wrapper(result, desc) {
|
|||
if (result) {
|
||||
passedTests++;
|
||||
}
|
||||
|
||||
if (completedTests == 4) {
|
||||
is(passedTests, 4, "there should be 3 passed inheritance tests");
|
||||
|
||||
if (completedTests == 6) {
|
||||
is(passedTests, 6, "there should be 6 passed inheritance tests");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,17 @@ function doTest() {
|
|||
// the sandboxing of subloads of content within that iframe
|
||||
var if_8 = document.getElementById('if_8');
|
||||
if_8.sandbox = 'allow-scripts';
|
||||
if_8.contentWindow.doSubload();
|
||||
if_8.contentWindow.doSubload();
|
||||
|
||||
// passes if good
|
||||
// 10) a <frame> inside an <iframe> sandboxed with 'allow-scripts' should not be same
|
||||
// origin with this document
|
||||
// done by file_iframe_sandbox_a_if11.html which is contained with file_iframe_sandbox_a_if10.html
|
||||
|
||||
// passes if good
|
||||
// 11) a <frame> inside a <frame> inside an <iframe> sandboxed with 'allow-scripts' should not be same
|
||||
// origin with its parent frame or this document
|
||||
// done by file_iframe_sandbox_a_if12.html which is contained with file_iframe_sandbox_a_if11.html
|
||||
}
|
||||
|
||||
addLoadEvent(doTest);
|
||||
|
@ -104,4 +114,5 @@ addLoadEvent(doTest);
|
|||
<iframe sandbox="allow-scripts" id="if_3" src="file_iframe_sandbox_a_if3.html" height="10" width="10"></iframe>
|
||||
<iframe sandbox="allow-scripts allow-same-origin" id="if_5" src="file_iframe_sandbox_a_if5.html" height="10" width="10"></iframe>
|
||||
<iframe sandbox="allow-scripts allow-same-origin" id="if_8" src="file_iframe_sandbox_a_if8.html" height="10" width="10"></iframe>
|
||||
<iframe sandbox="allow-scripts" id="if_10" src="file_iframe_sandbox_a_if10.html" height="10" width="10"></iframe>
|
||||
</div>
|
||||
|
|
Загрузка…
Ссылка в новой задаче