summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/for-of/array-iterator-null.js
blob: 6382f0701e4950288f73560c9fe49e51c5cda345 (plain)
1
2
3
4
5
6
7
8
9
10
11
// Array.prototype.iterator applied to undefined or null throws directly.

load(libdir + "asserts.js");
load(libdir + "iteration.js");

for (var v of [undefined, null]) {
    // ES6 draft 2013-09-05 section 22.1.5.1.
    assertThrowsInstanceOf(function () { Array.prototype[Symbol.iterator].call(v); }, TypeError);
    assertThrowsInstanceOf(function () { Array.prototype.keys.call(v); }, TypeError);
    assertThrowsInstanceOf(function () { Array.prototype.entries.call(v); }, TypeError);
}