dom/tests/mochitest/chrome/test_popup_blocker_chrome.xul

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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>
    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>
    17   <!-- test code goes here -->
    18   <script type="application/javascript">
    19   <![CDATA[
    21   /** Test for Bug 662519 **/
    23   SimpleTest.waitForExplicitFinish();
    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);
    32   let w = window.open("data:text/html,foobar", "", "width=200,height=200");
    33   ok(w, "The window object shouldn't be null");
    35   SimpleTest.waitForFocus(function() {
    36     w.close();
    37     ok(true, "The popup appeared");
    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");
    43       SimpleTest.waitForFocus(function() {
    44         w.close();
    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