archives

« Bugzilla Issues Index

#29 — S15.4.4.2_A2_T1.js and S15.4.4.3_A2_T1.js are invalid (ES3=>ES5 change)


S15.4.4.2_A2_T1 contains the following:
var obj = {};
obj.toString = Array.prototype.toString;

//CHECK#1
try {
obj.toString();
$ERROR('#1.1: var obj = {}; obj.toString = Array.prototype.toString; obj.toString() throw TypeError. Actual: ' + (obj.toString()));
} catch(e) {
if ((e instanceof TypeError) !== true) {
$ERROR('#1.2: var obj = {}; obj.toString = Array.prototype.toString; obj.toString() throw TypeError. Actual: ' + (e));
}
}

According to ES5.1 (15.4.4.2), this test which is checking to ensure Array.prototype.toString is *not* generic is now invalid:
NOTE The toString function is intentionally generic; it does not require that its this value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method. Whether the toString function can be applied successfully to a host object is implementation-dependent.

Step 3 of 15.4.4.2 guarantees the snippet above will in fact not throw an exception.


Fixed at http://hg.ecmascript.org/tests/test262/rev/947f8408a6eb