summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/WeakMap
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/tests/test262/built-ins/WeakMap
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/WeakMap')
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/constructor.js15
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/empty-iterable.js33
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/get-set-method-failure.js32
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/is-a-constructor.js26
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/iterable-failure.js21
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/iterable.js41
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/iterator-close-after-set-failure.js45
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/iterator-item-first-entry-returns-abrupt.js49
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/iterator-item-second-entry-returns-abrupt.js49
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/iterator-items-are-not-object-close-iterator.js77
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/iterator-items-are-not-object.js52
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/iterator-next-failure.js31
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/iterator-value-failure.js37
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/length.js16
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/name.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/no-iterable.js26
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/properties-of-map-instances.js16
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/properties-of-the-weakmap-prototype-object.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/proto-from-ctor-realm.js31
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype-of-weakmap.js16
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/Symbol.toStringTag.js23
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/constructor.js23
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry-initial-iterable.js33
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry.js33
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete.js25
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-array.js25
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-map.js26
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-object.js25
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-set.js26
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-weakmap-prototype.js25
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/length.js24
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/name.js24
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-value-is-not-object.js24
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-when-delete-is-noop.js23
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-boolean.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-null.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-number.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-string.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-symbol.js23
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-undefined.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/get/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot-map.js26
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot-set.js26
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot.js33
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/get/get.js24
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/get/length.js24
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/get/name.js24
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/get/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-undefined-key-is-not-object.js44
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-undefined.js39
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-value.js35
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/get/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/get/this-not-object-throw.js45
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-array.js25
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-map.js26
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-object.js25
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-set.js26
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-weakmap-prototype.js25
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/has.js25
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/length.js24
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/name.js24
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-value-is-not-object.js23
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-value-not-present.js27
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-true-when-value-present.js24
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-boolean.js23
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-null.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-number.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-string.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-symbol.js23
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-undefined.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/prototype-attributes.js14
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/adds-element.js29
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-array.js26
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-map.js26
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-object.js25
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-set.js26
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-weakmap-prototype.js25
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/key-not-object-throw.js39
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/length.js23
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/name.js23
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/returns-this-when-ignoring-duplicate.js26
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/returns-this.js19
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/set.js24
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-boolean.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-null.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-number.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-string.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-symbol.js23
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-undefined.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/set-not-callable-throws.js27
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/shell.js19
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/undefined-newtarget.js21
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/weakmap.js16
105 files changed, 2558 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/WeakMap/browser.js b/js/src/tests/test262/built-ins/WeakMap/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/browser.js
diff --git a/js/src/tests/test262/built-ins/WeakMap/constructor.js b/js/src/tests/test262/built-ins/WeakMap/constructor.js
new file mode 100644
index 0000000000..e7381ed004
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/constructor.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakmap-constructor
+description: >
+ The WeakMap constructor is the %WeakMap% intrinsic object and the initial
+ value of the WeakMap property of the global object.
+---*/
+
+assert.sameValue(
+ typeof WeakMap, 'function',
+ 'typeof WeakMap is "function"'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/empty-iterable.js b/js/src/tests/test262/built-ins/WeakMap/empty-iterable.js
new file mode 100644
index 0000000000..b3554b0aa5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/empty-iterable.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.
+/*---
+esid: sec-weakmap-iterable
+description: >
+ If the iterable argument is empty, return new WeakMap object.
+info: |
+ 23.3.1.1 WeakMap ( [ iterable ] )
+
+ ...
+ 9. Repeat
+ a. Let next be IteratorStep(iter).
+ b. ReturnIfAbrupt(next).
+ c. If next is false, return map.
+ ...
+---*/
+
+var counter = 0;
+var set = WeakMap.prototype.set;
+WeakMap.prototype.set = function(value) {
+ counter++;
+ return set.call(this, value);
+};
+var map = new WeakMap([]);
+
+assert.sameValue(Object.getPrototypeOf(map), WeakMap.prototype);
+assert(map instanceof WeakMap);
+assert.sameValue(
+ counter, 0,
+ 'empty iterable does not call WeakMap.prototype.set'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/get-set-method-failure.js b/js/src/tests/test262/built-ins/WeakMap/get-set-method-failure.js
new file mode 100644
index 0000000000..06ced26fae
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/get-set-method-failure.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.
+/*---
+esid: sec-weakmap-iterable
+description: >
+ Return abrupt after getting `set` method.
+info: |
+ 23.3.1.1 WeakMap ( [ iterable ] )
+
+ ...
+ 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).
+ ...
+---*/
+
+Object.defineProperty(WeakMap.prototype, 'set', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+new WeakMap();
+new WeakMap(null);
+
+assert.throws(Test262Error, function() {
+ new WeakMap([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/is-a-constructor.js b/js/src/tests/test262/built-ins/WeakMap/is-a-constructor.js
new file mode 100644
index 0000000000..8214f66f3f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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 WeakMap 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, WeakMap]
+---*/
+
+assert.sameValue(isConstructor(WeakMap), true, 'isConstructor(WeakMap) must return true');
+new WeakMap();
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/iterable-failure.js b/js/src/tests/test262/built-ins/WeakMap/iterable-failure.js
new file mode 100644
index 0000000000..28bf7c73e4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/iterable-failure.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakmap-iterable
+description: >
+ If the iterable argument is undefined, return new WeakMap object.
+info: |
+ 23.3.1.1 WeakMap ( [ iterable ] )
+
+ ...
+ 7. Else,
+ d. Let iter be GetIterator(iterable).
+ e. ReturnIfAbrupt(iter).
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ new WeakMap({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/iterable.js b/js/src/tests/test262/built-ins/WeakMap/iterable.js
new file mode 100644
index 0000000000..aee091e9b1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/iterable.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.
+/*---
+esid: sec-weakmap-iterable
+description: >
+ Returns the new WeakMap adding the objects from the iterable parameter.
+info: |
+ WeakMap ( [ 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).
+---*/
+
+var first = {};
+var second = {};
+var results = [];
+var set = WeakMap.prototype.set;
+WeakMap.prototype.set = function(key, value) {
+ results.push({
+ _this: this,
+ key: key,
+ value: value
+ });
+ return set.call(this, key, value);
+};
+var map = new WeakMap([
+ [first, 42],
+ [second, 43]
+]);
+
+assert.sameValue(results.length, 2, 'Called WeakMap#set for each object');
+assert.sameValue(results[0].key, first, 'Adds object in order - first key');
+assert.sameValue(results[0].value, 42, 'Adds object in order - first value');
+assert.sameValue(results[0]._this, map, 'Adds object in order - this');
+assert.sameValue(results[1].key, second, 'Adds object in order - second key');
+assert.sameValue(results[1].value, 43, 'Adds object in order - second value');
+assert.sameValue(results[1]._this, map, 'Adds object in order - this');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/iterator-close-after-set-failure.js b/js/src/tests/test262/built-ins/WeakMap/iterator-close-after-set-failure.js
new file mode 100644
index 0000000000..933794bc9a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/iterator-close-after-set-failure.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.
+/*---
+esid: sec-weakmap-iterable
+description: >
+ Return IteratorClose(iter, status) if fail on adding value on constructing.
+info: |
+ WeakMap ( [ 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;
+ }
+ };
+};
+WeakMap.prototype.set = function() {
+ throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+ new WeakMap(iterable);
+});
+
+assert.sameValue(
+ count, 1,
+ 'The iterator is closed when `WeakMap.prototype.set` throws an error.'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/iterator-item-first-entry-returns-abrupt.js b/js/src/tests/test262/built-ins/WeakMap/iterator-item-first-entry-returns-abrupt.js
new file mode 100644
index 0000000000..8fd9ca47cc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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.
+/*---
+esid: sec-weakmap-iterable
+description: >
+ Closes iterator if item first entry completes abruptly.
+info: |
+ WeakMap ( [ 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 WeakMap(iterable);
+});
+
+assert.sameValue(count, 1, 'The get error closed the iterator');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/iterator-item-second-entry-returns-abrupt.js b/js/src/tests/test262/built-ins/WeakMap/iterator-item-second-entry-returns-abrupt.js
new file mode 100644
index 0000000000..dbbb034139
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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.
+/*---
+esid: sec-weakmap-iterable
+description: >
+ Closes iterator if item second entry completes abruptly.
+info: |
+ WeakMap ( [ 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 WeakMap(iterable);
+});
+
+assert.sameValue(count, 1, 'The get error closed the iterator');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/iterator-items-are-not-object-close-iterator.js b/js/src/tests/test262/built-ins/WeakMap/iterator-items-are-not-object-close-iterator.js
new file mode 100644
index 0000000000..ef42eb0bed
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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.
+/*---
+esid: sec-weakmap-iterable
+description: >
+ Closes the iterator object after not object error on next item.
+info: |
+ WeakMap ( [ 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 WeakMap(iterable);
+});
+assert.sameValue(count, 1);
+
+nextItem = true;
+assert.throws(TypeError, function() {
+ new WeakMap(iterable);
+});
+assert.sameValue(count, 2);
+
+nextItem = '';
+assert.throws(TypeError, function() {
+ new WeakMap(iterable);
+});
+assert.sameValue(count, 3);
+
+nextItem = null;
+assert.throws(TypeError, function() {
+ new WeakMap(iterable);
+});
+assert.sameValue(count, 4);
+
+nextItem = undefined;
+assert.throws(TypeError, function() {
+ new WeakMap(iterable);
+});
+assert.sameValue(count, 5);
+
+nextItem = Symbol('a');
+assert.throws(TypeError, function() {
+ new WeakMap(iterable);
+});
+assert.sameValue(count, 6);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/iterator-items-are-not-object.js b/js/src/tests/test262/built-ins/WeakMap/iterator-items-are-not-object.js
new file mode 100644
index 0000000000..1f057feb21
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/iterator-items-are-not-object.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.
+/*---
+esid: sec-weakmap-iterable
+description: >
+ Throws a TypeError if iterable itens are not Objects.
+info: |
+ WeakMap ( [ 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 WeakMap([1, 1]);
+});
+
+assert.throws(TypeError, function() {
+ new WeakMap(['', 1]);
+});
+
+assert.throws(TypeError, function() {
+ new WeakMap([true, 1]);
+});
+
+assert.throws(TypeError, function() {
+ new WeakMap([null, 1]);
+});
+
+assert.throws(TypeError, function() {
+ new WeakMap([Symbol('a'), 1]);
+});
+
+assert.throws(TypeError, function() {
+ new WeakMap([undefined, 1]);
+});
+
+assert.throws(TypeError, function() {
+ new WeakMap([
+ ['a', 1], 2
+ ]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/iterator-next-failure.js b/js/src/tests/test262/built-ins/WeakMap/iterator-next-failure.js
new file mode 100644
index 0000000000..3cdac01c64
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/iterator-next-failure.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.
+/*---
+esid: sec-weakmap-iterable
+description: >
+ Return abrupt from next iterator step.
+info: |
+ 23.3.1.1 WeakMap ( [ 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 WeakMap(iterable);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/iterator-value-failure.js b/js/src/tests/test262/built-ins/WeakMap/iterator-value-failure.js
new file mode 100644
index 0000000000..4875063946
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/iterator-value-failure.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.
+/*---
+esid: sec-weakmap-iterable
+description: >
+ If the iterable argument is empty, return new WeakMap object.
+info: |
+ 23.3.1.1 WeakMap ( [ 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 WeakMap(iterable);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/length.js b/js/src/tests/test262/built-ins/WeakMap/length.js
new file mode 100644
index 0000000000..e5bf7043e3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/length.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.
+/*---
+esid: sec-properties-of-the-weakmap-constructor
+description: >
+ The length property of the WeakMap constructor is 0.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(WeakMap.length, 0, 'The value of `WeakMap.length` is `0`');
+
+verifyNotEnumerable(WeakMap, 'length');
+verifyNotWritable(WeakMap, 'length');
+verifyConfigurable(WeakMap, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/name.js b/js/src/tests/test262/built-ins/WeakMap/name.js
new file mode 100644
index 0000000000..d7d4457efe
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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.
+/*---
+esid: sec-weakmap-iterable
+description: >
+ WeakMap ( [ iterable ] )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ WeakMap.name, 'WeakMap',
+ 'The value of `WeakMap.name` is "WeakMap"'
+);
+
+verifyNotEnumerable(WeakMap, 'name');
+verifyNotWritable(WeakMap, 'name');
+verifyConfigurable(WeakMap, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/no-iterable.js b/js/src/tests/test262/built-ins/WeakMap/no-iterable.js
new file mode 100644
index 0000000000..8e891a99e0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/no-iterable.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.
+/*---
+esid: sec-weakmap-iterable
+description: >
+ If the iterable argument is undefined, return new WeakMap object.
+info: |
+ WeakMap ( [ iterable ] )
+
+ ...
+ 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 a = new WeakMap();
+var b = new WeakMap(undefined);
+var c = new WeakMap(null);
+
+assert.sameValue(Object.getPrototypeOf(a), WeakMap.prototype);
+assert.sameValue(Object.getPrototypeOf(b), WeakMap.prototype);
+assert.sameValue(Object.getPrototypeOf(c), WeakMap.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/properties-of-map-instances.js b/js/src/tests/test262/built-ins/WeakMap/properties-of-map-instances.js
new file mode 100644
index 0000000000..4eec328c6e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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.
+/*---
+esid: sec-properties-of-weakmap-instances
+description: >
+ WeakMap instances are ordinary objects that inherit properties from the
+ WeakMap prototype.
+---*/
+
+assert.sameValue(
+ Object.getPrototypeOf(new WeakMap()),
+ WeakMap.prototype,
+ '`Object.getPrototypeOf(new WeakMap())` returns `WeakMap.prototype`'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/properties-of-the-weakmap-prototype-object.js b/js/src/tests/test262/built-ins/WeakMap/properties-of-the-weakmap-prototype-object.js
new file mode 100644
index 0000000000..2a3e1057b2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/properties-of-the-weakmap-prototype-object.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.
+/*---
+esid: sec-properties-of-the-weakmap-prototype-object
+description: >
+ The WeakMap.prototype's prototype is Object.prototype.
+info: |
+ 23.3.3 Properties of the WeakMap Prototype Object
+
+ The WeakMap prototype object is the intrinsic object %WeakMapPrototype%. The
+ value of the [[Prototype]] internal slot of the WeakMap prototype object is
+ the intrinsic object %ObjectPrototype% (19.1.3). The WeakMap prototype object
+ is an ordinary object. It does not have a [[WeakMapData]] internal slot.
+---*/
+
+assert.sameValue(
+ Object.getPrototypeOf(WeakMap.prototype),
+ Object.prototype,
+ '`Object.getPrototypeOf(WeakMap.prototype)` returns `Object.prototype`'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/proto-from-ctor-realm.js b/js/src/tests/test262/built-ins/WeakMap/proto-from-ctor-realm.js
new file mode 100644
index 0000000000..cade937c93
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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-weakmap-iterable
+description: Default [[Prototype]] value derived from realm of the newTarget
+info: |
+ [...]
+ 2. Let map be ? OrdinaryCreateFromConstructor(NewTarget,
+ "%WeakMapPrototype%", « [[WeakMapData]] »).
+ [...]
+
+ 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(WeakMap, [], C);
+
+assert.sameValue(Object.getPrototypeOf(o), other.WeakMap.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype-of-weakmap.js b/js/src/tests/test262/built-ins/WeakMap/prototype-of-weakmap.js
new file mode 100644
index 0000000000..41131ea439
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype-of-weakmap.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.
+/*---
+esid: sec-properties-of-the-weakmap-constructor
+description: >
+ The value of the [[Prototype]] internal slot of the WeakMap constructor is the
+ intrinsic object %FunctionPrototype% (19.2.3).
+---*/
+
+assert.sameValue(
+ Object.getPrototypeOf(WeakMap),
+ Function.prototype,
+ '`Object.getPrototypeOf(WeakMap)` returns `Function.prototype`'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/Symbol.toStringTag.js b/js/src/tests/test262/built-ins/WeakMap/prototype/Symbol.toStringTag.js
new file mode 100644
index 0000000000..0e5a8a2617
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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.
+/*---
+esid: sec-weakmap.prototype-@@tostringtag
+description: >
+ `Symbol.toStringTag` property descriptor
+info: |
+ The initial value of the @@toStringTag property is the String value
+ "WeakMap".
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]:
+ false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [Symbol.toStringTag]
+---*/
+
+assert.sameValue(WeakMap.prototype[Symbol.toStringTag], 'WeakMap');
+
+verifyNotEnumerable(WeakMap.prototype, Symbol.toStringTag);
+verifyNotWritable(WeakMap.prototype, Symbol.toStringTag);
+verifyConfigurable(WeakMap.prototype, Symbol.toStringTag);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/browser.js b/js/src/tests/test262/built-ins/WeakMap/prototype/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/browser.js
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/constructor.js b/js/src/tests/test262/built-ins/WeakMap/prototype/constructor.js
new file mode 100644
index 0000000000..78bbfc0865
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/constructor.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.
+/*---
+esid: sec-weakmap.prototype.constructor
+description: >
+ WeakMap.prototype.constructor value and property descriptor
+info: |
+ The initial value of WeakMap.prototype.constructor is the %WeakMap%
+ intrinsic object.
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(WeakMap.prototype.constructor, WeakMap);
+assert.sameValue((new WeakMap()).constructor, WeakMap);
+
+verifyNotEnumerable(WeakMap.prototype, 'constructor');
+verifyWritable(WeakMap.prototype, 'constructor');
+verifyConfigurable(WeakMap.prototype, 'constructor');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/browser.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/browser.js
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry-initial-iterable.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry-initial-iterable.js
new file mode 100644
index 0000000000..59b2fbb91f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry-initial-iterable.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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: >
+ Delete an entry from initial iterable.
+info: |
+ WeakMap.prototype.delete ( value )
+
+ ...
+ 5. Let entries be the List that is the value of M’s [[WeakMapData]] internal
+ slot.
+ 6. If Type(key) is not Object, return false.
+ 7. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ a. If p.[[key]] is not empty and SameValue(p.[[key]], key) is true, then
+ i. Set p.[[key]] to empty.
+ ii. Set p.[[value]] to empty.
+ iii. Return true.
+ ...
+---*/
+
+var foo = {};
+var map = new WeakMap([
+ [foo, 42]
+]);
+
+var result = map.delete(foo);
+
+assert.sameValue(map.has(foo), false);
+assert.sameValue(result, true, 'WeakMap#delete returns true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry.js
new file mode 100644
index 0000000000..8f349fe7cd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry.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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: >
+ Delete an entry.
+info: |
+ WeakMap.prototype.delete ( value )
+
+ ...
+ 5. Let entries be the List that is the value of M’s [[WeakMapData]] internal
+ slot.
+ 6. If Type(key) is not Object, return false.
+ 7. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ a. If p.[[key]] is not empty and SameValue(p.[[key]], key) is true, then
+ i. Set p.[[key]] to empty.
+ ii. Set p.[[value]] to empty.
+ iii. Return true.
+ ...
+---*/
+
+var foo = {};
+var map = new WeakMap();
+
+map.set(foo, 42);
+
+var result = map.delete(foo);
+
+assert.sameValue(map.has(foo), false);
+assert.sameValue(result, true, 'WeakMap#delete returns true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete.js
new file mode 100644
index 0000000000..15c82ed408
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete.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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: >
+ WeakMap.prototype.delete property descriptor
+info: |
+ WeakMap.prototype.delete ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof WeakMap.prototype.delete,
+ 'function',
+ 'typeof WeakMap.prototype.delete is "function"'
+);
+
+verifyNotEnumerable(WeakMap.prototype, 'delete');
+verifyWritable(WeakMap.prototype, 'delete');
+verifyConfigurable(WeakMap.prototype, 'delete');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-array.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-array.js
new file mode 100644
index 0000000000..ee36e00388
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-array.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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: >
+ Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot.
+info: |
+ WeakMap.prototype.delete ( value )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.delete.call([], {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.delete.call([], {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-map.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-map.js
new file mode 100644
index 0000000000..c3c0403a19
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-map.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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: >
+ Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot.
+info: |
+ WeakMap.prototype.delete ( value )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Map]
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.delete.call(new Map(), {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.delete.call(new Map(), {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-object.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-object.js
new file mode 100644
index 0000000000..d87efe53d4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: >
+ Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot.
+info: |
+ WeakMap.prototype.delete ( value )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.delete.call({}, {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.delete.call({}, {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-set.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-set.js
new file mode 100644
index 0000000000..6ded891930
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: >
+ Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot.
+info: |
+ WeakMap.prototype.delete ( value )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Set]
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.delete.call(new Set(), {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.delete.call(new Set(), {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-weakmap-prototype.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-weakmap-prototype.js
new file mode 100644
index 0000000000..6d70c09325
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-weakmap-prototype.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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: >
+ Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot.
+info: |
+ WeakMap.prototype.delete ( value )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.delete.call(WeakMap.prototype, {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.delete.call(WeakMap.prototype, {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/length.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/length.js
new file mode 100644
index 0000000000..bfdcaff706
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: >
+ WeakMap.prototype.delete.length value and writability.
+info: |
+ WeakMap.prototype.delete ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ WeakMap.prototype.delete.length, 1,
+ 'The value of WeakMap.prototype.delete.length is 1'
+);
+
+verifyNotEnumerable(WeakMap.prototype.delete, 'length');
+verifyNotWritable(WeakMap.prototype.delete, 'length');
+verifyConfigurable(WeakMap.prototype.delete, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/name.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/name.js
new file mode 100644
index 0000000000..67bc4d2ee4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: >
+ WeakMap.prototype.delete.name value and writability.
+info: |
+ WeakMap.prototype.delete ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ WeakMap.prototype.delete.name, 'delete',
+ 'The value of WeakMap.prototype.delete.name is "delete"'
+);
+
+verifyNotEnumerable(WeakMap.prototype.delete, 'name');
+verifyNotWritable(WeakMap.prototype.delete, 'name');
+verifyConfigurable(WeakMap.prototype.delete, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/not-a-constructor.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/not-a-constructor.js
new file mode 100644
index 0000000000..59136bd1ef
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/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: >
+ WeakMap.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, WeakMap, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(WeakMap.prototype.delete),
+ false,
+ 'isConstructor(WeakMap.prototype.delete) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let wm = new WeakMap(); new wm.delete();
+}, '`let wm = new WeakMap(); new wm.delete()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-value-is-not-object.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-value-is-not-object.js
new file mode 100644
index 0000000000..9ab70fedfd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-value-is-not-object.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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: >
+ Return false if value is not an Object.
+info: |
+ WeakMap.prototype.delete ( value )
+
+ 5. If Type(key) is not Object, return false.
+features: [Symbol]
+---*/
+
+var map = new WeakMap();
+
+assert.sameValue(map.delete(1), false);
+assert.sameValue(map.delete(''), false);
+assert.sameValue(map.delete(NaN), false);
+assert.sameValue(map.delete(null), false);
+assert.sameValue(map.delete(undefined), false);
+assert.sameValue(map.delete(true), false);
+assert.sameValue(map.delete(Symbol()), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-when-delete-is-noop.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-when-delete-is-noop.js
new file mode 100644
index 0000000000..3c9757dbf5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-when-delete-is-noop.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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: >
+ Return false if entry is not in the WeakMap.
+info: |
+ WeakMap.prototype.delete ( value )
+
+ ...
+ 7. Return false.
+
+---*/
+
+var map = new WeakMap();
+var foo = {};
+var bar = {};
+
+map.set(foo, 42);
+
+assert.sameValue(map.delete(bar), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/shell.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/shell.js
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-boolean.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-boolean.js
new file mode 100644
index 0000000000..1ccbfd4398
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-boolean.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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.prototype.delete ( value )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.delete.call(false, {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.delete.call(false, {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-null.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-null.js
new file mode 100644
index 0000000000..ade3d45c31
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-null.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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.prototype.delete ( value )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.delete.call(null, {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.delete.call(null, {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-number.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-number.js
new file mode 100644
index 0000000000..6437acd104
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-number.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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.prototype.delete ( value )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.delete.call(0, {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.delete.call(0, {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-string.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-string.js
new file mode 100644
index 0000000000..661c0fd4d8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-string.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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.prototype.delete ( value )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.delete.call('', {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.delete.call('', {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-symbol.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-symbol.js
new file mode 100644
index 0000000000..b3feca5fa5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-symbol.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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.prototype.delete ( 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() {
+ WeakMap.prototype.delete.call(Symbol(), {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.delete.call(Symbol(), {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-undefined.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-undefined.js
new file mode 100644
index 0000000000..3ef3760c22
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/this-not-object-throw-undefined.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.
+/*---
+esid: sec-weakmap.prototype.delete
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.prototype.delete ( value )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.delete.call(undefined, {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.delete.call(undefined, {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/get/browser.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/get/browser.js
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot-map.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot-map.js
new file mode 100644
index 0000000000..387164ec86
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot-map.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.
+/*---
+esid: sec-weakmap.prototype.get
+description: >
+ Throws a TypeError if `this` is a Map object.
+info: |
+ WeakMap.prototype.get ( key )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Map]
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.get.call(new Map(), 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.get.call(new Map(), 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot-set.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot-set.js
new file mode 100644
index 0000000000..115f53ec9b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-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.
+/*---
+esid: sec-weakmap.prototype.get
+description: >
+ Throws a TypeError if `this` is a Set object.
+info: |
+ WeakMap.prototype.get ( key )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Set]
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.get.call(new Set(), 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.get.call(new Set(), 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot.js
new file mode 100644
index 0000000000..ac44156129
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot.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.
+/*---
+esid: sec-weakmap.prototype.get
+description: >
+ Throws a TypeError if `this` does not have a [[WeakMapData]] internal slot.
+info: |
+ WeakMap.prototype.get ( key )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+var map = new WeakMap();
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.get.call([], 1);
+});
+
+assert.throws(TypeError, function() {
+ map.get.call([], 1);
+});
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.get.call({}, 1);
+});
+
+assert.throws(TypeError, function() {
+ map.get.call({}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/get/get.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/get.js
new file mode 100644
index 0000000000..287b5c1f4b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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.
+/*---
+esid: sec-weakmap.prototype.get
+description: >
+ Property type and descriptor.
+info: |
+ WeakMap.prototype.get ( key )
+
+ 17 ECMAScript Standard Built-in Objects
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof WeakMap.prototype.get,
+ 'function',
+ '`typeof WeakMap.prototype.get` is `function`'
+);
+
+verifyNotEnumerable(WeakMap.prototype, 'get');
+verifyWritable(WeakMap.prototype, 'get');
+verifyConfigurable(WeakMap.prototype, 'get');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/get/length.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/length.js
new file mode 100644
index 0000000000..eb8f7d546e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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.
+/*---
+esid: sec-weakmap.prototype.get
+description: >
+ WeakMap.prototype.get.length value and descriptor.
+info: |
+ WeakMap.prototype.get ( key )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ WeakMap.prototype.get.length, 1,
+ 'The value of `WeakMap.prototype.get.length` is `1`'
+);
+
+verifyNotEnumerable(WeakMap.prototype.get, 'length');
+verifyNotWritable(WeakMap.prototype.get, 'length');
+verifyConfigurable(WeakMap.prototype.get, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/get/name.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/name.js
new file mode 100644
index 0000000000..ce82cdb4e4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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.
+/*---
+esid: sec-weakmap.prototype.get
+description: >
+ WeakMap.prototype.get.name value and descriptor.
+info: |
+ WeakMap.prototype.get ( key )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ WeakMap.prototype.get.name, 'get',
+ 'The value of `WeakMap.prototype.get.name` is `"get"`'
+);
+
+verifyNotEnumerable(WeakMap.prototype.get, 'name');
+verifyNotWritable(WeakMap.prototype.get, 'name');
+verifyConfigurable(WeakMap.prototype.get, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/get/not-a-constructor.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/not-a-constructor.js
new file mode 100644
index 0000000000..ec8be07522
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/get/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: >
+ WeakMap.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, WeakMap, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(WeakMap.prototype.get),
+ false,
+ 'isConstructor(WeakMap.prototype.get) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let wm = new WeakMap(); new wm.get();
+}, '`let wm = new WeakMap(); new wm.get()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-undefined-key-is-not-object.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-undefined-key-is-not-object.js
new file mode 100644
index 0000000000..aede19023a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-undefined-key-is-not-object.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.
+/*---
+esid: sec-weakmap.prototype.get
+description: >
+ Returns undefined when key is not an Object.
+info: |
+ WeakMap.prototype.get ( key )
+
+ ...
+ 4. Let entries be the List that is the value of M’s [[WeakMapData]] internal
+ slot.
+ 5. If Type(key) is not Object, return undefined.
+ ...
+features: [Symbol]
+---*/
+
+var map = new WeakMap();
+
+assert.sameValue(map.get(null), undefined, 'Returns undefined if key is null');
+
+assert.sameValue(map.get(NaN), undefined, 'Returns undefined if key is NaN');
+
+assert.sameValue(
+ map.get('foo'), undefined,
+ 'Returns undefined if key is a String'
+);
+
+assert.sameValue(
+ map.get(1), undefined,
+ 'Returns undefined if key is a Number'
+);
+
+assert.sameValue(
+ map.get(undefined), undefined,
+ 'Returns undefined if key is undefined'
+);
+
+assert.sameValue(
+ map.get(Symbol()), undefined,
+ 'Returns undefined if key is a Symbol'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-undefined.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-undefined.js
new file mode 100644
index 0000000000..62e410caa6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-undefined.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.
+/*---
+esid: sec-weakmap.prototype.get
+description: >
+ Returns undefined when key is not on the WeakMap object.
+info: |
+ WeakMap.prototype.get ( key )
+
+ 4. Let entries be the List that is the value of M’s [[WeakMapData]] internal
+ slot.
+ 5. If Type(key) is not Object, return undefined.
+ 6. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ a. If p.[[key]] is not empty and SameValue(p.[[key]], key) is true, return
+ p.[[value]].
+ 7. Return undefined.
+ ...
+---*/
+
+var map = new WeakMap();
+var key = {};
+
+assert.sameValue(
+ map.get(key), undefined,
+ 'returns undefined if key is not on the weakmap'
+);
+
+map.set(key, 1);
+map.set({}, 2);
+map.delete(key);
+map.set({}, 3);
+
+assert.sameValue(
+ map.get(key), undefined,
+ 'returns undefined if key was deleted'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-value.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-value.js
new file mode 100644
index 0000000000..c336441d19
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-value.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakmap.prototype.get
+description: >
+ Returns the value from the specified key
+info: |
+ WeakMap.prototype.get ( key )
+
+ 4. Let entries be the List that is the value of M’s [[WeakMapData]] internal
+ slot.
+ 5. If Type(key) is not Object, return undefined.
+ 6. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ a. If p.[[key]] is not empty and SameValue(p.[[key]], key) is true, return
+ p.[[value]].
+ ...
+---*/
+
+var foo = {};
+var bar = {};
+var baz = [];
+var map = new WeakMap([
+ [foo, 0]
+]);
+
+assert.sameValue(map.get(foo), 0);
+
+map.set(bar, 1);
+assert.sameValue(map.get(bar), 1);
+
+map.set(baz, 2);
+assert.sameValue(map.get(baz), 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/get/shell.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/get/shell.js
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/get/this-not-object-throw.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/this-not-object-throw.js
new file mode 100644
index 0000000000..31963d4847
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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.
+/*---
+esid: sec-weakmap.prototype.get
+description: >
+ Throws a TypeError if `this` value is not an Object.
+info: |
+ WeakMap.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() {
+ WeakMap.prototype.get.call(false, {});
+});
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.get.call(1, {});
+});
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.get.call('', {});
+});
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.get.call(undefined, {});
+});
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.get.call(null, {});
+});
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.get.call(Symbol(), {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.get.call(false, {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/browser.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/browser.js
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-array.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-array.js
new file mode 100644
index 0000000000..ad586369cc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-array.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.
+/*---
+esid: sec-weakmap.prototype.has
+description: >
+ Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot.
+info: |
+ WeakMap.prototype.has ( value )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.has.call([], {}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.has.call([], {}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-map.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-map.js
new file mode 100644
index 0000000000..5ca9d67eb7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-map.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.
+/*---
+esid: sec-weakmap.prototype.has
+description: >
+ Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot.
+info: |
+ WeakMap.prototype.has ( value )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Map]
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.has.call(new Map(), {}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.has.call(new Map(), {}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-object.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-object.js
new file mode 100644
index 0000000000..c83e6471a0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-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.
+/*---
+esid: sec-weakmap.prototype.has
+description: >
+ Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot.
+info: |
+ WeakMap.prototype.has ( value )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.has.call({}, {}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.has.call({}, {}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-set.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-set.js
new file mode 100644
index 0000000000..f6a493227f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-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.
+/*---
+esid: sec-weakmap.prototype.has
+description: >
+ Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot.
+info: |
+ WeakMap.prototype.has ( value )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Set]
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.has.call(new Set(), {}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.has.call(new Set(), {}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-weakmap-prototype.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-weakmap-prototype.js
new file mode 100644
index 0000000000..43fa3b4d5e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-weakmap-prototype.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.
+/*---
+esid: sec-weakmap.prototype.has
+description: >
+ Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot.
+info: |
+ WeakMap.prototype.has ( value )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.has.call(WeakMap.prototype, {}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.has.call(WeakMap.prototype, {}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/has.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/has.js
new file mode 100644
index 0000000000..7146168507
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/has.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.
+/*---
+esid: sec-weakmap.prototype.has
+description: >
+ WeakMap.prototype.has property descriptor
+info: |
+ WeakMap.prototype.has ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof WeakMap.prototype.has,
+ 'function',
+ 'typeof WeakMap.prototype.has is "function"'
+);
+
+verifyNotEnumerable(WeakMap.prototype, 'has');
+verifyWritable(WeakMap.prototype, 'has');
+verifyConfigurable(WeakMap.prototype, 'has');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/length.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/length.js
new file mode 100644
index 0000000000..a68fa8ecec
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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.
+/*---
+esid: sec-weakmap.prototype.has
+description: >
+ WeakMap.prototype.has.length value and writability.
+info: |
+ WeakMap.prototype.has ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ WeakMap.prototype.has.length, 1,
+ 'The value of WeakMap.prototype.has.length is 1'
+);
+
+verifyNotEnumerable(WeakMap.prototype.has, 'length');
+verifyNotWritable(WeakMap.prototype.has, 'length');
+verifyConfigurable(WeakMap.prototype.has, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/name.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/name.js
new file mode 100644
index 0000000000..558f24335d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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.
+/*---
+esid: sec-weakmap.prototype.has
+description: >
+ WeakMap.prototype.has.name value and writability.
+info: |
+ WeakMap.prototype.has ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ WeakMap.prototype.has.name, 'has',
+ 'The value of WeakMap.prototype.has.name is "has"'
+);
+
+verifyNotEnumerable(WeakMap.prototype.has, 'name');
+verifyNotWritable(WeakMap.prototype.has, 'name');
+verifyConfigurable(WeakMap.prototype.has, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/not-a-constructor.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/not-a-constructor.js
new file mode 100644
index 0000000000..83df17bbf5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/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: >
+ WeakMap.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, WeakMap, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(WeakMap.prototype.has),
+ false,
+ 'isConstructor(WeakMap.prototype.has) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let wm = new WeakMap(); new wm.has();
+}, '`let wm = new WeakMap(); new wm.has()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-value-is-not-object.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-value-is-not-object.js
new file mode 100644
index 0000000000..2874d603d4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-value-is-not-object.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.
+/*---
+esid: sec-weakmap.prototype.has
+description: >
+ Returns false if value is not an Object.
+info: |
+ WeakMap.prototype.has ( value )
+
+ 5. If Type(key) is not Object, return false.
+features: [Symbol]
+---*/
+
+var map = new WeakMap();
+
+assert.sameValue(map.has(1), false);
+assert.sameValue(map.has(''), false);
+assert.sameValue(map.has(null), false);
+assert.sameValue(map.has(undefined), false);
+assert.sameValue(map.has(true), false);
+assert.sameValue(map.has(Symbol()), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-value-not-present.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-value-not-present.js
new file mode 100644
index 0000000000..146afadb9e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-value-not-present.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.
+/*---
+esid: sec-weakmap.prototype.has
+description: >
+ Return false when value is not present in the WeakMap entries.
+info: |
+ WeakMap.prototype.has ( value )
+
+ ...
+ 7. Return false.
+
+---*/
+
+var foo = {};
+var bar = {};
+var map = new WeakMap();
+
+assert.sameValue(map.has(foo), false);
+
+map.set(foo, 1);
+assert.sameValue(map.has(bar), false);
+
+map.delete(foo);
+assert.sameValue(map.has(foo), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-true-when-value-present.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-true-when-value-present.js
new file mode 100644
index 0000000000..49ceb35d25
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-true-when-value-present.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.
+/*---
+esid: sec-weakmap.prototype.has
+description: >
+ Returns true when value is present in the WeakMap entries list.
+info: |
+ WeakMap.prototype.has ( value )
+
+ ...
+ 6. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ a. If p.[[key]] is not empty and SameValue(p.[[key]], key) is true, return
+ true.
+ ...
+---*/
+
+var foo = {};
+var map = new WeakMap();
+
+map.set(foo, 1);
+assert.sameValue(map.has(foo), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/shell.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/shell.js
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-boolean.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-boolean.js
new file mode 100644
index 0000000000..ccf9b1e6ec
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-boolean.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.
+/*---
+esid: sec-weakmap.prototype.has
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.prototype.has ( value )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.has.call(false, {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.has.call(false, {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-null.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-null.js
new file mode 100644
index 0000000000..b90fb80613
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-null.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.
+/*---
+esid: sec-weakmap.prototype.has
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.prototype.has ( value )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.has.call(null, {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.has.call(null, {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-number.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-number.js
new file mode 100644
index 0000000000..2beb7d5d0f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-number.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.
+/*---
+esid: sec-weakmap.prototype.has
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.prototype.has ( value )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.has.call(0, {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.has.call(0, {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-string.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-string.js
new file mode 100644
index 0000000000..b4f82cf17a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-string.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.
+/*---
+esid: sec-weakmap.prototype.has
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.prototype.has ( value )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.has.call('', {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.has.call('', {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-symbol.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-symbol.js
new file mode 100644
index 0000000000..0c80ffd07e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-symbol.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.
+/*---
+esid: sec-weakmap.prototype.has
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.prototype.has ( 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() {
+ WeakMap.prototype.has.call(Symbol(), {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.has.call(Symbol(), {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-undefined.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-undefined.js
new file mode 100644
index 0000000000..f8138cc349
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/this-not-object-throw-undefined.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.
+/*---
+esid: sec-weakmap.prototype.has
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.prototype.has ( value )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.has.call(undefined, {});
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.has.call(undefined, {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/prototype-attributes.js b/js/src/tests/test262/built-ins/WeakMap/prototype/prototype-attributes.js
new file mode 100644
index 0000000000..74158956fc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/prototype-attributes.js
@@ -0,0 +1,14 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakmap.prototype
+description: >
+ WeakMap.prototype is not writable, not enumerable and not configurable.
+includes: [propertyHelper.js]
+---*/
+
+verifyNotEnumerable(WeakMap, 'prototype');
+verifyNotWritable(WeakMap, 'prototype');
+verifyNotConfigurable(WeakMap, 'prototype');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/adds-element.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/adds-element.js
new file mode 100644
index 0000000000..d4c8eeaad2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/adds-element.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.
+/*---
+esid: sec-weakmap.prototype.set
+description: >
+ Appends value as the last element of entries.
+info: |
+ WeakMap.prototype.set ( key, value )
+
+ ...
+ 7. Let p be the Record {[[key]]: key, [[value]]: value}.
+ 8. Append p as the last element of entries.
+ ...
+---*/
+
+var map = new WeakMap();
+var foo = {};
+var bar = {};
+var baz = {};
+
+map.set(foo, 1);
+map.set(bar, 2);
+map.set(baz, 3);
+
+assert(map.has(foo));
+assert(map.has(bar));
+assert(map.has(baz));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/browser.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/browser.js
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-array.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-array.js
new file mode 100644
index 0000000000..490cbd751a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-array.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.
+/*---
+esid: sec-weakmap.prototype.set
+description: >
+ Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot.
+info: |
+ WeakMap.prototype.set ( key, value )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.set.call([], {}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.set.call([], {}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-map.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-map.js
new file mode 100644
index 0000000000..d07b8f16c0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-map.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.
+/*---
+esid: sec-weakmap.prototype.set
+description: >
+ Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot.
+info: |
+ WeakMap.prototype.set ( key, value )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Map]
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.set.call(new Map(), {}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.set.call(new Map(), {}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-object.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-object.js
new file mode 100644
index 0000000000..e31e8c6be1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-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.
+/*---
+esid: sec-weakmap.prototype.set
+description: >
+ Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot.
+info: |
+ WeakMap.prototype.set ( key, value )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.set.call({}, {}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.set.call({}, {}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-set.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-set.js
new file mode 100644
index 0000000000..5efcf091cf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-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.
+/*---
+esid: sec-weakmap.prototype.set
+description: >
+ Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot.
+info: |
+ WeakMap.prototype.set ( key, value )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Set]
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.set.call(new Set(), {}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.set.call(new Set(), {}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-weakmap-prototype.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-weakmap-prototype.js
new file mode 100644
index 0000000000..e60c46b13b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-weakmap-prototype.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.
+/*---
+esid: sec-weakmap.prototype.set
+description: >
+ Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot.
+info: |
+ WeakMap.prototype.set ( key, value )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.set.call(WeakMap.prototype, {}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.set.call(WeakMap.prototype, {}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/key-not-object-throw.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/key-not-object-throw.js
new file mode 100644
index 0000000000..19b9fcc948
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/key-not-object-throw.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.
+/*---
+esid: sec-weakmap.prototype.set
+description: Throws TypeError if `key` is not Object.
+info: |
+ WeakMap.prototype.set ( key, value )
+
+ 5. If Type(key) is not Object, throw a TypeError exception.
+features: [Symbol]
+---*/
+
+var s = new WeakMap();
+
+assert.throws(TypeError, function() {
+ s.set(1, 1);
+});
+
+assert.throws(TypeError, function() {
+ s.set(false, 1);
+});
+
+assert.throws(TypeError, function() {
+ s.set(undefined, 1);
+});
+
+assert.throws(TypeError, function() {
+ s.set('string', 1);
+});
+
+assert.throws(TypeError, function() {
+ s.set(null, 1);
+});
+
+assert.throws(TypeError, function() {
+ s.set(Symbol(), 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/length.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/length.js
new file mode 100644
index 0000000000..052f181e53
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/length.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.
+/*---
+esid: sec-weakmap.prototype.set
+description: WeakMap.prototype.set.length descriptor
+info: |
+ WeakMap.prototype.set ( key, value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ WeakMap.prototype.set.length, 2,
+ 'The value of `WeakMap.prototype.set.length` is `2`'
+);
+
+verifyNotEnumerable(WeakMap.prototype.set, 'length');
+verifyNotWritable(WeakMap.prototype.set, 'length');
+verifyConfigurable(WeakMap.prototype.set, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/name.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/name.js
new file mode 100644
index 0000000000..f1d62ffef5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/name.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.
+/*---
+esid: sec-weakmap.prototype.set
+description: WeakMap.prototype.set.name descriptor
+info: |
+ WeakMap.prototype.set ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ WeakMap.prototype.set.name, 'set',
+ 'The value of WeakMap.prototype.set.name is "set"'
+);
+
+verifyNotEnumerable(WeakMap.prototype.set, 'name');
+verifyNotWritable(WeakMap.prototype.set, 'name');
+verifyConfigurable(WeakMap.prototype.set, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/not-a-constructor.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/not-a-constructor.js
new file mode 100644
index 0000000000..c8d6272217
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/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: >
+ WeakMap.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, WeakMap, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(WeakMap.prototype.set),
+ false,
+ 'isConstructor(WeakMap.prototype.set) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let wm = new WeakMap(); new wm.set({}, 1);
+}, '`let wm = new WeakMap(); new wm.set({}, 1)` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/returns-this-when-ignoring-duplicate.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/returns-this-when-ignoring-duplicate.js
new file mode 100644
index 0000000000..9f96f5e2f2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/returns-this-when-ignoring-duplicate.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.
+/*---
+esid: sec-weakmap.prototype.set
+description: Returns `this` when new value is duplicate.
+info: |
+ WeakMap.prototype.set ( key, value )
+
+ 1. Let M be the this value.
+ ...
+ 6. Repeat for each Record {[[key]], [[value]]} p that is an element of
+ entries,
+ a. If p.[[key]] is not empty and SameValue(p.[[key]], key) is true, then
+ i. Set p.[[value]] to value.
+ ii. Return M.
+ ...
+---*/
+
+var foo = {};
+var map = new WeakMap([
+ [foo, 1]
+]);
+
+assert.sameValue(map.set(foo, 1), map, '`map.set(foo, 1)` returns `map`');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/returns-this.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/returns-this.js
new file mode 100644
index 0000000000..dd30cc2e77
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/returns-this.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.
+/*---
+esid: sec-weakmap.prototype.set
+description: Returns `this` after setting a new value.
+info: |
+ WeakMap.prototype.set ( key, value )
+
+ 1. Let M be this value.
+ ...
+ 9. Return M.
+
+---*/
+
+var map = new WeakMap();
+
+assert.sameValue(map.set({}, 1), map, '`map.set({}, 1)` returns `map`');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/set.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/set.js
new file mode 100644
index 0000000000..7ec5dd82c4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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.
+/*---
+esid: sec-weakmap.prototype.set
+description: WeakMap.prototype.set property descriptor
+info: |
+ WeakMap.prototype.set ( key, value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof WeakMap.prototype.set,
+ 'function',
+ 'typeof WeakMap.prototype.set is "function"'
+);
+
+verifyNotEnumerable(WeakMap.prototype, 'set');
+verifyWritable(WeakMap.prototype, 'set');
+verifyConfigurable(WeakMap.prototype, 'set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/shell.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/shell.js
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-boolean.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-boolean.js
new file mode 100644
index 0000000000..98b2fd02f3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-boolean.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.
+/*---
+esid: sec-weakmap.prototype.set
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.prototype.set ( key, value )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.set.call(false, {}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.set.call(false, {}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-null.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-null.js
new file mode 100644
index 0000000000..7a24860890
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-null.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.
+/*---
+esid: sec-weakmap.prototype.set
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.prototype.set ( key, value )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.set.call(null, {}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.set.call(null, {}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-number.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-number.js
new file mode 100644
index 0000000000..1af785afca
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-number.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.
+/*---
+esid: sec-weakmap.prototype.set
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.prototype.set ( key, value )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.set.call(0, {}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.set.call(0, {}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-string.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-string.js
new file mode 100644
index 0000000000..d689e80daa
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-string.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.
+/*---
+esid: sec-weakmap.prototype.set
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.prototype.set ( key, value )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.set.call('', {}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.set.call('', {}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-symbol.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-symbol.js
new file mode 100644
index 0000000000..47522549f9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-symbol.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.
+/*---
+esid: sec-weakmap.prototype.set
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.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() {
+ WeakMap.prototype.set.call(Symbol(), {}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.set.call(Symbol(), {}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-undefined.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-undefined.js
new file mode 100644
index 0000000000..188043687b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/this-not-object-throw-undefined.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.
+/*---
+esid: sec-weakmap.prototype.set
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakMap.prototype.set ( key, value )
+
+ 1. Let M be the this value.
+ 2. If Type(M) is not Object, throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.set.call(undefined, {}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var map = new WeakMap();
+ map.set.call(undefined, {}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/shell.js b/js/src/tests/test262/built-ins/WeakMap/prototype/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/shell.js
diff --git a/js/src/tests/test262/built-ins/WeakMap/set-not-callable-throws.js b/js/src/tests/test262/built-ins/WeakMap/set-not-callable-throws.js
new file mode 100644
index 0000000000..34a817c77e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/set-not-callable-throws.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.
+/*---
+esid: sec-weakmap-iterable
+description: >
+ Throws TypeError if add is not callable on constructor call.
+info: |
+ 23.3.1.1 WeakMap ( [ iterable ] )
+
+ ...
+ 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.
+ ...
+---*/
+
+WeakMap.prototype.set = null;
+new WeakMap();
+
+assert.throws(TypeError, function() {
+ new WeakMap([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/shell.js b/js/src/tests/test262/built-ins/WeakMap/shell.js
new file mode 100644
index 0000000000..54371b7789
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/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/WeakMap/undefined-newtarget.js b/js/src/tests/test262/built-ins/WeakMap/undefined-newtarget.js
new file mode 100644
index 0000000000..f4e3dbe2f8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/undefined-newtarget.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakmap-iterable
+description: >
+ Throws a TypeError if NewTarget is undefined.
+info: |
+ 23.3.1.1 WeakMap ( [ iterable ] )
+
+ 1. If NewTarget is undefined, throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ WeakMap();
+});
+
+assert.throws(TypeError, function() {
+ WeakMap([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/weakmap.js b/js/src/tests/test262/built-ins/WeakMap/weakmap.js
new file mode 100644
index 0000000000..0ba649d224
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/weakmap.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.
+/*---
+esid: sec-weakmap-iterable
+description: >
+ WeakMap ( [ iterable ] )
+
+ 17 ECMAScript Standard Built-in Objects
+includes: [propertyHelper.js]
+---*/
+
+verifyNotEnumerable(this, 'WeakMap');
+verifyWritable(this, 'WeakMap');
+verifyConfigurable(this, 'WeakMap');
+
+reportCompare(0, 0);