toolkit/content/tests/chrome/test_popupremoving_frame.xul

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 <?xml version="1.0"?>
     2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     5 <window title="Popup Unload Test"
     6         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
     8 <!--
     9   This test checks that popup elements are removed when the document is changed.
    10   -->
    12   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>      
    13   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>      
    15 <iframe id="frame" width="300" height="150" src="frame_popupremoving_frame.xul"/>
    17 <script class="testbody" type="application/javascript">
    18 <![CDATA[
    20 SimpleTest.waitForExplicitFinish();
    22 var gMenus = [];
    24 function popupsOpened()
    25 {
    26   var framedoc = $("frame").contentDocument;
    27   framedoc.addEventListener("DOMAttrModified", modified, false);
    29   // this is the order in which the menus should be hidden (reverse of the
    30   // order they were opened in). The second menu is removed during the
    31   // mutation listener, so gets the event afterwards.
    32   gMenus.push(framedoc.getElementById("nestedmenu4"));
    33   gMenus.push(framedoc.getElementById("nestedmenu2"));
    34   gMenus.push(framedoc.getElementById("nestedmenu3"));
    35   gMenus.push(framedoc.getElementById("nestedmenu1"));
    36   gMenus.push(framedoc.getElementById("separatemenu4"));
    37   gMenus.push(framedoc.getElementById("separatemenu2"));
    38   gMenus.push(framedoc.getElementById("separatemenu3"));
    39   gMenus.push(framedoc.getElementById("separatemenu1"));
    41   framedoc.location = "about:blank";
    42 }
    44 function modified(event)
    45 {
    46   if (event.attrName != "open")
    47     return;
    49   var framedoc = $("frame").contentDocument;
    51   var tohide = null;
    52   if (event.target.id == "separatemenu3")
    53     tohide = framedoc.getElementById("separatemenu2");
    54   else if (event.target.id == "nestedmenu3")
    55     tohide = framedoc.getElementById("nestedmenu2");
    57   if (tohide) {
    58     tohide.hidden = true;
    59     // force a layout flush
    60     $("frame").contentDocument.documentElement.boxObject.width;
    61   }
    63   is(event.target, gMenus.shift(), event.target.id + " hidden");
    64   if (gMenus.length == 0)
    65     SimpleTest.finish();
    66 }
    68 ]]>
    69 </script>
    71 <body xmlns="http://www.w3.org/1999/xhtml">
    72 <p id="display">
    73 </p>
    74 <div id="content" style="display: none">
    75 </div>
    76 <pre id="test">
    77 </pre>
    78 </body>
    80 </window>

mercurial