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