content/html/document/test/test_bug311681.xhtml

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 <html xmlns="http://www.w3.org/1999/xhtml">
     2 <!--
     3 https://bugzilla.mozilla.org/show_bug.cgi?id=311681
     4 -->
     5 <head>
     6   <title>Test for Bug 311681</title>
     7   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
     8   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     9 </head>
    10 <body>
    11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=311681">Mozilla Bug 311681</a>
    12 <script class="testbody" type="text/javascript">
    13 <![CDATA[
    14   // Setup script
    15   SimpleTest.waitForExplicitFinish();
    17   // Make sure to trigger the hashtable case by asking for enough elements
    18   // by ID.
    19   for (var i = 0; i < 256; ++i) {
    20     var x = document.getElementById(i);
    21   }
    23   // save off the document.getElementById function, since getting it as a
    24   // property off the document it causes a content flush.      
    25   var fun = document.getElementById;
    27   // Slot for our initial element with id "content"
    28   var testNode;
    30   function getCont() {
    31     return fun.call(document, "content");
    32   }
    34   function testClone() {
    35     // Test to make sure that if we have multiple nodes with the same ID in
    36     // a document we don't forget about one of them when the other is
    37     // removed.
    38     var newParent = $("display");
    39     var node = testNode.cloneNode(true);
    40     isnot(node, testNode, "Clone should be a different node");
    42     newParent.appendChild(node);
    44     // Check what getElementById returns, no flushing
    45     is(getCont(), node, "Should be getting new node pre-flush 1");
    47     // Trigger a layout flush, just in case.
    48     var itemHeight = newParent.offsetHeight/10;
    50     // Check what getElementById returns now.
    51     is(getCont(), node, "Should be getting new node post-flush 1");
    53     clear(newParent);
    55     // Check what getElementById returns, no flushing
    56     is(getCont(), testNode, "Should be getting orig node pre-flush 2");
    58     // Trigger a layout flush, just in case.
    59     var itemHeight = newParent.offsetHeight/10;
    61     // Check what getElementById returns now.
    62     is(getCont(), testNode, "Should be getting orig node post-flush 2");
    64     node = testNode.cloneNode(true);
    65     newParent.appendChild(node);
    66     testNode.parentNode.removeChild(testNode);
    68     // Check what getElementById returns, no flushing
    69     is(getCont(), node, "Should be getting clone pre-flush");
    71     // Trigger a layout flush, just in case.
    72     var itemHeight = newParent.offsetHeight/10;
    74     // Check what getElementById returns now.
    75     is(getCont(), node, "Should be getting clone post-flush");
    77   }
    79   function clear(node) {
    80     while (node.hasChildNodes()) {
    81       node.removeChild(node.firstChild);
    82     }
    83   }
    85   addLoadEvent(testClone);
    86   addLoadEvent(SimpleTest.finish);
    87 ]]>
    88 </script>
    89 <p id="display"></p>
    90 <div id="content" style="display: none">
    91   <script class="testbody" type="text/javascript">
    92   <![CDATA[
    93     testNode = fun.call(document, "content");
    94     ok(testNode != null, "Should have node here");
    95   ]]>
    96   </script>  
    97 </div>
    98 <pre id="test">
    99 </pre>
   100 </body>
   101 </html>

mercurial