dom/bindings/test/test_lookupGetter.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=462428
     5 -->
     6 <head>
     7   <title>Test for Bug 462428</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=462428">Mozilla Bug 462428</a>
    13 <p id="display"></p>
    14 <div id="content" style="display: none">
    16 </div>
    17 <pre id="test">
    18 <script type="application/javascript">
    20 /** Test for Bug 462428 **/
    21 var x = new XMLHttpRequest;
    22 x.open("GET", "");
    23 var getter = x.__lookupGetter__('readyState');
    24 ok(getter !== undefined, "But able to look it up the normal way");
    25 ok(!x.hasOwnProperty('readyState'), "property should still be on the prototype");
    27 var sawProp = false;
    28 for (var i in x) {
    29     if (i === "readyState") {
    30         sawProp = true;
    31     }
    32 }
    34 ok(sawProp, "property should be enumerable");
    36 is(getter.call(x), 1, "the getter actually works");
    38 Object.getPrototypeOf(x).__defineSetter__('readyState', function() {});
    39 is(getter.call(x), 1, "the getter works after defineSetter");
    41 is(x.responseType, "", "Should have correct responseType up front");
    42 var setter = x.__lookupSetter__('responseType');
    43 setter.call(x, "document");
    44 is(x.responseType, "document", "the setter is bound correctly");
    46 </script>
    47 </pre>
    48 </body>
    49 </html>

mercurial