diff -r 000000000000 -r 6474c204b198 js/src/jit-test/tests/arguments/rest-disallow-arguments.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/src/jit-test/tests/arguments/rest-disallow-arguments.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,30 @@ +load(libdir + "asserts.js"); +var ieval = eval; + +// Now for a tour of the various ways you can access arguments. +assertThrowsInstanceOf(function () { + ieval("function x(...rest) { arguments; }"); +}, SyntaxError) +assertThrowsInstanceOf(function () { + Function("...rest", "arguments;"); +}, SyntaxError); +assertThrowsInstanceOf(function (...rest) { + eval("arguments;"); +}, SyntaxError); +assertThrowsInstanceOf(function (...rest) { + eval("arguments = 42;"); +}, SyntaxError); + +function g(...rest) { + assertThrowsInstanceOf(h, Error); +} +function h() { + g.arguments; +} +g(); + +// eval() is evil, but you can still use it with rest parameters! +function still_use_eval(...rest) { + eval("x = 4"); +} +still_use_eval(); \ No newline at end of file