js/src/tests/js1_8/regress/regress-499524.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: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     3 /*
     4  * Any copyright is dedicated to the Public Domain.
     5  * http://creativecommons.org/licenses/publicdomain/
     6  */
     8 function isSyntaxError(code) {
     9   try {
    10     eval(code);
    11     return false;
    12   } catch (exception) {
    13     if (SyntaxError.prototype.isPrototypeOf(exception))
    14       return true;
    15     throw exception;
    16   };
    17 };
    19 /* 
    20  * Duplicate parameter names must be tolerated (as per ES3), unless
    21  * the parameter list uses destructuring, in which case we claim the
    22  * user has opted in to a modicum of sanity, and we forbid duplicate
    23  * parameter names.
    24  */
    25 assertEq(isSyntaxError("function f(x,x){}"),                false);
    27 assertEq(isSyntaxError("function f(x,[x]){})"),             true);
    28 assertEq(isSyntaxError("function f(x,{y:x}){})"),           true);
    29 assertEq(isSyntaxError("function f(x,{x}){})"),             true);
    31 assertEq(isSyntaxError("function f([x],x){})"),             true);
    32 assertEq(isSyntaxError("function f({y:x},x){})"),           true);
    33 assertEq(isSyntaxError("function f({x},x){})"),             true);
    35 assertEq(isSyntaxError("function f([x,x]){}"),              true);
    36 assertEq(isSyntaxError("function f({x,x}){}"),              true);
    37 assertEq(isSyntaxError("function f({y:x,z:x}){}"),          true);
    39 assertEq(isSyntaxError("function f(x,x,[y]){}"),            true);
    40 assertEq(isSyntaxError("function f(x,x,{y}){}"),            true);
    41 assertEq(isSyntaxError("function f([y],x,x){}"),            true);
    42 assertEq(isSyntaxError("function f({y},x,x){}"),            true);
    44 assertEq(isSyntaxError("function f(a,b,c,d,e,f,g,h,b,[y]){}"),  true);
    45 assertEq(isSyntaxError("function f([y],a,b,c,d,e,f,g,h,a){}"),  true);
    46 assertEq(isSyntaxError("function f([a],b,c,d,e,f,g,h,i,a){}"),  true);
    47 assertEq(isSyntaxError("function f(a,b,c,d,e,f,g,h,i,[a]){}"),  true);
    48 assertEq(isSyntaxError("function f(a,b,c,d,e,f,g,h,i,[a]){}"),  true);
    50 reportCompare(true, true);

mercurial