Bug 771273 - Part 3: Test that window.open(..., 'top') works properly for in-process <iframe mozbrowser>. r=bz

--HG--
extra : rebase_source : be8f4dc04d4755f5b61865addc1df406fd87a560
This commit is contained in:
Justin Lebar 2012-07-23 15:59:37 -04:00
Родитель 460836cb2b
Коммит 023ae88f78
5 изменённых файлов: 74 добавлений и 0 удалений

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

@ -59,6 +59,9 @@ MOCHITEST_FILES = \
browserElement_TargetBlank.js \
test_browserElement_inproc_TargetBlank.html \
file_browserElement_TargetBlank.html \
browserElement_TargetTop.js \
test_browserElement_inproc_TargetTop.html \
file_browserElement_TargetTop.html \
browserElement_PromptCheck.js \
test_browserElement_inproc_PromptCheck.html \
browserElement_PromptConfirm.js \
@ -120,6 +123,7 @@ MOCHITEST_FILES += \
test_browserElement_oop_Alert.html \
test_browserElement_oop_AlertInFrame.html \
test_browserElement_oop_TargetBlank.html \
test_browserElement_oop_TargetTop.html \
test_browserElement_oop_PromptCheck.html \
test_browserElement_oop_PromptConfirm.html \
test_browserElement_oop_Close.html \

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

@ -0,0 +1,32 @@
/* Any copyright is dedicated to the public domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Bug 771273 - Check that window.open(url, '_top') works properly with <iframe
// mozbrowser>.
"use strict";
SimpleTest.waitForExplicitFinish();
function runTest() {
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addToWhitelist();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
iframe.addEventListener('mozbrowseropenwindow', function(e) {
ok(false, 'Not expecting an openwindow event.');
});
iframe.addEventListener('mozbrowserlocationchange', function(e) {
if (/file_browserElement_TargetTop.html\?2$/.test(e.detail)) {
ok(true, 'Got the locationchange we were looking for.');
SimpleTest.finish();
}
});
document.body.appendChild(iframe);
iframe.src = 'file_browserElement_TargetTop.html';
}
runTest();

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

@ -0,0 +1,12 @@
<html>
<body>
<div id='url'></div>
<script>
if (location.search == '') {
window.open('file_browserElement_TargetTop.html?2', '_top');
}
document.getElementById('url').innerHTML = document.location.href;
</script>
</body>
</html>

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

@ -0,0 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Bug 771273</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript;version=1.7" src="browserElement_TargetTop.js">
</script>
</body>
</html>

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

@ -0,0 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Bug 771273</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript;version=1.7" src="browserElement_TargetTop.js">
</script>
</body>
</html>