toolkit/devtools/server/tests/mochitest/test_unsafeDereference.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=837723
     6 When we use Debugger.Object.prototype.unsafeDereference to get a non-D.O
     7 reference to a content object in chrome, that reference should be via an
     8 xray wrapper.
     9 -->
    10 <head>
    11   <meta charset="utf-8">
    12   <title>Mozilla Bug 837723</title>
    13   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    14   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
    15 </head>
    16 <body>
    17 <pre id="test">
    18 <script>
    20 Components.utils.import("resource://gre/modules/jsdebugger.jsm");
    21 addDebuggerToGlobal(this);
    23 window.onload = function () {
    24   SimpleTest.waitForExplicitFinish();
    26   var iframe = document.createElement("iframe");
    27   iframe.src = "http://mochi.test:8888/chrome/toolkit/devtools/server/tests/mochitest/nonchrome_unsafeDereference.html";
    29   iframe.onload = function () {
    30     var dbg = new Debugger;
    31     var contentDO = dbg.addDebuggee(iframe.contentWindow);
    32     var xhrDesc = contentDO.getOwnPropertyDescriptor('xhr');
    34     isnot(xhrDesc, undefined, "xhr should be visible as property of content global");
    35     isnot(xhrDesc.value, undefined, "xhr should have a value");
    37     var xhr = xhrDesc.value.unsafeDereference();
    39     is(typeof xhr, "object", "we should be able to deference xhr's value's D.O");
    40     is(xhr.timeout, 1742, "chrome should see the xhr's 'timeout' property");
    41     is(xhr.expando, undefined, "chrome should not see the xhr's 'expando' property");
    43     SimpleTest.finish();
    44   }
    46   document.body.appendChild(iframe);
    47 }
    49 </script>
    50 </pre>
    51 </body>
    52 </html>

mercurial