js/src/tests/ecma_5/Expressions/object-literal-accessor-arguments.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 // Any copyright is dedicated to the Public Domain.
     2 // http://creativecommons.org/licenses/publicdomain/
     4 var gTestfile = 'object-literal-accessor-arguments.js';
     5 //-----------------------------------------------------------------------------
     6 var BUGNUMBER = 536472;
     7 var summary =
     8   'ES5: { get x(v) { } } and { set x(v, v2) { } } should be syntax errors';
    10 print(BUGNUMBER + ": " + summary);
    12 //-----------------------------------------------------------------------------
    14 function expectSyntaxError(s)
    15 {
    16   try
    17   {
    18     eval(s);
    19     throw new Error("no error thrown");
    20   }
    21   catch (e)
    22   {
    23     assertEq(e instanceof SyntaxError, true,
    24              "expected syntax error parsing '" + s + "', got: " + e);
    25   }
    26 }
    28 expectSyntaxError("({ get x(a) { } })");
    29 expectSyntaxError("({ get x(a, a) { } })");
    30 expectSyntaxError("({ get x(a, b) { } })");
    31 expectSyntaxError("({ get x(a, a, b) { } })");
    32 expectSyntaxError("({ get x(a, b, c) { } })");
    34 expectSyntaxError("({ set x() { } })");
    35 expectSyntaxError("({ set x(a, a) { } })");
    36 expectSyntaxError("({ set x(a, b) { } })");
    37 expectSyntaxError("({ set x(a, a, b) { } })");
    38 expectSyntaxError("({ set x(a, b, c) { } })");
    40 //-----------------------------------------------------------------------------
    42 reportCompare(true, true);

mercurial