js/xpconnect/tests/mochitest/test_bug965082.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=965082
     5 -->
     6 <head>
     7   <meta charset="utf-8">
     8   <title>Test for Bug 965082</title>
     9   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    11   <script type="application/javascript">
    13   /** Test for Bug 965082 **/
    14   SimpleTest.waitForExplicitFinish();
    16   function checkThrows(f, msg) {
    17     try { f(); ok(false, "Should have thrown: " + msg); }
    18     catch (e) { ok(/denied|insecure/.test(e), "Should throw security exception: " + e + " (" + msg + ")"); }
    19   }
    21   function go() {
    22     var protoSetter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
    23     checkThrows(function() { protoSetter.call(window[0], new Object()); }, "Setting cross-origin Window prototype");
    24     checkThrows(function() { protoSetter.call(window[0].location, new Object()); }, "Setting cross-origin Location prototype");
    25     SimpleTest.finish();
    26   }
    28   </script>
    29 </head>
    30 <body>
    31 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=965082">Mozilla Bug 965082</a>
    32 <p id="display"></p>
    33 <div id="content" style="display: none">
    34 </div>
    35 <iframe id="ifr" onload="go();" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html"></iframe>
    36 <pre id="test">
    37 </pre>
    38 </body>
    39 </html>

mercurial