dom/tests/mochitest/chrome/test_popup_blocker_chrome.xul

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:b7a48e8ef70e
1 <?xml version="1.0"?>
2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
3 <?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?>
4 <!--
5 https://bugzilla.mozilla.org/show_bug.cgi?id=662519
6 -->
7 <window title="Mozilla Bug 662519"
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
10
11 <!-- test results are displayed in the html:body -->
12 <body xmlns="http://www.w3.org/1999/xhtml">
13 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=662519"
14 target="_blank">Mozilla Bug 662519</a>
15 </body>
16
17 <!-- test code goes here -->
18 <script type="application/javascript">
19 <![CDATA[
20
21 /** Test for Bug 662519 **/
22
23 SimpleTest.waitForExplicitFinish();
24
25 // We have to enable dom.disable_open_during_load which is disabled
26 // by the test harness.
27 let prefs = Components.classes["@mozilla.org/preferences-service;1"]
28 .getService(Components.interfaces.nsIPrefBranch);
29 var gLastDomLoadValue = prefs.getBoolPref("dom.disable_open_during_load");
30 prefs.setBoolPref("dom.disable_open_during_load", true);
31
32 let w = window.open("data:text/html,foobar", "", "width=200,height=200");
33 ok(w, "The window object shouldn't be null");
34
35 SimpleTest.waitForFocus(function() {
36 w.close();
37 ok(true, "The popup appeared");
38
39 SimpleTest.waitForFocus(function() {
40 let w = window.open("data:text/html,foobar", "", "width=200,height=200");
41 ok(w, "The window object shouldn't be null");
42
43 SimpleTest.waitForFocus(function() {
44 w.close();
45
46 ok(true, "The popup appeared");
47 prefs.setBoolPref("dom.disable_open_during_load", gLastDomLoadValue);
48 SimpleTest.finish();
49 }, w, false);
50 });
51 }, w, false);
52 ]]>
53 </script>
54 </window>

mercurial