js/src/jit-test/tests/proxy/bug901979-2.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 // A proxy on the prototype chain of the global should not observe anything at
     2 // all about lazy resolution of globals.
     4 var global = this;
     5 var status = "pass";
     7 // This is a little tricky. There are two proxies.
     8 // 1. handler is a proxy that fails the test if you try to call a method on it.
     9 var metaHandler = {
    10   get: _ => { status = "SMASH"; },
    11   has: _ => { status = "SMASH"; },
    12   invoke: _ => { status = "SMASH"; }
    13 };
    14 var handler = new Proxy({}, metaHandler);
    16 // 2. Then we create a proxy using 'handler' as its handler. This means the test
    17 //    will fail if *any* method of the handler is called, not just get/has/invoke.
    18 var angryProxy = new Proxy(Object.create(null), handler);
    19 this.__proto__ = angryProxy;
    20 Object.prototype.__proto__ = angryProxy;
    22 // Trip the alarm once, to make sure the proxies are working.
    23 this.nonExistingProperty;
    24 assertEq(status, "SMASH");
    26 // OK. Reset the status and run the actual test.
    27 status = "pass";
    28 Map;
    29 ArrayBuffer;
    30 Date;
    31 assertEq(status, "pass");

mercurial