dom/events/test/test_bug613634.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=613634
     5 -->
     6 <head>
     7   <title>Test for Bug 613634</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    10 </head>
    11 <body>
    12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=613634">Mozilla Bug 613634</a>
    13 <p id="display"></p>
    14 <div id="content" style="display: none">
    16 </div>
    17 <pre id="test">
    18 <script type="application/javascript">
    20 /** Test for Bug 613634 **/
    22 var eventCount = 0;
    23 function l(e) {
    24   if (e.eventPhase != Event.CAPTURING_PHASE) {
    25     ++eventCount;
    26   } else {
    27     ok(false, "Listener shouldn't be called!");
    28   }
    29 }
    31 var d1 = document.createElement("div");
    32 var d2 = document.createElement("div");
    34 d1.appendChild(d2);
    36 var x = new XMLHttpRequest();
    38 try {
    39 d1.addEventListener("foo", l);
    40 document.addEventListener("foo", l);
    41 window.addEventListener("foo", l);
    42 x.addEventListener("foo", l);
    43 } catch(ex) {
    44   ok(false, "Shouldn't throw " + ex);
    45 }
    47 var ev = document.createEvent("Event");
    48 ev.initEvent("foo", true, true);
    49 d2.dispatchEvent(ev);
    50 is(eventCount, 1, "Event listener should have been called!");
    52 ev = document.createEvent("Event");
    53 ev.initEvent("foo", false, false);
    54 d2.dispatchEvent(ev);
    55 is(eventCount, 1, "Event listener shouldn't have been called!");
    57 d1.removeEventListener("foo", l);
    58 ev = document.createEvent("Event");
    59 ev.initEvent("foo", true, true);
    60 d2.dispatchEvent(ev);
    61 is(eventCount, 1, "Event listener shouldn't have been called!");
    64 ev = document.createEvent("Event");
    65 ev.initEvent("foo", true, true);
    66 document.body.dispatchEvent(ev);
    67 is(eventCount, 3, "Event listener should have been called on document and window!");
    69 document.removeEventListener("foo", l);
    70 window.removeEventListener("foo", l, false);
    71 ev = document.createEvent("Event");
    72 ev.initEvent("foo", true, true);
    73 document.body.dispatchEvent(ev);
    74 is(eventCount, 3, "Event listener shouldn't have been called on document and window!");
    76 ev = document.createEvent("Event");
    77 ev.initEvent("foo", true, true);
    78 x.dispatchEvent(ev);
    79 is(eventCount, 4, "Event listener should have been called on XMLHttpRequest!");
    81 x.removeEventListener("foo", l);
    82 ev = document.createEvent("Event");
    83 ev.initEvent("foo", true, true);
    84 x.dispatchEvent(ev);
    85 is(eventCount, 4, "Event listener shouldn't have been called on XMLHttpRequest!");
    87 </script>
    88 </pre>
    89 </body>
    90 </html>

mercurial