Bug 764718 - Part 3: Test for calling window.close() on a window opened by window.open from <iframe mozbrowser>. r=bz

This commit is contained in:
Justin Lebar 2012-06-21 11:58:49 -04:00
Родитель 837cab5eb4
Коммит a39a8108c0
5 изменённых файлов: 82 добавлений и 0 удалений

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

@ -48,6 +48,9 @@ _TEST_FILES = \
test_browserElement_inproc_PromptConfirm.html \
browserElement_Close.js \
test_browserElement_inproc_Close.html \
browserElement_CloseFromOpener.js \
test_browserElement_inproc_CloseFromOpener.html \
file_browserElement_CloseFromOpener.html \
browserElement_OpenWindow.js \
test_browserElement_inproc_OpenWindow.html \
file_browserElement_Open1.html \
@ -77,6 +80,7 @@ _TEST_FILES += \
test_browserElement_oop_PromptCheck.html \
test_browserElement_oop_PromptConfirm.html \
test_browserElement_oop_Close.html \
test_browserElement_oop_CloseFromOpener.html \
test_browserElement_oop_OpenWindow.html \
test_browserElement_oop_OpenWindowRejected.html \
test_browserElement_oop_SecurityChange.html \

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

@ -0,0 +1,34 @@
/* Any copyright is dedicated to the public domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Bug 764718 - Test that window.close() works from the opener window.
"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(true, "got openwindow event.");
document.body.appendChild(e.detail.frameElement);
e.detail.frameElement.addEventListener("mozbrowserclose", function(e) {
ok(true, "got mozbrowserclose event.");
SimpleTest.finish();
});
});
document.body.appendChild(iframe);
// file_browserElement_CloseFromOpener opens a new window and then calls
// close() on it.
iframe.src = "file_browserElement_CloseFromOpener.html";
}
runTest();

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

@ -0,0 +1,8 @@
<html>
<body>
<script>
var win = window.open('file_empty.html');
win.close();
</script>
</body>
</html>

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

@ -0,0 +1,18 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=757182
-->
<head>
<title>Test for Bug 757182</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>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=757182">Mozilla Bug 757182</a>
<script type="application/javascript;version=1.7" src="browserElement_CloseFromOpener.js">
</script>
</body>
</html>

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

@ -0,0 +1,18 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=757182
-->
<head>
<title>Test for Bug 757182</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>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=757182">Mozilla Bug 757182</a>
<script type="application/javascript;version=1.7" src="browserElement_CloseFromOpener.js">
</script>
</body>
</html>