js/src/jit-test/tests/arguments/rest-disallow-arguments.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 load(libdir + "asserts.js");
     2 var ieval = eval;
     4 // Now for a tour of the various ways you can access arguments.
     5 assertThrowsInstanceOf(function () {
     6     ieval("function x(...rest) { arguments; }");
     7 }, SyntaxError)
     8 assertThrowsInstanceOf(function () {
     9     Function("...rest", "arguments;");
    10 }, SyntaxError);
    11 assertThrowsInstanceOf(function (...rest) {
    12     eval("arguments;");
    13 }, SyntaxError);
    14 assertThrowsInstanceOf(function (...rest) {
    15     eval("arguments = 42;");
    16 }, SyntaxError);
    18 function g(...rest) {
    19     assertThrowsInstanceOf(h, Error);
    20 }
    21 function h() {
    22     g.arguments;
    23 }
    24 g();
    26 // eval() is evil, but you can still use it with rest parameters!
    27 function still_use_eval(...rest) {
    28     eval("x = 4");
    29 }
    30 still_use_eval();

mercurial