dom/bindings/test/test_bug923904.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=923904
     5 -->
     6 <head>
     7   <meta charset="utf-8">
     8   <title>Test for Bug 923904</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 cloning of |any| and |object| for JS-Implemented WebIDL. **/
    14   SimpleTest.waitForExplicitFinish();
    15   SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]}, go);
    17   function go() {
    18     var someAny = { a: 11 };
    19     var someObj = { b: 22, c: "str" };
    20     var t = new TestInterfaceJS(someAny, someObj);
    21     is(Object.getPrototypeOf(t), TestInterfaceJS.prototype, "Prototype setup works correctly");
    22     is(t.anyArg.toSource(), someAny.toSource(), "anyArg comes back looking like what we sent");
    23     is(t.objectArg.toSource(), someObj.toSource(), "objectArg comes back looking like what we sent");
    24     isnot(t.anyArg, t.anyArg, "get a new anyArg each time");
    25     isnot(t.objectArg, t.objectArg, "get a new objectArg each time");
    27     t.anyAttr = 2;
    28     is(t.anyAttr, 2, "ping-pong works");
    29     testObjectCloned(t, 'anyAttr');
    30     testObjectCloned(t, 'objectAttr');
    32     is(someAny.toSource(), t.pingPongAny(someAny).toSource(), "ping-pong works with any");
    33     is(someObj.toSource(), t.pingPongObject(someObj).toSource(), "ping-pong works with obj");
    34     isnot(someAny, t.pingPongAny(someAny), "Clone works for ping-pong any");
    35     isnot(someObj, t.pingPongObject(someObj), "Clone works for ping-pong obj");
    37     SimpleTest.finish();
    38   }
    40   function testObjectCloned(iface, propname) {
    41     var obj = { prop: 42 };
    42     iface[propname] = obj;
    43     is(iface[propname].prop, 42, "objects come back as well");
    44     is(iface[propname].__proto__, Object.prototype, "vanilla object");
    45     isnot(iface[propname], obj, "Should not be the original object");
    46     isnot(iface[propname], iface[propname], "Should get cloned each time");
    47     try {
    48       iface[propname] = { stringProp: "hi", reflectorProp: document };
    49       ok(false, "Should throw when trying to clone reflector");
    50     } catch (e) {
    51       ok(/cloned/.test(e), "Should throw clone error: " + e);
    52     }
    53   }
    55   </script>
    56 </head>
    57 <body>
    58 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=923904">Mozilla Bug 923904</a>
    59 <p id="display"></p>
    60 <div id="content" style="display: none">
    62 </div>
    63 <pre id="test">
    64 </pre>
    65 </body>
    66 </html>

mercurial