js/xpconnect/tests/mochitest/test_getWebIDLCaller.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=968335
     5 -->
     6 <head>
     7   <meta charset="utf-8">
     8   <title>Test for Bug 968335</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 Cu.getCallerPrincipal (within JS-implemented WebIDL). **/
    15   SimpleTest.waitForExplicitFinish();
    16   SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]}, go);
    19   function go() {
    20     var t = new TestInterfaceJS();
    21     is(t.getCallerPrincipal(), location.origin,
    22        "Cu.getCallerPrincipal works right within JS-implemented WebIDL");
    24     try {
    25       SpecialPowers.Cu.getWebIDLCallerPrincipal();
    26       ok(false, "Should have thrown");
    27     } catch (e) {
    28       ok(/NOT_AVAILABLE/.test(SpecialPowers.wrap(e)),
    29          "API should throw when invoked outside of JS-implemented WebIDL");
    30     }
    32     SimpleTest.finish();
    33   }
    38   </script>
    39 </head>
    40 <body>
    41 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=968335">Mozilla Bug 968335</a>
    42 <p id="display"></p>
    43 <div id="content" style="display: none">
    45 </div>
    46 <pre id="test">
    47 </pre>
    48 </body>
    49 </html>

mercurial