summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Map/prototype/forEach/callback-this-strict-strict.js
blob: 97abaf89b5cad5c471447d5a02a1d0e91f7b30c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-map.prototype.forEach
description: >
  If a thisArg is not provided, undefined will be used as the this value for
  each invocation of callbackfn.
info: |
  Map.prototype.forEach ( callbackfn [ , thisArg ] )

  ...
  5. If thisArg was supplied, let T be thisArg; else let T be undefined.
  6. Let entries be the List that is the value of M’s [[MapData]] internal slot.
  7. Repeat for each Record {[[key]], [[value]]} e that is an element of
  entries, in original key insertion order
    a. If e.[[key]] is not empty, then
      i. Let funcResult be Call(callbackfn, T, «e.[[value]], e.[[key]], M»).
  ...
flags: [onlyStrict]
---*/

var _this = [];
var map = new Map();

map.set(0, 0);
map.set(1, 1);
map.set(2, 2);

map.forEach(function() {
  _this.push(this);
});

assert.sameValue(_this[0], undefined);
assert.sameValue(_this[1], undefined);
assert.sameValue(_this[2], undefined);

reportCompare(0, 0);