js/src/tests/js1_8_5/regress/regress-554955-4.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 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /*
     3  * Any copyright is dedicated to the Public Domain.
     4  * http://creativecommons.org/licenses/publicdomain/
     5  */
     7 function f() {
     8     return function(a) {
     9         // This eval must take place before the block is cloned, when the
    10         // call object is still not marked as a delegate. The scope chain
    11         // purge for the JSOP_DEFVAR will not change the global's shape,
    12         // and the property cache entry will remain valid.
    13         eval(a);
    14         let (c = 3) {
    15             // This eval forces the block to be cloned, so its shape gets
    16             // used as the property cache key shape.
    17             eval('');
    18             return b;
    19         };
    20     };
    21 }
    23 var b = 1;
    24 var g1 = f();
    25 var g2 = f();
    27 /* Call the lambda once, caching a reference to the global b. */
    28 g1('');
    30 /*
    31  * If this call sees the above cache entry, then it will erroneously use the
    32  * global b.
    33  */
    34 assertEq(g2('var b=2'), 2);
    36 reportCompare(true, true);

mercurial