dom/events/test/test_bug367781.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=367781
     5 -->
     6 <head>
     7   <title>Test for Bug 367781</title>
     8   <script type="text/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=367781">Mozilla Bug 367781</a>
    13 <p id="display"></p>
    14 <div id="content" style="display: none">
    16 </div>
    17 <pre id="test">
    18 <script class="testbody" type="text/javascript">
    20 /** Test for Bug  **/
    21 var eventCounter = 0;
    23 function handler(e) {
    24   if (e.type == "DOMNodeInserted")  {
    25     ++eventCounter;
    26   }
    27 }
    29 function doTest() {
    30   var i1 = document.getElementById('i1');
    31   var i2 = document.getElementById('i2');
    32   var pre = i1.contentDocument.getElementsByTagName("pre")[0];
    33   pre.addEventListener("DOMNodeInserted", handler, false);
    34   pre.textContent = pre.textContent + pre.textContent;
    35   ok(eventCounter == 1, "DOMNodeInserted should have been dispatched");
    37   pre.parentNode.removeChild(pre);
    38   i2.contentDocument.adoptNode(pre);
    39   i2.contentDocument.body.appendChild(pre);
    40   ok(eventCounter == 2, "DOMNodeInserted should have been dispatched in the new document");
    41 }
    43 SimpleTest.waitForExplicitFinish();
    44 addLoadEvent(doTest);
    45 addLoadEvent(SimpleTest.finish);
    47 </script>
    48 </pre>
    49 <iframe id="i1" src="data:text/html,&lt;html&gt;&lt;body&gt;&lt;pre&gt;Foobar&lt;/pre&gt;&lt;/body&gt;&lt;/html&gt;"></iframe>
    50 <iframe id="i2" src="data:text/html,&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;"></iframe>
    51 </body>
    52 </html>

mercurial