Bug 809290 - Tests. r=bz

This commit is contained in:
Bobby Holley 2012-11-08 08:26:50 -08:00
parent 2c0fa15194
commit 2b8c345ee2
6 changed files with 93 additions and 0 deletions

View File

@ -130,6 +130,11 @@ MOCHITEST_FILES = \
test_bug755320.html \ test_bug755320.html \
test_bug777628.html \ test_bug777628.html \
test_bug665548.html \ test_bug665548.html \
test_bug809290.html \
file_bug809290_b1.html \
file_bug809290_b2.html \
file_bug809290_c.html \
file_empty.html \
$(NULL) $(NULL)
ifneq (Linux,$(OS_ARCH)) ifneq (Linux,$(OS_ARCH))

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<script>
function innerLoad() {
var win = document.getElementById('ifr').contentWindow;
win.location = "file_bug809290_c.html";
}
</script>
</head>
<body>
<iframe id="ifr" src="file_empty.html">
</body>
</html>

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<script>
function eventHandlerLoad() {
var win = document.getElementById('ifr').contentWindow;
win.location = "file_bug809290_c.html";
}
</script>
</head>
<body onload="eventHandlerLoad();">
<iframe id="ifr" src="file_empty.html">
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<script>
window.parent.parent.notifyReferrer(document.referrer);
</script>
</head>
<body>
</body>
</html>

View File

@ -0,0 +1,2 @@
<!DOCTYPE html>
<html><head></head><body></body></html>

View File

@ -0,0 +1,48 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=809290
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 809290</title>
<script type="application/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=809290">Mozilla Bug 809290</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 809290 **/
SimpleTest.waitForExplicitFinish();
var gNotifyCount = 0;
function notifyReferrer(referrer) {
++gNotifyCount;
if (gNotifyCount == 1) {
is(referrer, window.location.href, "Referrer should be the script entry point (this script)");
document.getElementById('ifr').setAttribute('src', 'file_bug809290_b2.html');
} else {
is(gNotifyCount, 2);
is(referrer, window.location.href.replace(/test_bug.*/, 'file_bug809290_b2.html'),
"Referrer should be the script entry point (iframe)");
SimpleTest.finish();
}
}
function go() {
var ifr = document.getElementById('ifr');
ifr.onload = null;
ifr.contentWindow.innerLoad();
}
</script>
</pre>
<iframe id="ifr" src="file_bug809290_b1.html" onload="go();"></iframe>
</body>
</html>