js/src/jit-test/tests/proxy/bug-862848-1.js

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 // obj.hasOwnProperty(id), Object.getOwnPropertyDescriptor(obj, id), and
     2 // Object.defineProperty(obj, id, desc) do not look at obj's prototype.
     4 var angryHandler = new Proxy({}, {
     5     has: () => true,
     6     get: (t, id) => {
     7         throw new Error("angryHandler should not be queried (" + id + ")");
     8     }
     9 });
    10 var angryProto = new Proxy({}, angryHandler);
    12 var obj = Object.create(angryProto, {
    13     // Define hasOwnProperty directly on obj since we are poisoning its
    14     // prototype chain.
    15     hasOwnProperty: {
    16         value: Object.prototype.hasOwnProperty
    17     }
    18 });
    20 assertEq(Object.getOwnPropertyDescriptor(obj, "foo"), undefined);
    21 assertEq(obj.hasOwnProperty("foo"), false);
    22 Object.defineProperty(obj, "foo", {value: 5});
    23 assertEq(obj.hasOwnProperty("foo"), true);
    24 assertEq(obj.foo, 5);

mercurial