Fix the test: off-domain subframes can no longer change the location of a non-toplevel parent frame, with the checkin for bug 408052.

This commit is contained in:
bzbarsky@mit.edu 2008-01-27 13:00:13 -08:00
Родитель 30ec885b7d
Коммит 920b7a7995
3 изменённых файлов: 109 добавлений и 97 удалений

Просмотреть файл

@ -1,59 +1,59 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=326337
-->
<head>
<title>Inner file for Bug 326337</title>
</head>
<body>
<script>
document.domain = "example.com";
runTest1();
var xhr;
function runTest1() {
xhr = new XMLHttpRequest();
xhr.open("GET", "file_bug326337.xml", true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
check(xhr.responseXML.documentElement.getAttribute("root"));
runTest2();
}
}
xhr.send(null);
}
function runTest2() {
var secondDoc = false;
xhr = new XMLHttpRequest();
xhr.multipart = true;
xhr.open("GET", "file_bug326337_multipart.txt", true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
check(xhr.responseXML.documentElement.getAttribute("root"));
if (secondDoc) {
parent.location.hash = "#done";
}
else {
secondDoc = true;
}
}
}
xhr.send(null);
}
function check(attr) {
if (attr != "yes") {
parent.location.hash = "#fail";
throw 1;
}
}
</script>
</pre>
</body>
</html>
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=326337
-->
<head>
<title>Inner file for Bug 326337</title>
</head>
<body>
<script>
document.domain = "example.com";
runTest1();
var xhr;
function runTest1() {
xhr = new XMLHttpRequest();
xhr.open("GET", "file_bug326337.xml", true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
check(xhr.responseXML.documentElement.getAttribute("root"));
runTest2();
}
}
xhr.send(null);
}
function runTest2() {
var secondDoc = false;
xhr = new XMLHttpRequest();
xhr.multipart = true;
xhr.open("GET", "file_bug326337_multipart.txt", true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
check(xhr.responseXML.documentElement.getAttribute("root"));
if (secondDoc) {
parent.location.hash = "#done";
}
else {
secondDoc = true;
}
}
}
xhr.send(null);
}
function check(attr) {
if (attr != "yes") {
parent.location.hash = "#fail";
throw 1;
}
}
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<body>
<iframe id="inner" src="http://test1.example.com/tests/content/base/test/file_bug326337_inner.html"></iframe>
var t = setInterval(doCheck, 300);
function doCheck() {
if (location.hash) {
clearInterval(t);
window.opener.finishTest(location.hash);
}
}
<script>
</body>
</html>

Просмотреть файл

@ -1,38 +1,36 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=326337
-->
<head>
<title>Test for Bug 326337</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=326337">Mozilla Bug 326337</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<iframe id="inner" src="http://test1.example.com/tests/content/base/test/file_bug326337_inner.html"></iframe>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 326337 **/
SimpleTest.waitForExplicitFinish();
var t = setInterval(doCheck, 300);
function doCheck() {
if (location.hash) {
clearInterval(t);
is(location.hash, "#done", "failed to run");
SimpleTest.finish();
}
}
</script>
</pre>
</body>
</html>
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=326337
-->
<head>
<title>Test for Bug 326337</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=326337">Mozilla Bug 326337</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 326337 **/
SimpleTest.waitForExplicitFinish();
var win = window.open("file_bug326337_outer.html", "", "width=10, height=10");
function finishTest(str) {
win.close();
is(str, "#done", "failed to run");
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>