Merge pull request #285 from anba/for-in-undefined

Additional tests with incorrect for-in context
This commit is contained in:
Brian Terlson 2015-06-02 20:19:19 -05:00
commit 3b6953a3b4
23 changed files with 36 additions and 30 deletions

View File

@ -21,5 +21,5 @@ for (var p in Array.prototype.concat){
} }
if (result !== true) { if (result !== true) {
$ERROR('#2: result = true; for (p in Array.concat) { if (p === "length") result = false; } result === true;'); $ERROR('#2: result = true; for (p in Array.prototype.concat) { if (p === "length") result = false; } result === true;');
} }

View File

@ -14,12 +14,12 @@ if (Array.prototype.join.propertyIsEnumerable('length') !== false) {
//CHECK#2 //CHECK#2
var result = true; var result = true;
for (var p in Array.join){ for (var p in Array.prototype.join){
if (p === "length") { if (p === "length") {
result = false; result = false;
} }
} }
if (result !== true) { if (result !== true) {
$ERROR('#2: result = true; for (p in Array.join) { if (p === "length") result = false; } result === true;'); $ERROR('#2: result = true; for (p in Array.prototype.join) { if (p === "length") result = false; } result === true;');
} }

View File

@ -14,12 +14,12 @@ if (Array.prototype.pop.propertyIsEnumerable('length') !== false) {
//CHECK#2 //CHECK#2
var result = true; var result = true;
for (var p in Array.pop){ for (var p in Array.prototype.pop){
if (p === "length") { if (p === "length") {
result = false; result = false;
} }
} }
if (result !== true) { if (result !== true) {
$ERROR('#2: result = true; for (p in Array.pop) { if (p === "length") result = false; } result === true;'); $ERROR('#2: result = true; for (p in Array.prototype.pop) { if (p === "length") result = false; } result === true;');
} }

View File

@ -14,12 +14,12 @@ if (Array.prototype.push.propertyIsEnumerable('length') !== false) {
//CHECK#2 //CHECK#2
var result = true; var result = true;
for (var p in Array.push){ for (var p in Array.prototype.push){
if (p === "length") { if (p === "length") {
result = false; result = false;
} }
} }
if (result !== true) { if (result !== true) {
$ERROR('#2: result = true; for (p in Array.push) { if (p === "length") result = false; } result === true;'); $ERROR('#2: result = true; for (p in Array.prototype.push) { if (p === "length") result = false; } result === true;');
} }

View File

@ -14,12 +14,12 @@ if (Array.prototype.reverse.propertyIsEnumerable('length') !== false) {
//CHECK#2 //CHECK#2
var result = true; var result = true;
for (p in Array.reverse){ for (p in Array.prototype.reverse){
if (p === "length") { if (p === "length") {
var result = false; var result = false;
} }
} }
if (result !== true) { if (result !== true) {
$ERROR('#2: result = true; for (p in Array.reverse) { if (p === "length") result = false; } result === true;'); $ERROR('#2: result = true; for (p in Array.prototype.reverse) { if (p === "length") result = false; } result === true;');
} }

View File

@ -14,12 +14,12 @@ if (Array.prototype.shift.propertyIsEnumerable('length') !== false) {
//CHECK#2 //CHECK#2
var result = true; var result = true;
for (var p in Array.shift){ for (var p in Array.prototype.shift){
if (p === "length") { if (p === "length") {
result = false; result = false;
} }
} }
if (result !== true) { if (result !== true) {
$ERROR('#2: result = true; for (p in Array.shift) { if (p === "length") result = false; } result === true;'); $ERROR('#2: result = true; for (p in Array.prototype.shift) { if (p === "length") result = false; } result === true;');
} }

View File

@ -14,12 +14,12 @@ if (Array.prototype.slice.propertyIsEnumerable('length') !== false) {
//CHECK#2 //CHECK#2
var result = true; var result = true;
for (var p in Array.slice){ for (var p in Array.prototype.slice){
if (p === "length") { if (p === "length") {
result = false; result = false;
} }
} }
if (result !== true) { if (result !== true) {
$ERROR('#2: result = true; for (p in Array.slice) { if (p === "length") result = false; } result === true;'); $ERROR('#2: result = true; for (p in Array.prototype.slice) { if (p === "length") result = false; } result === true;');
} }

View File

@ -14,12 +14,12 @@ if (Array.prototype.sort.propertyIsEnumerable('length') !== false) {
//CHECK#2 //CHECK#2
var result = true; var result = true;
for (var p in Array.sort){ for (var p in Array.prototype.sort){
if (p === "length") { if (p === "length") {
result = false; result = false;
} }
} }
if (result !== true) { if (result !== true) {
$ERROR('#2: result = true; for (p in Array.sort) { if (p === "length") result = false; } result === true;'); $ERROR('#2: result = true; for (p in Array.prototype.sort) { if (p === "length") result = false; } result === true;');
} }

View File

@ -14,12 +14,12 @@ if (Array.prototype.splice.propertyIsEnumerable('length') !== false) {
//CHECK#2 //CHECK#2
var result = true; var result = true;
for (var p in Array.splice){ for (var p in Array.prototype.splice){
if (p === "length") { if (p === "length") {
result = false; result = false;
} }
} }
if (result !== true) { if (result !== true) {
$ERROR('#2: result = true; for (p in Array.splice) { if (p === "length") result = false; } result === true;'); $ERROR('#2: result = true; for (p in Array.prototype.splice) { if (p === "length") result = false; } result === true;');
} }

View File

@ -14,12 +14,12 @@ if (Array.prototype.toLocaleString.propertyIsEnumerable('length') !== false) {
//CHECK#2 //CHECK#2
var result = true; var result = true;
for (var p in Array.toLocaleString){ for (var p in Array.prototype.toLocaleString){
if (p === "length") { if (p === "length") {
result = false; result = false;
} }
} }
if (result !== true) { if (result !== true) {
$ERROR('#2: result = true; for (p in Array.toLocaleString) { if (p === "length") result = false; } result === true;'); $ERROR('#2: result = true; for (p in Array.prototype.toLocaleString) { if (p === "length") result = false; } result === true;');
} }

View File

@ -14,12 +14,12 @@ if (Array.prototype.toString.propertyIsEnumerable('length') !== false) {
//CHECK#2 //CHECK#2
var result = true; var result = true;
for (var p in Array.toString){ for (var p in Array.prototype.toString){
if (p === "length") { if (p === "length") {
result = false; result = false;
} }
} }
if (result !== true) { if (result !== true) {
$ERROR('#2: result = true; for (p in Array.toString) { if (p === "length") result = false; } result === true;'); $ERROR('#2: result = true; for (p in Array.prototype.toString) { if (p === "length") result = false; } result === true;');
} }

View File

@ -14,12 +14,12 @@ if (Array.prototype.unshift.propertyIsEnumerable('length') !== false) {
//CHECK#2 //CHECK#2
var result = true; var result = true;
for (var p in Array.unshift){ for (var p in Array.prototype.unshift){
if (p === "length") { if (p === "length") {
result = false; result = false;
} }
} }
if (result !== true) { if (result !== true) {
$ERROR('#2: result = true; for (p in Array.unshift) { if (p === "length") result = false; } result === true;'); $ERROR('#2: result = true; for (p in Array.prototype.unshift) { if (p === "length") result = false; } result === true;');
} }

View File

@ -33,7 +33,9 @@ iterable[Symbol.iterator] = function() {
}; };
Set.prototype.add = function() { throw new Error(); } Set.prototype.add = function() { throw new Error(); }
assert.throws(Error, function() {
new Set(iterable); new Set(iterable);
});
assert.sameValue( assert.sameValue(
count, 1, "The iterator is closed when `Set.prototype.add` throws an error." count, 1, "The iterator is closed when `Set.prototype.add` throws an error."

View File

@ -5,6 +5,7 @@
info: Global object properties have attributes { DontEnum } info: Global object properties have attributes { DontEnum }
es5id: 10.2.3_A2.2_T1 es5id: 10.2.3_A2.2_T1
description: Function execution context - Value Properties description: Function execution context - Value Properties
flags: [noStrict]
---*/ ---*/
function test() { function test() {

View File

@ -5,6 +5,7 @@
info: Global object properties have attributes { DontEnum } info: Global object properties have attributes { DontEnum }
es5id: 10.2.3_A2.2_T2 es5id: 10.2.3_A2.2_T2
description: Function execution context - Function Properties description: Function execution context - Function Properties
flags: [noStrict]
---*/ ---*/
function test() { function test() {

View File

@ -5,6 +5,7 @@
info: Global object properties have attributes { DontEnum } info: Global object properties have attributes { DontEnum }
es5id: 10.2.3_A2.2_T3 es5id: 10.2.3_A2.2_T3
description: Function execution context - Constructor Properties description: Function execution context - Constructor Properties
flags: [noStrict]
---*/ ---*/
function test() { function test() {

View File

@ -5,6 +5,7 @@
info: Global object properties have attributes { DontEnum } info: Global object properties have attributes { DontEnum }
es5id: 10.2.3_A2.2_T4 es5id: 10.2.3_A2.2_T4
description: Function execution context - Other Properties description: Function execution context - Other Properties
flags: [noStrict]
---*/ ---*/
function test() { function test() {

View File

@ -15,6 +15,6 @@ includes: [runTestCase.js]
function testcase() { function testcase() {
var foo = Function("'use strict'; for (var tempIndex in this) {if (tempIndex===\"caller\") {return false;}}; return true;"); var foo = Function("'use strict'; for (var tempIndex in this) {if (tempIndex===\"caller\") {return false;}}; return true;");
return foo(); return foo.call(foo);
} }
runTestCase(testcase); runTestCase(testcase);

View File

@ -15,6 +15,6 @@ includes: [runTestCase.js]
function testcase() { function testcase() {
var foo = new Function("'use strict'; for (var tempIndex in this) {if (tempIndex===\"arguments\") {return false;}}; return true;"); var foo = new Function("'use strict'; for (var tempIndex in this) {if (tempIndex===\"arguments\") {return false;}}; return true;");
return foo(); return foo.call(foo);
} }
runTestCase(testcase); runTestCase(testcase);

View File

@ -15,6 +15,6 @@ includes: [runTestCase.js]
function testcase() { function testcase() {
var foo = Function("'use strict'; for (var tempIndex in this) {if (tempIndex===\"arguments\") {return false;}}; return true;"); var foo = Function("'use strict'; for (var tempIndex in this) {if (tempIndex===\"arguments\") {return false;}}; return true;");
return foo(); return foo.call(foo);
} }
runTestCase(testcase); runTestCase(testcase);

View File

@ -23,6 +23,6 @@ function testcase() {
} }
return true; return true;
} }
return foo(); return foo.call(foo);
} }
runTestCase(testcase); runTestCase(testcase);

View File

@ -23,6 +23,6 @@ function testcase() {
} }
return true; return true;
} }
return foo(); return foo.call(foo);
} }
runTestCase(testcase); runTestCase(testcase);

View File

@ -15,6 +15,6 @@ includes: [runTestCase.js]
function testcase() { function testcase() {
var foo = new Function("'use strict'; for (var tempIndex in this) {if (tempIndex===\"caller\") {return false;}}; return true;"); var foo = new Function("'use strict'; for (var tempIndex in this) {if (tempIndex===\"caller\") {return false;}}; return true;");
return foo(); return foo.call(foo);
} }
runTestCase(testcase); runTestCase(testcase);