diff options
Diffstat (limited to 'js/src/tests/ecma_5')
5 files changed, 11 insertions, 20 deletions
diff --git a/js/src/tests/ecma_5/Function/arguments-caller-callee.js b/js/src/tests/ecma_5/Function/arguments-caller-callee.js index 3eda27b49..57efd9eb9 100644 --- a/js/src/tests/ecma_5/Function/arguments-caller-callee.js +++ b/js/src/tests/ecma_5/Function/arguments-caller-callee.js @@ -5,7 +5,8 @@ var gTestfile = 'arguments-caller-callee.js'; var BUGNUMBER = 514563; -var summary = "arguments.caller and arguments.callee are poison pills in ES5"; +var summary = "arguments.caller and arguments.callee are poison pills in ES5, " + + "later changed in ES2017 to only poison pill arguments.callee."; print(BUGNUMBER + ": " + summary); @@ -31,7 +32,7 @@ function expectTypeError(fun) } function bar() { "use strict"; return arguments; } -expectTypeError(function barCaller() { bar().caller; }); +assertEq(bar().caller, undefined); // No error when accessing arguments.caller in ES2017+ expectTypeError(function barCallee() { bar().callee; }); function baz() { return arguments; } @@ -41,15 +42,12 @@ assertEq(baz().callee, baz); // accessor identity function strictMode() { "use strict"; return arguments; } -var canonicalTTE = Object.getOwnPropertyDescriptor(strictMode(), "caller").get; +var canonicalTTE = Object.getOwnPropertyDescriptor(strictMode(), "callee").get; var args = strictMode(); var argsCaller = Object.getOwnPropertyDescriptor(args, "caller"); -assertEq("get" in argsCaller, true); -assertEq("set" in argsCaller, true); -assertEq(argsCaller.get, canonicalTTE); -assertEq(argsCaller.set, canonicalTTE); +assertEq(argsCaller, undefined); var argsCallee = Object.getOwnPropertyDescriptor(args, "callee"); assertEq("get" in argsCallee, true); diff --git a/js/src/tests/ecma_5/Function/arguments-property-attributes.js b/js/src/tests/ecma_5/Function/arguments-property-attributes.js index 994b97ca4..f50c1e6da 100644 --- a/js/src/tests/ecma_5/Function/arguments-property-attributes.js +++ b/js/src/tests/ecma_5/Function/arguments-property-attributes.js @@ -56,7 +56,7 @@ var sa = strictArgs(0, 1); var strictArgProps = Object.getOwnPropertyNames(sa).sort(); assertEq(strictArgProps.indexOf("callee") >= 0, true); -assertEq(strictArgProps.indexOf("caller") >= 0, true); +assertEq(strictArgProps.indexOf("caller") >= 0, false); assertEq(strictArgProps.indexOf("0") >= 0, true); assertEq(strictArgProps.indexOf("1") >= 0, true); assertEq(strictArgProps.indexOf("length") >= 0, true); @@ -69,11 +69,7 @@ assertEq(strictCalleeDesc.enumerable, false); assertEq(strictCalleeDesc.configurable, false); var strictCallerDesc = Object.getOwnPropertyDescriptor(sa, "caller"); -assertEq(typeof strictCallerDesc.get, "function"); -assertEq(typeof strictCallerDesc.set, "function"); -assertEq(strictCallerDesc.get, strictCallerDesc.set); -assertEq(strictCallerDesc.enumerable, false); -assertEq(strictCallerDesc.configurable, false); +assertEq(strictCallerDesc, undefined); var strictZeroDesc = Object.getOwnPropertyDescriptor(sa, "0"); assertEq(strictZeroDesc.value, 0); diff --git a/js/src/tests/ecma_5/RegExp/exec.js b/js/src/tests/ecma_5/RegExp/exec.js index 411f348d9..4284b6e01 100644 --- a/js/src/tests/ecma_5/RegExp/exec.js +++ b/js/src/tests/ecma_5/RegExp/exec.js @@ -165,7 +165,7 @@ r = /abc/; r.lastIndex = -17; res = r.exec("cdefg"); assertEq(res, null); -assertEq(r.lastIndex, 0); +assertEq(r.lastIndex, -17); r = /abc/g; r.lastIndex = -42; diff --git a/js/src/tests/ecma_5/RegExp/instance-property-storage-introspection.js b/js/src/tests/ecma_5/RegExp/instance-property-storage-introspection.js index 1f7c7042f..998d25e2c 100644 --- a/js/src/tests/ecma_5/RegExp/instance-property-storage-introspection.js +++ b/js/src/tests/ecma_5/RegExp/instance-property-storage-introspection.js @@ -40,9 +40,7 @@ function checkDataProperty(obj, p, expect, msg) // Check a bunch of "empty" regular expressions first. -var choices = [{ msg: "RegExp.prototype", - get: function() { return RegExp.prototype; } }, - { msg: "new RegExp()", +var choices = [{ msg: "new RegExp()", get: function() { return new RegExp(); } }, { msg: "/(?:)/", get: Function("return /(?:)/;") }]; @@ -55,7 +53,6 @@ function checkRegExp(r, msg, lastIndex) checkDataProperty(r, "lastIndex", expect, msg); } -checkRegExp(RegExp.prototype, "RegExp.prototype", 0); checkRegExp(new RegExp(), "new RegExp()", 0); checkRegExp(/(?:)/, "/(?:)/", 0); checkRegExp(Function("return /(?:)/;")(), 'Function("return /(?:)/;")()', 0); diff --git a/js/src/tests/ecma_5/extensions/error-tostring-function.js b/js/src/tests/ecma_5/extensions/error-tostring-function.js index 5e92f1075..86751c39d 100644 --- a/js/src/tests/ecma_5/extensions/error-tostring-function.js +++ b/js/src/tests/ecma_5/extensions/error-tostring-function.js @@ -27,7 +27,7 @@ assertEq(ErrorToString(function(){}), ""); var fn1 = function() {}; fn1.message = "ohai"; -assertEq(ErrorToString(fn1), "ohai"); +assertEq(ErrorToString(fn1), "fn1: ohai"); var fn2 = function blerch() {}; fn2.message = "fnord"; @@ -35,7 +35,7 @@ assertEq(ErrorToString(fn2), "blerch: fnord"); var fn3 = function() {}; fn3.message = ""; -assertEq(ErrorToString(fn3), ""); +assertEq(ErrorToString(fn3), "fn3"); /******************************************************************************/ |