content/xul/document/test/test_bug403868.xul

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 <?xml version="1.0"?>
     2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     4 <!--
     5 https://bugzilla.mozilla.org/show_bug.cgi?id=403868
     6 -->
     7 <window title="Mozilla Bug 403868"
     8   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
     9   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    11   <!-- test results are displayed in the html:body -->
    12   <body xmlns="http://www.w3.org/1999/xhtml">
    13   <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=403868"
    14      target="_blank">Mozilla Bug 403868</a>
    15     <div id="content" style="display: none"/>
    16   </body>
    18   <!-- test code goes here -->
    19   <script type="application/javascript"><![CDATA[
    21     /** Test for Bug 403868 **/
    22 function createSpan(id, insertionPoint) {
    23   var s = document.createElementNS("http://www.w3.org/1999/xhtml", "span");
    24   s.id = id;
    25   $("content").insertBefore(s, insertionPoint);
    26   return s;
    27 }
    29 var s1a = createSpan("test1", null);
    30 is(document.getElementById("test1"), s1a,
    31    "Only one span with id=test1 in the tree; should work!");
    33 var s2a = createSpan("test1", null);
    34 is(document.getElementById("test1"), s1a,
    35    "Appending span with id=test1 doesn't change which one comes first");
    37 var s3a = createSpan("test1", s2a);
    38 is(document.getElementById("test1"), s1a,
    39    "Inserting span with id=test1 not at the beginning; doesn't matter");
    41 var s4a = createSpan("test1", s1a);
    42 is(document.getElementById("test1"), s4a,
    43    "Inserting span with id=test1 at the beginning changes which one is first");
    45 s4a.parentNode.removeChild(s4a);
    46 is(document.getElementById("test1"), s1a,
    47    "First-created span with id=test1 is first again");
    49 s1a.parentNode.removeChild(s1a);
    50 is(document.getElementById("test1"), s3a,
    51    "Third-created span with id=test1 is first now");
    53 // Start the id hashtable
    54 for (var i = 0; i < 256; ++i) {
    55   document.getElementById("no-such-id-in-the-document" + i);
    56 }
    58 var s1b = createSpan("test2", null);
    59 is(document.getElementById("test2"), s1b,
    60    "Only one span with id=test2 in the tree; should work!");
    62 var s2b = createSpan("test2", null);
    63 is(document.getElementById("test2"), s1b,
    64    "Appending span with id=test2 doesn't change which one comes first");
    66 var s3b = createSpan("test2", s2b);
    67 is(document.getElementById("test2"), s1b,
    68    "Inserting span with id=test2 not at the beginning; doesn't matter");
    70 var s4b = createSpan("test2", s1b);
    71 is(document.getElementById("test2"), s4b,
    72    "Inserting span with id=test2 at the beginning changes which one is first");
    74 s4b.parentNode.removeChild(s4b);
    75 is(document.getElementById("test2"), s1b,
    76    "First-created span with id=test2 is first again");
    78 s1b.parentNode.removeChild(s1b);
    79 is(document.getElementById("test2"), s3b,
    80    "Third-created span with id=test2 is first now");
    82   ]]></script>
    83 </window>

mercurial