summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/WeakMap/prototype
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/built-ins/WeakMap/prototype
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/WeakMap/prototype')
-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-with-object-key-initial-iterable.js30
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry-with-object-key.js30
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry-with-symbol-key-initial-iterable.js38
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry-with-symbol-key.js41
-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-if-key-cannot-be-held-weakly.js23
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-when-object-key-not-present.js21
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-when-symbol-key-not-present.js25
-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-if-key-cannot-be-held-weakly.js39
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-undefined-with-object-key.js36
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-undefined-with-symbol-key.js37
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-value-with-object-key.js32
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-value-with-symbol-key.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-key-cannot-be-held-weakly.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-object-key-not-present.js25
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-symbol-key-not-present.js31
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-true-when-object-key-present.js21
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-true-when-symbol-key-present.js30
-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-object-element.js27
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/set/adds-symbol-element.js26
-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/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/set/throw-if-key-cannot-be-held-weakly.js38
-rw-r--r--js/src/tests/test262/built-ins/WeakMap/prototype/shell.js0
88 files changed, 2052 insertions, 0 deletions
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-with-object-key-initial-iterable.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry-with-object-key-initial-iterable.js
new file mode 100644
index 0000000000..dea167276f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry-with-object-key-initial-iterable.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakmap.prototype.delete
+description: >
+ Delete an entry with an Object key, added from initial iterable.
+info: |
+ WeakMap.prototype.delete ( _key_ )
+ 3. Let _entries_ be the List that is _M_.[[WeakMapData]].
+ 4. If CanBeHeldWeakly(_key_) is *false*, return *false*.
+ 5. For each Record {[[Key]], [[Value]]} _p_ of _entries_, do
+ 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*.
+features: [WeakMap]
+---*/
+
+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-with-object-key.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry-with-object-key.js
new file mode 100644
index 0000000000..be3d05ba31
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry-with-object-key.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakmap.prototype.delete
+description: >
+ Delete an entry with an Object key.
+info: |
+ WeakMap.prototype.delete ( _key_ )
+ 3. Let _entries_ be the List that is _M_.[[WeakMapData]].
+ 4. If CanBeHeldWeakly(_key_) is *false*, return *false*.
+ 5. For each Record {[[Key]], [[Value]]} _p_ of _entries_, do
+ 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*.
+features: [WeakMap]
+---*/
+
+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-entry-with-symbol-key-initial-iterable.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry-with-symbol-key-initial-iterable.js
new file mode 100644
index 0000000000..e84b4f0e05
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry-with-symbol-key-initial-iterable.js
@@ -0,0 +1,38 @@
+// |reftest| shell-option(--enable-symbols-as-weakmap-keys) skip-if(release_or_beta||!xulRuntime.shell) -- symbols-as-weakmap-keys is not released yet, requires shell-options
+// Copyright (C) 2022 Igalia, S.L. 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 with a Symbol key, added from initial iterable.
+info: |
+ WeakMap.prototype.delete ( _key_ )
+ 3. Let _entries_ be the List that is _M_.[[WeakMapData]].
+ 4. If CanBeHeldWeakly(_key_) is *false*, return *false*.
+ 5. For each Record {[[Key]], [[Value]]} _p_ of _entries_, do
+ 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*.
+features: [Symbol, WeakMap, symbols-as-weakmap-keys]
+---*/
+
+var foo = Symbol('a description');
+var bar = Symbol('a description');
+var map = new WeakMap([
+ [foo, 42],
+ [bar, 43],
+ [Symbol.hasInstance, 44],
+]);
+
+var result = map.delete(foo);
+assert(!map.has(foo), 'Regular symbol was deleted from map');
+assert(map.has(bar), "Symbols with the same description don't alias to each other");
+assert.sameValue(result, true, 'delete() returns true for regular symbol');
+
+result = map.delete(Symbol.hasInstance);
+assert(!map.has(Symbol.hasInstance), 'Well-known symbol was deleted from map');
+assert.sameValue(result, true, 'delete() returns true for well-known symbol');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry-with-symbol-key.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry-with-symbol-key.js
new file mode 100644
index 0000000000..9751b860c5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/delete-entry-with-symbol-key.js
@@ -0,0 +1,41 @@
+// |reftest| shell-option(--enable-symbols-as-weakmap-keys) skip-if(release_or_beta||!xulRuntime.shell) -- symbols-as-weakmap-keys is not released yet, requires shell-options
+// Copyright (C) 2022 Igalia, S.L. 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 with a Symbol key.
+info: |
+ WeakMap.prototype.delete ( _key_ )
+ 3. Let _entries_ be the List that is _M_.[[WeakMapData]].
+ 4. If CanBeHeldWeakly(_key_) is *false*, return *false*.
+ 5. For each Record {[[Key]], [[Value]]} _p_ of _entries_, do
+ 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*.
+features: [Symbol, WeakMap, symbols-as-weakmap-keys]
+---*/
+
+var foo = Symbol('a description');
+var bar = Symbol('a description');
+var map = new WeakMap();
+
+map.set(foo, 42);
+map.set(bar, 43);
+
+var result = map.delete(foo);
+
+assert(!map.has(foo), 'Regular symbol was deleted from map');
+assert(map.has(bar), "Symbols with the same description don't alias each other");
+assert.sameValue(result, true, 'delete() returns true for regular symbol');
+
+map.set(Symbol.hasInstance, 44);
+
+result = map.delete(Symbol.hasInstance);
+
+assert(!map.has(Symbol.hasInstance), 'Well-known symbol was deleted from map');
+assert.sameValue(result, true, 'delete() returns true for well-known symbol');
+
+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-if-key-cannot-be-held-weakly.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-if-key-cannot-be-held-weakly.js
new file mode 100644
index 0000000000..aea214c53c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-if-key-cannot-be-held-weakly.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 the key cannot be held weakly.
+info: |
+ WeakMap.prototype.delete ( _key_ )
+ 5. If CanBeHeldWeakly(_key_) is *false*, return *false*.
+features: [Symbol, WeakMap]
+---*/
+
+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.for('registered symbol')), false, 'registered symbol');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-when-object-key-not-present.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-when-object-key-not-present.js
new file mode 100644
index 0000000000..3ec2d9bebd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-when-object-key-not-present.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.prototype.delete
+description: >
+ Return false if an Object key is not in the WeakMap.
+info: |
+ WeakMap.prototype.delete ( _key_ )
+ 6. Return *false*.
+features: [WeakMap]
+---*/
+
+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/returns-false-when-symbol-key-not-present.js b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-when-symbol-key-not-present.js
new file mode 100644
index 0000000000..873b481212
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/delete/returns-false-when-symbol-key-not-present.js
@@ -0,0 +1,25 @@
+// |reftest| shell-option(--enable-symbols-as-weakmap-keys) skip-if(release_or_beta||!xulRuntime.shell) -- symbols-as-weakmap-keys is not released yet, requires shell-options
+// Copyright (C) 2022 Igalia, S.L. 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 a Symbol key is not in the WeakMap.
+info: |
+ WeakMap.prototype.delete ( _key_ )
+ 6. Return *false*.
+features: [Symbol, WeakMap, symbols-as-weakmap-keys]
+---*/
+
+var map = new WeakMap();
+var foo = Symbol('a description');
+var bar = Symbol('a description');
+var baz = Symbol('another description');
+
+map.set(foo, 42);
+
+assert.sameValue(map.delete(baz), false, 'Regular symbol key not present')
+assert.sameValue(map.delete(bar), false, "Symbols with the same description don't alias to each other");
+assert.sameValue(map.delete(Symbol.hasInstance), false, 'Well-known symbol key not present');
+
+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-if-key-cannot-be-held-weakly.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-undefined-if-key-cannot-be-held-weakly.js
new file mode 100644
index 0000000000..b05b51b67a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-undefined-if-key-cannot-be-held-weakly.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 cannot be held weakly.
+info: |
+ WeakMap.prototype.get ( _key_ )
+ 4. If CanBeHeldWeakly(_key_) is *false*, return *undefined*.
+features: [Symbol, WeakMap]
+---*/
+
+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.for('registered symbol')), undefined,
+ 'Returns undefined if key is a registered Symbol'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-undefined-with-object-key.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-undefined-with-object-key.js
new file mode 100644
index 0000000000..3a49d62d7f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-undefined-with-object-key.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakmap.prototype.get
+description: >
+ Returns undefined when an Object key is not on the WeakMap object.
+info: |
+ WeakMap.prototype.get ( _key_ )
+ 3. Let _entries_ be the List that is _M_.[[WeakMapData]].
+ 4. If CanBeHeldWeakly(_key_) is *false*, return *undefined*.
+ 5. For each Record {[[Key]], [[Value]]} _p_ of _entries_, do
+ a. If _p_.[[Key]] is not empty and SameValue(_p_.[[Key]], _key_) is *true*,
+ return _p_.[[Value]].
+ 6. Return *undefined*.
+features: [WeakMap]
+---*/
+
+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-undefined-with-symbol-key.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-undefined-with-symbol-key.js
new file mode 100644
index 0000000000..a4844b9244
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-undefined-with-symbol-key.js
@@ -0,0 +1,37 @@
+// |reftest| shell-option(--enable-symbols-as-weakmap-keys) skip-if(release_or_beta||!xulRuntime.shell) -- symbols-as-weakmap-keys is not released yet, requires shell-options
+// Copyright (C) 2022 Igalia, S.L. 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 a Symbol key is not on the WeakMap object.
+info: |
+ WeakMap.prototype.get ( _key_ )
+ 3. Let _entries_ be the List that is _M_.[[WeakMapData]].
+ 4. If CanBeHeldWeakly(_key_) is *false*, return *undefined*.
+ 5. For each Record {[[Key]], [[Value]]} _p_ of _entries_, do
+ a. If _p_.[[Key]] is not empty and SameValue(_p_.[[Key]], _key_) is *true*,
+ return _p_.[[Value]].
+ 6. Return *undefined*.
+features: [Symbol, WeakMap, symbols-as-weakmap-keys]
+---*/
+
+var map = new WeakMap();
+var key = Symbol('a description');
+
+assert.sameValue(map.get(key), undefined, 'returns undefined for regular symbol on initially empty map');
+assert.sameValue(
+ map.get(Symbol.hasInstance),
+ undefined,
+ 'returns undefined for well-known symbol on initially empty map'
+);
+
+map.set(key, 1);
+map.set(Symbol.hasInstance, 2);
+map.delete(key);
+map.delete(Symbol.hasInstance);
+
+assert.sameValue(map.get(key), undefined, 'returns undefined for deleted regular symbol');
+assert.sameValue(map.get(Symbol.hasInstance), undefined, 'returns undefined for deleted well-known symbol');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-value-with-object-key.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-value-with-object-key.js
new file mode 100644
index 0000000000..52875d308e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-value-with-object-key.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakmap.prototype.get
+description: >
+ Returns the value from the specified Object key
+info: |
+ WeakMap.prototype.get ( _key_ )
+ 3. Let _entries_ be the List that is _M_.[[WeakMapData]].
+ 4. If CanBeHeldWeakly(_key_) is *false*, return *undefined*.
+ 5. For each Record {[[Key]], [[Value]]} _p_ of _entries_, do
+ a. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is
+ *true*, return _p_.[[Value]].
+features: [WeakMap]
+---*/
+
+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/returns-value-with-symbol-key.js b/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-value-with-symbol-key.js
new file mode 100644
index 0000000000..e5af39eeee
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/get/returns-value-with-symbol-key.js
@@ -0,0 +1,35 @@
+// |reftest| shell-option(--enable-symbols-as-weakmap-keys) skip-if(release_or_beta||!xulRuntime.shell) -- symbols-as-weakmap-keys is not released yet, requires shell-options
+// Copyright (C) 2022 Igalia, S.L. 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 Symbol key
+info: |
+ WeakMap.prototype.get ( _key_ )
+ 3. Let _entries_ be the List that is _M_.[[WeakMapData]].
+ 4. If CanBeHeldWeakly(_key_) is *false*, return *undefined*.
+ 5. For each Record {[[Key]], [[Value]]} _p_ of _entries_, do
+ a. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is
+ *true*, return _p_.[[Value]].
+features: [Symbol, WeakMap, symbols-as-weakmap-keys]
+---*/
+
+var foo = Symbol('a description');
+var bar = Symbol('a description');
+var baz = Symbol('different description');
+var map = new WeakMap([
+ [foo, 0],
+]);
+
+assert.sameValue(map.get(foo), 0, 'Regular symbol as key, added in constructor');
+
+map.set(bar, 1);
+map.set(baz, 2);
+assert.sameValue(map.get(baz), 2, 'Regular symbol as key, added with set()');
+assert.sameValue(map.get(bar), 1, "Symbols with the same description don't overwrite each other");
+
+map.set(Symbol.hasInstance, 3);
+assert.sameValue(map.get(Symbol.hasInstance), 3, 'Well-known symbol as key');
+
+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-key-cannot-be-held-weakly.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-key-cannot-be-held-weakly.js
new file mode 100644
index 0000000000..c570a66518
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-key-cannot-be-held-weakly.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: >
+ Returns false if the key cannot be held weakly
+info: |
+ WeakMap.prototype.has ( _key_ )
+ 4. If CanBeHeldWeakly(_key_) is *false*, return *false*.
+features: [Symbol, WeakMap]
+---*/
+
+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.for('registered symbol')), false, 'Registered symbol not allowed as key');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-object-key-not-present.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-object-key-not-present.js
new file mode 100644
index 0000000000..a1fab07546
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-object-key-not-present.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: >
+ Return false when an Object key is not present in the WeakMap entries.
+info: |
+ WeakMap.prototype.has ( _key_ )
+ 6. Return *false*.
+features: [WeakMap]
+---*/
+
+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-false-when-symbol-key-not-present.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-symbol-key-not-present.js
new file mode 100644
index 0000000000..5f379d685a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-false-when-symbol-key-not-present.js
@@ -0,0 +1,31 @@
+// |reftest| shell-option(--enable-symbols-as-weakmap-keys) skip-if(release_or_beta||!xulRuntime.shell) -- symbols-as-weakmap-keys is not released yet, requires shell-options
+// Copyright (C) 2022 Igalia, S.L. 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 a Symbol key is not present in the WeakMap entries.
+info: |
+ WeakMap.prototype.has ( _key_ )
+ 6. Return *false*.
+features: [Symbol, WeakMap, symbols-as-weakmap-keys]
+---*/
+
+var foo = Symbol('a description');
+var bar = Symbol('a description');
+var map = new WeakMap();
+
+assert.sameValue(map.has(foo), false, 'Map is initially empty of regular symbol');
+assert.sameValue(map.has(Symbol.hasInstance), false, 'Map is initially empty of well-known symbol');
+
+map.set(foo, 1);
+assert.sameValue(map.has(bar), false, "Symbols with the same description don't alias each other");
+
+map.delete(foo);
+assert.sameValue(map.has(foo), false, 'Map is empty again of regular symbol after deleting');
+
+map.set(Symbol.hasInstance, 2);
+map.delete(Symbol.hasInstance);
+assert.sameValue(map.has(Symbol.hasInstance), false, 'Map is empty again of well-known symbol after deleting');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-true-when-object-key-present.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-true-when-object-key-present.js
new file mode 100644
index 0000000000..910a816609
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-true-when-object-key-present.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.prototype.has
+description: >
+ Returns true when an Object key is present in the WeakMap entries list.
+info: |
+ WeakMap.prototype.has ( _key_ )
+ 5. For each Record {[[Key]], [[Value]]} _p_ of _entries_, do
+ a. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is
+ *true*, return *true*.
+features: [WeakMap]
+---*/
+
+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/returns-true-when-symbol-key-present.js b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-true-when-symbol-key-present.js
new file mode 100644
index 0000000000..827543f947
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/has/returns-true-when-symbol-key-present.js
@@ -0,0 +1,30 @@
+// |reftest| shell-option(--enable-symbols-as-weakmap-keys) skip-if(release_or_beta||!xulRuntime.shell) -- symbols-as-weakmap-keys is not released yet, requires shell-options
+// Copyright (C) 2022 Igalia, S.L. 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 an Object key is present in the WeakMap entries list.
+info: |
+ WeakMap.prototype.has ( _key_ )
+ 5. For each Record {[[Key]], [[Value]]} _p_ of _entries_, do
+ a. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is
+ *true*, return *true*.
+features: [Symbol, WeakMap, symbols-as-weakmap-keys]
+---*/
+
+var foo = Symbol('a description');
+var bar = Symbol('a description');
+var map = new WeakMap();
+
+map.set(foo, 1);
+map.set(bar, 2);
+assert.sameValue(map.has(foo), true, "Regular symbol as key");
+
+map.delete(foo);
+assert.sameValue(map.has(bar), true, "Symbols with the same description don't alias each other");
+
+map.set(Symbol.hasInstance, 3);
+assert.sameValue(map.has(Symbol.hasInstance), true, "Well-known symbol as key");
+
+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-object-element.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/adds-object-element.js
new file mode 100644
index 0000000000..897b047e80
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/adds-object-element.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.set
+description: >
+ Adds a value with an Object key.
+info: |
+ WeakMap.prototype.set ( _key_, _value_ )
+ 6. Let _p_ be the Record {[[Key]]: _key_, [[Value]]: _value_}.
+ 7. Append _p_ as the last element of _entries_.
+features: [WeakMap]
+---*/
+
+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/adds-symbol-element.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/adds-symbol-element.js
new file mode 100644
index 0000000000..f23ea6b54f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/adds-symbol-element.js
@@ -0,0 +1,26 @@
+// |reftest| shell-option(--enable-symbols-as-weakmap-keys) skip-if(release_or_beta||!xulRuntime.shell) -- symbols-as-weakmap-keys is not released yet, requires shell-options
+// Copyright (C) 2022 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakmap.prototype.set
+description: Adds a value with a Symbol key.
+info: |
+ WeakMap.prototype.set ( _key_, _value_ )
+ 6. Let _p_ be the Record {[[Key]]: _key_, [[Value]]: _value_}.
+ 7. Append _p_ as the last element of _entries_.
+features: [Symbol, WeakMap, symbols-as-weakmap-keys]
+---*/
+
+var map = new WeakMap();
+var foo = Symbol('a description');
+var bar = Symbol('a description');
+
+map.set(foo, 1);
+map.set(bar, 2);
+map.set(Symbol.hasInstance, 3);
+
+assert(map.has(bar), 'Regular symbol as key');
+assert.sameValue(map.get(foo), 1, "Symbols with the same description don't overwrite each other");
+assert(map.has(Symbol.hasInstance), 'Well-known symbol as key');
+
+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/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/set/throw-if-key-cannot-be-held-weakly.js b/js/src/tests/test262/built-ins/WeakMap/prototype/set/throw-if-key-cannot-be-held-weakly.js
new file mode 100644
index 0000000000..ee115dae86
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakMap/prototype/set/throw-if-key-cannot-be-held-weakly.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakmap.prototype.set
+description: Throws TypeError if key cannot be held weakly.
+info: |
+ WeakMap.prototype.set ( _key_, _value_ )
+ 4. If CanBeHeldWeakly(_key_) is *false*, throw a *TypeError* exception.
+features: [Symbol, WeakMap]
+---*/
+
+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.for('registered symbol'), 1);
+}, 'Registered symbol not allowed as WeakMap key');
+
+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