summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/for-of/semantics-02.js
blob: 27b1323298c22cbba8e66749062077a0a94a2e50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// Replacing Array.prototype.iterator with something non-callable makes for-of throw.

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

function test(v) {
    Array.prototype[Symbol.iterator] = v;
    assertThrowsInstanceOf(function () { for (var x of []) ; }, TypeError);
}
test(undefined);
test(null);
test({});