2 "This tests that a call to array/string prototype methods pass the correct this value (undefined) to strict callees."
5 var undefinedString = String(undefined);
6 var globalObjectString = String(this);
8 function strictThrowThisString()
14 function nonstrictThrowThisString()
19 function testArrayPrototypeSort(callback)
29 function testArrayPrototypeFilter(callback)
32 [1,2].filter(callback);
39 function testArrayPrototypeMap(callback)
49 function testArrayPrototypeEvery(callback)
52 [1,2].every(callback);
59 function testArrayPrototypeForEach(callback)
62 [1,2].forEach(callback);
69 function testArrayPrototypeSome(callback)
79 function testStringPrototypeReplace(callback)
82 "1,2".replace('1', callback);
89 shouldBe('testArrayPrototypeSort(strictThrowThisString)', 'undefinedString');
90 shouldBe('testArrayPrototypeFilter(strictThrowThisString)', 'undefinedString');
91 shouldBe('testArrayPrototypeMap(strictThrowThisString)', 'undefinedString');
92 shouldBe('testArrayPrototypeEvery(strictThrowThisString)', 'undefinedString');
93 shouldBe('testArrayPrototypeForEach(strictThrowThisString)', 'undefinedString');
94 shouldBe('testArrayPrototypeSome(strictThrowThisString)', 'undefinedString');
95 shouldBe('testStringPrototypeReplace(strictThrowThisString)', 'undefinedString');
97 shouldBe('testArrayPrototypeSort(nonstrictThrowThisString)', 'globalObjectString');
98 shouldBe('testArrayPrototypeFilter(nonstrictThrowThisString)', 'globalObjectString');
99 shouldBe('testArrayPrototypeMap(nonstrictThrowThisString)', 'globalObjectString');
100 shouldBe('testArrayPrototypeEvery(nonstrictThrowThisString)', 'globalObjectString');
101 shouldBe('testArrayPrototypeForEach(nonstrictThrowThisString)', 'globalObjectString');
102 shouldBe('testArrayPrototypeSome(nonstrictThrowThisString)', 'globalObjectString');
103 shouldBe('testStringPrototypeReplace(nonstrictThrowThisString)', 'globalObjectString');