summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Map
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/tests/test262/built-ins/Map/Symbol.species/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/Symbol.species/length.js34
-rw-r--r--js/src/tests/test262/built-ins/Map/Symbol.species/return-value.js16
-rw-r--r--js/src/tests/test262/built-ins/Map/Symbol.species/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/Symbol.species/symbol-species-name.js22
-rw-r--r--js/src/tests/test262/built-ins/Map/Symbol.species/symbol-species.js23
-rw-r--r--js/src/tests/test262/built-ins/Map/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/constructor.js12
-rw-r--r--js/src/tests/test262/built-ins/Map/does-not-throw-when-set-is-not-callable.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/get-set-method-failure.js28
-rw-r--r--js/src/tests/test262/built-ins/Map/is-a-constructor.js26
-rw-r--r--js/src/tests/test262/built-ins/Map/iterable-calls-set.js44
-rw-r--r--js/src/tests/test262/built-ins/Map/iterator-close-after-set-failure.js43
-rw-r--r--js/src/tests/test262/built-ins/Map/iterator-close-failure-after-set-failure.js29
-rw-r--r--js/src/tests/test262/built-ins/Map/iterator-is-undefined-throws.js21
-rw-r--r--js/src/tests/test262/built-ins/Map/iterator-item-first-entry-returns-abrupt.js49
-rw-r--r--js/src/tests/test262/built-ins/Map/iterator-item-second-entry-returns-abrupt.js49
-rw-r--r--js/src/tests/test262/built-ins/Map/iterator-items-are-not-object-close-iterator.js77
-rw-r--r--js/src/tests/test262/built-ins/Map/iterator-items-are-not-object.js53
-rw-r--r--js/src/tests/test262/built-ins/Map/iterator-next-failure.js30
-rw-r--r--js/src/tests/test262/built-ins/Map/iterator-value-failure.js36
-rw-r--r--js/src/tests/test262/built-ins/Map/length.js19
-rw-r--r--js/src/tests/test262/built-ins/Map/map-iterable-empty-does-not-call-set.js33
-rw-r--r--js/src/tests/test262/built-ins/Map/map-iterable-throws-when-set-is-not-callable.js32
-rw-r--r--js/src/tests/test262/built-ins/Map/map-iterable.js28
-rw-r--r--js/src/tests/test262/built-ins/Map/map-no-iterable-does-not-call-set.js37
-rw-r--r--js/src/tests/test262/built-ins/Map/map-no-iterable.js34
-rw-r--r--js/src/tests/test262/built-ins/Map/map.js19
-rw-r--r--js/src/tests/test262/built-ins/Map/name.js20
-rw-r--r--js/src/tests/test262/built-ins/Map/newtarget.js39
-rw-r--r--js/src/tests/test262/built-ins/Map/properties-of-map-instances.js16
-rw-r--r--js/src/tests/test262/built-ins/Map/properties-of-the-map-prototype-object.js20
-rw-r--r--js/src/tests/test262/built-ins/Map/proto-from-ctor-realm.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype-of-map.js18
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/Symbol.iterator.js21
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/Symbol.iterator/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/Symbol.iterator/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/Symbol.iterator/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/Symbol.toStringTag.js23
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/clear/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/clear/clear-map.js38
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/clear/clear.js23
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/clear/context-is-not-map-object.js25
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/clear/context-is-not-object.js40
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/clear/context-is-set-object-throws.js22
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/clear/context-is-weakmap-object-throws.js22
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/clear/length.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/clear/map-data-list-is-preserved.js37
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/clear/name.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/clear/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/clear/returns-undefined.js27
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/clear/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/constructor.js18
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/delete/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/delete/context-is-not-map-object.js25
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/delete/context-is-not-object.js40
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/delete/context-is-set-object-throws.js22
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/delete/context-is-weakmap-object-throws.js22
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/delete/delete.js23
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/delete/does-not-break-iterators.js38
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/delete/length.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/delete/name.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/delete/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/delete/returns-false.js28
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/delete/returns-true-for-deleted-entry.js29
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/delete/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/descriptor.js16
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/entries/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/entries/does-not-have-mapdata-internal-slot-set.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/entries/does-not-have-mapdata-internal-slot-weakmap.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/entries/does-not-have-mapdata-internal-slot.js40
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/entries/entries.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/entries/length.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/entries/name.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/entries/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/entries/returns-iterator-empty.js29
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/entries/returns-iterator.js57
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/entries/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/entries/this-not-object-throw.js49
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/callback-parameters.js46
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/callback-result-is-abrupt.js29
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/callback-this-non-strict.js37
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/callback-this-strict-strict.js38
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/deleted-values-during-foreach.js43
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/does-not-have-mapdata-internal-slot-set.js26
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/does-not-have-mapdata-internal-slot-weakmap.js26
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/does-not-have-mapdata-internal-slot.js34
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/first-argument-is-not-callable.js45
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/forEach.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/iterates-in-key-insertion-order.js53
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/iterates-values-added-after-foreach-begins.js51
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/iterates-values-deleted-then-readded.js52
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/length.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/name.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/return-undefined.js29
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/second-parameter-as-callback-context.js39
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/forEach/this-not-object-throw.js45
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/get/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/get/does-not-have-mapdata-internal-slot-set.js26
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/get/does-not-have-mapdata-internal-slot-weakmap.js26
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/get/does-not-have-mapdata-internal-slot.js34
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/get/get.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/get/length.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/get/name.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/get/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/get/returns-undefined.js43
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/get/returns-value-different-key-types.js50
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/get/returns-value-normalized-zero-key.js27
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/get/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/get/this-not-object-throw.js45
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/has/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/has/does-not-have-mapdata-internal-slot-set.js26
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/has/does-not-have-mapdata-internal-slot-weakmap.js26
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/has/does-not-have-mapdata-internal-slot.js34
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/has/has.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/has/length.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/has/name.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/has/normalizes-zero-key.js32
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/has/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/has/return-false-different-key-types.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/has/return-true-different-key-types.js46
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/has/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/has/this-not-object-throw.js45
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/keys/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/keys/does-not-have-mapdata-internal-slot-set.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/keys/does-not-have-mapdata-internal-slot-weakmap.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/keys/does-not-have-mapdata-internal-slot.js40
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/keys/keys.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/keys/length.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/keys/name.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/keys/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/keys/returns-iterator-empty.js29
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/keys/returns-iterator.js52
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/keys/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/keys/this-not-object-throw.js49
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/set/append-new-values-normalizes-zero-key.js27
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/set/append-new-values-return-map.js32
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/set/append-new-values.js49
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/set/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/set/does-not-have-mapdata-internal-slot-set.js26
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/set/does-not-have-mapdata-internal-slot-weakmap.js26
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/set/does-not-have-mapdata-internal-slot.js34
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/set/length.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/set/name.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/set/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/set/replaces-a-value-normalizes-zero-key.js28
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/set/replaces-a-value-returns-map.js32
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/set/replaces-a-value.js25
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/set/set.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/set/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/set/this-not-object-throw.js45
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/size/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/size/does-not-have-mapdata-internal-slot-set.js28
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/size/does-not-have-mapdata-internal-slot-weakmap.js29
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/size/does-not-have-mapdata-internal-slot.js28
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/size/length.js25
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/size/name.js29
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/size/returns-count-of-present-values-before-after-set-clear.js32
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/size/returns-count-of-present-values-before-after-set-delete.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/size/returns-count-of-present-values-by-insertion.js28
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/size/returns-count-of-present-values-by-iterable.js28
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/size/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/size/size.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/size/this-not-object-throw.js49
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/values/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/values/does-not-have-mapdata-internal-slot-set.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/values/does-not-have-mapdata-internal-slot-weakmap.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/values/does-not-have-mapdata-internal-slot.js40
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/values/length.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/values/name.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/values/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/values/returns-iterator-empty.js29
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/values/returns-iterator.js52
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/values/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/values/this-not-object-throw.js49
-rw-r--r--js/src/tests/test262/built-ins/Map/prototype/values/values.js24
-rw-r--r--js/src/tests/test262/built-ins/Map/shell.js19
-rw-r--r--js/src/tests/test262/built-ins/Map/symbol-as-entry-key.js20
-rw-r--r--js/src/tests/test262/built-ins/Map/undefined-newtarget.js26
-rw-r--r--js/src/tests/test262/built-ins/MapIteratorPrototype/Symbol.toStringTag.js25
-rw-r--r--js/src/tests/test262/built-ins/MapIteratorPrototype/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/MapIteratorPrototype/next/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/MapIteratorPrototype/next/does-not-have-mapiterator-internal-slots-map.js41
-rw-r--r--js/src/tests/test262/built-ins/MapIteratorPrototype/next/does-not-have-mapiterator-internal-slots.js44
-rw-r--r--js/src/tests/test262/built-ins/MapIteratorPrototype/next/iteration-mutable.js54
-rw-r--r--js/src/tests/test262/built-ins/MapIteratorPrototype/next/iteration.js49
-rw-r--r--js/src/tests/test262/built-ins/MapIteratorPrototype/next/length.js33
-rw-r--r--js/src/tests/test262/built-ins/MapIteratorPrototype/next/name.js30
-rw-r--r--js/src/tests/test262/built-ins/MapIteratorPrototype/next/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/MapIteratorPrototype/next/this-not-object-throw-entries.js50
-rw-r--r--js/src/tests/test262/built-ins/MapIteratorPrototype/next/this-not-object-throw-keys.js50
-rw-r--r--js/src/tests/test262/built-ins/MapIteratorPrototype/next/this-not-object-throw-prototype-iterator.js50
-rw-r--r--js/src/tests/test262/built-ins/MapIteratorPrototype/next/this-not-object-throw-values.js50
-rw-r--r--js/src/tests/test262/built-ins/MapIteratorPrototype/shell.js0
199 files changed, 5418 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Map/Symbol.species/browser.js b/js/src/tests/test262/built-ins/Map/Symbol.species/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/Symbol.species/browser.js
diff --git a/js/src/tests/test262/built-ins/Map/Symbol.species/length.js b/js/src/tests/test262/built-ins/Map/Symbol.species/length.js
new file mode 100644
index 0000000000..d606baeca6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/Symbol.species/length.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 23.1.2.2
+description: >
+ get Map [ @@species ].length is 0.
+info: |
+ get Map [ @@species ]
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [Symbol.species]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(Map, Symbol.species);
+
+assert.sameValue(desc.get.length, 0);
+
+verifyNotEnumerable(desc.get, "length");
+verifyNotWritable(desc.get, "length");
+verifyConfigurable(desc.get, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/Symbol.species/return-value.js b/js/src/tests/test262/built-ins/Map/Symbol.species/return-value.js
new file mode 100644
index 0000000000..2698c6b964
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/Symbol.species/return-value.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-map-@@species
+description: Return value of @@species accessor method
+info: |
+ 1. Return the this value.
+features: [Symbol.species]
+---*/
+
+var thisVal = {};
+var accessor = Object.getOwnPropertyDescriptor(Map, Symbol.species).get;
+
+assert.sameValue(accessor.call(thisVal), thisVal);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/Symbol.species/shell.js b/js/src/tests/test262/built-ins/Map/Symbol.species/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/Symbol.species/shell.js
diff --git a/js/src/tests/test262/built-ins/Map/Symbol.species/symbol-species-name.js b/js/src/tests/test262/built-ins/Map/Symbol.species/symbol-species-name.js
new file mode 100644
index 0000000000..926d6fb31f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/Symbol.species/symbol-species-name.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.2.2
+description: >
+ Map[Symbol.species] accessor property get name
+info: |
+ 23.1.2.2 get Map [ @@species ]
+
+ ...
+ The value of the name property of this function is "get [Symbol.species]".
+features: [Symbol.species]
+---*/
+
+var descriptor = Object.getOwnPropertyDescriptor(Map, Symbol.species);
+
+assert.sameValue(
+ descriptor.get.name,
+ 'get [Symbol.species]'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/Symbol.species/symbol-species.js b/js/src/tests/test262/built-ins/Map/Symbol.species/symbol-species.js
new file mode 100644
index 0000000000..b3c7fa8742
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/Symbol.species/symbol-species.js
@@ -0,0 +1,23 @@
+// Copyright 2015 Cubane Canada, Inc. All rights reserved.
+// See LICENSE for details.
+
+/*---
+info: |
+ Map has a property at `Symbol.species`
+esid: sec-get-map-@@species
+author: Sam Mikes
+description: Map[Symbol.species] exists per spec
+includes: [propertyHelper.js]
+features: [Symbol.species]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(Map, Symbol.species);
+
+assert.sameValue(desc.set, undefined);
+assert.sameValue(typeof desc.get, 'function');
+
+verifyNotWritable(Map, Symbol.species, Symbol.species);
+verifyNotEnumerable(Map, Symbol.species);
+verifyConfigurable(Map, Symbol.species);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/browser.js b/js/src/tests/test262/built-ins/Map/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/browser.js
diff --git a/js/src/tests/test262/built-ins/Map/constructor.js b/js/src/tests/test262/built-ins/Map/constructor.js
new file mode 100644
index 0000000000..f96f47fd44
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/constructor.js
@@ -0,0 +1,12 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1
+description: >
+ The Map constructor is the %Map% intrinsic object and the initial value of the
+ Map property of the global object.
+---*/
+
+assert.sameValue(typeof Map, 'function', 'typeof Map is "function"');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/does-not-throw-when-set-is-not-callable.js b/js/src/tests/test262/built-ins/Map/does-not-throw-when-set-is-not-callable.js
new file mode 100644
index 0000000000..d61fa0435e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/does-not-throw-when-set-is-not-callable.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ Creating a new Map object without arguments doesn't throw if `set` is not
+ callable
+info: |
+ Map ( [ iterable ] )
+
+ When the Set function is called with optional argument iterable the following steps are taken:
+
+ ...
+ 5. If iterable is not present, let iterable be undefined.
+ 6. If iterable is either undefined or null, let iter be undefined.
+ 7. Else,
+ a. Let adder be Get(map, "set").
+ b. ReturnIfAbrupt(adder).
+ c. If IsCallable(adder) is false, throw a TypeError exception.
+ ...
+ 8. If iter is undefined, return map.
+ ...
+---*/
+
+Map.prototype.set = null;
+
+var m = new Map();
+
+assert.sameValue(m.size, 0, 'The value of `m.size` is `0`');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/get-set-method-failure.js b/js/src/tests/test262/built-ins/Map/get-set-method-failure.js
new file mode 100644
index 0000000000..0f00f969cf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/get-set-method-failure.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ new Map returns abrupt from getting Map.prototype.set.
+info: |
+ Map ( [ iterable ] )
+
+ ...
+ 7. Else,
+ a. Let adder be Get(map, "add").
+ b. ReturnIfAbrupt(adder).
+---*/
+
+Object.defineProperty(Map.prototype, 'set', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+new Map();
+
+assert.throws(Test262Error, function() {
+ new Map([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/is-a-constructor.js b/js/src/tests/test262/built-ins/Map/is-a-constructor.js
new file mode 100644
index 0000000000..6d119375f1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/is-a-constructor.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ The Map constructor implements [[Construct]]
+info: |
+ IsConstructor ( argument )
+
+ The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
+ It determines if argument is a function object with a [[Construct]] internal method.
+ It performs the following steps when called:
+
+ If Type(argument) is not Object, return false.
+ If argument has a [[Construct]] internal method, return true.
+ Return false.
+includes: [isConstructor.js]
+features: [Reflect.construct, Map]
+---*/
+
+assert.sameValue(isConstructor(Map), true, 'isConstructor(Map) must return true');
+new Map();
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/iterable-calls-set.js b/js/src/tests/test262/built-ins/Map/iterable-calls-set.js
new file mode 100644
index 0000000000..56fd358a2b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/iterable-calls-set.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ new Map calls `set` for each item on the iterable argument in order.
+info: |
+ Map ( [ iterable ] )
+
+ ...
+ 9. Repeat
+ ...
+ k. Let status be Call(adder, map, «k.[[value]], v.[[value]]»).
+ ...
+includes: [compareArray.js]
+---*/
+
+var mapSet = Map.prototype.set;
+var counter = 0;
+
+var iterable = [
+ ["foo", 1],
+ ["bar", 2]
+];
+var results = [];
+var _this = [];
+
+Map.prototype.set = function(k, v) {
+ counter++;
+ results.push([k, v]);
+ _this.push(this);
+ mapSet.call(this, k, v);
+};
+
+var map = new Map(iterable);
+
+assert.sameValue(counter, 2, "`Map.prototype.set` called twice.");
+
+assert(compareArray(results[0], iterable[0]));
+assert(compareArray(results[1], iterable[1]));
+assert.sameValue(_this[0], map);
+assert.sameValue(_this[1], map);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/iterator-close-after-set-failure.js b/js/src/tests/test262/built-ins/Map/iterator-close-after-set-failure.js
new file mode 100644
index 0000000000..234d358cea
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/iterator-close-after-set-failure.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ The iterator is closed when `Map.prototype.set` throws an error.
+info: |
+ Map ( [ iterable ] )
+
+ ...
+ 9. Repeat
+ ...
+ k. Let status be Call(adder, map, «k.[[value]], v.[[value]]»).
+ l. If status is an abrupt completion, return IteratorClose(iter, status).
+features: [Symbol.iterator]
+---*/
+
+var count = 0;
+var iterable = {};
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return {
+ value: [],
+ done: false
+ };
+ },
+ return: function() {
+ count += 1;
+ }
+ };
+};
+Map.prototype.set = function() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ new Map(iterable);
+});
+
+assert.sameValue(count, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/iterator-close-failure-after-set-failure.js b/js/src/tests/test262/built-ins/Map/iterator-close-failure-after-set-failure.js
new file mode 100644
index 0000000000..5986ccab3c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/iterator-close-failure-after-set-failure.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-map-iterable
+description: >
+ The correct error is thrown `Map.prototype.set` throws an error and
+ the IteratorClose throws an error.
+features: [Symbol.iterator]
+---*/
+
+var count = 0;
+var iterable = {};
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return { value: [], done: false };
+ },
+ return: function() {
+ throw new TypeError('ignore');
+ }
+ };
+};
+Map.prototype.set = function() { throw new Test262Error(); }
+
+assert.throws(Test262Error, function() {
+ new Map(iterable);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/iterator-is-undefined-throws.js b/js/src/tests/test262/built-ins/Map/iterator-is-undefined-throws.js
new file mode 100644
index 0000000000..f6a3c01bea
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/iterator-is-undefined-throws.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2018 Amal Hussein. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-map-objects
+description: >
+ Throws a TypeError if the iterator of the iterable is undefined.
+info: |
+ Map ( [ iterable ] )
+ ...
+ 9. Let iteratorRecord be ? GetIterator(iterable).
+features: [Symbol.iterator]
+---*/
+
+var iterable = { [Symbol.iterator]: undefined };
+
+assert.throws(TypeError,
+ function () {
+ new Map(iterable);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/iterator-item-first-entry-returns-abrupt.js b/js/src/tests/test262/built-ins/Map/iterator-item-first-entry-returns-abrupt.js
new file mode 100644
index 0000000000..3d8d2bb7db
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/iterator-item-first-entry-returns-abrupt.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ Closes iterator if item first entry completes abruptly.
+info: |
+ Map ( [ iterable ] )
+
+ ...
+ 9. Repeat
+ ...
+ d. Let nextItem be IteratorValue(next).
+ ...
+ g. Let k be Get(nextItem, "0").
+ h. If k is an abrupt completion, return IteratorClose(iter, k).
+ ...
+features: [Symbol.iterator]
+---*/
+
+var count = 0;
+var item = ['foo', 'bar'];
+Object.defineProperty(item, 0, {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iterable = {};
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return {
+ value: item,
+ done: false
+ };
+ },
+ return: function() {
+ count++;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ new Map(iterable);
+});
+
+assert.sameValue(count, 1, 'The get error closed the iterator');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/iterator-item-second-entry-returns-abrupt.js b/js/src/tests/test262/built-ins/Map/iterator-item-second-entry-returns-abrupt.js
new file mode 100644
index 0000000000..bc475f47ee
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/iterator-item-second-entry-returns-abrupt.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ Closes iterator if item second entry completes abruptly.
+info: |
+ Map ( [ iterable ] )
+
+ ...
+ 9. Repeat
+ ...
+ d. Let nextItem be IteratorValue(next).
+ ...
+ i. Let v be Get(nextItem, "1").
+ j. If v is an abrupt completion, return IteratorClose(iter, v).
+ ...
+features: [Symbol.iterator]
+---*/
+
+var count = 0;
+var item = ['foo', 'bar'];
+Object.defineProperty(item, 1, {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iterable = {};
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return {
+ value: item,
+ done: false
+ };
+ },
+ return: function() {
+ count++;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ new Map(iterable);
+});
+
+assert.sameValue(count, 1, 'The get error closed the iterator');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/iterator-items-are-not-object-close-iterator.js b/js/src/tests/test262/built-ins/Map/iterator-items-are-not-object-close-iterator.js
new file mode 100644
index 0000000000..8daeef13d7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/iterator-items-are-not-object-close-iterator.js
@@ -0,0 +1,77 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ Closes the iterator after `not Object` error.
+info: |
+ Map ( [ iterable ] )
+
+ ...
+ 9. Repeat
+ ...
+ d. Let nextItem be IteratorValue(next).
+ e. ReturnIfAbrupt(nextItem).
+ f. If Type(nextItem) is not Object,
+ i. Let error be Completion{[[type]]: throw, [[value]]: a newly created
+ TypeError object, [[target]]:empty}.
+ ii. Return IteratorClose(iter, error).
+features:
+ - Symbol
+ - Symbol.iterator
+---*/
+
+var count = 0;
+var nextItem;
+var iterable = {};
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return {
+ value: nextItem,
+ done: false
+ };
+ },
+ return: function() {
+ count += 1;
+ }
+ };
+};
+
+nextItem = 1;
+assert.throws(TypeError, function() {
+ new Map(iterable);
+});
+assert.sameValue(count, 1);
+
+nextItem = true;
+assert.throws(TypeError, function() {
+ new Map(iterable);
+});
+assert.sameValue(count, 2);
+
+nextItem = '';
+assert.throws(TypeError, function() {
+ new Map(iterable);
+});
+assert.sameValue(count, 3);
+
+nextItem = null;
+assert.throws(TypeError, function() {
+ new Map(iterable);
+});
+assert.sameValue(count, 4);
+
+nextItem = undefined;
+assert.throws(TypeError, function() {
+ new Map(iterable);
+});
+assert.sameValue(count, 5);
+
+nextItem = Symbol('a');
+assert.throws(TypeError, function() {
+ new Map(iterable);
+});
+assert.sameValue(count, 6);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/iterator-items-are-not-object.js b/js/src/tests/test262/built-ins/Map/iterator-items-are-not-object.js
new file mode 100644
index 0000000000..b08b825169
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/iterator-items-are-not-object.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ Throws a TypeError if iterable items are not Objects.
+info: |
+ Map ( [ iterable ] )
+
+ ...
+ 9. Repeat
+ ...
+ d. Let nextItem be IteratorValue(next).
+ e. ReturnIfAbrupt(nextItem).
+ f. If Type(nextItem) is not Object,
+ i. Let error be Completion{[[type]]: throw, [[value]]: a newly created
+ TypeError object, [[target]]:empty}.
+ ii. Return IteratorClose(iter, error).
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ new Map([1]);
+});
+
+assert.throws(TypeError, function() {
+ new Map(['']);
+});
+
+assert.throws(TypeError, function() {
+ new Map([true]);
+});
+
+assert.throws(TypeError, function() {
+ new Map([null]);
+});
+
+assert.throws(TypeError, function() {
+ new Map([Symbol('a')]);
+});
+
+assert.throws(TypeError, function() {
+ new Map([undefined]);
+});
+
+assert.throws(TypeError, function() {
+ new Map([
+ ['a', 1],
+ 2
+ ]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/iterator-next-failure.js b/js/src/tests/test262/built-ins/Map/iterator-next-failure.js
new file mode 100644
index 0000000000..65c2fd7d3d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/iterator-next-failure.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ The iterator is closed when iterable `next` throws an error.
+info: |
+ Map ( [ iterable ] )
+
+ ...
+ 9. Repeat
+ a. Let next be IteratorStep(iter).
+ b. ReturnIfAbrupt(next).
+features: [Symbol.iterator]
+---*/
+
+var iterable = {};
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ new Map(iterable);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/iterator-value-failure.js b/js/src/tests/test262/built-ins/Map/iterator-value-failure.js
new file mode 100644
index 0000000000..d0cc7f4e46
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/iterator-value-failure.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ The iterator is closed when iterable `next` value throws an error.
+info: |
+ Map ( [ iterable ] )
+
+ ...
+ 9. Repeat
+ ...
+ d. Let nextItem be IteratorValue(next).
+ e. ReturnIfAbrupt(nextItem).
+features: [Symbol.iterator]
+---*/
+
+var iterable = {};
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return {
+ get value() {
+ throw new Test262Error();
+ },
+ done: false
+ };
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ new Map(iterable);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/length.js b/js/src/tests/test262/built-ins/Map/length.js
new file mode 100644
index 0000000000..c63939508b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/length.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.2
+description: Map.length is 0.
+info: |
+ Properties of the Map Constructor
+
+ Besides the length property (whose value is 0)
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Map.length, 0, 'The value of Map.length is 0');
+
+verifyNotEnumerable(Map, 'length');
+verifyNotWritable(Map, 'length');
+verifyConfigurable(Map, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/map-iterable-empty-does-not-call-set.js b/js/src/tests/test262/built-ins/Map/map-iterable-empty-does-not-call-set.js
new file mode 100644
index 0000000000..b561e0a8f1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/map-iterable-empty-does-not-call-set.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ A Map constructed with an empty iterable argument does not call set.
+info: |
+ Map ( [ iterable ] )
+
+ When the Map function is called with optional argument the following steps are
+ taken:
+
+ ...
+ 8. If iter is undefined, return map.
+ 9. Repeat
+ a. Let next be IteratorStep(iter).
+ b. ReturnIfAbrupt(next).
+ c. If next is false, return map.
+---*/
+
+var set = Map.prototype.set;
+var counter = 0;
+
+Map.prototype.set = function(value) {
+ counter++;
+ set.call(this, value);
+};
+
+new Map([]);
+
+assert.sameValue(counter, 0, '`Map.prototype.set` was not called.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/map-iterable-throws-when-set-is-not-callable.js b/js/src/tests/test262/built-ins/Map/map-iterable-throws-when-set-is-not-callable.js
new file mode 100644
index 0000000000..233c875208
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/map-iterable-throws-when-set-is-not-callable.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ Throws a TypeError if `set` is not callable on Map constructor with a
+ iterable argument.
+info: |
+ Map ( [ iterable ] )
+
+ When the Map function is called with optional argument the following steps are
+ taken:
+
+ ...
+ 5. If iterable is not present, let iterable be undefined.
+ 6. If iterable is either undefined or null, let iter be undefined.
+ 7. Else,
+ a. Let adder be Get(map, "set").
+ b. ReturnIfAbrupt(adder).
+ c. If IsCallable(adder) is false, throw a TypeError exception.
+---*/
+
+Map.prototype.set = null;
+
+assert.throws(TypeError, function() {
+ new Map([
+ [1, 1],
+ [2, 2]
+ ]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/map-iterable.js b/js/src/tests/test262/built-ins/Map/map-iterable.js
new file mode 100644
index 0000000000..82d8e1985e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/map-iterable.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ Contructor returns a map object set with the elements from the iterable
+ argument.
+info: |
+ Map ( [ iterable ] )
+
+ ...
+ 9. Repeat
+ a. Let next be IteratorStep(iter).
+ b. ReturnIfAbrupt(next).
+ c. If next is false, return map.
+ ...
+---*/
+
+var m = new Map([
+ ["attr", 1],
+ ["foo", 2]
+]);
+
+assert.sameValue(m.size, 2, 'The value of `m.size` is `2`');
+assert.sameValue(m.get("attr"), 1);
+assert.sameValue(m.get("foo"), 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/map-no-iterable-does-not-call-set.js b/js/src/tests/test262/built-ins/Map/map-no-iterable-does-not-call-set.js
new file mode 100644
index 0000000000..1eb4fd5b13
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/map-no-iterable-does-not-call-set.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ A Map constructed without a iterable argument does not call set.
+info: |
+ Map ( [ iterable ] )
+
+ When the Map function is called with optional argument the following steps are
+ taken:
+
+ ...
+ 5. If iterable is not present, let iterable be undefined.
+ 6. If iterable is either undefined or null, let iter be undefined.
+ 7. Else,
+ a. Let adder be Get(map, "set").
+ b. ReturnIfAbrupt(adder).
+ c. If IsCallable(adder) is false, throw a TypeError exception.
+ d. Let iter be GetIterator(iterable).
+ e. ReturnIfAbrupt(iter).
+ 8. If iter is undefined, return map.
+---*/
+
+var set = Map.prototype.set;
+var counter = 0;
+
+Map.prototype.set = function(value) {
+ counter++;
+ set.call(this, value);
+};
+
+new Map();
+
+assert.sameValue(counter, 0, '`Map.prototype.set` was not called.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/map-no-iterable.js b/js/src/tests/test262/built-ins/Map/map-no-iterable.js
new file mode 100644
index 0000000000..4ac1941791
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/map-no-iterable.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ Returns the new Map object with the new empty list if the iterable argument is
+ undefined.
+info: |
+ Map ( [ iterable ] )
+
+ ...
+ 2. Let map be OrdinaryCreateFromConstructor(NewTarget, "%MapPrototype%",
+ «‍[[MapData]]» ).
+ ...
+ 4. Map map’s [[MapData]] internal slot to a new empty List.
+ 5. If iterable is not present, let iterable be undefined.
+ 6. If iterable is either undefined or null, let iter be undefined.
+ ...
+ 8. If iter is undefined, return map.
+---*/
+
+var m1 = new Map();
+var m2 = new Map(undefined);
+var m3 = new Map(null);
+
+assert.sameValue(m1.size, 0, 'The value of `new Map().size` is `0`');
+assert.sameValue(m2.size, 0, 'The value of `new Map(undefined).size` is `0`');
+assert.sameValue(m3.size, 0, 'The value of `new Map(null).size` is `0`');
+
+assert(m1 instanceof Map);
+assert(m2 instanceof Map);
+assert(m3 instanceof Map);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/map.js b/js/src/tests/test262/built-ins/Map/map.js
new file mode 100644
index 0000000000..19187bf12e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/map.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ Map descriptor as a standard built-in object.
+info: |
+ Map ( [ iterable ] )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+verifyNotEnumerable(this, 'Map');
+verifyWritable(this, 'Map');
+verifyConfigurable(this, 'Map');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/name.js b/js/src/tests/test262/built-ins/Map/name.js
new file mode 100644
index 0000000000..9eec4210dd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/name.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: Map.name value and descriptor.
+info: |
+ Map ( [ iterable ] )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Map.name, 'Map', 'The value of Map.name is "Map"');
+
+verifyNotEnumerable(Map, 'name');
+verifyNotWritable(Map, 'name');
+verifyConfigurable(Map, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/newtarget.js b/js/src/tests/test262/built-ins/Map/newtarget.js
new file mode 100644
index 0000000000..628d014865
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/newtarget.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ The new Map object's prototype is Map.prototype
+info: |
+ Map ( [ iterable ] )
+
+ When the Map function is called with optional argument the following steps
+ are taken:
+
+ ...
+ 2. Let map be OrdinaryCreateFromConstructor(NewTarget, "%MapPrototype%",
+ «‍[[MapData]]» ).
+ ...
+
+---*/
+
+var m1 = new Map();
+
+assert.sameValue(
+ Object.getPrototypeOf(m1),
+ Map.prototype,
+ "`Object.getPrototypeOf(m1)` returns `Map.prototype`"
+);
+
+var m2 = new Map([
+ [1, 1],
+ [2, 2]
+]);
+
+assert.sameValue(
+ Object.getPrototypeOf(m2),
+ Map.prototype,
+ "`Object.getPrototypeOf(m2)` returns `Map.prototype`"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/properties-of-map-instances.js b/js/src/tests/test262/built-ins/Map/properties-of-map-instances.js
new file mode 100644
index 0000000000..b38608c055
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/properties-of-map-instances.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.4
+description: >
+ Map instances are ordinary objects that inherit properties from the Map
+ prototype.
+---*/
+
+assert.sameValue(
+ Object.getPrototypeOf(new Map()),
+ Map.prototype,
+ '`Object.getPrototypeOf(new Map())` returns `Map.prototype`'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/properties-of-the-map-prototype-object.js b/js/src/tests/test262/built-ins/Map/properties-of-the-map-prototype-object.js
new file mode 100644
index 0000000000..a6c1ec8d7c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/properties-of-the-map-prototype-object.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3
+description: >
+ The prototype of Map.prototype is Object.prototype.
+info: |
+ The Map prototype object is the intrinsic object %MapPrototype%. The value
+ of the [[Prototype]] internal slot of the Map prototype object is the
+ intrinsic object %ObjectPrototype% (19.1.3). The Map prototype object is an
+ ordinary object. It does not have a [[MapData]] internal slot.
+---*/
+
+assert.sameValue(
+ Object.getPrototypeOf(Map.prototype),
+ Object.prototype,
+ 'Object.getPrototypeOf(Map.prototype) returns Object.prototype'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/proto-from-ctor-realm.js b/js/src/tests/test262/built-ins/Map/proto-from-ctor-realm.js
new file mode 100644
index 0000000000..f85cc28e78
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/proto-from-ctor-realm.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-map-iterable
+description: Default [[Prototype]] value derived from realm of the newTarget
+info: |
+ [...]
+ 3. Let map be ? OrdinaryCreateFromConstructor(NewTarget, "%MapPrototype%",
+ « [[MapData]] »).
+ [...]
+
+ 9.1.14 GetPrototypeFromConstructor
+
+ [...]
+ 3. Let proto be ? Get(constructor, "prototype").
+ 4. If Type(proto) is not Object, then
+ a. Let realm be ? GetFunctionRealm(constructor).
+ b. Let proto be realm's intrinsic object named intrinsicDefaultProto.
+ [...]
+features: [cross-realm, Reflect]
+---*/
+
+var other = $262.createRealm().global;
+var C = new other.Function();
+C.prototype = null;
+
+var o = Reflect.construct(Map, [], C);
+
+assert.sameValue(Object.getPrototypeOf(o), other.Map.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype-of-map.js b/js/src/tests/test262/built-ins/Map/prototype-of-map.js
new file mode 100644
index 0000000000..91f931c4eb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype-of-map.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.2
+description: >
+ The prototype of Map is the intrinsic FunctionPrototype.
+info: |
+ The value of the [[Prototype]] internal slot of the Map constructor is the
+ intrinsic object %FunctionPrototype% (19.2.3).
+---*/
+
+assert.sameValue(
+ Object.getPrototypeOf(Map),
+ Function.prototype,
+ '`Object.getPrototypeOf(Map)` returns `Function.prototype`'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/Symbol.iterator.js b/js/src/tests/test262/built-ins/Map/prototype/Symbol.iterator.js
new file mode 100644
index 0000000000..f36d1319fc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/Symbol.iterator.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.12
+description: Initial state of the Symbol.iterator property
+info: |
+ The initial value of the @@iterator property is the same function object as
+ the initial value of the entries property.
+
+ Per ES6 section 17, the method should exist on the Array prototype, and it
+ should be writable and configurable, but not enumerable.
+includes: [propertyHelper.js]
+features: [Symbol.iterator]
+---*/
+
+assert.sameValue(Map.prototype[Symbol.iterator], Map.prototype.entries);
+verifyNotEnumerable(Map.prototype, Symbol.iterator);
+verifyWritable(Map.prototype, Symbol.iterator);
+verifyConfigurable(Map.prototype, Symbol.iterator);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/Symbol.iterator/browser.js b/js/src/tests/test262/built-ins/Map/prototype/Symbol.iterator/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/Symbol.iterator/browser.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/Symbol.iterator/not-a-constructor.js b/js/src/tests/test262/built-ins/Map/prototype/Symbol.iterator/not-a-constructor.js
new file mode 100644
index 0000000000..9a8bb37858
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/Symbol.iterator/not-a-constructor.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Map.prototype[Symbol.iterator] does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, Symbol, Symbol.iterator, Map, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(Map.prototype[Symbol.iterator]),
+ false,
+ 'isConstructor(Map.prototype[Symbol.iterator]) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let m = new Map(); new m[Symbol.iterator]();
+}, '`let m = new Map(); new m[Symbol.iterator]()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/Symbol.iterator/shell.js b/js/src/tests/test262/built-ins/Map/prototype/Symbol.iterator/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/Symbol.iterator/shell.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/Symbol.toStringTag.js b/js/src/tests/test262/built-ins/Map/prototype/Symbol.toStringTag.js
new file mode 100644
index 0000000000..403b73a518
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/Symbol.toStringTag.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.13
+description: >
+ `Symbol.toStringTag` property descriptor
+info: |
+ The initial value of the @@toStringTag property is the String value
+ "Map".
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]:
+ false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [Symbol.toStringTag]
+---*/
+
+assert.sameValue(Map.prototype[Symbol.toStringTag], 'Map');
+
+verifyNotEnumerable(Map.prototype, Symbol.toStringTag);
+verifyNotWritable(Map.prototype, Symbol.toStringTag);
+verifyConfigurable(Map.prototype, Symbol.toStringTag);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/browser.js b/js/src/tests/test262/built-ins/Map/prototype/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/browser.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/clear/browser.js b/js/src/tests/test262/built-ins/Map/prototype/clear/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/clear/browser.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/clear/clear-map.js b/js/src/tests/test262/built-ins/Map/prototype/clear/clear-map.js
new file mode 100644
index 0000000000..c2035dd42d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/clear/clear-map.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.1
+description: >
+ Clears a Map.
+info: |
+ Map.prototype.clear ( )
+
+ ...
+ 4. Let entries be the List that is the value of M’s [[MapData]] internal slot.
+ 5. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ a. Set p.[[key]] to empty.
+ b. Set p.[[value]] to empty.
+ 6. Return undefined.
+features: [Symbol]
+---*/
+
+var m1 = new Map([
+ ['foo', 'bar'],
+ [1, 1]
+]);
+var m2 = new Map();
+var m3 = new Map();
+m2.set('foo', 'bar');
+m2.set(1, 1);
+m2.set(Symbol('a'), Symbol('a'));
+
+m1.clear();
+m2.clear();
+m3.clear();
+
+assert.sameValue(m1.size, 0);
+assert.sameValue(m2.size, 0);
+assert.sameValue(m3.size, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/clear/clear.js b/js/src/tests/test262/built-ins/Map/prototype/clear/clear.js
new file mode 100644
index 0000000000..8160750a6b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/clear/clear.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.1
+description: >
+ Map.prototype.clear ( )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof Map.prototype.clear,
+ 'function',
+ 'typeof Map.prototype.clear is "function"'
+);
+
+verifyNotEnumerable(Map.prototype, 'clear');
+verifyWritable(Map.prototype, 'clear');
+verifyConfigurable(Map.prototype, 'clear');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/clear/context-is-not-map-object.js b/js/src/tests/test262/built-ins/Map/prototype/clear/context-is-not-map-object.js
new file mode 100644
index 0000000000..0ac7ce8094
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/clear/context-is-not-map-object.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.1
+description: >
+ Throws a TypeError if `this` does not have a [[MapData]] internal slot.
+info: |
+ Map.prototype.clear ( )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.clear.call({});
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.clear.call([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/clear/context-is-not-object.js b/js/src/tests/test262/built-ins/Map/prototype/clear/context-is-not-object.js
new file mode 100644
index 0000000000..171ed317eb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/clear/context-is-not-object.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.1
+description: >
+ Throws a TypeError if `this` is not an Object.
+info: |
+ Map.prototype.clear ( )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+ ...
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.clear.call(1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.clear.call(true);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.clear.call('');
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.clear.call(null);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.clear.call(undefined);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.clear.call(Symbol());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/clear/context-is-set-object-throws.js b/js/src/tests/test262/built-ins/Map/prototype/clear/context-is-set-object-throws.js
new file mode 100644
index 0000000000..562c2b0ccb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/clear/context-is-set-object-throws.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.1
+description: >
+ Throws a TypeError if `this` is a Set object.
+info: |
+ Map.prototype.clear ( )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Set]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.clear.call(new Set());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/clear/context-is-weakmap-object-throws.js b/js/src/tests/test262/built-ins/Map/prototype/clear/context-is-weakmap-object-throws.js
new file mode 100644
index 0000000000..d465404f20
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/clear/context-is-weakmap-object-throws.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.1
+description: >
+ Throws a TypeError if `this` is a WeakMap object.
+info: |
+ Map.prototype.clear ( )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [WeakMap]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.clear.call(new WeakMap());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/clear/length.js b/js/src/tests/test262/built-ins/Map/prototype/clear/length.js
new file mode 100644
index 0000000000..e8cc8ee285
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/clear/length.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.1
+description: >
+ Map.prototype.clear.length value and descriptor.
+info: |
+ Map.prototype.clear ( )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.clear.length, 0,
+ 'The value of `Map.prototype.clear.length` is `0`'
+);
+
+verifyNotEnumerable(Map.prototype.clear, 'length');
+verifyNotWritable(Map.prototype.clear, 'length');
+verifyConfigurable(Map.prototype.clear, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/clear/map-data-list-is-preserved.js b/js/src/tests/test262/built-ins/Map/prototype/clear/map-data-list-is-preserved.js
new file mode 100644
index 0000000000..45776fdf73
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/clear/map-data-list-is-preserved.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.1
+description: >
+ The existing [[MapData]] List is preserved.
+info: |
+ The existing [[MapData]] List is preserved because there may be existing
+ MapIterator objects that are suspended midway through iterating over that
+ List.
+
+ Map.prototype.clear ( )
+
+ ...
+ 4. Let entries be the List that is the value of M’s [[MapData]] internal slot.
+ 5. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ a. Set p.[[key]] to empty.
+ b. Set p.[[value]] to empty.
+ 6. Return undefined.
+---*/
+
+var m = new Map([
+ [1, 1],
+ [2, 2],
+ [3, 3]
+]);
+var e = m.entries();
+
+e.next();
+m.clear();
+
+var n = e.next();
+assert.sameValue(n.value, undefined);
+assert.sameValue(n.done, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/clear/name.js b/js/src/tests/test262/built-ins/Map/prototype/clear/name.js
new file mode 100644
index 0000000000..4f3192f74d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/clear/name.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.1
+description: >
+ Map.prototype.entries.name value and descriptor.
+info: |
+ Map.prototype.clear ( )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.clear.name, 'clear',
+ 'The value of `Map.prototype.clear.name` is `"clear"`'
+);
+
+verifyNotEnumerable(Map.prototype.clear, 'name');
+verifyNotWritable(Map.prototype.clear, 'name');
+verifyConfigurable(Map.prototype.clear, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/clear/not-a-constructor.js b/js/src/tests/test262/built-ins/Map/prototype/clear/not-a-constructor.js
new file mode 100644
index 0000000000..9567b58b7b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/clear/not-a-constructor.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Map.prototype.clear does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, Map, arrow-function]
+---*/
+
+assert.sameValue(isConstructor(Map.prototype.clear), false, 'isConstructor(Map.prototype.clear) must return false');
+
+assert.throws(TypeError, () => {
+ let m = new Map(); new m.clear();
+}, '`let m = new Map(); new m.clear()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/clear/returns-undefined.js b/js/src/tests/test262/built-ins/Map/prototype/clear/returns-undefined.js
new file mode 100644
index 0000000000..84790473b3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/clear/returns-undefined.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.1
+description: >
+ Returns undefined.
+info: |
+ Map.prototype.clear ( )
+
+ ...
+ 4. Let entries be the List that is the value of M’s [[MapData]] internal slot.
+ 5. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ a. Set p.[[key]] to empty.
+ b. Set p.[[value]] to empty.
+ 6. Return undefined.
+---*/
+
+var m1 = new Map([
+ ['foo', 'bar'],
+ [1, 1]
+]);
+
+assert.sameValue(m1.clear(), undefined, 'clears a map and returns undefined');
+assert.sameValue(m1.clear(), undefined, 'returns undefined on an empty map');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/clear/shell.js b/js/src/tests/test262/built-ins/Map/prototype/clear/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/clear/shell.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/constructor.js b/js/src/tests/test262/built-ins/Map/prototype/constructor.js
new file mode 100644
index 0000000000..0b731c694c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/constructor.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.2
+description: Map.prototype.constructor value and descriptor
+info: |
+ The initial value of Map.prototype.constructor is the intrinsic object %Map%.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Map.prototype.constructor, Map);
+assert.sameValue((new Map()).constructor, Map);
+
+verifyNotEnumerable(Map.prototype, 'constructor');
+verifyWritable(Map.prototype, 'constructor');
+verifyConfigurable(Map.prototype, 'constructor');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/delete/browser.js b/js/src/tests/test262/built-ins/Map/prototype/delete/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/delete/browser.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/delete/context-is-not-map-object.js b/js/src/tests/test262/built-ins/Map/prototype/delete/context-is-not-map-object.js
new file mode 100644
index 0000000000..9443d41d46
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/delete/context-is-not-map-object.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.3
+description: >
+ Throws a TypeError if `this` does not have a [[MapData]] internal slot.
+info: |
+ Map.prototype.delete ( key )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.delete.call({}, 'attr');
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.delete.call([], 'attr');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/delete/context-is-not-object.js b/js/src/tests/test262/built-ins/Map/prototype/delete/context-is-not-object.js
new file mode 100644
index 0000000000..cd4d92a8a8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/delete/context-is-not-object.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.3
+description: >
+ Throws a TypeError if `this` is not an Object.
+info: |
+ Map.prototype.delete ( key )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+ ...
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.delete.call(1, 'attr');
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.delete.call(true, 'attr');
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.delete.call('', 'attr');
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.delete.call(null, 'attr');
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.delete.call(undefined, 'attr');
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.delete.call(Symbol(), 'attr');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/delete/context-is-set-object-throws.js b/js/src/tests/test262/built-ins/Map/prototype/delete/context-is-set-object-throws.js
new file mode 100644
index 0000000000..ab0c778afa
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/delete/context-is-set-object-throws.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.3
+description: >
+ Throws a TypeError if `this` is a Set object.
+info: |
+ Map.prototype.delete ( key )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Set]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.delete.call(new Set(), 'attr');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/delete/context-is-weakmap-object-throws.js b/js/src/tests/test262/built-ins/Map/prototype/delete/context-is-weakmap-object-throws.js
new file mode 100644
index 0000000000..bf61a5e71b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/delete/context-is-weakmap-object-throws.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.3
+description: >
+ Throws a TypeError if `this` is a WeakMap object.
+info: |
+ Map.prototype.delete ( key )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [WeakMap]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.delete.call(new WeakMap(), 'attr');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/delete/delete.js b/js/src/tests/test262/built-ins/Map/prototype/delete/delete.js
new file mode 100644
index 0000000000..2458200e6e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/delete/delete.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.3
+description: >
+ Map.prototype.delete ( )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof Map.prototype.delete,
+ 'function',
+ 'typeof Map.prototype.delete is "function"'
+);
+
+verifyNotEnumerable(Map.prototype, 'delete');
+verifyWritable(Map.prototype, 'delete');
+verifyConfigurable(Map.prototype, 'delete');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/delete/does-not-break-iterators.js b/js/src/tests/test262/built-ins/Map/prototype/delete/does-not-break-iterators.js
new file mode 100644
index 0000000000..2f7ddb4a47
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/delete/does-not-break-iterators.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.3
+description: >
+ Deleting an entry does not break a [[MapData]] List.
+info: |
+ Map.prototype.delete ( key )
+
+ 4. Let entries be the List that is the value of M’s [[MapData]] internal slot.
+ 5. Repeat for each Record {[[key]], [[value]]} p that is an element of entries,
+ a. If p.[[key]] is not empty and SameValueZero(p.[[key]], key) is true, then
+ i. Set p.[[key]] to empty.
+ ii. Set p.[[value]] to empty.
+ iii. Return true.
+ ...
+---*/
+
+var m = new Map([
+ ['a', 1],
+ ['b', 2],
+ ['c', 3]
+]);
+var e = m.entries();
+
+e.next();
+m.delete('b');
+
+var n = e.next();
+
+assert.sameValue(n.value[0], 'c');
+assert.sameValue(n.value[1], 3);
+
+n = e.next();
+assert.sameValue(n.value, undefined);
+assert.sameValue(n.done, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/delete/length.js b/js/src/tests/test262/built-ins/Map/prototype/delete/length.js
new file mode 100644
index 0000000000..4dc4dcb6dd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/delete/length.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.3
+description: >
+ Map.prototype.delete.length value and descriptor.
+info: |
+ Map.prototype.delete ( key )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.delete.length, 1,
+ 'The value of `Map.prototype.delete.length` is `1`'
+);
+
+verifyNotEnumerable(Map.prototype.delete, 'length');
+verifyNotWritable(Map.prototype.delete, 'length');
+verifyConfigurable(Map.prototype.delete, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/delete/name.js b/js/src/tests/test262/built-ins/Map/prototype/delete/name.js
new file mode 100644
index 0000000000..265086297d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/delete/name.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.3
+description: >
+ Map.prototype.delete.name value and descriptor.
+info: |
+ Map.prototype.delete ( key )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.delete.name, 'delete',
+ 'The value of `Map.prototype.delete.name` is `"delete"`'
+);
+
+verifyNotEnumerable(Map.prototype.delete, 'name');
+verifyNotWritable(Map.prototype.delete, 'name');
+verifyConfigurable(Map.prototype.delete, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/delete/not-a-constructor.js b/js/src/tests/test262/built-ins/Map/prototype/delete/not-a-constructor.js
new file mode 100644
index 0000000000..fb43d0a430
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/delete/not-a-constructor.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Map.prototype.delete does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, Map, arrow-function]
+---*/
+
+assert.sameValue(isConstructor(Map.prototype.delete), false, 'isConstructor(Map.prototype.delete) must return false');
+
+assert.throws(TypeError, () => {
+ let m = new Map(); new m.delete();
+}, '`let m = new Map(); new m.delete()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/delete/returns-false.js b/js/src/tests/test262/built-ins/Map/prototype/delete/returns-false.js
new file mode 100644
index 0000000000..8a3a3fe45f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/delete/returns-false.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.3
+description: >
+ Returns false when it does not delete an entry.
+info: |
+ Map.prototype.delete ( key )
+
+ 4. Let entries be the List that is the value of M’s [[MapData]] internal slot.
+ 5. Repeat for each Record {[[key]], [[value]]} p that is an element of entries,
+ a. If p.[[key]] is not empty and SameValueZero(p.[[key]], key) is true, then
+ ...
+ iii. Return true.
+ 6. Return false.
+---*/
+
+var m = new Map([
+ ['a', 1],
+ ['b', 2]
+]);
+
+assert.sameValue(m.delete('not-in-the-map'), false);
+
+m.delete('a');
+assert.sameValue(m.delete('a'), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/delete/returns-true-for-deleted-entry.js b/js/src/tests/test262/built-ins/Map/prototype/delete/returns-true-for-deleted-entry.js
new file mode 100644
index 0000000000..3b9ffc4494
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/delete/returns-true-for-deleted-entry.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.3
+description: >
+ Returns true when deletes an entry.
+info: |
+ Map.prototype.delete ( key )
+
+ 4. Let entries be the List that is the value of M’s [[MapData]] internal slot.
+ 5. Repeat for each Record {[[key]], [[value]]} p that is an element of entries,
+ a. If p.[[key]] is not empty and SameValueZero(p.[[key]], key) is true, then
+ i. Set p.[[key]] to empty.
+ ii. Set p.[[value]] to empty.
+ iii. Return true.
+ ...
+---*/
+
+var m = new Map([
+ ['a', 1],
+ ['b', 2]
+]);
+
+var result = m.delete('a');
+
+assert(result);
+assert.sameValue(m.size, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/delete/shell.js b/js/src/tests/test262/built-ins/Map/prototype/delete/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/delete/shell.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/descriptor.js b/js/src/tests/test262/built-ins/Map/prototype/descriptor.js
new file mode 100644
index 0000000000..a1d5287cd5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/descriptor.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.2.1
+description: Map.prototype property attributes.
+info: |
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: false }.
+includes: [propertyHelper.js]
+---*/
+
+verifyNotEnumerable(Map, 'prototype');
+verifyNotWritable(Map, 'prototype');
+verifyNotConfigurable(Map, 'prototype');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/entries/browser.js b/js/src/tests/test262/built-ins/Map/prototype/entries/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/entries/browser.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/entries/does-not-have-mapdata-internal-slot-set.js b/js/src/tests/test262/built-ins/Map/prototype/entries/does-not-have-mapdata-internal-slot-set.js
new file mode 100644
index 0000000000..6fb16af8cc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/entries/does-not-have-mapdata-internal-slot-set.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.4
+description: >
+ Throws a TypeError if `this` is a Set object.
+info: |
+ Map.prototype.entries ( )
+
+ 1. Let M be the this value.
+ 2. Return CreateMapIterator(M, "key+value").
+
+ 23.1.5.1 CreateMapIterator Abstract Operation
+
+ ...
+ 2. If map does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Set]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.entries.call(new Set());
+});
+
+assert.throws(TypeError, function() {
+ var m = new Map();
+ m.entries.call(new Set());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/entries/does-not-have-mapdata-internal-slot-weakmap.js b/js/src/tests/test262/built-ins/Map/prototype/entries/does-not-have-mapdata-internal-slot-weakmap.js
new file mode 100644
index 0000000000..4aa2bd38b3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/entries/does-not-have-mapdata-internal-slot-weakmap.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.4
+description: >
+ Throws a TypeError if `this` is a WeakMap object.
+info: |
+ Map.prototype.entries ( )
+
+ 1. Let M be the this value.
+ 2. Return CreateMapIterator(M, "key+value").
+
+ 23.1.5.1 CreateMapIterator Abstract Operation
+
+ ...
+ 2. If map does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [WeakMap]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.entries.call(new WeakMap());
+});
+
+assert.throws(TypeError, function() {
+ var m = new Map();
+ m.entries.call(new WeakMap());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/entries/does-not-have-mapdata-internal-slot.js b/js/src/tests/test262/built-ins/Map/prototype/entries/does-not-have-mapdata-internal-slot.js
new file mode 100644
index 0000000000..c62687482a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/entries/does-not-have-mapdata-internal-slot.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.4
+description: >
+ Throws a TypeError if `this` object does not have a [[MapData]] internal slot.
+info: |
+ Map.prototype.entries ( )
+
+ 1. Let M be the this value.
+ 2. Return CreateMapIterator(M, "key+value").
+
+ 23.1.5.1 CreateMapIterator Abstract Operation
+
+ ...
+ 2. If map does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+
+---*/
+
+var m = new Map();
+
+assert.throws(TypeError, function() {
+ Map.prototype.entries.call([]);
+});
+
+assert.throws(TypeError, function() {
+ m.entries.call([]);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.entries.call({});
+});
+
+assert.throws(TypeError, function() {
+ m.entries.call({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/entries/entries.js b/js/src/tests/test262/built-ins/Map/prototype/entries/entries.js
new file mode 100644
index 0000000000..102c6f0951
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/entries/entries.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.4
+description: >
+ Property type and descriptor.
+info: |
+ Map.prototype.entries ( )
+
+ 17 ECMAScript Standard Built-in Objects
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof Map.prototype.entries,
+ 'function',
+ '`typeof Map.prototype.entries` is `function`'
+);
+
+verifyNotEnumerable(Map.prototype, 'entries');
+verifyWritable(Map.prototype, 'entries');
+verifyConfigurable(Map.prototype, 'entries');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/entries/length.js b/js/src/tests/test262/built-ins/Map/prototype/entries/length.js
new file mode 100644
index 0000000000..061fb37a9f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/entries/length.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.4
+description: >
+ Map.prototype.entries.length value and descriptor.
+info: |
+ Map.prototype.entries ( )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.entries.length, 0,
+ 'The value of `Map.prototype.entries.length` is `0`'
+);
+
+verifyNotEnumerable(Map.prototype.entries, 'length');
+verifyNotWritable(Map.prototype.entries, 'length');
+verifyConfigurable(Map.prototype.entries, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/entries/name.js b/js/src/tests/test262/built-ins/Map/prototype/entries/name.js
new file mode 100644
index 0000000000..ccdd641cf2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/entries/name.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.4
+description: >
+ Map.prototype.entries.name value and descriptor.
+info: |
+ Map.prototype.entries ( )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.entries.name, 'entries',
+ 'The value of `Map.prototype.entries.name` is `"entries"`'
+);
+
+verifyNotEnumerable(Map.prototype.entries, 'name');
+verifyNotWritable(Map.prototype.entries, 'name');
+verifyConfigurable(Map.prototype.entries, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/entries/not-a-constructor.js b/js/src/tests/test262/built-ins/Map/prototype/entries/not-a-constructor.js
new file mode 100644
index 0000000000..087ce39b98
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/entries/not-a-constructor.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Map.prototype.entries does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, Map, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(Map.prototype.entries),
+ false,
+ 'isConstructor(Map.prototype.entries) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let m = new Map(); new m.entries();
+}, '`let m = new Map(); new m.entries()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/entries/returns-iterator-empty.js b/js/src/tests/test262/built-ins/Map/prototype/entries/returns-iterator-empty.js
new file mode 100644
index 0000000000..7b467ef46e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/entries/returns-iterator-empty.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.4
+description: >
+ Returns an iterator on an empty Map object.
+info: |
+ Map.prototype.entries ( )
+
+ ...
+ 2. Return CreateMapIterator(M, "key+value").
+
+ 23.1.5.1 CreateMapIterator Abstract Operation
+
+ ...
+ 7. Return iterator.
+---*/
+
+var map = new Map();
+var iterator = map.entries();
+var result = iterator.next();
+
+assert.sameValue(
+ result.value, undefined,
+ 'The value of `result.value` is `undefined`'
+);
+assert.sameValue(result.done, true, 'The value of `result.done` is `true`');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/entries/returns-iterator.js b/js/src/tests/test262/built-ins/Map/prototype/entries/returns-iterator.js
new file mode 100644
index 0000000000..c258f17ca6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/entries/returns-iterator.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.4
+description: >
+ Returns an iterator.
+info: |
+ Map.prototype.entries ( )
+
+ ...
+ 2. Return CreateMapIterator(M, "key+value").
+
+ 23.1.5.1 CreateMapIterator Abstract Operation
+
+ ...
+ 7. Return iterator.
+---*/
+
+var map = new Map();
+map.set('a',1);
+map.set('b',2);
+map.set('c',3);
+
+var iterator = map.entries();
+var result;
+
+result = iterator.next();
+assert.sameValue(result.value[0], 'a', 'First result `value` ("key")');
+assert.sameValue(result.value[1], 1, 'First result `value` ("value")');
+assert.sameValue(result.value.length, 2, 'First result `value` (length)');
+assert.sameValue(result.done, false, 'First result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value[0], 'b', 'Second result `value` ("key")');
+assert.sameValue(result.value[1], 2, 'Second result `value` ("value")');
+assert.sameValue(result.value.length, 2, 'Second result `value` (length)');
+assert.sameValue(result.done, false, 'Second result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value[0], 'c', 'Third result `value` ("key")');
+assert.sameValue(result.value[1], 3, 'Third result `value` ("value")');
+assert.sameValue(result.value.length, 2, 'Third result `value` (length)');
+assert.sameValue(result.done, false, 'Third result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value, undefined, 'Exhausted result `value`');
+assert.sameValue(result.done, true, 'Exhausted result `done` flag');
+
+result = iterator.next();
+assert.sameValue(
+ result.value, undefined, 'Exhausted result `value` (repeated request)'
+);
+assert.sameValue(
+ result.done, true, 'Exhausted result `done` flag (repeated request)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/entries/shell.js b/js/src/tests/test262/built-ins/Map/prototype/entries/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/entries/shell.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/entries/this-not-object-throw.js b/js/src/tests/test262/built-ins/Map/prototype/entries/this-not-object-throw.js
new file mode 100644
index 0000000000..17c6914fd8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/entries/this-not-object-throw.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.4
+description: >
+ Throws a TypeError if `this` is not an Object.
+info: |
+ Map.prototype.entries ( )
+
+ ...
+ 2. Return CreateSetIterator(M, "key+value").
+
+ 23.1.5.1 CreateSetIterator Abstract Operation
+
+ 1. If Type(map) is not Object, throw a TypeError exception.
+ ...
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.entries.call(false);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.entries.call(1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.entries.call('');
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.entries.call(undefined);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.entries.call(null);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.entries.call(Symbol());
+});
+
+assert.throws(TypeError, function() {
+ var map = new Map();
+ map.entries.call(false);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/browser.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/browser.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/callback-parameters.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/callback-parameters.js
new file mode 100644
index 0000000000..68f1d1fe77
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/callback-parameters.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.5
+description: >
+ Verify the parameters order on the given callback.
+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»).
+ ...
+---*/
+
+var map = new Map();
+map.set('foo', 42);
+map.set('bar', 'baz');
+
+var results = [];
+
+var callback = function(value, key, thisArg) {
+ results.push({
+ value: value,
+ key: key,
+ thisArg: thisArg
+ });
+};
+
+map.forEach(callback);
+
+assert.sameValue(results[0].value, 42);
+assert.sameValue(results[0].key, 'foo');
+assert.sameValue(results[0].thisArg, map);
+
+assert.sameValue(results[1].value, 'baz');
+assert.sameValue(results[1].key, 'bar');
+assert.sameValue(results[1].thisArg, map);
+
+assert.sameValue(results.length, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/callback-result-is-abrupt.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/callback-result-is-abrupt.js
new file mode 100644
index 0000000000..2a99ee3ba1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/callback-result-is-abrupt.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.5
+description: >
+ Returns error from callback result is abrupt.
+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»).
+ ii. ReturnIfAbrupt(funcResult).
+ ...
+---*/
+
+var map = new Map([[0, 0]]);
+
+assert.throws(Test262Error, function() {
+ map.forEach(function() {
+ throw new Test262Error();
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/callback-this-non-strict.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/callback-this-non-strict.js
new file mode 100644
index 0000000000..a20afec5b5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/callback-this-non-strict.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.5
+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: [noStrict]
+---*/
+
+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], this);
+assert.sameValue(_this[1], this);
+assert.sameValue(_this[2], this);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/callback-this-strict-strict.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/callback-this-strict-strict.js
new file mode 100644
index 0000000000..1a8006089b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/callback-this-strict-strict.js
@@ -0,0 +1,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.
+/*---
+es6id: 23.1.3.5
+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);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/deleted-values-during-foreach.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/deleted-values-during-foreach.js
new file mode 100644
index 0000000000..84c773f4a4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/deleted-values-during-foreach.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.5
+description: >
+ Map state with deleted values during forEach.
+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»).
+ ii. ReturnIfAbrupt(funcResult).
+ ...
+---*/
+
+var map = new Map();
+map.set('foo', 0);
+map.set('bar', 1);
+
+var count = 0;
+var results = [];
+
+map.forEach(function(value, key) {
+ if (count === 0) {
+ map.delete('bar');
+ }
+ results.push({
+ value: value,
+ key: key
+ });
+ count++;
+});
+
+assert.sameValue(results.length, 1);
+assert.sameValue(results[0].key, 'foo');
+assert.sameValue(results[0].value, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/does-not-have-mapdata-internal-slot-set.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/does-not-have-mapdata-internal-slot-set.js
new file mode 100644
index 0000000000..1cfea0915f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/does-not-have-mapdata-internal-slot-set.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.5
+description: >
+ Throws a TypeError if `this` is a Set object.
+info: |
+ Map.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Set]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.forEach.call(new Set(), function() {});
+});
+
+assert.throws(TypeError, function() {
+ var m = new Map();
+ m.forEach.call(new Set(), function() {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/does-not-have-mapdata-internal-slot-weakmap.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/does-not-have-mapdata-internal-slot-weakmap.js
new file mode 100644
index 0000000000..deb205d227
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/does-not-have-mapdata-internal-slot-weakmap.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.5
+description: >
+ Throws a TypeError if `this` is a WeakMap object.
+info: |
+ Map.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [WeakMap]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.forEach.call(new WeakMap(), function() {});
+});
+
+assert.throws(TypeError, function() {
+ var m = new Map();
+ m.forEach.call(new WeakMap(), function() {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/does-not-have-mapdata-internal-slot.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/does-not-have-mapdata-internal-slot.js
new file mode 100644
index 0000000000..4030d454a8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/does-not-have-mapdata-internal-slot.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.5
+description: >
+ Throws a TypeError if `this` object does not have a [[MapData]] internal slot.
+info: |
+ Map.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+var m = new Map();
+
+assert.throws(TypeError, function() {
+ Map.prototype.forEach.call([], function() {});
+});
+
+assert.throws(TypeError, function() {
+ m.forEach.call([], function() {});
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.forEach.call({}, function() {});
+});
+
+assert.throws(TypeError, function() {
+ m.forEach.call({}, function() {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/first-argument-is-not-callable.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/first-argument-is-not-callable.js
new file mode 100644
index 0000000000..630484f435
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/first-argument-is-not-callable.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.5
+description: >
+ Throws a TypeError if first argument is not callable.
+info: |
+ Map.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
+ ...
+features: [Symbol]
+---*/
+
+var map = new Map();
+
+assert.throws(TypeError, function() {
+ map.forEach({});
+});
+
+assert.throws(TypeError, function() {
+ map.forEach([]);
+});
+
+assert.throws(TypeError, function() {
+ map.forEach(1);
+});
+
+assert.throws(TypeError, function() {
+ map.forEach('');
+});
+
+assert.throws(TypeError, function() {
+ map.forEach(null);
+});
+
+assert.throws(TypeError, function() {
+ map.forEach(undefined);
+});
+
+assert.throws(TypeError, function() {
+ map.forEach(Symbol());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/forEach.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/forEach.js
new file mode 100644
index 0000000000..2678982972
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/forEach.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.5
+description: >
+ Property type and descriptor.
+info: |
+ Map.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof Map.prototype.forEach,
+ 'function',
+ '`typeof Map.prototype.forEach` is `function`'
+);
+
+verifyNotEnumerable(Map.prototype, 'forEach');
+verifyWritable(Map.prototype, 'forEach');
+verifyConfigurable(Map.prototype, 'forEach');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/iterates-in-key-insertion-order.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/iterates-in-key-insertion-order.js
new file mode 100644
index 0000000000..e064c061ef
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/iterates-in-key-insertion-order.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.5
+description: >
+ Repeats for each non-empty record, in original key insertion order.
+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»).
+ ...
+---*/
+
+var map = new Map([
+ ['foo', 'valid foo'],
+ ['bar', false],
+ ['baz', 'valid baz']
+]);
+map.set(0, false);
+map.set(1, false);
+map.set(2, 'valid 2');
+map.delete(1);
+map.delete('bar');
+
+// Not setting a new key, just changing the value
+map.set(0, 'valid 0');
+
+var results = [];
+var callback = function(value) {
+ results.push(value);
+};
+
+map.forEach(callback);
+
+assert.sameValue(results[0], 'valid foo');
+assert.sameValue(results[1], 'valid baz');
+assert.sameValue(results[2], 'valid 0');
+assert.sameValue(results[3], 'valid 2');
+assert.sameValue(results.length, 4);
+
+map.clear();
+results = [];
+
+map.forEach(callback);
+assert.sameValue(results.length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/iterates-values-added-after-foreach-begins.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/iterates-values-added-after-foreach-begins.js
new file mode 100644
index 0000000000..eb120ee611
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/iterates-values-added-after-foreach-begins.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.5
+description: >
+ New keys are visited if created during forEach execution.
+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»).
+ ii. ReturnIfAbrupt(funcResult).
+ ...
+---*/
+
+var map = new Map();
+map.set('foo', 0);
+map.set('bar', 1);
+
+var count = 0;
+var results = [];
+
+map.forEach(function(value, key) {
+ if (count === 0) {
+ map.set('baz', 2);
+ }
+ results.push({
+ value: value,
+ key: key
+ });
+ count++;
+});
+
+assert.sameValue(count, 3);
+assert.sameValue(map.size, 3);
+
+assert.sameValue(results[0].key, 'foo');
+assert.sameValue(results[0].value, 0);
+
+assert.sameValue(results[1].key, 'bar');
+assert.sameValue(results[1].value, 1);
+
+assert.sameValue(results[2].key, 'baz');
+assert.sameValue(results[2].value, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/iterates-values-deleted-then-readded.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/iterates-values-deleted-then-readded.js
new file mode 100644
index 0000000000..1f2d8a62b8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/iterates-values-deleted-then-readded.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.5
+description: >
+ New keys are visited if created during forEach execution.
+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»).
+ ii. ReturnIfAbrupt(funcResult).
+ ...
+---*/
+
+var map = new Map();
+map.set('foo', 0);
+map.set('bar', 1);
+
+var count = 0;
+var results = [];
+
+map.forEach(function(value, key) {
+ if (count === 0) {
+ map.delete('foo');
+ map.set('foo', 'baz');
+ }
+ results.push({
+ value: value,
+ key: key
+ });
+ count++;
+});
+
+assert.sameValue(count, 3);
+assert.sameValue(map.size, 2);
+
+assert.sameValue(results[0].key, 'foo');
+assert.sameValue(results[0].value, 0);
+
+assert.sameValue(results[1].key, 'bar');
+assert.sameValue(results[1].value, 1);
+
+assert.sameValue(results[2].key, 'foo');
+assert.sameValue(results[2].value, 'baz');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/length.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/length.js
new file mode 100644
index 0000000000..072bdb3ea4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/length.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.5
+description: >
+ Map.prototype.forEach.length value and descriptor.
+info: |
+ Map.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.forEach.length, 1,
+ 'The value of `Map.prototype.forEach.length` is `1`'
+);
+
+verifyNotEnumerable(Map.prototype.forEach, 'length');
+verifyNotWritable(Map.prototype.forEach, 'length');
+verifyConfigurable(Map.prototype.forEach, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/name.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/name.js
new file mode 100644
index 0000000000..7656ab1df1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/name.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.5
+description: >
+ Map.prototype.forEach.name value and descriptor.
+info: |
+ Map.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.forEach.name, 'forEach',
+ 'The value of `Map.prototype.forEach.name` is `"forEach"`'
+);
+
+verifyNotEnumerable(Map.prototype.forEach, 'name');
+verifyNotWritable(Map.prototype.forEach, 'name');
+verifyConfigurable(Map.prototype.forEach, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/not-a-constructor.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/not-a-constructor.js
new file mode 100644
index 0000000000..0a113f9d68
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/not-a-constructor.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Map.prototype.forEach does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, Map, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(Map.prototype.forEach),
+ false,
+ 'isConstructor(Map.prototype.forEach) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let m = new Map(); new m.forEach();
+}, '`let m = new Map(); new m.forEach()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/return-undefined.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/return-undefined.js
new file mode 100644
index 0000000000..8e3a0d52f3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/return-undefined.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.5
+description: >
+ Returns undefined.
+info: |
+ Map.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 8. Return undefined.
+---*/
+
+var map = new Map();
+
+var result = map.forEach(function() {
+ return true;
+});
+
+assert.sameValue(result, undefined, 'Empty map#forEach returns undefined');
+
+map.set(1, 1);
+result = map.forEach(function() {
+ return true;
+});
+
+assert.sameValue(result, undefined, 'map#forEach returns undefined');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/second-parameter-as-callback-context.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/second-parameter-as-callback-context.js
new file mode 100644
index 0000000000..162b3c047c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/second-parameter-as-callback-context.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.5
+description: >
+ If a thisArg parameter is provided, it 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»).
+ ...
+---*/
+
+var expectedThis = {};
+var _this = [];
+
+var map = new Map();
+map.set(0, 0);
+map.set(1, 1);
+map.set(2, 2);
+
+var callback = function() {
+ _this.push(this);
+};
+
+map.forEach(callback, expectedThis);
+
+assert.sameValue(_this[0], expectedThis);
+assert.sameValue(_this[1], expectedThis);
+assert.sameValue(_this[2], expectedThis);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/shell.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/shell.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/forEach/this-not-object-throw.js b/js/src/tests/test262/built-ins/Map/prototype/forEach/this-not-object-throw.js
new file mode 100644
index 0000000000..649b477835
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/forEach/this-not-object-throw.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.5
+description: >
+ Throws a TypeError if `this` is not an Object.
+info: |
+ Map.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+ ...
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.forEach.call(false, function() {});
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.forEach.call(1, function() {});
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.forEach.call('', function() {});
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.forEach.call(undefined, function() {});
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.forEach.call(null, function() {});
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.forEach.call(Symbol(), function() {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new Map();
+ map.forEach.call(false, function() {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/get/browser.js b/js/src/tests/test262/built-ins/Map/prototype/get/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/get/browser.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/get/does-not-have-mapdata-internal-slot-set.js b/js/src/tests/test262/built-ins/Map/prototype/get/does-not-have-mapdata-internal-slot-set.js
new file mode 100644
index 0000000000..1bb2bd09b8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/get/does-not-have-mapdata-internal-slot-set.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.6
+description: >
+ Throws a TypeError if `this` is a Set object.
+info: |
+ Map.prototype.get ( key )
+
+ ...
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Set]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.get.call(new Set(), 1);
+});
+
+assert.throws(TypeError, function() {
+ var m = new Map();
+ m.get.call(new Set(), 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/get/does-not-have-mapdata-internal-slot-weakmap.js b/js/src/tests/test262/built-ins/Map/prototype/get/does-not-have-mapdata-internal-slot-weakmap.js
new file mode 100644
index 0000000000..06a6ad62b6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/get/does-not-have-mapdata-internal-slot-weakmap.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.6
+description: >
+ Throws a TypeError if `this` is a WeakMap object.
+info: |
+ Map.prototype.get ( key )
+
+ ...
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [WeakMap]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.get.call(new WeakMap(), 1);
+});
+
+assert.throws(TypeError, function() {
+ var m = new Map();
+ m.get.call(new WeakMap(), 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/get/does-not-have-mapdata-internal-slot.js b/js/src/tests/test262/built-ins/Map/prototype/get/does-not-have-mapdata-internal-slot.js
new file mode 100644
index 0000000000..0e3c065582
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/get/does-not-have-mapdata-internal-slot.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.6
+description: >
+ Throws a TypeError if `this` object does not have a [[MapData]] internal slot.
+info: |
+ Map.prototype.get ( key )
+
+ ...
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+var m = new Map();
+
+assert.throws(TypeError, function() {
+ Map.prototype.get.call([], 1);
+});
+
+assert.throws(TypeError, function() {
+ m.get.call([], 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.get.call({}, 1);
+});
+
+assert.throws(TypeError, function() {
+ m.get.call({}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/get/get.js b/js/src/tests/test262/built-ins/Map/prototype/get/get.js
new file mode 100644
index 0000000000..2463ed9943
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/get/get.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.6
+description: >
+ Property type and descriptor.
+info: |
+ Map.prototype.get ( key )
+
+ 17 ECMAScript Standard Built-in Objects
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof Map.prototype.get,
+ 'function',
+ '`typeof Map.prototype.get` is `function`'
+);
+
+verifyNotEnumerable(Map.prototype, 'get');
+verifyWritable(Map.prototype, 'get');
+verifyConfigurable(Map.prototype, 'get');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/get/length.js b/js/src/tests/test262/built-ins/Map/prototype/get/length.js
new file mode 100644
index 0000000000..7c7ba35a4d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/get/length.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.6
+description: >
+ Map.prototype.get.length value and descriptor.
+info: |
+ Map.prototype.get ( key )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.get.length, 1,
+ 'The value of `Map.prototype.get.length` is `1`'
+);
+
+verifyNotEnumerable(Map.prototype.get, 'length');
+verifyNotWritable(Map.prototype.get, 'length');
+verifyConfigurable(Map.prototype.get, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/get/name.js b/js/src/tests/test262/built-ins/Map/prototype/get/name.js
new file mode 100644
index 0000000000..986bb39b67
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/get/name.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.6
+description: >
+ Map.prototype.get.name value and descriptor.
+info: |
+ Map.prototype.get ( key )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.get.name, 'get',
+ 'The value of `Map.prototype.get.name` is `"get"`'
+);
+
+verifyNotEnumerable(Map.prototype.get, 'name');
+verifyNotWritable(Map.prototype.get, 'name');
+verifyConfigurable(Map.prototype.get, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/get/not-a-constructor.js b/js/src/tests/test262/built-ins/Map/prototype/get/not-a-constructor.js
new file mode 100644
index 0000000000..9bc9b965e2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/get/not-a-constructor.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Map.prototype.get does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, Map, arrow-function]
+---*/
+
+assert.sameValue(isConstructor(Map.prototype.get), false, 'isConstructor(Map.prototype.get) must return false');
+
+assert.throws(TypeError, () => {
+ let m = new Map(); new m.get();
+}, '`let m = new Map(); new m.get()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/get/returns-undefined.js b/js/src/tests/test262/built-ins/Map/prototype/get/returns-undefined.js
new file mode 100644
index 0000000000..220528d5da
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/get/returns-undefined.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.6
+description: >
+ Returns undefined when key is not on the map.
+info: |
+ Map.prototype.get ( key )
+
+ 4. Let entries be the List that is the value of M’s [[MapData]] internal slot.
+ 5. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ a. If p.[[key]] is not empty and SameValueZero(p.[[key]], key) is true,
+ return p.[[value]].
+ 6. Return undefined.
+ ...
+---*/
+
+var map = new Map();
+
+assert.sameValue(
+ map.get('item'), undefined,
+ 'returns undefined if key is not on the map'
+);
+
+map.set('item', 1);
+map.set('another_item', 2);
+map.delete('item');
+
+assert.sameValue(
+ map.get('item'), undefined,
+ 'returns undefined if key was deleted'
+);
+
+map.set('item', 1);
+map.clear();
+
+assert.sameValue(
+ map.get('item'), undefined,
+ 'returns undefined after map is cleared'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/get/returns-value-different-key-types.js b/js/src/tests/test262/built-ins/Map/prototype/get/returns-value-different-key-types.js
new file mode 100644
index 0000000000..a495876ee8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/get/returns-value-different-key-types.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.6
+description: >
+ Returns the value from the specified key on different types.
+info: |
+ Map.prototype.get ( key )
+
+ 4. Let entries be the List that is the value of M’s [[MapData]] internal slot.
+ 5. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ a. If p.[[key]] is not empty and SameValueZero(p.[[key]], key) is true,
+ return p.[[value]].
+ ...
+features: [Symbol]
+---*/
+
+var map = new Map();
+
+map.set('bar', 0);
+assert.sameValue(map.get('bar'), 0);
+
+map.set(1, 42);
+assert.sameValue(map.get(1), 42);
+
+map.set(NaN, 1);
+assert.sameValue(map.get(NaN), 1);
+
+var item = {};
+map.set(item, 2);
+assert.sameValue(map.get(item), 2);
+
+item = [];
+map.set(item, 3);
+assert.sameValue(map.get(item), 3);
+
+item = Symbol('item');
+map.set(item, 4);
+assert.sameValue(map.get(item), 4);
+
+item = null;
+map.set(item, 5);
+assert.sameValue(map.get(item), 5);
+
+item = undefined;
+map.set(item, 6);
+assert.sameValue(map.get(item), 6);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/get/returns-value-normalized-zero-key.js b/js/src/tests/test262/built-ins/Map/prototype/get/returns-value-normalized-zero-key.js
new file mode 100644
index 0000000000..b2671b3d00
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/get/returns-value-normalized-zero-key.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.6
+description: >
+ -0 and +0 are normalized to +0;
+info: |
+ Map.prototype.get ( key )
+
+ 4. Let entries be the List that is the value of M’s [[MapData]] internal slot.
+ 5. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ a. If p.[[key]] is not empty and SameValueZero(p.[[key]], key) is true,
+ return p.[[value]].
+ ...
+---*/
+
+var map = new Map();
+
+map.set(+0, 42);
+assert.sameValue(map.get(-0), 42);
+
+map = new Map();
+map.set(-0, 43);
+assert.sameValue(map.get(+0), 43);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/get/shell.js b/js/src/tests/test262/built-ins/Map/prototype/get/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/get/shell.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/get/this-not-object-throw.js b/js/src/tests/test262/built-ins/Map/prototype/get/this-not-object-throw.js
new file mode 100644
index 0000000000..360a5b3999
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/get/this-not-object-throw.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.6
+description: >
+ Throws a TypeError if `this` is not an Object.
+info: |
+ Map.prototype.get ( key )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+ ...
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.get.call(false, 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.get.call(1, 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.get.call('', 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.get.call(undefined, 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.get.call(null, 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.get.call(Symbol(), 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new Map();
+ map.get.call(false, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/has/browser.js b/js/src/tests/test262/built-ins/Map/prototype/has/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/has/browser.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/has/does-not-have-mapdata-internal-slot-set.js b/js/src/tests/test262/built-ins/Map/prototype/has/does-not-have-mapdata-internal-slot-set.js
new file mode 100644
index 0000000000..5cc316d7b2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/has/does-not-have-mapdata-internal-slot-set.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.7
+description: >
+ Throws a TypeError if `this` is a Set object.
+info: |
+ Map.prototype.has ( key )
+
+ ...
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Set]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.has.call(new Set(), 1);
+});
+
+assert.throws(TypeError, function() {
+ var m = new Map();
+ m.has.call(new Set(), 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/has/does-not-have-mapdata-internal-slot-weakmap.js b/js/src/tests/test262/built-ins/Map/prototype/has/does-not-have-mapdata-internal-slot-weakmap.js
new file mode 100644
index 0000000000..e0dfd6c459
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/has/does-not-have-mapdata-internal-slot-weakmap.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.7
+description: >
+ Throws a TypeError if `this` is a WeakMap object.
+info: |
+ Map.prototype.has ( key )
+
+ ...
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [WeakMap]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.has.call(new WeakMap(), 1);
+});
+
+assert.throws(TypeError, function() {
+ var m = new Map();
+ m.has.call(new WeakMap(), 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/has/does-not-have-mapdata-internal-slot.js b/js/src/tests/test262/built-ins/Map/prototype/has/does-not-have-mapdata-internal-slot.js
new file mode 100644
index 0000000000..78bf506655
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/has/does-not-have-mapdata-internal-slot.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.7
+description: >
+ Throws a TypeError if `this` object does not have a [[MapData]] internal slot.
+info: |
+ Map.prototype.has ( key )
+
+ ...
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+var m = new Map();
+
+assert.throws(TypeError, function() {
+ Map.prototype.has.call([], 1);
+});
+
+assert.throws(TypeError, function() {
+ m.has.call([], 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.has.call({}, 1);
+});
+
+assert.throws(TypeError, function() {
+ m.has.call({}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/has/has.js b/js/src/tests/test262/built-ins/Map/prototype/has/has.js
new file mode 100644
index 0000000000..d90141e50b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/has/has.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.7
+description: >
+ Property type and descriptor.
+info: |
+ Map.prototype.has ( key )
+
+ 17 ECMAScript Standard Built-in Objects
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof Map.prototype.has,
+ 'function',
+ '`typeof Map.prototype.has` is `function`'
+);
+
+verifyNotEnumerable(Map.prototype, 'has');
+verifyWritable(Map.prototype, 'has');
+verifyConfigurable(Map.prototype, 'has');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/has/length.js b/js/src/tests/test262/built-ins/Map/prototype/has/length.js
new file mode 100644
index 0000000000..be24d24fca
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/has/length.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.7
+description: >
+ Map.prototype.has.length value and descriptor.
+info: |
+ Map.prototype.has ( key )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.has.length, 1,
+ 'The value of `Map.prototype.has.length` is `1`'
+);
+
+verifyNotEnumerable(Map.prototype.has, 'length');
+verifyNotWritable(Map.prototype.has, 'length');
+verifyConfigurable(Map.prototype.has, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/has/name.js b/js/src/tests/test262/built-ins/Map/prototype/has/name.js
new file mode 100644
index 0000000000..11d7853e3f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/has/name.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.7
+description: >
+ Map.prototype.has.name value and descriptor.
+info: |
+ Map.prototype.has ( key )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.has.name, 'has',
+ 'The value of `Map.prototype.has.name` is `"has"`'
+);
+
+verifyNotEnumerable(Map.prototype.has, 'name');
+verifyNotWritable(Map.prototype.has, 'name');
+verifyConfigurable(Map.prototype.has, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/has/normalizes-zero-key.js b/js/src/tests/test262/built-ins/Map/prototype/has/normalizes-zero-key.js
new file mode 100644
index 0000000000..faadc82fc4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/has/normalizes-zero-key.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.7
+description: >
+ -0 and +0 are normalized to +0;
+info: |
+ Map.prototype.has ( key )
+
+ 5. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ a. If p.[[key]] is not empty and SameValueZero(p.[[key]], key) is true,
+ return true.
+ ...
+---*/
+
+var map = new Map();
+
+assert.sameValue(map.has(-0), false);
+assert.sameValue(map.has(+0), false);
+
+map.set(-0, 42);
+assert.sameValue(map.has(-0), true);
+assert.sameValue(map.has(+0), true);
+
+map.clear();
+
+map.set(+0, 42);
+assert.sameValue(map.has(-0), true);
+assert.sameValue(map.has(+0), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/has/not-a-constructor.js b/js/src/tests/test262/built-ins/Map/prototype/has/not-a-constructor.js
new file mode 100644
index 0000000000..6f1d7d9253
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/has/not-a-constructor.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Map.prototype.has does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, Map, arrow-function]
+---*/
+
+assert.sameValue(isConstructor(Map.prototype.has), false, 'isConstructor(Map.prototype.has) must return false');
+
+assert.throws(TypeError, () => {
+ let m = new Map(); new m.has();
+}, '`let m = new Map(); new m.has()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/has/return-false-different-key-types.js b/js/src/tests/test262/built-ins/Map/prototype/has/return-false-different-key-types.js
new file mode 100644
index 0000000000..31e7c6d24e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/has/return-false-different-key-types.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.7
+description: >
+ Returns true for existing keys, using different key types.
+info: |
+ Map.prototype.has ( key )
+
+ 5. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ i. If p.[[key]] is not empty and SameValueZero(p.[[key]], key) is true,
+ return true.
+ ...
+features: [Symbol]
+---*/
+
+var map = new Map();
+
+assert.sameValue(map.has('str'), false);
+assert.sameValue(map.has(1), false);
+assert.sameValue(map.has(NaN), false);
+assert.sameValue(map.has(true), false);
+assert.sameValue(map.has(false), false);
+assert.sameValue(map.has({}), false);
+assert.sameValue(map.has([]), false);
+assert.sameValue(map.has(Symbol()), false);
+assert.sameValue(map.has(null), false);
+assert.sameValue(map.has(undefined), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/has/return-true-different-key-types.js b/js/src/tests/test262/built-ins/Map/prototype/has/return-true-different-key-types.js
new file mode 100644
index 0000000000..b90060e93a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/has/return-true-different-key-types.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.7
+description: >
+ Returns true for existing keys, using different key types.
+info: |
+ Map.prototype.has ( key )
+
+ 5. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ i. If p.[[key]] is not empty and SameValueZero(p.[[key]], key) is true,
+ return true.
+ ...
+features: [Symbol]
+---*/
+
+var map = new Map();
+
+var obj = {};
+var arr = [];
+var symb = Symbol();
+
+map.set('str', undefined);
+map.set(1, undefined);
+map.set(NaN, undefined);
+map.set(true, undefined);
+map.set(false, undefined);
+map.set(obj, undefined);
+map.set(arr, undefined);
+map.set(symb, undefined);
+map.set(null, undefined);
+map.set(undefined, undefined);
+
+assert.sameValue(map.has('str'), true);
+assert.sameValue(map.has(1), true);
+assert.sameValue(map.has(NaN), true);
+assert.sameValue(map.has(true), true);
+assert.sameValue(map.has(false), true);
+assert.sameValue(map.has(obj), true);
+assert.sameValue(map.has(arr), true);
+assert.sameValue(map.has(symb), true);
+assert.sameValue(map.has(null), true);
+assert.sameValue(map.has(undefined), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/has/shell.js b/js/src/tests/test262/built-ins/Map/prototype/has/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/has/shell.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/has/this-not-object-throw.js b/js/src/tests/test262/built-ins/Map/prototype/has/this-not-object-throw.js
new file mode 100644
index 0000000000..3c76da555b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/has/this-not-object-throw.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.7
+description: >
+ Throws a TypeError if `this` is not an Object.
+info: |
+ Map.prototype.has ( key )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+ ...
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.has.call(false, 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.has.call(1, 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.has.call('', 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.has.call(undefined, 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.has.call(null, 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.has.call(Symbol(), 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new Map();
+ map.has.call(false, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/keys/browser.js b/js/src/tests/test262/built-ins/Map/prototype/keys/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/keys/browser.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/keys/does-not-have-mapdata-internal-slot-set.js b/js/src/tests/test262/built-ins/Map/prototype/keys/does-not-have-mapdata-internal-slot-set.js
new file mode 100644
index 0000000000..e0ce782707
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/keys/does-not-have-mapdata-internal-slot-set.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.8
+description: >
+ Throws a TypeError if `this` is a Set object.
+info: |
+ Map.prototype.keys ()
+
+ 1. Let M be the this value.
+ 2. Return CreateMapIterator(M, "key").
+
+ 23.1.5.1 CreateMapIterator Abstract Operation
+
+ ...
+ 2. If map does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Set]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.keys.call(new Set());
+});
+
+assert.throws(TypeError, function() {
+ var m = new Map();
+ m.keys.call(new Set());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/keys/does-not-have-mapdata-internal-slot-weakmap.js b/js/src/tests/test262/built-ins/Map/prototype/keys/does-not-have-mapdata-internal-slot-weakmap.js
new file mode 100644
index 0000000000..2a0f750f91
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/keys/does-not-have-mapdata-internal-slot-weakmap.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.8
+description: >
+ Throws a TypeError if `this` is a WeakMap object.
+info: |
+ Map.prototype.keys ()
+
+ 1. Let M be the this value.
+ 2. Return CreateMapIterator(M, "key").
+
+ 23.1.5.1 CreateMapIterator Abstract Operation
+
+ ...
+ 2. If map does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [WeakMap]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.keys.call(new WeakMap());
+});
+
+assert.throws(TypeError, function() {
+ var m = new Map();
+ m.keys.call(new WeakMap());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/keys/does-not-have-mapdata-internal-slot.js b/js/src/tests/test262/built-ins/Map/prototype/keys/does-not-have-mapdata-internal-slot.js
new file mode 100644
index 0000000000..af2864b3cd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/keys/does-not-have-mapdata-internal-slot.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.8
+description: >
+ Throws a TypeError if `this` object does not have a [[MapData]] internal slot.
+info: |
+ Map.prototype.keys ()
+
+ 1. Let M be the this value.
+ 2. Return CreateMapIterator(M, "key").
+
+ 23.1.5.1 CreateMapIterator Abstract Operation
+
+ ...
+ 2. If map does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+
+---*/
+
+var m = new Map();
+
+assert.throws(TypeError, function() {
+ Map.prototype.keys.call([]);
+});
+
+assert.throws(TypeError, function() {
+ m.keys.call([]);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.keys.call({});
+});
+
+assert.throws(TypeError, function() {
+ m.keys.call({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/keys/keys.js b/js/src/tests/test262/built-ins/Map/prototype/keys/keys.js
new file mode 100644
index 0000000000..1c9b01aca8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/keys/keys.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.8
+description: >
+ Property type and descriptor.
+info: |
+ Map.prototype.keys ()
+
+ 17 ECMAScript Standard Built-in Objects
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof Map.prototype.keys,
+ 'function',
+ '`typeof Map.prototype.keys` is `function`'
+);
+
+verifyNotEnumerable(Map.prototype, 'keys');
+verifyWritable(Map.prototype, 'keys');
+verifyConfigurable(Map.prototype, 'keys');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/keys/length.js b/js/src/tests/test262/built-ins/Map/prototype/keys/length.js
new file mode 100644
index 0000000000..2821d98197
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/keys/length.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.8
+description: >
+ Map.prototype.keys.length value and descriptor.
+info: |
+ Map.prototype.keys ()
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.keys.length, 0,
+ 'The value of `Map.prototype.keys.length` is `0`'
+);
+
+verifyNotEnumerable(Map.prototype.keys, 'length');
+verifyNotWritable(Map.prototype.keys, 'length');
+verifyConfigurable(Map.prototype.keys, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/keys/name.js b/js/src/tests/test262/built-ins/Map/prototype/keys/name.js
new file mode 100644
index 0000000000..95c8920db7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/keys/name.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.8
+description: >
+ Map.prototype.keys.name value and descriptor.
+info: |
+ Map.prototype.keys ()
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.keys.name, 'keys',
+ 'The value of `Map.prototype.keys.name` is `"keys"`'
+);
+
+verifyNotEnumerable(Map.prototype.keys, 'name');
+verifyNotWritable(Map.prototype.keys, 'name');
+verifyConfigurable(Map.prototype.keys, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/keys/not-a-constructor.js b/js/src/tests/test262/built-ins/Map/prototype/keys/not-a-constructor.js
new file mode 100644
index 0000000000..be9835b84e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/keys/not-a-constructor.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Map.prototype.keys does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, Map, arrow-function]
+---*/
+
+assert.sameValue(isConstructor(Map.prototype.keys), false, 'isConstructor(Map.prototype.keys) must return false');
+
+assert.throws(TypeError, () => {
+ let m = new Map(); new m.keys();
+}, '`let m = new Map(); new m.keys()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/keys/returns-iterator-empty.js b/js/src/tests/test262/built-ins/Map/prototype/keys/returns-iterator-empty.js
new file mode 100644
index 0000000000..7791949cc0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/keys/returns-iterator-empty.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.8
+description: >
+ Returns an iterator on an empty Map object.
+info: |
+ Map.prototype.keys ()
+
+ ...
+ 2. Return CreateMapIterator(M, "key").
+
+ 23.1.5.1 CreateMapIterator Abstract Operation
+
+ ...
+ 7. Return iterator.
+---*/
+
+var map = new Map();
+var iterator = map.keys();
+var result = iterator.next();
+
+assert.sameValue(
+ result.value, undefined,
+ 'The value of `result.value` is `undefined`'
+);
+assert.sameValue(result.done, true, 'The value of `result.done` is `true`');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/keys/returns-iterator.js b/js/src/tests/test262/built-ins/Map/prototype/keys/returns-iterator.js
new file mode 100644
index 0000000000..6a4f0925ef
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/keys/returns-iterator.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.8
+description: >
+ Returns an iterator.
+info: |
+ Map.prototype.keys ( )
+
+ ...
+ 2. Return CreateMapIterator(M, "key").
+
+ 23.1.5.1 CreateMapIterator Abstract Operation
+
+ ...
+ 7. Return iterator.
+---*/
+
+var obj = {};
+var map = new Map();
+map.set('foo', 1);
+map.set(obj, 2);
+map.set(map, 3);
+
+var iterator = map.keys();
+var result;
+
+result = iterator.next();
+assert.sameValue(result.value, 'foo', 'First result `value` ("key")');
+assert.sameValue(result.done, false, 'First result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value, obj, 'Second result `value` ("key")');
+assert.sameValue(result.done, false, 'Second result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value, map, 'Third result `value` ("key")');
+assert.sameValue(result.done, false, 'Third result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value, undefined, 'Exhausted result `value`');
+assert.sameValue(result.done, true, 'Exhausted result `done` flag');
+
+result = iterator.next();
+assert.sameValue(
+ result.value, undefined, 'Exhausted result `value` (repeated request)'
+);
+assert.sameValue(
+ result.done, true, 'Exhausted result `done` flag (repeated request)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/keys/shell.js b/js/src/tests/test262/built-ins/Map/prototype/keys/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/keys/shell.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/keys/this-not-object-throw.js b/js/src/tests/test262/built-ins/Map/prototype/keys/this-not-object-throw.js
new file mode 100644
index 0000000000..cdea87a663
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/keys/this-not-object-throw.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.8
+description: >
+ Throws a TypeError if `this` is not an Object.
+info: |
+ Map.prototype.keys ()
+
+ ...
+ 2. Return CreateMapIterator(M, "key").
+
+ 23.1.5.1 CreateMapIterator Abstract Operation
+
+ 1. If Type(map) is not Object, throw a TypeError exception.
+ ...
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.keys.call(false);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.keys.call(1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.keys.call('');
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.keys.call(undefined);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.keys.call(null);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.keys.call(Symbol());
+});
+
+assert.throws(TypeError, function() {
+ var map = new Map();
+ map.keys.call(false);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/set/append-new-values-normalizes-zero-key.js b/js/src/tests/test262/built-ins/Map/prototype/set/append-new-values-normalizes-zero-key.js
new file mode 100644
index 0000000000..9a5401a41f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/set/append-new-values-normalizes-zero-key.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.9
+description: >
+ Appends new value in the map normalizing +0 and -0.
+info: |
+ Map.prototype.set ( key , value )
+
+ ...
+ 6. If key is −0, let key be +0.
+ 7. Let p be the Record {[[key]]: key, [[value]]: value}.
+ 8. Append p as the last element of entries.
+ 9. Return M.
+ ...
+---*/
+
+var map = new Map();
+map.set(-0, 42);
+
+assert.sameValue(map.get(0), 42);
+
+map = new Map();
+map.set(+0, 43);
+assert.sameValue(map.get(0), 43);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/set/append-new-values-return-map.js b/js/src/tests/test262/built-ins/Map/prototype/set/append-new-values-return-map.js
new file mode 100644
index 0000000000..61b2768adf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/set/append-new-values-return-map.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.9
+description: >
+ Map.prototype.set returns the given `this` object.
+info: |
+ Map.prototype.set ( key , value )
+
+ ...
+ 6. If key is −0, let key be +0.
+ 7. Let p be the Record {[[key]]: key, [[value]]: value}.
+ 8. Append p as the last element of entries.
+ 9. Return M.
+ ...
+---*/
+
+var map = new Map();
+var result = map.set(1, 1);
+
+assert.sameValue(result, map);
+
+result = map.set(1,1).set(2,2).set(3,3);
+
+assert.sameValue(result, map, 'Map.prototype.set is chainable');
+
+var map2 = new Map();
+result = map2.set.call(map, 4, 4);
+
+assert.sameValue(result, map);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/set/append-new-values.js b/js/src/tests/test262/built-ins/Map/prototype/set/append-new-values.js
new file mode 100644
index 0000000000..6ee18502f2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/set/append-new-values.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.9
+description: >
+ Append a new value as the last element of entries.
+info: |
+ Map.prototype.set ( key , value )
+
+ ...
+ 6. If key is −0, let key be +0.
+ 7. Let p be the Record {[[key]]: key, [[value]]: value}.
+ 8. Append p as the last element of entries.
+ 9. Return M.
+ ...
+features: [Symbol]
+---*/
+
+var s = Symbol(2);
+var map = new Map([[4, 4], ['foo3', 3], [s, 2]]);
+
+map.set(null, 42);
+map.set(1, 'valid');
+
+assert.sameValue(map.size, 5);
+assert.sameValue(map.get(1), 'valid');
+
+var results = [];
+
+map.forEach(function(value, key) {
+ results.push({
+ value: value,
+ key: key
+ });
+});
+
+var result = results.pop();
+assert.sameValue(result.value, 'valid');
+assert.sameValue(result.key, 1);
+
+result = results.pop();
+assert.sameValue(result.value, 42);
+assert.sameValue(result.key, null);
+
+result = results.pop();
+assert.sameValue(result.value, 2);
+assert.sameValue(result.key, s);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/set/browser.js b/js/src/tests/test262/built-ins/Map/prototype/set/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/set/browser.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/set/does-not-have-mapdata-internal-slot-set.js b/js/src/tests/test262/built-ins/Map/prototype/set/does-not-have-mapdata-internal-slot-set.js
new file mode 100644
index 0000000000..56776de5ec
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/set/does-not-have-mapdata-internal-slot-set.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.9
+description: >
+ Throws a TypeError if `this` is a Set object.
+info: |
+ Map.prototype.set ( key , value )
+
+ ...
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Set]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.set.call(new Set(), 1, 1);
+});
+
+assert.throws(TypeError, function() {
+ var m = new Map();
+ m.set.call(new Set(), 1, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/set/does-not-have-mapdata-internal-slot-weakmap.js b/js/src/tests/test262/built-ins/Map/prototype/set/does-not-have-mapdata-internal-slot-weakmap.js
new file mode 100644
index 0000000000..c3050b5e3e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/set/does-not-have-mapdata-internal-slot-weakmap.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.9
+description: >
+ Throws a TypeError if `this` is a WeakMap object.
+info: |
+ Map.prototype.set ( key , value )
+
+ ...
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [WeakMap]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.set.call(new WeakMap(), 1, 1);
+});
+
+assert.throws(TypeError, function() {
+ var m = new Map();
+ m.set.call(new WeakMap(), 1, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/set/does-not-have-mapdata-internal-slot.js b/js/src/tests/test262/built-ins/Map/prototype/set/does-not-have-mapdata-internal-slot.js
new file mode 100644
index 0000000000..5934f5acc7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/set/does-not-have-mapdata-internal-slot.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.9
+description: >
+ Throws a TypeError if `this` object does not have a [[MapData]] internal slot.
+info: |
+ Map.prototype.set ( key , value )
+
+ ...
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+var m = new Map();
+
+assert.throws(TypeError, function() {
+ Map.prototype.set.call([], 1, 1);
+});
+
+assert.throws(TypeError, function() {
+ m.set.call([], 1, 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.set.call({}, 1, 1);
+});
+
+assert.throws(TypeError, function() {
+ m.set.call({}, 1, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/set/length.js b/js/src/tests/test262/built-ins/Map/prototype/set/length.js
new file mode 100644
index 0000000000..573208670a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/set/length.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.9
+description: >
+ Map.prototype.set.length value and descriptor.
+info: |
+ Map.prototype.set ( key , value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.set.length, 2,
+ 'The value of `Map.prototype.set.length` is `2`'
+);
+
+verifyNotEnumerable(Map.prototype.set, 'length');
+verifyNotWritable(Map.prototype.set, 'length');
+verifyConfigurable(Map.prototype.set, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/set/name.js b/js/src/tests/test262/built-ins/Map/prototype/set/name.js
new file mode 100644
index 0000000000..8f41b1adda
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/set/name.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.9
+description: >
+ Map.prototype.set.name value and descriptor.
+info: |
+ Map.prototype.set ( key , value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.set.name, 'set',
+ 'The value of `Map.prototype.set.name` is `"set"`'
+);
+
+verifyNotEnumerable(Map.prototype.set, 'name');
+verifyNotWritable(Map.prototype.set, 'name');
+verifyConfigurable(Map.prototype.set, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/set/not-a-constructor.js b/js/src/tests/test262/built-ins/Map/prototype/set/not-a-constructor.js
new file mode 100644
index 0000000000..2880254c25
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/set/not-a-constructor.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Map.prototype.set does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, Map, arrow-function]
+---*/
+
+assert.sameValue(isConstructor(Map.prototype.set), false, 'isConstructor(Map.prototype.set) must return false');
+
+assert.throws(TypeError, () => {
+ let m = new Map(); new m.set();
+}, '`let m = new Map(); new m.set()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/set/replaces-a-value-normalizes-zero-key.js b/js/src/tests/test262/built-ins/Map/prototype/set/replaces-a-value-normalizes-zero-key.js
new file mode 100644
index 0000000000..675193a542
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/set/replaces-a-value-normalizes-zero-key.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.9
+description: >
+ Replaces a value in the map normalizing +0 and -0.
+info: |
+ Map.prototype.set ( key , value )
+
+ ...
+ 5. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ a. If p.[[key]] is not empty and SameValueZero(p.[[key]], key) is true, then
+ i. Set p.[[value]] to value.
+ ii. Return M.
+ ...
+---*/
+
+var map = new Map([[+0, 1]]);
+
+map.set(-0, 42);
+assert.sameValue(map.get(+0), 42, 'zero key is normalized in SameValueZero');
+
+map = new Map([[-0, 1]]);
+map.set(+0, 42);
+assert.sameValue(map.get(-0), 42, 'zero key is normalized in SameValueZero');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/set/replaces-a-value-returns-map.js b/js/src/tests/test262/built-ins/Map/prototype/set/replaces-a-value-returns-map.js
new file mode 100644
index 0000000000..7619f75627
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/set/replaces-a-value-returns-map.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.9
+description: >
+ Map.prototype.set returns the given `this` map object.
+info: |
+ Map.prototype.set ( key , value )
+
+ 1. Let M be the this value.
+ ...
+ 5. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ a. If p.[[key]] is not empty and SameValueZero(p.[[key]], key) is true, then
+ i. Set p.[[value]] to value.
+ ii. Return M.
+ ...
+---*/
+
+var map = new Map([['item', 0]]);
+var map2 = new Map();
+
+var x = map.set('item', 42);
+assert.sameValue(x, map);
+
+x = Map.prototype.set.call(map, 'item', 0);
+assert.sameValue(x, map);
+
+x = map2.set.call(map, 'item', 0);
+assert.sameValue(x, map, 'Map#set returns the map `this` value');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/set/replaces-a-value.js b/js/src/tests/test262/built-ins/Map/prototype/set/replaces-a-value.js
new file mode 100644
index 0000000000..4fa2a58fa3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/set/replaces-a-value.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.9
+description: >
+ Replaces a value in the map.
+info: |
+ Map.prototype.set ( key , value )
+
+ ...
+ 5. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ a. If p.[[key]] is not empty and SameValueZero(p.[[key]], key) is true, then
+ i. Set p.[[value]] to value.
+ ii. Return M.
+ ...
+---*/
+
+var m = new Map([['item', 1]]);
+
+m.set('item', 42);
+assert.sameValue(m.get('item'), 42);
+assert.sameValue(m.size, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/set/set.js b/js/src/tests/test262/built-ins/Map/prototype/set/set.js
new file mode 100644
index 0000000000..d38341daa0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/set/set.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.9
+description: >
+ Property type and descriptor.
+info: |
+ Map.prototype.set ( key , value )
+
+ 17 ECMAScript Standard Built-in Objects
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof Map.prototype.set,
+ 'function',
+ '`typeof Map.prototype.set` is `function`'
+);
+
+verifyNotEnumerable(Map.prototype, 'set');
+verifyWritable(Map.prototype, 'set');
+verifyConfigurable(Map.prototype, 'set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/set/shell.js b/js/src/tests/test262/built-ins/Map/prototype/set/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/set/shell.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/set/this-not-object-throw.js b/js/src/tests/test262/built-ins/Map/prototype/set/this-not-object-throw.js
new file mode 100644
index 0000000000..c75043c115
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/set/this-not-object-throw.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.9
+description: >
+ Throws a TypeError if `this` is not an Object.
+info: |
+ Map.prototype.set ( key , value )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+ ...
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.set.call(false, 1, 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.set.call(1, 1, 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.set.call('', 1, 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.set.call(undefined, 1, 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.set.call(null, 1, 1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.set.call(Symbol(), 1, 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new Map();
+ map.set.call(false, 1, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/shell.js b/js/src/tests/test262/built-ins/Map/prototype/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/shell.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/size/browser.js b/js/src/tests/test262/built-ins/Map/prototype/size/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/size/browser.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/size/does-not-have-mapdata-internal-slot-set.js b/js/src/tests/test262/built-ins/Map/prototype/size/does-not-have-mapdata-internal-slot-set.js
new file mode 100644
index 0000000000..44a432c7e6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/size/does-not-have-mapdata-internal-slot-set.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.10
+description: >
+ Throws a TypeError if `this` is a Set object.
+info: |
+ Map.prototype.set ( key , value )
+
+ ...
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Set]
+---*/
+
+var descriptor = Object.getOwnPropertyDescriptor(Map.prototype, 'size');
+
+var map = new Map();
+
+// Does not throw
+descriptor.get.call(map);
+
+assert.throws(TypeError, function() {
+ descriptor.get.call(new Set());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/size/does-not-have-mapdata-internal-slot-weakmap.js b/js/src/tests/test262/built-ins/Map/prototype/size/does-not-have-mapdata-internal-slot-weakmap.js
new file mode 100644
index 0000000000..da31eea7e6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/size/does-not-have-mapdata-internal-slot-weakmap.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.9
+description: >
+ Throws a TypeError if `this` is a WeakMap object.
+info: |
+ get Map.prototype.size
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [WeakMap]
+---*/
+
+var descriptor = Object.getOwnPropertyDescriptor(Map.prototype, 'size');
+
+var map = new Map();
+
+// Does not throw
+descriptor.get.call(map);
+
+assert.throws(TypeError, function() {
+ descriptor.get.call(new WeakMap());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/size/does-not-have-mapdata-internal-slot.js b/js/src/tests/test262/built-ins/Map/prototype/size/does-not-have-mapdata-internal-slot.js
new file mode 100644
index 0000000000..7cac8871ee
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/size/does-not-have-mapdata-internal-slot.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.9
+description: >
+ Throws a TypeError if `this` object does not have a [[MapData]] internal slot.
+info: |
+ get Map.prototype.size
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+var descriptor = Object.getOwnPropertyDescriptor(Map.prototype, 'size');
+
+var map = new Map();
+
+// Does not throw
+descriptor.get.call(map);
+
+assert.throws(TypeError, function() {
+ descriptor.get.call([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/size/length.js b/js/src/tests/test262/built-ins/Map/prototype/size/length.js
new file mode 100644
index 0000000000..ed357b3cc2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/size/length.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.10
+description: >
+ Map.prototype.size.length value and descriptor.
+info: |
+ get Map.prototype.size
+
+ 17 ECMAScript Standard Built-in Objects
+includes: [propertyHelper.js]
+---*/
+
+var descriptor = Object.getOwnPropertyDescriptor(Map.prototype, 'size');
+
+assert.sameValue(
+ descriptor.get.length, 0,
+ 'The value of `Map.prototype.size.length` is `0`'
+);
+
+verifyNotEnumerable(descriptor.get, 'length');
+verifyNotWritable(descriptor.get, 'length');
+verifyConfigurable(descriptor.get, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/size/name.js b/js/src/tests/test262/built-ins/Map/prototype/size/name.js
new file mode 100644
index 0000000000..4c60a96510
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/size/name.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.10
+description: >
+ Map.prototype.size.name value and descriptor.
+info: |
+ get Map.prototype.size
+
+ 17 ECMAScript Standard Built-in Objects
+
+ Functions that are specified as get or set accessor functions of built-in
+ properties have "get " or "set " prepended to the property name string.
+
+includes: [propertyHelper.js]
+---*/
+
+var descriptor = Object.getOwnPropertyDescriptor(Map.prototype, 'size');
+
+assert.sameValue(descriptor.get.name,
+ 'get size',
+ 'The value of `descriptor.get.name` is `get size`'
+);
+
+verifyNotEnumerable(descriptor.get, 'name');
+verifyNotWritable(descriptor.get, 'name');
+verifyConfigurable(descriptor.get, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/size/returns-count-of-present-values-before-after-set-clear.js b/js/src/tests/test262/built-ins/Map/prototype/size/returns-count-of-present-values-before-after-set-clear.js
new file mode 100644
index 0000000000..8d22fb0bde
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/size/returns-count-of-present-values-before-after-set-clear.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.10
+description: >
+ Returns count of present values before and after using `set` and `clear`.
+info: |
+ get Map.prototype.size
+
+ 5. Let count be 0.
+ 6. For each Record {[[key]], [[value]]} p that is an element of entries
+ a. If p.[[key]] is not empty, set count to count+1.
+---*/
+
+var map = new Map();
+
+assert.sameValue(map.size, 0, 'The value of `map.size` is `0`');
+
+map.set(1, 1);
+map.set(2, 2);
+assert.sameValue(
+ map.size, 2,
+ 'The value of `map.size` is `2`'
+);
+
+map.clear();
+assert.sameValue(
+ map.size, 0,
+ 'The value of `map.size` is `0`, after executing `map.clear()`'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/size/returns-count-of-present-values-before-after-set-delete.js b/js/src/tests/test262/built-ins/Map/prototype/size/returns-count-of-present-values-before-after-set-delete.js
new file mode 100644
index 0000000000..d0934a8149
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/size/returns-count-of-present-values-before-after-set-delete.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.10
+description: >
+ Returns count of present values before and after using `set` and `delete`.
+info: |
+ get Map.prototype.size
+
+ 5. Let count be 0.
+ 6. For each Record {[[key]], [[value]]} p that is an element of entries
+ a. If p.[[key]] is not empty, set count to count+1.
+---*/
+
+var map = new Map();
+
+assert.sameValue(map.size, 0, 'The value of `map.size` is `0`');
+
+map.set(1, 1);
+assert.sameValue(
+ map.size, 1,
+ 'The value of `map.size` is `1`, after executing `map.set(1, 1)`'
+);
+
+map.delete(1);
+assert.sameValue(
+ map.size, 0,
+ 'The value of `map.size` is `0`, after executing `map.delete(1)`'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/size/returns-count-of-present-values-by-insertion.js b/js/src/tests/test262/built-ins/Map/prototype/size/returns-count-of-present-values-by-insertion.js
new file mode 100644
index 0000000000..20cc59a7d0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/size/returns-count-of-present-values-by-insertion.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.10
+description: >
+ Returns count of present values inserted with set.
+info: |
+ get Map.prototype.size
+
+ 5. Let count be 0.
+ 6. For each Record {[[key]], [[value]]} p that is an element of entries
+ a. If p.[[key]] is not empty, set count to count+1.
+features: [Symbol]
+---*/
+
+var map = new Map();
+
+map.set(0, undefined);
+map.set(undefined, undefined);
+map.set(false, undefined);
+map.set(NaN, undefined);
+map.set(null, undefined);
+map.set('', undefined);
+map.set(Symbol(), undefined);
+
+assert.sameValue(map.size, 7, 'The value of `map.size` is `7`');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/size/returns-count-of-present-values-by-iterable.js b/js/src/tests/test262/built-ins/Map/prototype/size/returns-count-of-present-values-by-iterable.js
new file mode 100644
index 0000000000..200d42926a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/size/returns-count-of-present-values-by-iterable.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.10
+description: >
+ Returns count of present values inserted via iterable argument.
+info: |
+ get Map.prototype.size
+
+ 5. Let count be 0.
+ 6. For each Record {[[key]], [[value]]} p that is an element of entries
+ a. If p.[[key]] is not empty, set count to count+1.
+features: [Symbol]
+---*/
+
+var map = new Map([
+ [0, undefined],
+ [undefined, undefined],
+ [false, undefined],
+ [NaN, undefined],
+ [null, undefined],
+ ['', undefined],
+ [Symbol(), undefined],
+]);
+
+assert.sameValue(map.size, 7, 'The value of `map.size` is `7`');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/size/shell.js b/js/src/tests/test262/built-ins/Map/prototype/size/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/size/shell.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/size/size.js b/js/src/tests/test262/built-ins/Map/prototype/size/size.js
new file mode 100644
index 0000000000..8e3d9ec6e7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/size/size.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.10
+description: >
+ Property type and descriptor.
+info: |
+ get Map.prototype.size
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+var descriptor = Object.getOwnPropertyDescriptor(Map.prototype, 'size');
+
+assert.sameValue(
+ typeof descriptor.get,
+ 'function',
+ 'typeof descriptor.get is function'
+);
+assert.sameValue(
+ typeof descriptor.set,
+ 'undefined',
+ 'typeof descriptor.set is undefined'
+);
+
+verifyNotEnumerable(Map.prototype, 'size');
+verifyConfigurable(Map.prototype, 'size');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/size/this-not-object-throw.js b/js/src/tests/test262/built-ins/Map/prototype/size/this-not-object-throw.js
new file mode 100644
index 0000000000..7df988ccbd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/size/this-not-object-throw.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.10
+description: >
+ Throws a TypeError if `this` is not an Object.
+info: |
+ get Map.prototype.size
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+ 3. If M does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+
+features: [Symbol]
+---*/
+
+var descriptor = Object.getOwnPropertyDescriptor(Map.prototype, 'size');
+
+assert.throws(TypeError, function() {
+ descriptor.get.call(1);
+});
+
+assert.throws(TypeError, function() {
+ descriptor.get.call(false);
+});
+
+assert.throws(TypeError, function() {
+ descriptor.get.call(1);
+});
+
+assert.throws(TypeError, function() {
+ descriptor.get.call('');
+});
+
+assert.throws(TypeError, function() {
+ descriptor.get.call(undefined);
+});
+
+assert.throws(TypeError, function() {
+ descriptor.get.call(null);
+});
+
+assert.throws(TypeError, function() {
+ descriptor.get.call(Symbol());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/values/browser.js b/js/src/tests/test262/built-ins/Map/prototype/values/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/values/browser.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/values/does-not-have-mapdata-internal-slot-set.js b/js/src/tests/test262/built-ins/Map/prototype/values/does-not-have-mapdata-internal-slot-set.js
new file mode 100644
index 0000000000..e6bae49dc2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/values/does-not-have-mapdata-internal-slot-set.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.11
+description: >
+ Throws a TypeError if `this` is a Set object.
+info: |
+ Map.prototype.values ()
+
+ 1. Let M be the this value.
+ 2. Return CreateMapIterator(M, "value").
+
+ 23.1.5.1 CreateMapIterator Abstract Operation
+
+ ...
+ 2. If map does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Set]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.values.call(new Set());
+});
+
+assert.throws(TypeError, function() {
+ var m = new Map();
+ m.values.call(new Set());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/values/does-not-have-mapdata-internal-slot-weakmap.js b/js/src/tests/test262/built-ins/Map/prototype/values/does-not-have-mapdata-internal-slot-weakmap.js
new file mode 100644
index 0000000000..0a47c8df37
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/values/does-not-have-mapdata-internal-slot-weakmap.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.11
+description: >
+ Throws a TypeError if `this` is a WeakMap object.
+info: |
+ Map.prototype.values ()
+
+ 1. Let M be the this value.
+ 2. Return CreateMapIterator(M, "value").
+
+ 23.1.5.1 CreateMapIterator Abstract Operation
+
+ ...
+ 2. If map does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [WeakMap]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.values.call(new WeakMap());
+});
+
+assert.throws(TypeError, function() {
+ var m = new Map();
+ m.values.call(new WeakMap());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/values/does-not-have-mapdata-internal-slot.js b/js/src/tests/test262/built-ins/Map/prototype/values/does-not-have-mapdata-internal-slot.js
new file mode 100644
index 0000000000..06e0790ccd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/values/does-not-have-mapdata-internal-slot.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.11
+description: >
+ Throws a TypeError if `this` object does not have a [[MapData]] internal slot.
+info: |
+ Map.prototype.values ()
+
+ 1. Let M be the this value.
+ 2. Return CreateMapIterator(M, "value").
+
+ 23.1.5.1 CreateMapIterator Abstract Operation
+
+ ...
+ 2. If map does not have a [[MapData]] internal slot, throw a TypeError
+ exception.
+ ...
+
+---*/
+
+var m = new Map();
+
+assert.throws(TypeError, function() {
+ Map.prototype.values.call([]);
+});
+
+assert.throws(TypeError, function() {
+ m.values.call([]);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.values.call({});
+});
+
+assert.throws(TypeError, function() {
+ m.values.call({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/values/length.js b/js/src/tests/test262/built-ins/Map/prototype/values/length.js
new file mode 100644
index 0000000000..61aad13775
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/values/length.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.11
+description: >
+ Map.prototype.values.length value and descriptor.
+info: |
+ Map.prototype.values ()
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.values.length, 0,
+ 'The value of `Map.prototype.values.length` is `0`'
+);
+
+verifyNotEnumerable(Map.prototype.values, 'length');
+verifyNotWritable(Map.prototype.values, 'length');
+verifyConfigurable(Map.prototype.values, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/values/name.js b/js/src/tests/test262/built-ins/Map/prototype/values/name.js
new file mode 100644
index 0000000000..b003edde22
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/values/name.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.11
+description: >
+ Map.prototype.values.name value and descriptor.
+info: |
+ Map.prototype.values ()
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ Map.prototype.values.name, 'values',
+ 'The value of `Map.prototype.values.name` is `"values"`'
+);
+
+verifyNotEnumerable(Map.prototype.values, 'name');
+verifyNotWritable(Map.prototype.values, 'name');
+verifyConfigurable(Map.prototype.values, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/values/not-a-constructor.js b/js/src/tests/test262/built-ins/Map/prototype/values/not-a-constructor.js
new file mode 100644
index 0000000000..0fd6e656d2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/values/not-a-constructor.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Map.prototype.values does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, Map, arrow-function]
+---*/
+
+assert.sameValue(isConstructor(Map.prototype.values), false, 'isConstructor(Map.prototype.values) must return false');
+
+assert.throws(TypeError, () => {
+ let m = new Map(); new m.values();
+}, '`let m = new Map(); new m.values()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/values/returns-iterator-empty.js b/js/src/tests/test262/built-ins/Map/prototype/values/returns-iterator-empty.js
new file mode 100644
index 0000000000..4f90ebb162
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/values/returns-iterator-empty.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.11
+description: >
+ Returns an iterator on an empty Map object.
+info: |
+ Map.prototype.values ()
+
+ ...
+ 2. Return CreateMapIterator(M, "value").
+
+ 23.1.5.1 CreateMapIterator Abstract Operation
+
+ ...
+ 7. Return iterator.
+---*/
+
+var map = new Map();
+var iterator = map.values();
+var result = iterator.next();
+
+assert.sameValue(
+ result.value, undefined,
+ 'The value of `result.value` is `undefined`'
+);
+assert.sameValue(result.done, true, 'The value of `result.done` is `true`');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/values/returns-iterator.js b/js/src/tests/test262/built-ins/Map/prototype/values/returns-iterator.js
new file mode 100644
index 0000000000..3fa7e712d1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/values/returns-iterator.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.11
+description: >
+ Returns an iterator.
+info: |
+ Map.prototype.values ( )
+
+ ...
+ 2. Return CreateMapIterator(M, "value").
+
+ 23.1.5.1 CreateMapIterator Abstract Operation
+
+ ...
+ 7. Return iterator.
+---*/
+
+var obj = {};
+var map = new Map();
+map.set(1, 'foo');
+map.set(2, obj);
+map.set(3, map);
+
+var iterator = map.values();
+var result;
+
+result = iterator.next();
+assert.sameValue(result.value, 'foo', 'First result `value` ("value")');
+assert.sameValue(result.done, false, 'First result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value, obj, 'Second result `value` ("value")');
+assert.sameValue(result.done, false, 'Second result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value, map, 'Third result `value` ("value")');
+assert.sameValue(result.done, false, 'Third result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value, undefined, 'Exhausted result `value`');
+assert.sameValue(result.done, true, 'Exhausted result `done` flag');
+
+result = iterator.next();
+assert.sameValue(
+ result.value, undefined, 'Exhausted result `value` (repeated request)'
+);
+assert.sameValue(
+ result.done, true, 'Exhausted result `done` flag (repeated request)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/values/shell.js b/js/src/tests/test262/built-ins/Map/prototype/values/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/values/shell.js
diff --git a/js/src/tests/test262/built-ins/Map/prototype/values/this-not-object-throw.js b/js/src/tests/test262/built-ins/Map/prototype/values/this-not-object-throw.js
new file mode 100644
index 0000000000..59a5580fd4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/values/this-not-object-throw.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.11
+description: >
+ Throws a TypeError if `this` is not an Object.
+info: |
+ Map.prototype.values ()
+
+ ...
+ 2. Return CreateMapIterator(M, "values").
+
+ 23.1.5.1 CreateMapIterator Abstract Operation
+
+ 1. If Type(map) is not Object, throw a TypeError exception.
+ ...
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ Map.prototype.values.call(false);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.values.call(1);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.values.call('');
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.values.call(undefined);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.values.call(null);
+});
+
+assert.throws(TypeError, function() {
+ Map.prototype.values.call(Symbol());
+});
+
+assert.throws(TypeError, function() {
+ var map = new Map();
+ map.values.call(false);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/prototype/values/values.js b/js/src/tests/test262/built-ins/Map/prototype/values/values.js
new file mode 100644
index 0000000000..5504c7a23d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/prototype/values/values.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.11
+description: >
+ Property type and descriptor.
+info: |
+ Map.prototype.values ()
+
+ 17 ECMAScript Standard Built-in Objects
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof Map.prototype.values,
+ 'function',
+ '`typeof Map.prototype.values` is `function`'
+);
+
+verifyNotEnumerable(Map.prototype, 'values');
+verifyWritable(Map.prototype, 'values');
+verifyConfigurable(Map.prototype, 'values');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/shell.js b/js/src/tests/test262/built-ins/Map/shell.js
new file mode 100644
index 0000000000..54371b7789
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/shell.js
@@ -0,0 +1,19 @@
+// GENERATED, DO NOT EDIT
+// file: isConstructor.js
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: |
+ Test if a given function is a constructor function.
+defines: [isConstructor]
+---*/
+
+function isConstructor(f) {
+ try {
+ Reflect.construct(function(){}, [], f);
+ } catch (e) {
+ return false;
+ }
+ return true;
+}
diff --git a/js/src/tests/test262/built-ins/Map/symbol-as-entry-key.js b/js/src/tests/test262/built-ins/Map/symbol-as-entry-key.js
new file mode 100644
index 0000000000..3bb5d3dc1b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/symbol-as-entry-key.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.4
+description: >
+ Symbol as Map key
+features: [Symbol]
+---*/
+var map = new Map();
+var sym = Symbol();
+
+map.set(sym, 1);
+
+assert.sameValue(map.size, 1, "The value of `map.size` is `1`, after executing `map.set(sym, 1)`");
+assert.sameValue(map.has(sym), true, "`map.has(sym)` returns `true`");
+assert.sameValue(map.get(sym), 1, "`map.get(sym)` returns `1`");
+assert.sameValue(map.delete(sym), true, "`map.delete(sym)` returns `true`");
+assert.sameValue(map.size, 0, "The value of `map.size` is `0`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Map/undefined-newtarget.js b/js/src/tests/test262/built-ins/Map/undefined-newtarget.js
new file mode 100644
index 0000000000..31e4067208
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/undefined-newtarget.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1.1
+description: >
+ Throws a TypeError if Map is called without a newTarget.
+info: |
+ Map ( [ iterable ] )
+
+ When the Map function is called with optional argument the following steps
+ are taken:
+
+ 1. If NewTarget is undefined, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Map();
+});
+
+assert.throws(TypeError, function() {
+ Map([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/MapIteratorPrototype/Symbol.toStringTag.js b/js/src/tests/test262/built-ins/MapIteratorPrototype/Symbol.toStringTag.js
new file mode 100644
index 0000000000..d7487e38cf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/MapIteratorPrototype/Symbol.toStringTag.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.5.2.2
+description: >
+ `Symbol.toStringTag` property descriptor
+info: |
+ The initial value of the @@toStringTag property is the String value
+ "Map Iterator".
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]:
+ false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [Symbol.iterator, Symbol.toStringTag]
+---*/
+
+var MapIteratorProto = Object.getPrototypeOf(new Map()[Symbol.iterator]());
+
+assert.sameValue('Map Iterator', MapIteratorProto[Symbol.toStringTag]);
+
+verifyNotEnumerable(MapIteratorProto, Symbol.toStringTag);
+verifyNotWritable(MapIteratorProto, Symbol.toStringTag);
+verifyConfigurable(MapIteratorProto, Symbol.toStringTag);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/MapIteratorPrototype/browser.js b/js/src/tests/test262/built-ins/MapIteratorPrototype/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/MapIteratorPrototype/browser.js
diff --git a/js/src/tests/test262/built-ins/MapIteratorPrototype/next/browser.js b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/browser.js
diff --git a/js/src/tests/test262/built-ins/MapIteratorPrototype/next/does-not-have-mapiterator-internal-slots-map.js b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/does-not-have-mapiterator-internal-slots-map.js
new file mode 100644
index 0000000000..73aafb2b94
--- /dev/null
+++ b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/does-not-have-mapiterator-internal-slots-map.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.5.2.1
+description: >
+ Throws a TypeError if `this` does not have all of the internal slots of a Map
+ Iterator Instance.
+info: |
+ %MapIteratorPrototype%.next ( )
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ 3. If O does not have all of the internal slots of a Map Iterator Instance
+ (23.1.5.3), throw a TypeError exception.
+ ...
+features: [Symbol.iterator]
+---*/
+
+var map = new Map([[1, 11], [2, 22]]);
+
+var iterator = map[Symbol.iterator]();
+assert.throws(TypeError, function() {
+ iterator.next.call(map);
+});
+
+iterator = map.entries();
+assert.throws(TypeError, function() {
+ iterator.next.call(map);
+});
+
+iterator = map.keys();
+assert.throws(TypeError, function() {
+ iterator.next.call(map);
+});
+
+iterator = map.values();
+assert.throws(TypeError, function() {
+ iterator.next.call(map);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/MapIteratorPrototype/next/does-not-have-mapiterator-internal-slots.js b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/does-not-have-mapiterator-internal-slots.js
new file mode 100644
index 0000000000..9e89de3e35
--- /dev/null
+++ b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/does-not-have-mapiterator-internal-slots.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.5.2.1
+description: >
+ Throws a TypeError if `this` does not have all of the internal slots of a Map
+ Iterator Instance.
+info: |
+ %MapIteratorPrototype%.next ( )
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ 3. If O does not have all of the internal slots of a Map Iterator Instance
+ (23.1.5.3), throw a TypeError exception.
+ ...
+features: [Symbol.iterator]
+---*/
+
+var map = new Map([[1, 11], [2, 22]]);
+
+var iterator = map[Symbol.iterator]();
+assert.throws(TypeError, function() {
+ iterator.next.call({});
+});
+
+iterator = map.entries();
+assert.throws(TypeError, function() {
+ iterator.next.call({});
+});
+
+iterator = map.keys();
+assert.throws(TypeError, function() {
+ iterator.next.call({});
+});
+
+iterator = map.values();
+assert.throws(TypeError, function() {
+ iterator.next.call({});
+});
+
+// does not throw an Error
+iterator.next.call(map[Symbol.iterator]());
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/MapIteratorPrototype/next/iteration-mutable.js b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/iteration-mutable.js
new file mode 100644
index 0000000000..bbb332bdd2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/iteration-mutable.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.12
+description: >
+ When an item is added to the map after the iterator is created but before
+ the iterator is "done" (as defined by 23.1.5.2.1), the new item should be
+ accessible via iteration. When an item is added to the map after the
+ iterator is "done", the new item should not be accessible via iteration.
+features: [Symbol.iterator]
+---*/
+
+var map = new Map();
+map.set(1, 11);
+map.set(2, 22);
+
+var iterator = map[Symbol.iterator]();
+var result;
+
+result = iterator.next();
+assert.sameValue(result.value[0], 1, 'First result `value` (map key)');
+assert.sameValue(result.value[1], 11, 'First result `value` (map value)');
+assert.sameValue(result.value.length, 2, 'First result `value` (length)');
+assert.sameValue(result.done, false, 'First result `done` flag');
+
+map.set(3, 33);
+
+result = iterator.next();
+assert.sameValue(result.value[0], 2, 'Second result `value` (map key)');
+assert.sameValue(result.value[1], 22, 'Second result `value` (map value)');
+assert.sameValue(result.value.length, 2, 'Second result `value` (length)');
+assert.sameValue(result.done, false, 'Second result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value[0], 3, 'Third result `value` (map key)');
+assert.sameValue(result.value[1], 33, 'Third result `value` (map value)');
+assert.sameValue(result.value.length, 2, 'Third result `value` (length)');
+assert.sameValue(result.done, false, 'Third result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value, undefined, 'Exhausted result `value`');
+assert.sameValue(result.done, true, 'Exhausted result `done` flag');
+
+map.set(4, 44);
+
+result = iterator.next();
+assert.sameValue(
+ result.value, undefined, 'Exhausted result `value` (repeated request)'
+);
+assert.sameValue(
+ result.done, true, 'Exhausted result `done` flag (repeated request)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/MapIteratorPrototype/next/iteration.js b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/iteration.js
new file mode 100644
index 0000000000..fcd223704e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/iteration.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.3.12
+description: >
+ The method should return a valid iterator with the context as the
+ IteratedObject.
+features: [Symbol.iterator]
+---*/
+
+var map = new Map();
+map.set(1, 11);
+map.set(2, 22);
+map.set(3, 33);
+
+var iterator = map[Symbol.iterator]();
+var result;
+
+result = iterator.next();
+assert.sameValue(result.value[0], 1, 'First result `value` (map key)');
+assert.sameValue(result.value[1], 11, 'First result `value` (map value)');
+assert.sameValue(result.value.length, 2, 'First result `value` (length)');
+assert.sameValue(result.done, false, 'First result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value[0], 2, 'Second result `value` (map key)');
+assert.sameValue(result.value[1], 22, 'Second result `value` (map value)');
+assert.sameValue(result.value.length, 2, 'Second result `value` (length)');
+assert.sameValue(result.done, false, 'Second result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value[0], 3, 'Third result `value` (map key)');
+assert.sameValue(result.value[1], 33, 'Third result `value` (map value)');
+assert.sameValue(result.value.length, 2, 'Third result `value` (length)');
+assert.sameValue(result.done, false, 'Third result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value, undefined, 'Exhausted result `value`');
+assert.sameValue(result.done, true, 'Exhausted result `done` flag');
+
+result = iterator.next();
+assert.sameValue(
+ result.value, undefined, 'Exhausted result `value` (repeated request)'
+);
+assert.sameValue(
+ result.done, true, 'Exhausted result `done` flag (repeated request)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/MapIteratorPrototype/next/length.js b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/length.js
new file mode 100644
index 0000000000..7617371899
--- /dev/null
+++ b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/length.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 23.1.5.2.1
+description: >
+ %MapIteratorPrototype%.next.length is 0.
+info: |
+ %MapIteratorPrototype%.next ( )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+var MapIteratorProto = Object.getPrototypeOf(new Map().values());
+
+assert.sameValue(MapIteratorProto.next.length, 0);
+
+verifyNotEnumerable(MapIteratorProto.next, "length");
+verifyNotWritable(MapIteratorProto.next, "length");
+verifyConfigurable(MapIteratorProto.next, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/MapIteratorPrototype/next/name.js b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/name.js
new file mode 100644
index 0000000000..5666f8ecc8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/name.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 23.1.5.2.1
+description: >
+ %MapIteratorPrototype%.next.name is "next".
+info: |
+ %MapIteratorPrototype%.next ( )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+var MapIteratorProto = Object.getPrototypeOf(new Map().values());
+
+assert.sameValue(MapIteratorProto.next.name, "next");
+
+verifyNotEnumerable(MapIteratorProto.next, "name");
+verifyNotWritable(MapIteratorProto.next, "name");
+verifyConfigurable(MapIteratorProto.next, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/MapIteratorPrototype/next/shell.js b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/shell.js
diff --git a/js/src/tests/test262/built-ins/MapIteratorPrototype/next/this-not-object-throw-entries.js b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/this-not-object-throw-entries.js
new file mode 100644
index 0000000000..b87456f307
--- /dev/null
+++ b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/this-not-object-throw-entries.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.5.2.1
+description: >
+ Throws a TypeError if `this` value is not an Object.
+info: |
+ From Map.prototype.entries()
+
+ %MapIteratorPrototype%.next ( )
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ ...
+features:
+ - Symbol
+ - Symbol.iterator
+---*/
+
+var map = new Map([[1, 11], [2, 22]]);
+var iterator = map.entries();
+
+assert.throws(TypeError, function() {
+ iterator.next.call(false);
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call(1);
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call('');
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call(undefined);
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call(null);
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call(Symbol());
+});
+
+// does not throw an Error
+iterator.next.call(map[Symbol.iterator]());
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/MapIteratorPrototype/next/this-not-object-throw-keys.js b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/this-not-object-throw-keys.js
new file mode 100644
index 0000000000..d2bc4ab829
--- /dev/null
+++ b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/this-not-object-throw-keys.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.5.2.1
+description: >
+ Throws a TypeError if `this` value is not an Object.
+info: |
+ From Map.prototype.keys()
+
+ %MapIteratorPrototype%.next ( )
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ ...
+features:
+ - Symbol
+ - Symbol.iterator
+---*/
+
+var map = new Map([[1, 11], [2, 22]]);
+var iterator = map.keys();
+
+assert.throws(TypeError, function() {
+ iterator.next.call(false);
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call(1);
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call('');
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call(undefined);
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call(null);
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call(Symbol());
+});
+
+// does not throw an Error
+iterator.next.call(map[Symbol.iterator]());
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/MapIteratorPrototype/next/this-not-object-throw-prototype-iterator.js b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/this-not-object-throw-prototype-iterator.js
new file mode 100644
index 0000000000..d35932d014
--- /dev/null
+++ b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/this-not-object-throw-prototype-iterator.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.5.2.1
+description: >
+ Throws a TypeError if `this` value is not an Object.
+info: |
+ Using Map.prototype[Symbol.iterator]()
+
+ %MapIteratorPrototype%.next ( )
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ ...
+features:
+ - Symbol
+ - Symbol.iterator
+---*/
+
+var map = new Map([[1, 11], [2, 22]]);
+var iterator = map[Symbol.iterator]();
+
+assert.throws(TypeError, function() {
+ iterator.next.call(false);
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call(1);
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call('');
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call(undefined);
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call(null);
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call(Symbol());
+});
+
+// does not throw an Error
+iterator.next.call(map[Symbol.iterator]());
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/MapIteratorPrototype/next/this-not-object-throw-values.js b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/this-not-object-throw-values.js
new file mode 100644
index 0000000000..e976fc7a1b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/MapIteratorPrototype/next/this-not-object-throw-values.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.5.2.1
+description: >
+ Throws a TypeError if `this` value is not an Object.
+info: |
+ From Map.prototype.values()
+
+ %MapIteratorPrototype%.next ( )
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ ...
+features:
+ - Symbol
+ - Symbol.iterator
+---*/
+
+var map = new Map([[1, 11], [2, 22]]);
+var iterator = map.values();
+
+assert.throws(TypeError, function() {
+ iterator.next.call(false);
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call(1);
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call('');
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call(undefined);
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call(null);
+});
+
+assert.throws(TypeError, function() {
+ iterator.next.call(Symbol());
+});
+
+// does not throw an Error
+iterator.next.call(map[Symbol.iterator]());
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/MapIteratorPrototype/shell.js b/js/src/tests/test262/built-ins/MapIteratorPrototype/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/MapIteratorPrototype/shell.js