js/xpconnect/tests/mochitest/test_bug720619.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=720619
     5 -->
     6 <head>
     7   <title>Test for Bug 629227</title>
     8   <script type="application/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=720619">Mozilla Bug 720619</a>
    13 <p id="display">
    14   <iframe id="testTarget"></iframe>
    15 </p>
    16 <div id="content" style="display: none">
    18 </div>
    19 <pre id="test">
    20 <script type="application/javascript">
    22 /** Test for Bug 720619 **/
    23 SimpleTest.waitForExplicitFinish();
    25 function checkThrows(f, exception) {
    26     try {
    27         f();
    28         ok(false, "should have thrown: " + f);
    29     } catch (e) {
    30         ok(exception.test(e.toString()), "correctly threw");
    31     }
    32 }
    34 function go() {
    35     var loc = $('ifr').contentWindow.location;
    36     checkThrows(function() {loc + '';}, /Permission denied/);
    37     checkThrows(function() {'' + loc;}, /Permission denied/);
    38     checkThrows(function() {String(loc);}, /Permission denied/);
    40     var win = $('ifr').contentWindow;
    41     checkThrows(function() {win + '';}, /Permission denied/);
    42     checkThrows(function() {'' + win;}, /Permission denied/);
    43     checkThrows(function() {String(win);}, /Permission denied/);
    45     SimpleTest.finish();
    46 }
    48 </script>
    50 <iframe id="ifr" onload="go()"
    51         src="http://example.org/tests/js/xpconnect/tests/mochitest/file_bug720619.html">
    52 </iframe>
    53 </pre>
    54 </body>
    55 </html>

mercurial