js/src/jit-test/tests/generators/es6-syntax.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 // Test interactions between ES6 generators and not-yet-standard
     2 // features.
     4 function assertSyntaxError(str) {
     5     var msg;
     6     var evil = eval;
     7     try {
     8         // Non-direct eval.
     9         evil(str);
    10     } catch (exc) {
    11         if (exc instanceof SyntaxError)
    12             return;
    13         msg = "Assertion failed: expected SyntaxError, got " + exc;
    14     }
    15     if (msg === undefined)
    16         msg = "Assertion failed: expected SyntaxError, but no exception thrown";
    17     throw new Error(msg + " - " + str);
    18 }
    20 // Destructuring binding.
    21 assertSyntaxError("function* f(x = yield) {}");
    22 assertSyntaxError("function* f(x = yield 17) {}");
    23 assertSyntaxError("function* f([yield]) {}");
    24 assertSyntaxError("function* f({ yield }) {}");
    25 assertSyntaxError("function* f(...yield) {}");
    27 // For each.
    28 assertSyntaxError("for yield");
    29 assertSyntaxError("for yield (;;) {}");
    30 assertSyntaxError("for yield (x of y) {}");
    31 assertSyntaxError("for yield (var i in o) {}");
    33 // Expression bodies.
    34 assertSyntaxError("function* f() yield 7");

mercurial