js/xpconnect/tests/mochitest/test_bug505915.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=505915
     5 -->
     6 <head>
     7   <title>Test for Bug 505915</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=505915">Mozilla Bug 505915</a>
    13 <p id="display"></p>
    14 <div id="content" style="display: none">
    16 </div>
    17 <pre id="test">
    18 <script type="application/javascript;version=1.7">
    20 /** Test for Bug 505915 **/
    21 window.addEventListener("message", function () { gen.next() }, false);
    23 function go() {
    24     var ifr = $('ifr');
    25     try {
    26         // NB: the contentDocument getter now returns null for cross-origin
    27         // frames, so use SpecialPowers to get a security wrapper to the document.
    28         var xdoc = SpecialPowers.unwrap(SpecialPowers.wrap(ifr).contentDocument)
    29         document.createTreeWalker(xdoc, 0, null);
    30         ok(false, "should have thrown a security exception");
    31     } catch (e) {
    32         ok(/NS_ERROR_XPC_SECURITY_MANAGER_VETO/.test(e) ||
    33            /TypeError: Argument 1 of Document.createTreeWalker does not implement interface Node/.test(e),
    34            "threw a security exception or binding exception instead of an " +
    35            "invalid child exception");
    36     }
    38     SimpleTest.finish();
    39     yield;
    40 }
    42 SimpleTest.waitForExplicitFinish();
    44 </script>
    45 </pre>
    47 <iframe id="ifr" onload="gen = go(); gen.next();" src="http://example.org/"></iframe>
    49 </body>
    50 </html>

mercurial