content/html/document/test/test_bug172261.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=172261
     5 -->
     6 <head>
     7   <title>Test for Bug 172261</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=172261">Mozilla Bug 172261</a>
    13 <p id="display">
    14   <iframe id="test"></iframe>
    15 </p>
    16 <div id="content" style="display: none">
    18 </div>
    19 <pre id="test">
    20 <script class="testbody" type="text/javascript">
    21   /** Test for Bug 172261 **/
    22   SimpleTest.waitForExplicitFinish();
    24   var callable = false;
    25   function toggleCallable() { callable = true; }
    27   var doTestInIframe = false;
    29   // Shouldn't do history stuff from inside onload
    30   addLoadEvent(function() { setTimeout(startTest, 10) });
    32   function startTest() {
    33     // First, create a dummy document.  Use onunload handlers to make sure
    34     // bfcache doesn't screw us up.
    35     var doc = $("test").contentDocument;
    37     doc.write("<html><body onunload=''>First</body></html>");
    38     doc.close();
    40     // Now write our test document
    41     doc.write("<html><script>window.onerror = parent.onerror; if (parent.doTestInIframe) { parent.is(document.domain, parent.document.domain, 'Domains should match');  parent.toggleCallable(); } <"  + "/script><body>Second</body></html>");
    42     doc.close();
    44     $("test").onload = goForward;
    45     history.back();
    46   }
    48   function goForward() {
    49       $("test").onload = doTest;
    50       doTestInIframe = true;
    51       history.forward();
    52   }
    54   function doTest() {
    55     is($("test").contentDocument.domain, document.domain,
    56        "Domains should match 2");
    57     is($("test").contentDocument.location.href, location.href,
    58          "Locations should match");
    59     is(callable, true, "Subframe should be able to call us");
    60     SimpleTest.finish();
    61   }
    62 </script>
    63 </pre>
    64 </body>
    65 </html>

mercurial