js/xpconnect/tests/mochitest/test_bug478438.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=478438
     5 -->
     6 <head>
     7   <title>Test for Bug 478438</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   <script type="application/javascript;version=1.8">
    11     function fail(s, e) { ok(false, s + e) }
    12     function pass(s, e) { ok(true, s) }
    13     (pass.opposite = fail).opposite = pass;
    15     function test() {
    16       if (test.calledAlready)
    17         return;
    18       test.calledAlready = true;
    20       var iwin = document.getElementById("f").contentWindow;
    22       function testOne(fn, onAllow, infinitive) {
    23         try { fn(); onAllow("able " + infinitive, "") }
    24         catch (e) { onAllow.opposite("unable " + infinitive, ": " + e) }
    25       }
    27       testOne(function() iwin.focus, pass,
    28               "to resolve/get allAccess property iwin.focus");
    30       testOne(function() iwin.focus(), pass,
    31               "to call allAccess method iwin.focus");
    33       testOne(function() iwin.alert, fail,
    34               "to resolve/get restricted property iwin.alert");
    36       testOne(function() iwin.alert(), fail,
    37               "to call restricted method iwin.alert");
    39       testOne(function() iwin.location.toString(), fail,
    40               "to call restricted method iwin.location.toString");
    42       testOne(function() { iwin.location = "http://example.org" }, pass,
    43               "to set writable property iwin.location");
    45       SimpleTest.finish();
    46     }
    47   </script>
    48 </head>
    49 <body>
    50 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=478438">Mozilla Bug 478438</a>
    51 <p id="display"></p>
    52 <div id="content">
    53   <iframe id="f" src="http://example.com" onload="test()"></iframe>
    54 </div>
    55 <pre id="test">
    56 <script type="application/javascript">
    58 /** Test for Bug 478438 **/
    60 SimpleTest.waitForExplicitFinish();
    62 </script>
    63 </pre>
    64 </body>
    65 </html>

mercurial