dom/tests/mochitest/chrome/file_bug799299.xul

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
michael@0 3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
michael@0 4 <!--
michael@0 5 https://bugzilla.mozilla.org/show_bug.cgi?id=799299
michael@0 6 -->
michael@0 7 <window title="Mozilla Bug 799299"
michael@0 8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
michael@0 9 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
michael@0 10 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
michael@0 11
michael@0 12 <!-- test results are displayed in the html:body -->
michael@0 13 <body xmlns="http://www.w3.org/1999/xhtml">
michael@0 14 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=799299"
michael@0 15 target="_blank">Mozilla Bug 799299</a>
michael@0 16 </body>
michael@0 17
michael@0 18 <!-- test code goes here -->
michael@0 19 <script type="application/javascript">
michael@0 20 <![CDATA[
michael@0 21 /** Test for Bug 799299 **/
michael@0 22
michael@0 23 function sendClick(win) {
michael@0 24 var wu = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
michael@0 25 .getInterface(Components.interfaces.nsIDOMWindowUtils);
michael@0 26 wu.sendMouseEventToWindow("mousedown", 10, 10, 0, 0, 0);
michael@0 27 wu.sendMouseEventToWindow("mouseup", 10, 10, 0, 0, 0);
michael@0 28 }
michael@0 29
michael@0 30 function runTests() {
michael@0 31 var b1 = document.getElementById("b1");
michael@0 32 var b2 = document.getElementById("b2");
michael@0 33 b1.contentWindow.focus();
michael@0 34 opener.wrappedJSObject.is(document.activeElement, b1,
michael@0 35 "Focused first iframe");
michael@0 36
michael@0 37 var didCallDummy = false;
michael@0 38 b2.contentWindow.addEventListener("mousedown", function(e) { didCallDummy = true; });
michael@0 39 sendClick(b2.contentWindow);
michael@0 40 opener.wrappedJSObject.ok(didCallDummy, "dummy mousedown handler should fire");
michael@0 41 opener.wrappedJSObject.is(document.activeElement, b2,
michael@0 42 "Focus shifted to second iframe");
michael@0 43
michael@0 44 b1.contentWindow.focus();
michael@0 45 opener.wrappedJSObject.is(document.activeElement, b1,
michael@0 46 "Re-focused first iframe for the first time");
michael@0 47
michael@0 48 var didCallListener = false;
michael@0 49 b2.contentWindow.addEventListener("mousedown", function(e) { didCallListener = true; e.preventDefault(); });
michael@0 50 sendClick(b2.contentWindow);
michael@0 51 opener.wrappedJSObject.ok(didCallListener, "mousedown handler should fire");
michael@0 52 opener.wrappedJSObject.is(document.activeElement, b2,
michael@0 53 "focus should move to the second iframe");
michael@0 54
michael@0 55 window.close();
michael@0 56 opener.wrappedJSObject.SimpleTest.finish();
michael@0 57 }
michael@0 58
michael@0 59 SimpleTest.waitForFocus(runTests);
michael@0 60 ]]>
michael@0 61 </script>
michael@0 62 <hbox flex="1">
michael@0 63 <browser id="b1" type="content" src="about:blank" flex="1" style="border: 1px solid black;"/>
michael@0 64 <browser id="b2" type="content" src="about:blank" flex="1" style="border: 1px solid black;"/>
michael@0 65 </hbox>
michael@0 66 </window>

mercurial