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.

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

mercurial