dom/events/test/test_bug742376.html

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 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=402089
     5 -->
     6 <head>
     7   <title>Test for Bug 742376</title>
     8   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    11 </head>
    13 <body>
    14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=742376">Mozilla Bug 742376</a>
    15 <script class="testbody" type="text/javascript">
    17 /** Test for Bug 742376 **/
    19 function hasListeners() {
    21   var Cc = SpecialPowers.Cc;
    22   var Ci = SpecialPowers.Ci;
    23   var dss = Cc["@mozilla.org/devicesensors;1"].getService(Ci.nsIDeviceSensors);
    25   return dss.hasWindowListener(Ci.nsIDeviceSensorData.TYPE_ORIENTATION, window);
    26 }
    28 is(hasListeners(), false, "Must not have listeners before tests start");
    30 function dumbListener(event) {}
    31 function dumbListener2(event) {}
    33 window.addEventListener("deviceorientation", dumbListener, false);
    34 window.addEventListener("deviceorientation", dumbListener2, false);
    36 is(hasListeners(), true, "Listeners should have been added");
    38 window.setTimeout(function() {
    40   window.removeEventListener("deviceorientation", dumbListener, false);
    41   is(hasListeners(), true, "Only some listeners should have been removed");
    42   window.setTimeout(function() {
    44     window.removeEventListener("deviceorientation", dumbListener2, false);
    45     window.setTimeout(function() {
    46       is(hasListeners(), false, "Listeners should have been removed");
    47       SimpleTest.finish();
    48     }, 0);
    49   }, 0);
    50 }, 0);
    52 SimpleTest.waitForExplicitFinish();
    54 </script>
    55 </pre>
    56 </body>
    57 </html>

mercurial