1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 /* ES6 20121122 draft 15.14.4.4. */
7 function MapForEach(callbackfn, thisArg = undefined) {
11 ThrowError(JSMSG_INCOMPATIBLE_PROTO, "Map", "forEach", typeof M);
15 callFunction(std_Map_has, M);
17 // has will throw on non-Map objects, throw our own error in that case.
18 ThrowError(JSMSG_INCOMPATIBLE_PROTO, "Map", "forEach", typeof M);
22 if (!IsCallable(callbackfn))
23 ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
26 var entries = callFunction(std_Map_iterator, M);
28 var result = callFunction(std_Map_iterator_next, entries);
31 var entry = result.value;
32 callFunction(callbackfn, thisArg, entry[1], entry[0], M);