content/html/document/test/test_bug403868.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=403868
     4 -->
     5 <head>
     6   <title>Test for Bug 403868</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=403868">Mozilla Bug 403868</a>
    12 <p id="display"></p>
    13 <div id="content" style="display: none">
    15 </div>
    16 <pre id="test">
    17 <script class="testbody" type="text/javascript">
    18 <![CDATA[
    20 /** Test for Bug 403868 **/
    21 function createSpan(id, insertionPoint) {
    22   var s = document.createElementNS("http://www.w3.org/1999/xhtml", "span");
    23   s.id = id;
    24   $("content").insertBefore(s, insertionPoint);
    25   return s;
    26 }
    28 var s1a = createSpan("test1", null);
    29 is(document.getElementById("test1"), s1a,
    30    "Only one span with id=test1 in the tree; should work!");
    32 var s2a = createSpan("test1", null);
    33 is(document.getElementById("test1"), s1a,
    34    "Appending span with id=test1 doesn't change which one comes first");
    36 var s3a = createSpan("test1", s2a);
    37 is(document.getElementById("test1"), s1a,
    38    "Inserting span with id=test1 not at the beginning; doesn't matter");
    40 var s4a = createSpan("test1", s1a);
    41 is(document.getElementById("test1"), s4a,
    42    "Inserting span with id=test1 at the beginning changes which one is first");
    44 s4a.parentNode.removeChild(s4a);
    45 is(document.getElementById("test1"), s1a,
    46    "First-created span with id=test1 is first again");
    48 s1a.parentNode.removeChild(s1a);
    49 is(document.getElementById("test1"), s3a,
    50    "Third-created span with id=test1 is first now");
    52 // Start the id hashtable
    53 for (var i = 0; i < 256; ++i) {
    54   document.getElementById("no-such-id-in-the-document" + i);
    55 }
    57 var s1b = createSpan("test2", null);
    58 is(document.getElementById("test2"), s1b,
    59    "Only one span with id=test2 in the tree; should work!");
    61 var s2b = createSpan("test2", null);
    62 is(document.getElementById("test2"), s1b,
    63    "Appending span with id=test2 doesn't change which one comes first");
    65 var s3b = createSpan("test2", s2b);
    66 is(document.getElementById("test2"), s1b,
    67    "Inserting span with id=test2 not at the beginning; doesn't matter");
    69 var s4b = createSpan("test2", s1b);
    70 is(document.getElementById("test2"), s4b,
    71    "Inserting span with id=test2 at the beginning changes which one is first");
    73 s4b.parentNode.removeChild(s4b);
    74 is(document.getElementById("test2"), s1b,
    75    "First-created span with id=test2 is first again");
    77 s1b.parentNode.removeChild(s1b);
    78 is(document.getElementById("test2"), s3b,
    79    "Third-created span with id=test2 is first now");
    81 ]]>
    82 </script>
    83 </pre>
    84 </body>
    85 </html>

mercurial