Merge pull request #245 from anba/issue-35/builtins-Error

Fix strict mode errors in built-ins/Error
This commit is contained in:
Brian Terlson 2015-04-30 09:29:35 -07:00
commit aed52de599
7 changed files with 12 additions and 10 deletions

View File

@ -5,6 +5,7 @@
info: Error.prototype property has the attributes {DontDelete} info: Error.prototype property has the attributes {DontDelete}
es5id: 15.11.3.1_A1_T1 es5id: 15.11.3.1_A1_T1
description: Checking if deleting the Error.prototype property fails description: Checking if deleting the Error.prototype property fails
flags: [noStrict]
---*/ ---*/
var proto=Error.prototype; var proto=Error.prototype;

View File

@ -27,9 +27,9 @@ if (Error.propertyIsEnumerable('prototype')) {
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// CHECK#2 // CHECK#2
cout=0; var cout=0;
for (p in Error){ for (var p in Error){
if (p==="prototype") cout++; if (p==="prototype") cout++;
} }

View File

@ -5,6 +5,7 @@
info: Error.prototype property has the attributes {ReadOnly} info: Error.prototype property has the attributes {ReadOnly}
es5id: 15.11.3.1_A3_T1 es5id: 15.11.3.1_A3_T1
description: Checking if varying the Error.prototype property fails description: Checking if varying the Error.prototype property fails
flags: [noStrict]
---*/ ---*/
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -12,7 +12,7 @@ description: >
---*/ ---*/
Error.prototype.toString=Object.prototype.toString; Error.prototype.toString=Object.prototype.toString;
__tostr = Error.prototype.toString(); var __tostr = Error.prototype.toString();
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#1 //CHECK#1

View File

@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
info: Since Error prototype object is not function it has not [[call]] method info: Since Error prototype object is not function it has no [[Call]] method
es5id: 15.11.4_A3 es5id: 15.11.4_A3
description: Checking if call of Error prototype as a function fails description: Checking if call of Error prototype as a function fails
includes: includes:

View File

@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
info: Since Error prototype object is not function it has not [[create]] method info: Since Error prototype object is not function it has no [[Construct]] method
es5id: 15.11.4_A4 es5id: 15.11.4_A4
description: Checking if creating "new Error.prototype" fails description: Checking if creating "new Error.prototype" fails
includes: includes:
@ -13,8 +13,8 @@ includes:
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#1 //CHECK#1
try { try {
__instance = new Object.prototype; var __instance = new Error.prototype;
$FAIL('#1: "__instance = new Object.prototype" lead to throwing exception'); $FAIL('#1: "var __instance = new Error.prototype" lead to throwing exception');
} catch (e) { } catch (e) {
if (e instanceof Test262Error) throw e; if (e instanceof Test262Error) throw e;
} }

View File

@ -11,9 +11,9 @@ description: >
checking its properties checking its properties
---*/ ---*/
constr = Error.prototype.constructor; var constr = Error.prototype.constructor;
err = new constr; var err = new constr;
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// CHECK#0 // CHECK#0
@ -42,7 +42,7 @@ if (!(Error.prototype.isPrototypeOf(err))) {
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// CHECK#3 // CHECK#3
Error.prototype.toString=Object.prototype.toString; Error.prototype.toString=Object.prototype.toString;
to_string_result = '[object '+ 'Error' +']'; var to_string_result = '[object '+ 'Error' +']';
if (err.toString() !== to_string_result) { if (err.toString() !== to_string_result) {
$ERROR('#3: constr = Error.prototype.constructor; err = new constr; Error.prototype.toString=Object.prototype.toString; err.toString() === \'[object Error]\'. Actual: '+err.toString() ); $ERROR('#3: constr = Error.prototype.constructor; err = new constr; Error.prototype.toString=Object.prototype.toString; err.toString() === \'[object Error]\'. Actual: '+err.toString() );
} }