dom/xbl/test/test_bug378518.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 https://bugzilla.mozilla.org/show_bug.cgi?id=378518
michael@0 6 -->
michael@0 7 <window title="Mozilla Bug 378518"
michael@0 8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
michael@0 9
michael@0 10 <script type="application/javascript"
michael@0 11 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
michael@0 12
michael@0 13 <bindings xmlns="http://www.mozilla.org/xbl"
michael@0 14 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
michael@0 15
michael@0 16 <binding id="mybinding" extends="xul:checkbox">
michael@0 17 <content>
michael@0 18 </content>
michael@0 19 </binding>
michael@0 20
michael@0 21 </bindings>
michael@0 22
michael@0 23 <!-- test results are displayed in the html:body -->
michael@0 24 <body xmlns="http://www.w3.org/1999/xhtml">
michael@0 25 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=378518"
michael@0 26 target="_blank">Mozilla Bug 378518</a>
michael@0 27 </body>
michael@0 28
michael@0 29 <!-- The elements we're testing with -->
michael@0 30 <command id="myBoxCommand" oncommand="myBoxClicked = true;"/>
michael@0 31 <command id="myCheckBoxCommand" oncommand="myCheckBoxClicked = true;"/>
michael@0 32 <command id="myExtendedBoxCommand" oncommand="myExtendedBoxClicked = true;"/>
michael@0 33
michael@0 34 <box id="myBox" command="myBoxCommand">
michael@0 35 <label>myBox</label>
michael@0 36 </box>
michael@0 37
michael@0 38 <checkbox id="myCheckBox" command="myCheckBoxCommand" label="myCheckBox"/>
michael@0 39
michael@0 40 <box id="myExtendedBox" command="myExtendedBoxCommand"
michael@0 41 style="-moz-binding:url(#mybinding)">
michael@0 42 <label>myExtendedBox</label>
michael@0 43 </box>
michael@0 44
michael@0 45 <!-- test code goes here -->
michael@0 46 <script type="application/javascript"> <![CDATA[
michael@0 47
michael@0 48 SimpleTest.expectAssertions(1);
michael@0 49
michael@0 50 var myBoxClicked = false;
michael@0 51 var myCheckBoxClicked = false;
michael@0 52 var myExtendedBoxClicked = false;
michael@0 53
michael@0 54 function testClick(elemName) {
michael@0 55 var wu =
michael@0 56 window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
michael@0 57 .getInterface(Components.interfaces.nsIDOMWindowUtils);
michael@0 58
michael@0 59 var a = document.getElementById(elemName).getBoundingClientRect();
michael@0 60 wu.sendMouseEvent('mousedown', a.left + 1, a.top + 1, 0, 1, 0);
michael@0 61 wu.sendMouseEvent('mouseup', a.left + 1, a.top + 1, 0, 1, 0);
michael@0 62 }
michael@0 63
michael@0 64 function doTest() {
michael@0 65 testClick('myBox');
michael@0 66 testClick('myCheckBox');
michael@0 67 testClick('myExtendedBox');
michael@0 68 ok(!myBoxClicked, "Shouldn't fire");
michael@0 69 ok(myCheckBoxClicked, "Should fire");
michael@0 70 ok(!myExtendedBoxClicked, "Shouldn't fire");
michael@0 71 SimpleTest.finish();
michael@0 72 }
michael@0 73
michael@0 74 /** Test for Bug 378518 **/
michael@0 75 SimpleTest.waitForExplicitFinish();
michael@0 76
michael@0 77 addLoadEvent(function() {
michael@0 78 setTimeout(doTest, 0);
michael@0 79 });
michael@0 80
michael@0 81 ]]>
michael@0 82 </script>
michael@0 83 </window>

mercurial