summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Set/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/Set/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/Set/prototype')
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/Symbol.iterator.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/Symbol.iterator/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/Symbol.iterator/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/Symbol.iterator/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/Symbol.toStringTag.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/Symbol.toStringTag/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/Symbol.toStringTag/property-descriptor.js25
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/Symbol.toStringTag/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/add.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-array.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-map.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-object.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-set-prototype.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-weakset.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/length.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/name.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/preserves-insertion-order.js24
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/returns-this-when-ignoring-duplicate.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/returns-this.js18
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-boolean.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-null.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-number.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-string.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-symbol.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-undefined.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/will-not-add-duplicate-entry-initial-iterable.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/will-not-add-duplicate-entry-normalizes-zero.js31
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/add/will-not-add-duplicate-entry.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/clear.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/clears-all-contents-from-iterable.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/clears-all-contents.js30
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/clears-an-empty-set.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-array.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-map.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-object.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-set.prototype.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-weakset.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/length.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/name.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/returns-undefined.js17
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-boolean.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-null.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-number.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-string.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-symbol.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-undefined.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/constructor/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/constructor/set-prototype-constructor-intrinsic.js18
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/constructor/set-prototype-constructor.js17
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/constructor/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/delete-entry-initial-iterable.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/delete-entry-normalizes-zero.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/delete-entry.js32
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/delete.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-array.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-map.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-object.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-set-prototype.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-weakset.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/length.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/name.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/returns-false-when-delete-is-noop.js17
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/returns-true-when-delete-operation-occurs.js24
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-boolean.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-null.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-number.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-string.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-symbol.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-undefined.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/add-not-called.js30
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/allows-set-like-class.js38
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/allows-set-like-object.js36
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/array-throws.js20
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/builtins.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/called-with-object.js69
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/combines-Map.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/combines-empty-sets.js35
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/combines-itself.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/combines-same-sets.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/combines-sets.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/converts-negative-zero.js31
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/difference.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/has-is-callable.js39
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/keys-is-callable.js36
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/length.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/name.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/not-a-constructor.js25
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/receiver-not-set.js47
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/require-internal-slot.js30
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/result-order.js40
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/set-like-array.js29
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/set-like-class-mutation.js52
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/set-like-class-order.js143
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/size-is-a-number.js75
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/subclass-receiver-methods.js48
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/subclass-symbol-species.js32
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/difference/subclass.js26
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-array.js29
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-map.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-object.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-set-prototype.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-weakset.js29
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/entries.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/length.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/name.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator-empty.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator.js58
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-boolean.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-null.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-number.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-string.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-symbol.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-undefined.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-boolean.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-null.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-number.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-string.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-symbol.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-undefined.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-array.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-map.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-object.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-set-prototype.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-weakset.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/forEach.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-in-insertion-order.js31
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-in-iterable-entry-order.js29
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-values-added-after-foreach-begins.js44
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-values-deleted-then-readded.js47
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-values-not-deleted.js36
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-values-revisits-after-delete-re-add.js47
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/length.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/name.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/returns-undefined.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/this-arg-explicit-cannot-override-lexical-this-arrow.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/this-arg-explicit.js24
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/this-non-strict.js26
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-boolean.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-null.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-number.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-string.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-symbol.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-undefined.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/this-strict-strict.js26
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/forEach/throws-when-callback-throws.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-array.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-map.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-object.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-set-prototype.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-weakset.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/has.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/length.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/name.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-undefined-added-deleted-not-present-undefined.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-boolean.js17
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-nan.js17
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-null.js17
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-number.js17
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-string.js17
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-symbol.js18
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-undefined.js17
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-boolean.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-nan.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-null.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-number.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-string.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-symbol.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-undefined.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-boolean.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-null.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-number.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-string.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-symbol.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-undefined.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/add-not-called.js30
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/allows-set-like-class.js38
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/allows-set-like-object.js36
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/array-throws.js20
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/builtins.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/called-with-object.js69
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/combines-Map.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/combines-empty-sets.js35
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/combines-itself.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/combines-same-sets.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/combines-sets.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/converts-negative-zero.js31
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/has-is-callable.js39
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/intersection.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/keys-is-callable.js36
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/length.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/name.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/not-a-constructor.js25
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/receiver-not-set.js47
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/require-internal-slot.js30
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/result-order.js56
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/set-like-array.js29
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/set-like-class-mutation.js52
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/set-like-class-order.js143
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/size-is-a-number.js75
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/subclass-receiver-methods.js48
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/subclass-symbol-species.js32
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/intersection/subclass.js26
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/allows-set-like-class.js33
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/allows-set-like-object.js31
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/array-throws.js20
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/builtins.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/called-with-object.js69
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-Map.js18
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-empty-sets.js25
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-itself.js14
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-same-sets.js15
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-sets.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/converts-negative-zero.js25
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/has-is-callable.js39
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/isDisjointFrom.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/keys-is-callable.js36
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/length.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/name.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/not-a-constructor.js25
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/receiver-not-set.js47
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/require-internal-slot.js30
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/set-like-array.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/set-like-class-mutation.js41
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/set-like-class-order.js194
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/size-is-a-number.js75
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/subclass-receiver-methods.js40
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/allows-set-like-class.js34
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/allows-set-like-object.js32
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/array-throws.js20
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/builtins.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/called-with-object.js69
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-Map.js18
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-empty-sets.js25
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-itself.js14
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-same-sets.js15
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-sets.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/has-is-callable.js39
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/isSubsetOf.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/keys-is-callable.js36
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/length.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/name.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/not-a-constructor.js25
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/receiver-not-set.js47
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/require-internal-slot.js30
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/set-like-array.js24
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/set-like-class-mutation.js32
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/set-like-class-order.js124
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/size-is-a-number.js75
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/subclass-receiver-methods.js40
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/allows-set-like-class.js32
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/allows-set-like-object.js30
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/array-throws.js20
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/builtins.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/called-with-object.js69
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-Map.js18
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-empty-sets.js25
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-itself.js14
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-same-sets.js15
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-sets.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/converts-negative-zero.js25
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/has-is-callable.js39
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/isSupersetOf.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/keys-is-callable.js36
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/length.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/name.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/not-a-constructor.js25
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/receiver-not-set.js47
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/require-internal-slot.js30
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/set-like-array.js24
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/set-like-class-mutation.js33
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/set-like-class-order.js182
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/size-is-a-number.js75
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/subclass-receiver-methods.js40
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/keys/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/keys/keys.js17
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/keys/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/size/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/size/length.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/size/name.js25
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-before-after-add-delete.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-by-insertion.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-by-iterable.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/size/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/size/size.js29
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/add-not-called.js30
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/allows-set-like-class.js37
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/allows-set-like-object.js35
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/array-throws.js20
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/builtins.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/called-with-object.js69
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-Map.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-empty-sets.js35
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-itself.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-same-sets.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-sets.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/converts-negative-zero.js31
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/has-is-callable.js39
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/keys-is-callable.js36
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/length.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/name.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/not-a-constructor.js25
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/receiver-not-set.js47
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/require-internal-slot.js30
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/result-order.js26
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-array.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-class-mutation.js52
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-class-order.js169
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/size-is-a-number.js75
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/subclass-receiver-methods.js48
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/subclass-symbol-species.js32
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/subclass.js26
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/symmetricDifference.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/add-not-called.js30
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/allows-set-like-class.js37
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/allows-set-like-object.js35
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/appends-new-values.js33
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/array-throws.js20
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/builtins.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/called-with-object.js69
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/combines-Map.js22
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/combines-empty-sets.js35
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/combines-itself.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/combines-same-sets.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/combines-sets.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/converts-negative-zero.js38
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/has-is-callable.js39
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/keys-is-callable.js36
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/length.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/name.js21
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/not-a-constructor.js25
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/receiver-not-set.js47
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/require-internal-slot.js30
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/result-order.js39
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/set-like-array.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/set-like-class-mutation.js50
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/set-like-class-order.js121
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/size-is-a-number.js75
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/subclass-receiver-methods.js48
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/subclass-symbol-species.js32
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/subclass.js26
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/union/union.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-array.js29
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-map.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-object.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-set-prototype.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-weakset.js29
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/length.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/name.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/returns-iterator-empty.js16
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/returns-iterator.js43
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-boolean.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-null.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-number.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-string.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-symbol.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-undefined.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/values-iteration-mutable.js48
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/values/values.js23
395 files changed, 11058 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Set/prototype/Symbol.iterator.js b/js/src/tests/test262/built-ins/Set/prototype/Symbol.iterator.js
new file mode 100644
index 0000000000..d52cbf391e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/Symbol.iterator.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-set.prototype-@@iterator
+description: Initial state of the Symbol.iterator property
+info: |
+ The initial value of the @@iterator property is the same function object as
+ the initial value of the values property.
+
+ Per ES6 section 17, the method should exist on the Set prototype, and it
+ should be writable and configurable, but not enumerable.
+includes: [propertyHelper.js]
+features: [Symbol.iterator]
+---*/
+
+assert.sameValue(Set.prototype[Symbol.iterator], Set.prototype.values);
+verifyNotEnumerable(Set.prototype, Symbol.iterator);
+verifyWritable(Set.prototype, Symbol.iterator);
+verifyConfigurable(Set.prototype, Symbol.iterator);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/Symbol.iterator/browser.js b/js/src/tests/test262/built-ins/Set/prototype/Symbol.iterator/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/Symbol.iterator/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/Symbol.iterator/not-a-constructor.js b/js/src/tests/test262/built-ins/Set/prototype/Symbol.iterator/not-a-constructor.js
new file mode 100644
index 0000000000..8db788f9c0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/Symbol.iterator/not-a-constructor.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Set.prototype[Symbol.iterator] does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, Symbol, Symbol.iterator, Set, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(Set.prototype[Symbol.iterator]),
+ false,
+ 'isConstructor(Set.prototype[Symbol.iterator]) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let s = new Set([]); new s[Symbol.iterator]();
+}, '`let s = new Set([]); new s[Symbol.iterator]()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/Symbol.iterator/shell.js b/js/src/tests/test262/built-ins/Set/prototype/Symbol.iterator/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/Symbol.iterator/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/Symbol.toStringTag.js b/js/src/tests/test262/built-ins/Set/prototype/Symbol.toStringTag.js
new file mode 100644
index 0000000000..c1defb8041
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/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-set.prototype-@@tostringtag
+description: >
+ `Symbol.toStringTag` property descriptor
+info: |
+ The initial value of the @@toStringTag property is the String value
+ "Set".
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]:
+ false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [Symbol.toStringTag]
+---*/
+
+assert.sameValue(Set.prototype[Symbol.toStringTag], 'Set');
+
+verifyNotEnumerable(Set.prototype, Symbol.toStringTag);
+verifyNotWritable(Set.prototype, Symbol.toStringTag);
+verifyConfigurable(Set.prototype, Symbol.toStringTag);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/Symbol.toStringTag/browser.js b/js/src/tests/test262/built-ins/Set/prototype/Symbol.toStringTag/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/Symbol.toStringTag/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/Symbol.toStringTag/property-descriptor.js b/js/src/tests/test262/built-ins/Set/prototype/Symbol.toStringTag/property-descriptor.js
new file mode 100644
index 0000000000..5926763343
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/Symbol.toStringTag/property-descriptor.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-set.prototype-@@tostringtag
+description: >
+ `Object.prototype.getOwnPropertyDescriptor` should reflect the value and
+ writability of the @@toStringTag attribute.
+includes: [propertyHelper.js]
+features: [Symbol.toStringTag]
+---*/
+
+var SetProto = Object.getPrototypeOf(new Set());
+
+assert.sameValue(
+ SetProto[Symbol.toStringTag],
+ 'Set',
+ "The value of `SetProto[Symbol.toStringTag]` is `'Set'`"
+);
+
+verifyNotEnumerable(SetProto, Symbol.toStringTag);
+verifyNotWritable(SetProto, Symbol.toStringTag);
+verifyConfigurable(SetProto, Symbol.toStringTag);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/Symbol.toStringTag/shell.js b/js/src/tests/test262/built-ins/Set/prototype/Symbol.toStringTag/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/Symbol.toStringTag/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/add.js b/js/src/tests/test262/built-ins/Set/prototype/add/add.js
new file mode 100644
index 0000000000..159a0ef029
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/add.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-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof Set.prototype.add,
+ "function",
+ "`typeof Set.prototype.add` is `'function'`"
+);
+
+verifyNotEnumerable(Set.prototype, "add");
+verifyWritable(Set.prototype, "add");
+verifyConfigurable(Set.prototype, "add");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/browser.js b/js/src/tests/test262/built-ins/Set/prototype/add/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-array.js b/js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-array.js
new file mode 100644
index 0000000000..e28138f16f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-array.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-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.add.call([], 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.add.call([], 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-map.js b/js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-map.js
new file mode 100644
index 0000000000..4049431f04
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-map.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-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.add.call(new Map(), 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.add.call(new Map(), 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-object.js b/js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-object.js
new file mode 100644
index 0000000000..b40f08509a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-object.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.add.call({}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.add.call({}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-set-prototype.js b/js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-set-prototype.js
new file mode 100644
index 0000000000..373a9c8583
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-set-prototype.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-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.add.call(Set.prototype, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.add.call(Set.prototype, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-weakset.js b/js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-weakset.js
new file mode 100644
index 0000000000..42c33b2a27
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-weakset.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-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+features: [WeakSet]
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.add.call(new WeakSet(), 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.add.call(new WeakSet(), 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/length.js b/js/src/tests/test262/built-ins/Set/prototype/add/length.js
new file mode 100644
index 0000000000..88b79c7dae
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/length.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Set.prototype.add.length, 1, "The value of `Set.prototype.add.length` is `1`");
+
+verifyNotEnumerable(Set.prototype.add, "length");
+verifyNotWritable(Set.prototype.add, "length");
+verifyConfigurable(Set.prototype.add, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/name.js b/js/src/tests/test262/built-ins/Set/prototype/add/name.js
new file mode 100644
index 0000000000..f8f5441845
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/name.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-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Set.prototype.add.name, "add", "The value of `Set.prototype.add.name` is `'add'`");
+
+verifyNotEnumerable(Set.prototype.add, "name");
+verifyNotWritable(Set.prototype.add, "name");
+verifyConfigurable(Set.prototype.add, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/not-a-constructor.js b/js/src/tests/test262/built-ins/Set/prototype/add/not-a-constructor.js
new file mode 100644
index 0000000000..c1ba69377d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/not-a-constructor.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Set.prototype.add 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, Set, arrow-function]
+---*/
+
+assert.sameValue(isConstructor(Set.prototype.add), false, 'isConstructor(Set.prototype.add) must return false');
+
+assert.throws(TypeError, () => {
+ let s = new Set([]); new s.add();
+}, '`let s = new Set([]); new s.add()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/preserves-insertion-order.js b/js/src/tests/test262/built-ins/Set/prototype/add/preserves-insertion-order.js
new file mode 100644
index 0000000000..1cef6a0cc7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/preserves-insertion-order.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-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ ...
+ 7. Append value as the last element of entries.
+ ...
+---*/
+
+var s = new Set();
+var expects = [1, 2, 3];
+
+s.add(1).add(2).add(3);
+
+s.forEach(function(value) {
+ assert.sameValue(value, expects.shift());
+});
+
+assert.sameValue(expects.length, 0, "The value of `expects.length` is `0`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/returns-this-when-ignoring-duplicate.js b/js/src/tests/test262/built-ins/Set/prototype/add/returns-this-when-ignoring-duplicate.js
new file mode 100644
index 0000000000..5635af8eb6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/returns-this-when-ignoring-duplicate.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-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ 1. Let S be this value.
+ ...
+ 5. Repeat for each e that is an element of entries,
+ a. If e is not empty and SameValueZero(e, value) is true, then
+ i. Return S.
+ ...
+
+---*/
+
+var s = new Set([1]);
+
+assert.sameValue(s.add(1), s, "`s.add(1)` returns `s`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/returns-this.js b/js/src/tests/test262/built-ins/Set/prototype/add/returns-this.js
new file mode 100644
index 0000000000..da84ccde06
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/returns-this.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ 1. Let S be this value.
+ ...
+ 8. Return S.
+
+---*/
+
+var s = new Set();
+
+assert.sameValue(s.add(1), s, "`s.add(1)` returns `s`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/shell.js b/js/src/tests/test262/built-ins/Set/prototype/add/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-boolean.js b/js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-boolean.js
new file mode 100644
index 0000000000..f21abae912
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/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-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.add.call(false, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.add.call(false, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-null.js b/js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-null.js
new file mode 100644
index 0000000000..e99e6729d6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/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-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.add.call(null, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.add.call(null, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-number.js b/js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-number.js
new file mode 100644
index 0000000000..d5abae701c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/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-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.add.call(0, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.add.call(0, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-string.js b/js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-string.js
new file mode 100644
index 0000000000..bf2e69fc91
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/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-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.add.call("", 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.add.call("", 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-symbol.js b/js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-symbol.js
new file mode 100644
index 0000000000..5e6996de64
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/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-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.add.call(Symbol(), 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.add.call(Symbol(), 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-undefined.js b/js/src/tests/test262/built-ins/Set/prototype/add/this-not-object-throw-undefined.js
new file mode 100644
index 0000000000..3d301c001f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/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-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.add.call(undefined, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.add.call(undefined, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/will-not-add-duplicate-entry-initial-iterable.js b/js/src/tests/test262/built-ins/Set/prototype/add/will-not-add-duplicate-entry-initial-iterable.js
new file mode 100644
index 0000000000..5b078d29bb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/will-not-add-duplicate-entry-initial-iterable.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-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ ...
+ 4. Let entries be the List that is the value of S’s [[SetData]] internal slot.
+ 5. Repeat for each e that is an element of entries,
+ a. If e is not empty and SameValueZero(e, value) is true, then
+ i. Return S.
+ 6. If value is −0, let value be +0.
+ 7. Append value as the last element of entries.
+ ...
+
+---*/
+
+var s = new Set([1]);
+
+assert.sameValue(s.size, 1, "The value of `s.size` is `1`");
+
+s.add(1);
+
+assert.sameValue(s.size, 1, "The value of `s.size` is `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/will-not-add-duplicate-entry-normalizes-zero.js b/js/src/tests/test262/built-ins/Set/prototype/add/will-not-add-duplicate-entry-normalizes-zero.js
new file mode 100644
index 0000000000..9cc7167351
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/will-not-add-duplicate-entry-normalizes-zero.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ ...
+ 4. Let entries be the List that is the value of S’s [[SetData]] internal slot.
+ 5. Repeat for each e that is an element of entries,
+ a. If e is not empty and SameValueZero(e, value) is true, then
+ i. Return S.
+ 6. If value is −0, let value be +0.
+ 7. Append value as the last element of entries.
+ ...
+
+---*/
+
+var s = new Set([-0]);
+
+assert.sameValue(s.size, 1, "The value of `s.size` is `1`");
+
+s.add(-0);
+
+assert.sameValue(s.size, 1, "The value of `s.size` is `1`, after executing `s.add(-0)`");
+
+s.add(0);
+
+assert.sameValue(s.size, 1, "The value of `s.size` is `1`, after executing `s.add(0)`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/add/will-not-add-duplicate-entry.js b/js/src/tests/test262/built-ins/Set/prototype/add/will-not-add-duplicate-entry.js
new file mode 100644
index 0000000000..28d5c75759
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/add/will-not-add-duplicate-entry.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.add
+description: >
+ Set.prototype.add ( value )
+
+ ...
+ 4. Let entries be the List that is the value of S’s [[SetData]] internal slot.
+ 5. Repeat for each e that is an element of entries,
+ a. If e is not empty and SameValueZero(e, value) is true, then
+ i. Return S.
+ 6. If value is −0, let value be +0.
+ 7. Append value as the last element of entries.
+ ...
+
+---*/
+
+var s = new Set();
+
+assert.sameValue(s.size, 0, "The value of `s.size` is `0`");
+
+s.add(1);
+s.add(1);
+
+assert.sameValue(s.size, 1, "The value of `s.size` is `1`, after executing `s.add(1); s.add(1);`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/browser.js b/js/src/tests/test262/built-ins/Set/prototype/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/browser.js b/js/src/tests/test262/built-ins/Set/prototype/clear/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/clear.js b/js/src/tests/test262/built-ins/Set/prototype/clear/clear.js
new file mode 100644
index 0000000000..802c67227a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/clear.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof Set.prototype.clear,
+ "function",
+ "`typeof Set.prototype.clear` is `'function'`"
+);
+
+verifyNotEnumerable(Set.prototype, "clear");
+verifyWritable(Set.prototype, "clear");
+verifyConfigurable(Set.prototype, "clear");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/clears-all-contents-from-iterable.js b/js/src/tests/test262/built-ins/Set/prototype/clear/clears-all-contents-from-iterable.js
new file mode 100644
index 0000000000..5b0c5adbd4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/clears-all-contents-from-iterable.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ ...
+ 4. Let entries be the List that is the value of S’s [[SetData]] internal slot.
+ 5. Repeat for each e that is an element of entries,
+ a. Replace the element of entries whose value is e with an element whose value is empty.
+ ...
+
+---*/
+
+var s = new Set([1, 2, 3]);
+
+assert.sameValue(s.size, 3, "The value of `s.size` is `3`");
+
+var result = s.clear();
+
+assert.sameValue(s.size, 0, "The value of `s.size` is `0`, after executing `s.clear()`");
+assert.sameValue(s.has(1), false, "`s.has(1)` returns `false`");
+assert.sameValue(s.has(2), false, "`s.has(2)` returns `false`");
+assert.sameValue(s.has(3), false, "`s.has(3)` returns `false`");
+assert.sameValue(result, undefined, "The result of `s.clear()` is `undefined`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/clears-all-contents.js b/js/src/tests/test262/built-ins/Set/prototype/clear/clears-all-contents.js
new file mode 100644
index 0000000000..44c4ecf59b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/clears-all-contents.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-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ ...
+ 4. Let entries be the List that is the value of S’s [[SetData]] internal slot.
+ 5. Repeat for each e that is an element of entries,
+ a. Replace the element of entries whose value is e with an element whose value is empty.
+ ...
+
+---*/
+
+var s = new Set();
+
+s.add(1).add(2).add(3);
+
+assert.sameValue(s.size, 3, "The value of `s.size` is `3`");
+
+var result = s.clear();
+
+assert.sameValue(s.size, 0, "The value of `s.size` is `0`, after executing `s.clear()`");
+assert.sameValue(s.has(1), false, "`s.has(1)` returns `false`");
+assert.sameValue(s.has(2), false, "`s.has(2)` returns `false`");
+assert.sameValue(s.has(3), false, "`s.has(3)` returns `false`");
+assert.sameValue(result, undefined, "The result of `s.clear()` is `undefined`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/clears-an-empty-set.js b/js/src/tests/test262/built-ins/Set/prototype/clear/clears-an-empty-set.js
new file mode 100644
index 0000000000..47fe4dd05b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/clears-an-empty-set.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-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ ...
+ 4. Let entries be the List that is the value of S’s [[SetData]] internal slot.
+ 5. Repeat for each e that is an element of entries,
+ a. Replace the element of entries whose value is e with an element whose value is empty.
+ ...
+
+---*/
+
+var s = new Set();
+
+var result = s.clear();
+
+assert.sameValue(s.size, 0, "The value of `s.size` is `0`");
+assert.sameValue(result, undefined, "The result of `s.clear()` is `undefined`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-array.js b/js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-array.js
new file mode 100644
index 0000000000..a892c1d9d1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-array.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-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.clear.call([]);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.clear.call([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-map.js b/js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-map.js
new file mode 100644
index 0000000000..4177ce9c6d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-map.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-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.clear.call(new Map());
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.clear.call(new Map());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-object.js b/js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-object.js
new file mode 100644
index 0000000000..fc0ac57bd8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-object.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.clear.call({});
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.clear.call({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-set.prototype.js b/js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-set.prototype.js
new file mode 100644
index 0000000000..b13aee60b9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-set.prototype.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-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.clear.call(Set.prototype);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.clear.call(Set.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-weakset.js b/js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-weakset.js
new file mode 100644
index 0000000000..e693c1e5bd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-weakset.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-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+features: [WeakSet]
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.clear.call(new WeakSet());
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.clear.call(new WeakSet());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/length.js b/js/src/tests/test262/built-ins/Set/prototype/clear/length.js
new file mode 100644
index 0000000000..84e1dd1146
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/length.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Set.prototype.clear.length, 0, "The value of `Set.prototype.clear.length` is `0`");
+
+verifyNotEnumerable(Set.prototype.clear, "length");
+verifyNotWritable(Set.prototype.clear, "length");
+verifyConfigurable(Set.prototype.clear, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/name.js b/js/src/tests/test262/built-ins/Set/prototype/clear/name.js
new file mode 100644
index 0000000000..722a8af8f1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/name.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-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Set.prototype.clear.name, "clear", "The value of `Set.prototype.clear.name` is `'clear'`");
+
+verifyNotEnumerable(Set.prototype.clear, "name");
+verifyNotWritable(Set.prototype.clear, "name");
+verifyConfigurable(Set.prototype.clear, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/not-a-constructor.js b/js/src/tests/test262/built-ins/Set/prototype/clear/not-a-constructor.js
new file mode 100644
index 0000000000..16f0ebd97c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/not-a-constructor.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Set.prototype.clear does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, Set, arrow-function]
+---*/
+
+assert.sameValue(isConstructor(Set.prototype.clear), false, 'isConstructor(Set.prototype.clear) must return false');
+
+assert.throws(TypeError, () => {
+ let s = new Set([]); new s.clear();
+}, '`let s = new Set([]); new s.clear()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/returns-undefined.js b/js/src/tests/test262/built-ins/Set/prototype/clear/returns-undefined.js
new file mode 100644
index 0000000000..8857aa8a85
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/returns-undefined.js
@@ -0,0 +1,17 @@
+// 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-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ ...
+ 6. Return undefined.
+
+---*/
+
+var s = new Set();
+
+assert.sameValue(s.clear(), undefined, "`s.clear()` returns `undefined`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/shell.js b/js/src/tests/test262/built-ins/Set/prototype/clear/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-boolean.js b/js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-boolean.js
new file mode 100644
index 0000000000..8b8a18b1ca
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/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-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.clear.call(false);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.clear.call(false);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-null.js b/js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-null.js
new file mode 100644
index 0000000000..c21931f3e1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/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-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.clear.call(null);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.clear.call(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-number.js b/js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-number.js
new file mode 100644
index 0000000000..211fa883ff
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/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-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.clear.call(0);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.clear.call(0);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-string.js b/js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-string.js
new file mode 100644
index 0000000000..8097a19afa
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/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-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.clear.call("");
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.clear.call("");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-symbol.js b/js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-symbol.js
new file mode 100644
index 0000000000..3b284170fb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/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-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.clear.call(Symbol());
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.clear.call(Symbol());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-undefined.js b/js/src/tests/test262/built-ins/Set/prototype/clear/this-not-object-throw-undefined.js
new file mode 100644
index 0000000000..35b9fc665a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/clear/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-set.prototype.clear
+description: >
+ Set.prototype.clear ( )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.clear.call(undefined);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.clear.call(undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/constructor/browser.js b/js/src/tests/test262/built-ins/Set/prototype/constructor/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/constructor/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/constructor/set-prototype-constructor-intrinsic.js b/js/src/tests/test262/built-ins/Set/prototype/constructor/set-prototype-constructor-intrinsic.js
new file mode 100644
index 0000000000..356342fe06
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/constructor/set-prototype-constructor-intrinsic.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Set.prototype.constructor
+
+ The initial value of Set.prototype.constructor is the intrinsic object %Set%.
+
+---*/
+
+assert.sameValue(
+ Set.prototype.constructor,
+ Set,
+ "The value of `Set.prototype.constructor` is `Set`"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/constructor/set-prototype-constructor.js b/js/src/tests/test262/built-ins/Set/prototype/constructor/set-prototype-constructor.js
new file mode 100644
index 0000000000..0c48222b34
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/constructor/set-prototype-constructor.js
@@ -0,0 +1,17 @@
+// 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-ecmascript-standard-built-in-objects
+description: >
+ Set ( [ iterable ] )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+verifyNotEnumerable(Set.prototype, "constructor");
+verifyWritable(Set.prototype, "constructor");
+verifyConfigurable(Set.prototype, "constructor");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/constructor/shell.js b/js/src/tests/test262/built-ins/Set/prototype/constructor/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/constructor/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/browser.js b/js/src/tests/test262/built-ins/Set/prototype/delete/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/delete/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/delete-entry-initial-iterable.js b/js/src/tests/test262/built-ins/Set/prototype/delete/delete-entry-initial-iterable.js
new file mode 100644
index 0000000000..688b467b30
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/delete/delete-entry-initial-iterable.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ ...
+ 4. Let entries be the List that is the value of S’s [[SetData]] internal slot.
+ 5. Repeat for each e that is an element of entries,
+ a. If e is not empty and SameValueZero(e, value) is true, then
+ b. Replace the element of entries whose value is e with an element whose value is empty.
+ c. Return true.
+ ...
+
+
+---*/
+
+var s = new Set([1]);
+
+assert.sameValue(s.size, 1, "The value of `s.size` is `1`");
+
+var result = s.delete(1);
+
+assert.sameValue(s.size, 0, "The value of `s.size` is `0`, after executing `s.delete(1)`");
+assert.sameValue(result, true, "The result of `s.delete(1)` is `true`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/delete-entry-normalizes-zero.js b/js/src/tests/test262/built-ins/Set/prototype/delete/delete-entry-normalizes-zero.js
new file mode 100644
index 0000000000..fb17ea0e00
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/delete/delete-entry-normalizes-zero.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-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ ...
+ 4. Let entries be the List that is the value of S’s [[SetData]] internal slot.
+ 5. Repeat for each e that is an element of entries,
+ a. If e is not empty and SameValueZero(e, value) is true, then
+ b. Replace the element of entries whose value is e with an element whose value is empty.
+ c. Return true.
+ ...
+
+---*/
+
+var s = new Set([-0]);
+
+assert.sameValue(s.size, 1, "The value of `s.size` is `1`");
+
+var result = s.delete(+0);
+
+assert.sameValue(s.size, 0, "The value of `s.size` is `0`, after executing `s.delete(-0)`");
+assert.sameValue(result, true, "The result of `s.delete(+0)` is `true`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/delete-entry.js b/js/src/tests/test262/built-ins/Set/prototype/delete/delete-entry.js
new file mode 100644
index 0000000000..cc84a3a368
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/delete/delete-entry.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-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ ...
+ 4. Let entries be the List that is the value of S’s [[SetData]] internal slot.
+ 5. Repeat for each e that is an element of entries,
+ a. If e is not empty and SameValueZero(e, value) is true, then
+ i. Return S.
+ 6. If value is −0, let value be +0.
+ 7. Append value as the last element of entries.
+ ...
+
+---*/
+
+var s = new Set();
+
+assert.sameValue(s.size, 0, "The value of `s.size` is `0`");
+
+s.add(1);
+
+assert.sameValue(s.size, 1, "The value of `s.size` is `1`, after executing `s.add(1)`");
+
+var result = s.delete(1);
+
+assert.sameValue(s.size, 0, "The value of `s.size` is `0`, after executing `s.delete(1)`");
+assert.sameValue(result, true, "The result of `s.delete(1)` is `true`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/delete.js b/js/src/tests/test262/built-ins/Set/prototype/delete/delete.js
new file mode 100644
index 0000000000..1cea6e6103
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/delete/delete.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof Set.prototype.delete,
+ "function",
+ "`typeof Set.prototype.delete` is `'function'`"
+);
+
+verifyNotEnumerable(Set.prototype, "delete");
+verifyWritable(Set.prototype, "delete");
+verifyConfigurable(Set.prototype, "delete");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-array.js b/js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-array.js
new file mode 100644
index 0000000000..b69fc404d7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-array.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-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.delete.call([], 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.delete.call([], 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-map.js b/js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-map.js
new file mode 100644
index 0000000000..9ac5ce0e03
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-map.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-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.delete.call(new Map(), 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.delete.call(new Map(), 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-object.js b/js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-object.js
new file mode 100644
index 0000000000..0bf57e4ce0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-object.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.delete.call({}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.delete.call({}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-set-prototype.js b/js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-set-prototype.js
new file mode 100644
index 0000000000..6c564ec064
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-set-prototype.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-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.delete.call(Set.prototype, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.delete.call(Set.prototype, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-weakset.js b/js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-weakset.js
new file mode 100644
index 0000000000..60e1ef49e3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-weakset.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-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+features: [WeakSet]
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.delete.call(new WeakSet(), 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.delete.call(new WeakSet(), 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/length.js b/js/src/tests/test262/built-ins/Set/prototype/delete/length.js
new file mode 100644
index 0000000000..5d28a0ad40
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/delete/length.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Set.prototype.delete.length, 1, "The value of `Set.prototype.delete.length` is `1`");
+
+verifyNotEnumerable(Set.prototype.delete, "length");
+verifyNotWritable(Set.prototype.delete, "length");
+verifyConfigurable(Set.prototype.delete, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/name.js b/js/src/tests/test262/built-ins/Set/prototype/delete/name.js
new file mode 100644
index 0000000000..538d7b4370
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/delete/name.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-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Set.prototype.delete.name, "delete", "The value of `Set.prototype.delete.name` is `'delete'`");
+
+verifyNotEnumerable(Set.prototype.delete, "name");
+verifyNotWritable(Set.prototype.delete, "name");
+verifyConfigurable(Set.prototype.delete, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/not-a-constructor.js b/js/src/tests/test262/built-ins/Set/prototype/delete/not-a-constructor.js
new file mode 100644
index 0000000000..3c978d44f0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/delete/not-a-constructor.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Set.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, Set, arrow-function]
+---*/
+
+assert.sameValue(isConstructor(Set.prototype.delete), false, 'isConstructor(Set.prototype.delete) must return false');
+
+assert.throws(TypeError, () => {
+ let s = new Set([]); new s.delete();
+}, '`let s = new Set([]); new s.delete()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/returns-false-when-delete-is-noop.js b/js/src/tests/test262/built-ins/Set/prototype/delete/returns-false-when-delete-is-noop.js
new file mode 100644
index 0000000000..8a8e69e886
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/delete/returns-false-when-delete-is-noop.js
@@ -0,0 +1,17 @@
+// 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-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ ...
+ 6. Return false.
+
+---*/
+
+var s = new Set();
+
+assert.sameValue(s.delete(1), false, "`s.delete(1)` returns `false`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/returns-true-when-delete-operation-occurs.js b/js/src/tests/test262/built-ins/Set/prototype/delete/returns-true-when-delete-operation-occurs.js
new file mode 100644
index 0000000000..e622e9bc17
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/delete/returns-true-when-delete-operation-occurs.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-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ ...
+ 4. Let entries be the List that is the value of S’s [[SetData]] internal slot.
+ 5. Repeat for each e that is an element of entries,
+ a. If e is not empty and SameValueZero(e, value) is true, then
+ b. Replace the element of entries whose value is e with an element whose value is empty.
+ c. Return true.
+ ...
+
+---*/
+
+var s = new Set();
+
+s.add(1);
+
+assert.sameValue(s.delete(1), true, "`s.delete(1)` returns `true`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/shell.js b/js/src/tests/test262/built-ins/Set/prototype/delete/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/delete/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-boolean.js b/js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-boolean.js
new file mode 100644
index 0000000000..3f40763571
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/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-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.delete.call(false, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.delete.call(false, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-null.js b/js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-null.js
new file mode 100644
index 0000000000..11415e35c0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/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-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.delete.call(null, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.delete.call(null, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-number.js b/js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-number.js
new file mode 100644
index 0000000000..4dfc55488e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/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-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.delete.call(0, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.delete.call(0, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-string.js b/js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-string.js
new file mode 100644
index 0000000000..5d97d8fb2a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/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-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.delete.call("", 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.delete.call("", 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-symbol.js b/js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-symbol.js
new file mode 100644
index 0000000000..cf01f94cb3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/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-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.delete.call(Symbol(), 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.delete.call(Symbol(), 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-undefined.js b/js/src/tests/test262/built-ins/Set/prototype/delete/this-not-object-throw-undefined.js
new file mode 100644
index 0000000000..ffa90305f1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/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-set.prototype.delete
+description: >
+ Set.prototype.delete ( value )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.delete.call(undefined, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.delete.call(undefined, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/add-not-called.js b/js/src/tests/test262/built-ins/Set/prototype/difference/add-not-called.js
new file mode 100644
index 0000000000..18e9a9ada4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/add-not-called.js
@@ -0,0 +1,30 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference should not call Set.prototype.add
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [1];
+
+const originalAdd = Set.prototype.add;
+let count = 0;
+Set.prototype.add = function (...rest) {
+ count++;
+ return originalAdd.apply(this, rest);
+};
+
+const combined = s1.difference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(count, 0, "Add is never called");
+
+Set.prototype.add = originalAdd;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/allows-set-like-class.js b/js/src/tests/test262/built-ins/Set/prototype/difference/allows-set-like-class.js
new file mode 100644
index 0000000000..d10ceb5a05
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/allows-set-like-class.js
@@ -0,0 +1,38 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: GetSetRecord allows instances of Set-like classes
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+ 2. Let rawSize be ? Get(obj, "size").
+ ...
+ 7. Let has be ? Get(obj, "has").
+ ...
+ 9. Let keys be ? Get(obj, "keys").
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new class {
+ get size() {
+ return 2;
+ }
+ has(v) {
+ if (v === 1) return false;
+ if (v === 2) return true;
+ throw new Test262Error("Set.prototype.difference should only call its argument's has method with contents of this");
+ }
+ * keys() {
+ throw new Test262Error("Set.prototype.difference should not call its argument's keys iterator when this.size ≤ arg.size");
+ }
+};
+const expected = [1];
+const combined = s1.difference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/allows-set-like-object.js b/js/src/tests/test262/built-ins/Set/prototype/difference/allows-set-like-object.js
new file mode 100644
index 0000000000..486bfab5f4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/allows-set-like-object.js
@@ -0,0 +1,36 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: GetSetRecord allows Set-like objects
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+ 2. Let rawSize be ? Get(obj, "size").
+ ...
+ 7. Let has be ? Get(obj, "has").
+ ...
+ 9. Let keys be ? Get(obj, "keys").
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: (v) => {
+ if (v === 1) return false;
+ if (v === 2) return true;
+ throw new Test262Error("Set.prototype.difference should only call its argument's has method with contents of this");
+ },
+ keys: function* keys() {
+ throw new Test262Error("Set.prototype.difference should not call its argument's keys iterator when this.size ≤ arg.size");
+ },
+};
+const expected = [1];
+const combined = s1.difference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/array-throws.js b/js/src/tests/test262/built-ins/Set/prototype/difference/array-throws.js
new file mode 100644
index 0000000000..162bb8844f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/array-throws.js
@@ -0,0 +1,20 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference doesn't work with arrays
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = [3];
+assert.throws(
+ TypeError,
+ function () {
+ s1.difference(s2);
+ },
+ "Throws an error when an array is used"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/browser.js b/js/src/tests/test262/built-ins/Set/prototype/difference/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/builtins.js b/js/src/tests/test262/built-ins/Set/prototype/difference/builtins.js
new file mode 100644
index 0000000000..84e200f711
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/builtins.js
@@ -0,0 +1,28 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Tests that Set.prototype.difference meets the requirements for built-in objects
+features: [set-methods]
+---*/
+
+assert.sameValue(
+ Object.isExtensible(Set.prototype.difference),
+ true,
+ "Built-in objects must be extensible."
+);
+
+assert.sameValue(
+ Object.prototype.toString.call(Set.prototype.difference),
+ "[object Function]",
+ "Object.prototype.toString"
+);
+
+assert.sameValue(
+ Object.getPrototypeOf(Set.prototype.difference),
+ Function.prototype,
+ "prototype"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/called-with-object.js b/js/src/tests/test262/built-ins/Set/prototype/difference/called-with-object.js
new file mode 100644
index 0000000000..b00e0c4c3e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/called-with-object.js
@@ -0,0 +1,69 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws if obj is not an object
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+let s1 = new Set([1]);
+assert.throws(
+ TypeError,
+ function () {
+ s1.difference(1);
+ },
+ "number"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.difference("");
+ },
+ "string"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.difference(1n);
+ },
+ "bigint"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.difference(false);
+ },
+ "boolean"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.difference(undefined);
+ },
+ "undefined"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.difference(null);
+ },
+ "null"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.difference(Symbol("test"));
+ },
+ "symbol"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/combines-Map.js b/js/src/tests/test262/built-ins/Set/prototype/difference/combines-Map.js
new file mode 100644
index 0000000000..90095fe9e1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/combines-Map.js
@@ -0,0 +1,22 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference combines with Map
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const m1 = new Map([
+ [2, "two"],
+ [3, "three"],
+]);
+const expected = [1];
+const combined = s1.difference(m1);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/combines-empty-sets.js b/js/src/tests/test262/built-ins/Set/prototype/difference/combines-empty-sets.js
new file mode 100644
index 0000000000..1cf259d4eb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/combines-empty-sets.js
@@ -0,0 +1,35 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference can combine empty Sets
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([]);
+const s2 = new Set([1, 2]);
+let expected = [];
+let combined = s1.difference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+const s3 = new Set([1, 2]);
+const s4 = new Set([]);
+expected = [1, 2];
+combined = s3.difference(s4);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+const s5 = new Set([]);
+const s6 = new Set([]);
+expected = [];
+combined = s5.difference(s6);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/combines-itself.js b/js/src/tests/test262/built-ins/Set/prototype/difference/combines-itself.js
new file mode 100644
index 0000000000..ffc34313de
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/combines-itself.js
@@ -0,0 +1,19 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference is successful when called on itself
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const expected = [];
+const combined = s1.difference(s1);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(combined === s1, false, "The returned object is a new object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/combines-same-sets.js b/js/src/tests/test262/built-ins/Set/prototype/difference/combines-same-sets.js
new file mode 100644
index 0000000000..41365b05c5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/combines-same-sets.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference can combine Sets that have the same content
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([1, 2]);
+const expected = [];
+const combined = s1.difference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(combined === s1, false, "The returned object is a new object");
+assert.sameValue(combined === s2, false, "The returned object is a new object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/combines-sets.js b/js/src/tests/test262/built-ins/Set/prototype/difference/combines-sets.js
new file mode 100644
index 0000000000..856dc570ce
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/combines-sets.js
@@ -0,0 +1,19 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference combines Sets
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [1];
+const combined = s1.difference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/converts-negative-zero.js b/js/src/tests/test262/built-ins/Set/prototype/difference/converts-negative-zero.js
new file mode 100644
index 0000000000..68b33012cd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/converts-negative-zero.js
@@ -0,0 +1,31 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference converts -0𝔽 to +0𝔽
+info: |
+ 7.b.ii If nextValue is -0𝔽, set nextValue to +0𝔽.
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const setlikeWithMinusZero = {
+ size: 1,
+ has: function () {
+ throw new Test262Error("Set.prototype.difference should not call its argument's has method when this.size > arg.size");
+ },
+ keys: function () {
+ // we use an array here because the Set constructor would normalize away -0
+ return [-0].values();
+ },
+};
+
+const s1 = new Set([+0, 1]);
+let expected = [1];
+let combined = s1.difference(setlikeWithMinusZero);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/difference.js b/js/src/tests/test262/built-ins/Set/prototype/difference/difference.js
new file mode 100644
index 0000000000..a68a3313b5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/difference.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference properties
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+
+assert.sameValue(
+ typeof Set.prototype.difference,
+ "function",
+ "`typeof Set.prototype.difference` is `'function'`"
+);
+
+verifyProperty(Set.prototype, "difference", {
+ enumerable: false,
+ writable: true,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/has-is-callable.js b/js/src/tests/test262/built-ins/Set/prototype/difference/has-is-callable.js
new file mode 100644
index 0000000000..b7dfe4dd32
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/has-is-callable.js
@@ -0,0 +1,39 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object's 'has' property is not callable
+info: |
+ 7. Let has be ? Get(obj, "has").
+ 8. If IsCallable(has) is false, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: undefined,
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.difference(s2);
+ },
+ "GetSetRecord throws an error when has is undefined"
+);
+
+s2.has = {};
+assert.throws(
+ TypeError,
+ function () {
+ s1.difference(s2);
+ },
+ "GetSetRecord throws an error when has is not callable"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/keys-is-callable.js b/js/src/tests/test262/built-ins/Set/prototype/difference/keys-is-callable.js
new file mode 100644
index 0000000000..6162ee469f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/keys-is-callable.js
@@ -0,0 +1,36 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object's 'keys' property is not callable
+info: |
+ 9. Let keys be ? Get(obj, "keys").
+ 10. If IsCallable(keys) is false, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: () => {},
+ keys: undefined,
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.difference(s2);
+ },
+ "GetSetRecord throws an error when keys is undefined"
+);
+
+s2.keys = {};
+assert.throws(
+ TypeError,
+ function () {
+ s1.difference(s2);
+ },
+ "GetSetRecord throws an error when keys is not callable"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/length.js b/js/src/tests/test262/built-ins/Set/prototype/difference/length.js
new file mode 100644
index 0000000000..838c9704c3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/length.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference length property
+info: |
+ Set.prototype.difference ( other )
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+assert.sameValue(typeof Set.prototype.difference, "function");
+
+verifyProperty(Set.prototype.difference, "length", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 1,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/name.js b/js/src/tests/test262/built-ins/Set/prototype/difference/name.js
new file mode 100644
index 0000000000..056beed1a0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/name.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference name property
+info: |
+ Set.prototype.difference ( other )
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+assert.sameValue(typeof Set.prototype.difference, "function");
+
+verifyProperty(Set.prototype.difference, "name", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: "difference",
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/not-a-constructor.js b/js/src/tests/test262/built-ins/Set/prototype/difference/not-a-constructor.js
new file mode 100644
index 0000000000..eb8765cfb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/not-a-constructor.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference does not implement [[Construct]], is not new-able
+includes: [isConstructor.js]
+features: [Reflect.construct, set-methods]
+---*/
+
+assert.sameValue(
+ isConstructor(Set.prototype.difference),
+ false,
+ "isConstructor(Set.prototype.difference) must return false"
+);
+
+assert.throws(
+ TypeError,
+ () => {
+ new Set.prototype.difference();
+ },
+ "`new Set.prototype.difference()` throws TypeError"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/receiver-not-set.js b/js/src/tests/test262/built-ins/Set/prototype/difference/receiver-not-set.js
new file mode 100644
index 0000000000..83e66706af
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/receiver-not-set.js
@@ -0,0 +1,47 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference throws when receiver is not a Set
+features: [set-methods]
+---*/
+
+class MySetLike {
+ constructor() {
+ this.size = 2;
+ this.has = () => {};
+ this.keys = function* keys() {
+ yield 2;
+ yield 3;
+ };
+ }
+}
+
+const s1 = new MySetLike();
+const s2 = new Set();
+assert.throws(
+ TypeError,
+ () => {
+ Set.prototype.difference.call(s1, s2);
+ },
+ "Set-like class"
+);
+
+const s3 = {
+ size: 2,
+ has: () => {},
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ () => {
+ Set.prototype.difference.call(s3, s2);
+ },
+ "Set-like object"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/require-internal-slot.js b/js/src/tests/test262/built-ins/Set/prototype/difference/require-internal-slot.js
new file mode 100644
index 0000000000..4493e1a4cf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/require-internal-slot.js
@@ -0,0 +1,30 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference RequireInternalSlot
+info: |
+ 2. Perform ? RequireInternalSlot(O, [[SetData]])
+features: [set-methods]
+---*/
+
+const difference = Set.prototype.difference;
+
+assert.sameValue(typeof difference, "function");
+
+const realSet = new Set([]);
+
+assert.throws(TypeError, () => difference.call(undefined, realSet), "undefined");
+assert.throws(TypeError, () => difference.call(null, realSet), "null");
+assert.throws(TypeError, () => difference.call(true, realSet), "true");
+assert.throws(TypeError, () => difference.call("", realSet), "empty string");
+assert.throws(TypeError, () => difference.call(Symbol(), realSet), "symbol");
+assert.throws(TypeError, () => difference.call(1, realSet), "1");
+assert.throws(TypeError, () => difference.call(1n, realSet), "1n");
+assert.throws(TypeError, () => difference.call({}, realSet), "plain object");
+assert.throws(TypeError, () => difference.call([], realSet), "array");
+assert.throws(TypeError, () => difference.call(new Map(), realSet), "map");
+assert.throws(TypeError, () => difference.call(Set.prototype, realSet), "Set.prototype");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/result-order.js b/js/src/tests/test262/built-ins/Set/prototype/difference/result-order.js
new file mode 100644
index 0000000000..3db17f2413
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/result-order.js
@@ -0,0 +1,40 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference orders results as in this, regardless of sizes
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+{
+ const s1 = new Set([1, 2, 3, 4]);
+ const s2 = new Set([6, 5, 3, 2]);
+
+ assert.compareArray([...s1.difference(s2)], [1, 4]);
+}
+
+{
+ const s1 = new Set([6, 5, 3, 2]);
+ const s2 = new Set([1, 2, 3, 4]);
+
+ assert.compareArray([...s1.difference(s2)], [6, 5]);
+}
+
+{
+ const s1 = new Set([1, 2, 3, 4]);
+ const s2 = new Set([7, 6, 5, 3, 2]);
+
+ assert.compareArray([...s1.difference(s2)], [1, 4]);
+}
+
+{
+ const s1 = new Set([7, 6, 5, 3, 2]);
+ const s2 = new Set([1, 2, 3, 4]);
+
+ assert.compareArray([...s1.difference(s2)], [7, 6, 5]);
+}
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/set-like-array.js b/js/src/tests/test262/built-ins/Set/prototype/difference/set-like-array.js
new file mode 100644
index 0000000000..580902f126
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/set-like-array.js
@@ -0,0 +1,29 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference consumes a set-like array as a set-like, not an array
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = [5, 6];
+s2.size = 3;
+s2.has = function (v) {
+ if (v === 1) return false;
+ if (v === 2) return true;
+ throw new Test262Error("Set.prototype.difference should only call its argument's has method with contents of this");
+};
+s2.keys = function () {
+ throw new Test262Error("Set.prototype.difference should not call its argument's keys iterator when this.size ≤ arg.size");
+};
+
+const expected = [1];
+const combined = s1.difference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/set-like-class-mutation.js b/js/src/tests/test262/built-ins/Set/prototype/difference/set-like-class-mutation.js
new file mode 100644
index 0000000000..72790f6791
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/set-like-class-mutation.js
@@ -0,0 +1,52 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference maintains values even when a custom Set-like class mutates the receiver
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const baseSet = new Set(["a", "b", "c", "d", "e"]);
+
+function mutatingIterator() {
+ let index = 0;
+ let values = ["x", "b", "b"];
+ return {
+ next() {
+ if (index === 0) {
+ baseSet.delete("b");
+ baseSet.delete("c");
+ baseSet.add("b");
+ baseSet.add("d");
+ }
+ return {
+ done: index >= values.length,
+ value: values[index++],
+ };
+ },
+ };
+}
+
+const evilSetLike = {
+ size: 3,
+ get has() {
+ baseSet.add("q");
+ return function () {
+ throw new Test262Error("Set.prototype.difference should not invoke .has on its argument when this.size > other.size");
+ };
+ },
+ keys() {
+ return mutatingIterator();
+ },
+};
+
+const combined = baseSet.difference(evilSetLike);
+const expectedCombined = ["a", "c", "d", "e", "q"];
+assert.compareArray([...combined], expectedCombined);
+
+const expectedNewBase = ["a", "d", "e", "q", "b"];
+assert.compareArray([...baseSet], expectedNewBase);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/set-like-class-order.js b/js/src/tests/test262/built-ins/Set/prototype/difference/set-like-class-order.js
new file mode 100644
index 0000000000..170423f06e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/set-like-class-order.js
@@ -0,0 +1,143 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference calls a Set-like class's methods in order
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+let observedOrder = [];
+
+function observableIterator() {
+ let values = ["a", "b", "c"];
+ let index = 0;
+ return {
+ get next() {
+ observedOrder.push("getting next");
+ return function () {
+ observedOrder.push("calling next");
+ return {
+ get done() {
+ observedOrder.push("getting done");
+ return index >= values.length;
+ },
+ get value() {
+ observedOrder.push("getting value");
+ return values[index++];
+ },
+ };
+ };
+ },
+ };
+}
+
+class MySetLike {
+ get size() {
+ observedOrder.push("getting size");
+ return {
+ valueOf: function () {
+ observedOrder.push("ToNumber(size)");
+ return 3;
+ },
+ };
+ }
+ get has() {
+ observedOrder.push("getting has");
+ return function (v) {
+ observedOrder.push("calling has");
+ return ["a", "b", "c"].indexOf(v) !== -1;
+ };
+ }
+ get keys() {
+ observedOrder.push("getting keys");
+ return function () {
+ observedOrder.push("calling keys");
+ return observableIterator();
+ };
+ }
+}
+
+// this is smaller than argument
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "d"]);
+ const s2 = new MySetLike();
+ const combined = s1.difference(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ // two calls to has
+ "calling has",
+ "calling has",
+ ];
+
+ assert.compareArray([...combined], ["d"]);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is same size as argument
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "b", "d"]);
+ const s2 = new MySetLike();
+ const combined = s1.difference(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ // three calls to has
+ "calling has",
+ "calling has",
+ "calling has",
+ ];
+
+ assert.compareArray([...combined], ["d"]);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is larger than argument
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "b", "c", "d"]);
+ const s2 = new MySetLike();
+ const combined = s1.difference(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ "calling keys",
+ "getting next",
+ // first iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // second iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // third iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // fourth iteration, no value; ends
+ "calling next",
+ "getting done",
+ ];
+
+ assert.compareArray([...combined], ["d"]);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/shell.js b/js/src/tests/test262/built-ins/Set/prototype/difference/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/size-is-a-number.js b/js/src/tests/test262/built-ins/Set/prototype/difference/size-is-a-number.js
new file mode 100644
index 0000000000..1ec10b1bff
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/size-is-a-number.js
@@ -0,0 +1,75 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object has a size that is coerced to NaN
+info: |
+ 2. Let rawSize be ? Get(obj, "size").
+ 3. Let numSize be ? ToNumber(rawSize).
+ 4. NOTE: If rawSize is undefined, then numSize will be NaN.
+ 5. If numSize is NaN, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: undefined,
+ has: () => {},
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.difference(s2);
+ },
+ "GetSetRecord throws an error when size is undefined"
+);
+
+s2.size = NaN;
+assert.throws(
+ TypeError,
+ function () {
+ s1.difference(s2);
+ },
+ "GetSetRecord throws an error when size is NaN"
+);
+
+let coercionCalls = 0;
+s2.size = {
+ valueOf: function() {
+ ++coercionCalls;
+ return NaN;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.difference(s2);
+ },
+ "GetSetRecord throws an error when size coerces to NaN"
+);
+assert.sameValue(coercionCalls, 1, "GetSetRecord coerces size");
+
+s2.size = 0n;
+assert.throws(
+ TypeError,
+ function () {
+ s1.difference(s2);
+ },
+ "GetSetRecord throws an error when size is a BigInt"
+);
+
+s2.size = "string";
+assert.throws(
+ TypeError,
+ function () {
+ s1.difference(s2);
+ },
+ "GetSetRecord throws an error when size is a non-numeric string"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/subclass-receiver-methods.js b/js/src/tests/test262/built-ins/Set/prototype/difference/subclass-receiver-methods.js
new file mode 100644
index 0000000000..d8ab25bc02
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/subclass-receiver-methods.js
@@ -0,0 +1,48 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference works on subclasses of Set, but never calls the receiver's size/has/keys methods
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+let sizeCount = 0;
+let hasCount = 0;
+let keysCount = 0;
+
+class MySet extends Set {
+ size(...rest) {
+ sizeCount++;
+ return super.size(...rest);
+ }
+
+ has(...rest) {
+ hasCount++;
+ return super.has(...rest);
+ }
+
+ keys(...rest) {
+ keysCount++;
+ return super.keys(...rest);
+ }
+}
+
+const s1 = new MySet([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [1];
+const combined = s1.difference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(
+ combined instanceof MySet,
+ false,
+ "The returned object is a Set, not a subclass"
+);
+assert.sameValue(sizeCount, 0, "size should not be called on the receiver");
+assert.sameValue(hasCount, 0, "has should not be called on the receiver");
+assert.sameValue(keysCount, 0, "keys should not be called on the receiver");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/subclass-symbol-species.js b/js/src/tests/test262/built-ins/Set/prototype/difference/subclass-symbol-species.js
new file mode 100644
index 0000000000..28b4440fd5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/subclass-symbol-species.js
@@ -0,0 +1,32 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference works on subclasses of Set, but returns an instance of Set even when Symbol.species is overridden.
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+var count = 0;
+class MySet extends Set {
+ static get [Symbol.species]() {
+ count++;
+ return Set;
+ }
+}
+
+const s1 = new MySet([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [1];
+const combined = s1.difference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(count, 0, "Symbol.species is never called");
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(
+ combined instanceof MySet,
+ false,
+ "The returned object is a Set, not a subclass"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/difference/subclass.js b/js/src/tests/test262/built-ins/Set/prototype/difference/subclass.js
new file mode 100644
index 0000000000..a739a7d6b1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/difference/subclass.js
@@ -0,0 +1,26 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.difference
+description: Set.prototype.difference works on subclasses of Set, but returns an instance of Set
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+class MySet extends Set {}
+
+const s1 = new MySet([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [1];
+const combined = s1.difference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(
+ combined instanceof MySet,
+ false,
+ "The returned object is a Set, not a subclass"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/browser.js b/js/src/tests/test262/built-ins/Set/prototype/entries/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-array.js b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-array.js
new file mode 100644
index 0000000000..771d461f65
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-array.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.entries
+description: >
+ Set.prototype.entries ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "key+value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ ...
+ 2. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.entries.call([]);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.entries.call([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-map.js b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-map.js
new file mode 100644
index 0000000000..5326a8eb6b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-map.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.entries
+description: >
+ Set.prototype.entries ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "key+value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ ...
+ 2. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.entries.call(new Map());
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.entries.call(new Map());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-object.js b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-object.js
new file mode 100644
index 0000000000..37e0b7f7a4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-object.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.entries
+description: >
+ Set.prototype.entries ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "key+value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ ...
+ 2. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.entries.call({});
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.entries.call({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-set-prototype.js b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-set-prototype.js
new file mode 100644
index 0000000000..588d45aee6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-set-prototype.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.entries
+description: >
+ Set.prototype.entries ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "key+value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ ...
+ 2. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.entries.call(Set.prototype);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.entries.call(Set.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-weakset.js b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-weakset.js
new file mode 100644
index 0000000000..b8b7c97974
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-weakset.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.entries
+description: >
+ Set.prototype.entries ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "key+value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ ...
+ 2. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+features: [WeakSet]
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.entries.call(new WeakSet());
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.entries.call(new WeakSet());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/entries.js b/js/src/tests/test262/built-ins/Set/prototype/entries/entries.js
new file mode 100644
index 0000000000..2dc649d63a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/entries.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-set.prototype.entries
+description: >
+ Set.prototype.entries ( )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof Set.prototype.entries,
+ "function",
+ "`typeof Set.prototype.entries` is `'function'`"
+);
+
+verifyNotEnumerable(Set.prototype, "entries");
+verifyWritable(Set.prototype, "entries");
+verifyConfigurable(Set.prototype, "entries");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/length.js b/js/src/tests/test262/built-ins/Set/prototype/entries/length.js
new file mode 100644
index 0000000000..5f7ab9dd4c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/length.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.entries
+description: >
+ Set.prototype.entries ( )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Set.prototype.entries.length, 0, "The value of `Set.prototype.entries.length` is `0`");
+
+verifyNotEnumerable(Set.prototype.entries, "length");
+verifyNotWritable(Set.prototype.entries, "length");
+verifyConfigurable(Set.prototype.entries, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/name.js b/js/src/tests/test262/built-ins/Set/prototype/entries/name.js
new file mode 100644
index 0000000000..ffcfec6df1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/name.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-set.prototype.entries
+description: >
+ Set.prototype.entries ( )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Set.prototype.entries.name, "entries", "The value of `Set.prototype.entries.name` is `'entries'`");
+
+verifyNotEnumerable(Set.prototype.entries, "name");
+verifyNotWritable(Set.prototype.entries, "name");
+verifyConfigurable(Set.prototype.entries, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/not-a-constructor.js b/js/src/tests/test262/built-ins/Set/prototype/entries/not-a-constructor.js
new file mode 100644
index 0000000000..cd385a7077
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/not-a-constructor.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Set.prototype.entries does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, Set, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(Set.prototype.entries),
+ false,
+ 'isConstructor(Set.prototype.entries) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let s = new Set([]); new s.entries();
+}, '`let s = new Set([]); new s.entries()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator-empty.js b/js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator-empty.js
new file mode 100644
index 0000000000..306b48546f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator-empty.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-set.prototype.entries
+description: >
+ Set.prototype.entries ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "key+value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ ...
+ 7. Return iterator.
+
+
+---*/
+
+var set = new Set();
+var iterator = set.entries();
+var result = iterator.next();
+
+assert.sameValue(result.value, undefined, "The value of `result.value` is `undefined`");
+assert.sameValue(result.done, true, "The value of `result.done` is `true`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator.js b/js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator.js
new file mode 100644
index 0000000000..8193ffd31f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator.js
@@ -0,0 +1,58 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.entries
+description: >
+ Set.prototype.entries ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "key+value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ ...
+ 7. Return iterator.
+
+
+---*/
+
+var set = new Set();
+set.add(1);
+set.add(2);
+set.add(3);
+
+var iterator = set.entries();
+var result;
+
+result = iterator.next();
+assert.sameValue(result.value[0], 1, 'First result `value` ("key")');
+assert.sameValue(result.value[1], 1, 'First result `value` ("value")');
+assert.sameValue(result.value.length, 2, 'First result `value` (length)');
+assert.sameValue(result.done, false, 'First result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value[0], 2, 'Second result `value` ("key")');
+assert.sameValue(result.value[1], 2, 'Second result `value` ("value")');
+assert.sameValue(result.value.length, 2, 'Second result `value` (length)');
+assert.sameValue(result.done, false, 'Second result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value[0], 3, 'Third result `value` ("key")');
+assert.sameValue(result.value[1], 3, 'Third result `value` ("value")');
+assert.sameValue(result.value.length, 2, 'Third result `value` (length)');
+assert.sameValue(result.done, false, 'Third result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value, undefined, 'Exhausted result `value`');
+assert.sameValue(result.done, true, 'Exhausted result `done` flag');
+
+result = iterator.next();
+assert.sameValue(
+ result.value, undefined, 'Exhausted result `value` (repeated request)'
+);
+assert.sameValue(
+ result.done, true, 'Exhausted result `done` flag (repeated request)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/shell.js b/js/src/tests/test262/built-ins/Set/prototype/entries/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-boolean.js b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-boolean.js
new file mode 100644
index 0000000000..d3ebbfdc38
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-boolean.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.entries
+description: >
+ Set.prototype.entries ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "key+value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ 1. If Type(set) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.entries.call(false);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.entries.call(false);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-null.js b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-null.js
new file mode 100644
index 0000000000..93613ac76d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-null.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-set.prototype.entries
+description: >
+ Set.prototype.entries ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "key+value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ 1. If Type(set) is not Object, throw a TypeError exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.entries.call(null);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.entries.call(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-number.js b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-number.js
new file mode 100644
index 0000000000..6d03bbba3e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-number.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-set.prototype.entries
+description: >
+ Set.prototype.entries ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "key+value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ 1. If Type(set) is not Object, throw a TypeError exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.entries.call(0);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.entries.call(0);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-string.js b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-string.js
new file mode 100644
index 0000000000..8230c391d9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-string.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-set.prototype.entries
+description: >
+ Set.prototype.entries ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "key+value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ 1. If Type(set) is not Object, throw a TypeError exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.entries.call("");
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.entries.call("");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-symbol.js b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-symbol.js
new file mode 100644
index 0000000000..cddd8e20f3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-symbol.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.entries
+description: >
+ Set.prototype.entries ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "key+value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ 1. If Type(set) is not Object, throw a TypeError exception.
+ ...
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.entries.call(Symbol());
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.entries.call(Symbol());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-undefined.js b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-undefined.js
new file mode 100644
index 0000000000..cbae89d89d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-undefined.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.entries
+description: >
+ Set.prototype.entries ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "key+value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ 1. If Type(set) is not Object, throw a TypeError exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.entries.call(undefined);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.entries.call(undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/browser.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-boolean.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-boolean.js
new file mode 100644
index 0000000000..f24c6d0ade
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
+ ...
+
+ Passing `false` as callback
+
+---*/
+
+var s = new Set([1]);
+
+assert.throws(TypeError, function() {
+ s.forEach(false);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-null.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-null.js
new file mode 100644
index 0000000000..89b29d2737
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
+ ...
+
+ Passing `null` as callback
+
+---*/
+
+var s = new Set([1]);
+
+assert.throws(TypeError, function() {
+ s.forEach(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-number.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-number.js
new file mode 100644
index 0000000000..38740e4dd0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
+ ...
+
+ Passing `number` as callback
+
+---*/
+
+var s = new Set([1]);
+
+assert.throws(TypeError, function() {
+ s.forEach(0);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-string.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-string.js
new file mode 100644
index 0000000000..071fd839e2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
+ ...
+
+ Passing `string` as callback
+
+---*/
+
+var s = new Set([1]);
+
+assert.throws(TypeError, function() {
+ s.forEach("");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-symbol.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-symbol.js
new file mode 100644
index 0000000000..0fccfd438a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
+ ...
+
+ Passing `symbol` as callback
+
+features: [Symbol]
+---*/
+
+var s = new Set([1]);
+
+assert.throws(TypeError, function() {
+ s.forEach(Symbol());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-undefined.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-undefined.js
new file mode 100644
index 0000000000..40afeda4db
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/callback-not-callable-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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
+ ...
+
+ Passing `undefined` as callback
+
+---*/
+
+var s = new Set([1]);
+
+assert.throws(TypeError, function() {
+ s.forEach(undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-array.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-array.js
new file mode 100644
index 0000000000..d462ba579b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-array.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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.forEach.call([], function() {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.forEach.call([], function() {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-map.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-map.js
new file mode 100644
index 0000000000..50f6171e36
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-map.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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.forEach.call(new Map(), function() {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.forEach.call(new Map(), function() {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-object.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-object.js
new file mode 100644
index 0000000000..a8f2bb3d1e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-object.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.forEach.call({}, function() {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.forEach.call({}, function() {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-set-prototype.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-set-prototype.js
new file mode 100644
index 0000000000..8ec937a84c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-set-prototype.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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.forEach.call(Set.prototype, function() {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.forEach.call(Set.prototype, function() {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-weakset.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-weakset.js
new file mode 100644
index 0000000000..e407f5e46c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-weakset.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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+features: [WeakSet]
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.forEach.call(new WeakSet(), function() {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.forEach.call(new WeakSet(), function() {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/forEach.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/forEach.js
new file mode 100644
index 0000000000..e1ec73eb15
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/forEach.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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof Set.prototype.forEach,
+ "function",
+ "`typeof Set.prototype.forEach` is `'function'`"
+);
+
+verifyNotEnumerable(Set.prototype, "forEach");
+verifyWritable(Set.prototype, "forEach");
+verifyConfigurable(Set.prototype, "forEach");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-in-insertion-order.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-in-insertion-order.js
new file mode 100644
index 0000000000..594b2c0735
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-in-insertion-order.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 7. Repeat for each e that is an element of entries, in original insertion order
+ a. If e is not empty, then
+ i. Let funcResult be Call(callbackfn, T, «e, e, S»).
+ ii. ReturnIfAbrupt(funcResult).
+ ...
+---*/
+
+var s = new Set();
+var expects = [1, 2, 3];
+
+s.add(1).add(2).add(3);
+
+s.forEach(function(value, entry, set) {
+ var expect = expects.shift();
+
+ assert.sameValue(value, expect);
+ assert.sameValue(entry, expect);
+ assert.sameValue(set, s);
+});
+
+assert.sameValue(expects.length, 0, "The value of `expects.length` is `0`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-in-iterable-entry-order.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-in-iterable-entry-order.js
new file mode 100644
index 0000000000..920de93dff
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-in-iterable-entry-order.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 7. Repeat for each e that is an element of entries, in original insertion order
+ a. If e is not empty, then
+ i. Let funcResult be Call(callbackfn, T, «e, e, S»).
+ ii. ReturnIfAbrupt(funcResult).
+ ...
+---*/
+
+var expects = [1, 2, 3];
+var s = new Set(expects);
+
+s.forEach(function(value, entry, set) {
+ var expect = expects.shift();
+
+ assert.sameValue(value, expect);
+ assert.sameValue(entry, expect);
+ assert.sameValue(set, s);
+});
+
+assert.sameValue(expects.length, 0, "The value of `expects.length` is `0`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-values-added-after-foreach-begins.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-values-added-after-foreach-begins.js
new file mode 100644
index 0000000000..4a6eb0a13e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-values-added-after-foreach-begins.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 7. Repeat for each e that is an element of entries, in original insertion order
+ a. If e is not empty, then
+ i. Let funcResult be Call(callbackfn, T, «e, e, S»).
+ ii. ReturnIfAbrupt(funcResult).
+ ...
+
+ NOTE:
+
+ ...
+ New values added after the call to forEach begins are visited.
+
+---*/
+
+
+var s = new Set([1]);
+var expects = [1, 2, 3];
+
+s.forEach(function(value, entry, set) {
+ var expect = expects.shift();
+
+ if (value === 1) {
+ set.add(2);
+ }
+
+ if (value === 2) {
+ set.add(3);
+ }
+
+ assert.sameValue(value, expect);
+ assert.sameValue(entry, expect);
+ assert.sameValue(set, s);
+});
+
+assert.sameValue(expects.length, 0, "The value of `expects.length` is `0`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-values-deleted-then-readded.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-values-deleted-then-readded.js
new file mode 100644
index 0000000000..b764598d72
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-values-deleted-then-readded.js
@@ -0,0 +1,47 @@
+// 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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 7. Repeat for each e that is an element of entries, in original insertion order
+ a. If e is not empty, then
+ i. Let funcResult be Call(callbackfn, T, «e, e, S»).
+ ii. ReturnIfAbrupt(funcResult).
+ ...
+
+ NOTE:
+
+ ...
+ Values that are deleted after the call to forEach begins and before being visited are not visited unless the value is added again before the forEach call completes.
+ ...
+
+---*/
+
+
+var s = new Set([1, 2, 3]);
+var expects = [1, 3, 2];
+
+s.forEach(function(value, entry, set) {
+ var expect = expects.shift();
+
+ // Delete `2` before being visited
+ if (value === 1) {
+ set.delete(2);
+ }
+
+ // Re-add `2` before forEach call completes
+ if (value === 3) {
+ set.add(2);
+ }
+
+ assert.sameValue(value, expect);
+ assert.sameValue(entry, expect);
+ assert.sameValue(set, s);
+});
+
+assert.sameValue(expects.length, 0, "The value of `expects.length` is `0`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-values-not-deleted.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-values-not-deleted.js
new file mode 100644
index 0000000000..97f5bde079
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-values-not-deleted.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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 7. Repeat for each e that is an element of entries, in original insertion order
+ a. If e is not empty, then
+ i. Let funcResult be Call(callbackfn, T, «e, e, S»).
+ ii. ReturnIfAbrupt(funcResult).
+ ...
+
+ NOTE:
+
+ callbackfn should be a function that accepts three arguments. forEach calls callbackfn once for each value present in the set object, in value insertion order. callbackfn is called only for values of the Set which actually exist; it is not called for keys that have been deleted from the set.
+
+---*/
+
+var expects = [1, 3];
+var s = new Set([1, 2, 3]);
+
+s.delete(2);
+
+s.forEach(function(value, entry, set) {
+ var expect = expects.shift();
+
+ assert.sameValue(value, expect);
+ assert.sameValue(entry, expect);
+ assert.sameValue(set, s);
+});
+
+assert.sameValue(expects.length, 0, "`forEach` is not a no-op");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-values-revisits-after-delete-re-add.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-values-revisits-after-delete-re-add.js
new file mode 100644
index 0000000000..11de01c1be
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/iterates-values-revisits-after-delete-re-add.js
@@ -0,0 +1,47 @@
+// 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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 7. Repeat for each e that is an element of entries, in original insertion order
+ a. If e is not empty, then
+ i. Let funcResult be Call(callbackfn, T, «e, e, S»).
+ ii. ReturnIfAbrupt(funcResult).
+ ...
+
+ NOTE:
+
+ ...
+ a value will be revisited if it is deleted after it has been visited and then re-added before the forEach call completes.
+ ...
+
+---*/
+
+
+var s = new Set([1, 2, 3]);
+var expects = [1, 2, 3, 1];
+
+s.forEach(function(value, entry, set) {
+ var expect = expects.shift();
+
+ // Delete `1` after visit
+ if (value === 2) {
+ set.delete(1);
+ }
+
+ // Re-add `1`
+ if (value === 3) {
+ set.add(1);
+ }
+
+ assert.sameValue(value, expect);
+ assert.sameValue(entry, expect);
+ assert.sameValue(set, s);
+});
+
+assert.sameValue(expects.length, 0, "The value of `expects.length` is `0`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/length.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/length.js
new file mode 100644
index 0000000000..8304c78447
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/length.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ The length property of the forEach method is 1.
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Set.prototype.forEach.length, 1, "The value of `Set.prototype.forEach.length` is `1`");
+
+verifyNotEnumerable(Set.prototype.forEach, "length");
+verifyNotWritable(Set.prototype.forEach, "length");
+verifyConfigurable(Set.prototype.forEach, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/name.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/name.js
new file mode 100644
index 0000000000..390b016c64
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/name.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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Set.prototype.forEach.name, "forEach", "The value of `Set.prototype.forEach.name` is `'forEach'`");
+
+verifyNotEnumerable(Set.prototype.forEach, "name");
+verifyNotWritable(Set.prototype.forEach, "name");
+verifyConfigurable(Set.prototype.forEach, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/not-a-constructor.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/not-a-constructor.js
new file mode 100644
index 0000000000..96509bf80a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/not-a-constructor.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Set.prototype.forEach does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, Set, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(Set.prototype.forEach),
+ false,
+ 'isConstructor(Set.prototype.forEach) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let s = new Set([]); new s.forEach(() => {});
+}, '`let s = new Set([]); new s.forEach(() => {})` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/returns-undefined.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/returns-undefined.js
new file mode 100644
index 0000000000..27cac6eb45
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/returns-undefined.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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 8. Return undefined.
+
+---*/
+
+var s = new Set([1]);
+
+assert.sameValue(
+ s.forEach(function() {}),
+ undefined,
+ "`s.forEach(function() {})` returns `undefined`"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/shell.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/this-arg-explicit-cannot-override-lexical-this-arrow.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/this-arg-explicit-cannot-override-lexical-this-arrow.js
new file mode 100644
index 0000000000..7c20508936
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/this-arg-explicit-cannot-override-lexical-this-arrow.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ ...
+
+ An arrow function will ignore an explicit thisArg
+
+features: [arrow-function]
+---*/
+
+var s = new Set([1]);
+var usurper = {};
+var counter = 0;
+
+s.forEach(_ => {
+ assert.notSameValue(this, usurper, "`this` is not `usurper`");
+ counter++;
+}, usurper);
+
+assert.sameValue(counter, 1, "`forEach` is not a no-op");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/this-arg-explicit.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/this-arg-explicit.js
new file mode 100644
index 0000000000..dcae47e946
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/this-arg-explicit.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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ ...
+---*/
+
+var s = new Set([1]);
+var thisArg = {};
+var counter = 0;
+
+s.forEach(function() {
+ assert.sameValue(this, thisArg, "`this` is `thisArg`");
+ counter++;
+}, thisArg);
+
+assert.sameValue(counter, 1, "`forEach` is not a no-op");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/this-non-strict.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/this-non-strict.js
new file mode 100644
index 0000000000..b7d3a08faf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/this-non-strict.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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ ...
+
+flags: [noStrict]
+---*/
+
+var s = new Set([1]);
+var counter = 0;
+var globalObject = this;
+
+s.forEach(function() {
+ assert.sameValue(this, globalObject, "`this` is the global object in non-strict mode code");
+ counter++;
+});
+
+assert.sameValue(counter, 1, "`forEach` is not a no-op");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-boolean.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-boolean.js
new file mode 100644
index 0000000000..d06d23cec1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.forEach.call(false, function() {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.forEach.call(false, function() {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-null.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-null.js
new file mode 100644
index 0000000000..9fb0dd4177
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.forEach.call(null, function() {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.forEach.call(null, function() {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-number.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-number.js
new file mode 100644
index 0000000000..2ee877c8dc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.forEach.call(0, function() {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.forEach.call(0, function() {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-string.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-string.js
new file mode 100644
index 0000000000..0e12d3fdc5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.forEach.call("", function() {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.forEach.call("", function() {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-symbol.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-symbol.js
new file mode 100644
index 0000000000..acf72f3e03
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.forEach.call(Symbol(), function() {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.forEach.call(Symbol(), function() {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-undefined.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/this-not-object-throw-undefined.js
new file mode 100644
index 0000000000..cc97196396
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/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-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.forEach.call(undefined, function() {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.forEach.call(undefined, function() {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/this-strict-strict.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/this-strict-strict.js
new file mode 100644
index 0000000000..8360f34120
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/this-strict-strict.js
@@ -0,0 +1,26 @@
+'use strict';
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ ...
+
+flags: [onlyStrict]
+---*/
+
+var s = new Set([1]);
+var counter = 0;
+
+s.forEach(function() {
+ assert.sameValue(this, undefined, "`this` is `undefined` in strict mode code");
+ counter++;
+});
+
+assert.sameValue(counter, 1, "`forEach` is not a no-op");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/forEach/throws-when-callback-throws.js b/js/src/tests/test262/built-ins/Set/prototype/forEach/throws-when-callback-throws.js
new file mode 100644
index 0000000000..423b0d2fe5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/forEach/throws-when-callback-throws.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.forEach
+description: >
+ Set.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 7. Repeat for each e that is an element of entries, in original insertion order
+ a. If e is not empty, then
+ i. Let funcResult be Call(callbackfn, T, «e, e, S»).
+ ii. ReturnIfAbrupt(funcResult).
+ ...
+---*/
+
+var s = new Set([1]);
+var counter = 0;
+
+assert.throws(Error, function() {
+ s.forEach(function() {
+ counter++;
+ throw new Error();
+ });
+});
+
+assert.sameValue(counter, 1, "`forEach` is not a no-op");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/browser.js b/js/src/tests/test262/built-ins/Set/prototype/has/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-array.js b/js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-array.js
new file mode 100644
index 0000000000..3ae1b82da5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-array.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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.has.call([], 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.has.call([], 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-map.js b/js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-map.js
new file mode 100644
index 0000000000..1730d3589f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-map.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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.has.call(new Map(), 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.has.call(new Map(), 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-object.js b/js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-object.js
new file mode 100644
index 0000000000..ec257eb554
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-object.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.has.call({}, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.has.call({}, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-set-prototype.js b/js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-set-prototype.js
new file mode 100644
index 0000000000..aa82cb1ade
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-set-prototype.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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.has.call(Set.prototype, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.has.call(Set.prototype, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-weakset.js b/js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-weakset.js
new file mode 100644
index 0000000000..e2137cc903
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-weakset.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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+features: [WeakSet]
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.has.call(new WeakSet(), 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.has.call(new WeakSet(), 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/has.js b/js/src/tests/test262/built-ins/Set/prototype/has/has.js
new file mode 100644
index 0000000000..c8f3c054ae
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/has.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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof Set.prototype.has,
+ "function",
+ "`typeof Set.prototype.has` is `'function'`"
+);
+
+verifyNotEnumerable(Set.prototype, "has");
+verifyWritable(Set.prototype, "has");
+verifyConfigurable(Set.prototype, "has");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/length.js b/js/src/tests/test262/built-ins/Set/prototype/has/length.js
new file mode 100644
index 0000000000..93326a3565
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/length.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Set.prototype.has.length, 1, "The value of `Set.prototype.has.length` is `1`");
+
+verifyNotEnumerable(Set.prototype.has, "length");
+verifyNotWritable(Set.prototype.has, "length");
+verifyConfigurable(Set.prototype.has, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/name.js b/js/src/tests/test262/built-ins/Set/prototype/has/name.js
new file mode 100644
index 0000000000..c95b4ff0b5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/name.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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Set.prototype.has.name, "has", "The value of `Set.prototype.has.name` is `'has'`");
+
+verifyNotEnumerable(Set.prototype.has, "name");
+verifyNotWritable(Set.prototype.has, "name");
+verifyConfigurable(Set.prototype.has, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/not-a-constructor.js b/js/src/tests/test262/built-ins/Set/prototype/has/not-a-constructor.js
new file mode 100644
index 0000000000..8f41ff0c1f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/not-a-constructor.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Set.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, Set, arrow-function]
+---*/
+
+assert.sameValue(isConstructor(Set.prototype.has), false, 'isConstructor(Set.prototype.has) must return false');
+
+assert.throws(TypeError, () => {
+ let s = new Set([]); new s.has();
+}, '`let s = new Set([]); new s.has()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-undefined-added-deleted-not-present-undefined.js b/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-undefined-added-deleted-not-present-undefined.js
new file mode 100644
index 0000000000..4391df70be
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-undefined-added-deleted-not-present-undefined.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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 6. Return false.
+
+---*/
+
+var s = new Set();
+
+s.add(undefined);
+assert.sameValue(s.has(undefined), true, "`s.has(undefined)` returns `true`");
+
+var result = s.delete(undefined);
+
+assert.sameValue(s.has(undefined), false, "`s.has(undefined)` returns `false`");
+assert.sameValue(result, true, "The result of `s.delete(undefined)` is `true`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-boolean.js b/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-boolean.js
new file mode 100644
index 0000000000..366a694050
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-boolean.js
@@ -0,0 +1,17 @@
+// 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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 6. Return false.
+
+---*/
+
+var s = new Set();
+
+assert.sameValue(s.has(false), false, "`s.has(false)` returns `false`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-nan.js b/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-nan.js
new file mode 100644
index 0000000000..7ce69a5c8b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-nan.js
@@ -0,0 +1,17 @@
+// 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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 6. Return false.
+
+---*/
+
+var s = new Set();
+
+assert.sameValue(s.has(NaN), false, "`s.has(NaN)` returns `false`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-null.js b/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-null.js
new file mode 100644
index 0000000000..ddfada5bf3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-null.js
@@ -0,0 +1,17 @@
+// 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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 6. Return false.
+
+---*/
+
+var s = new Set();
+
+assert.sameValue(s.has(null), false, "`s.has(null)` returns `false`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-number.js b/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-number.js
new file mode 100644
index 0000000000..9075d36884
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-number.js
@@ -0,0 +1,17 @@
+// 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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 6. Return false.
+
+---*/
+
+var s = new Set();
+
+assert.sameValue(s.has(0), false, "`s.has(0)` returns `false`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-string.js b/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-string.js
new file mode 100644
index 0000000000..f244b2ee87
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-string.js
@@ -0,0 +1,17 @@
+// 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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 6. Return false.
+
+---*/
+
+var s = new Set();
+
+assert.sameValue(s.has(""), false, "`s.has('')` returns `false`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-symbol.js b/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-symbol.js
new file mode 100644
index 0000000000..8f974f799c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-symbol.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 6. Return false.
+
+features: [Symbol]
+---*/
+
+var s = new Set();
+
+assert.sameValue(s.has(Symbol()), false, "`s.has(Symbol())` returns `false`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-undefined.js b/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-undefined.js
new file mode 100644
index 0000000000..6863c7a53f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/returns-false-when-value-not-present-undefined.js
@@ -0,0 +1,17 @@
+// 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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 6. Return false.
+
+---*/
+
+var s = new Set();
+
+assert.sameValue(s.has(undefined), false, "`s.has(undefined)` returns `false`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-boolean.js b/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-boolean.js
new file mode 100644
index 0000000000..4809af3dc6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-boolean.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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 5. Repeat for each e that is an element of entries,
+ a. If e is not empty and SameValueZero(e, value) is true, return true.
+ ...
+
+---*/
+
+var s = new Set();
+
+s.add(false)
+
+assert.sameValue(s.has(false), true, "`s.has(false)` returns `true`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-nan.js b/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-nan.js
new file mode 100644
index 0000000000..dcc51d54e5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-nan.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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 5. Repeat for each e that is an element of entries,
+ a. If e is not empty and SameValueZero(e, value) is true, return true.
+ ...
+
+---*/
+
+var s = new Set();
+
+s.add(NaN)
+
+assert.sameValue(s.has(NaN), true, "`s.has(NaN)` returns `true`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-null.js b/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-null.js
new file mode 100644
index 0000000000..7c90fcd66f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-null.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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 5. Repeat for each e that is an element of entries,
+ a. If e is not empty and SameValueZero(e, value) is true, return true.
+ ...
+
+---*/
+
+var s = new Set();
+
+s.add(null)
+
+assert.sameValue(s.has(null), true, "`s.has(null)` returns `true`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-number.js b/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-number.js
new file mode 100644
index 0000000000..1831aaa35f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-number.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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 5. Repeat for each e that is an element of entries,
+ a. If e is not empty and SameValueZero(e, value) is true, return true.
+ ...
+
+---*/
+
+var s = new Set();
+
+s.add(0)
+
+assert.sameValue(s.has(0), true, "`s.has(0)` returns `true`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-string.js b/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-string.js
new file mode 100644
index 0000000000..938bcae841
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-string.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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 5. Repeat for each e that is an element of entries,
+ a. If e is not empty and SameValueZero(e, value) is true, return true.
+ ...
+
+---*/
+
+var s = new Set();
+
+s.add("")
+
+assert.sameValue(s.has(""), true, "`s.has('')` returns `true`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-symbol.js b/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-symbol.js
new file mode 100644
index 0000000000..f8c5b80400
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 5. Repeat for each e that is an element of entries,
+ a. If e is not empty and SameValueZero(e, value) is true, return true.
+ ...
+
+features: [Symbol]
+---*/
+
+var s = new Set();
+var a = Symbol();
+
+s.add(a)
+
+assert.sameValue(s.has(a), true, "`s.has(a)` returns `true`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-undefined.js b/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-undefined.js
new file mode 100644
index 0000000000..0f14f5c490
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/returns-true-when-value-present-undefined.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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ ...
+ 5. Repeat for each e that is an element of entries,
+ a. If e is not empty and SameValueZero(e, value) is true, return true.
+ ...
+
+---*/
+
+var s = new Set();
+
+s.add(undefined)
+
+assert.sameValue(s.has(undefined), true, "`s.has(undefined)` returns `true`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/shell.js b/js/src/tests/test262/built-ins/Set/prototype/has/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-boolean.js b/js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-boolean.js
new file mode 100644
index 0000000000..c954fa9572
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/has/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-set.prototype.has
+description: >
+ Set.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() {
+ Set.prototype.has.call(false, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.has.call(false, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-null.js b/js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-null.js
new file mode 100644
index 0000000000..150cb8fb83
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/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-set.prototype.has
+description: >
+ Set.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() {
+ Set.prototype.has.call(null, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.has.call(null, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-number.js b/js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-number.js
new file mode 100644
index 0000000000..067c2918bd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/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-set.prototype.has
+description: >
+ Set.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() {
+ Set.prototype.has.call(0, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.has.call(0, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-string.js b/js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-string.js
new file mode 100644
index 0000000000..e8f4b2ec5b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/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-set.prototype.has
+description: >
+ Set.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() {
+ Set.prototype.has.call("", 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.has.call("", 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-symbol.js b/js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-symbol.js
new file mode 100644
index 0000000000..8254cab357
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/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-set.prototype.has
+description: >
+ Set.prototype.has ( value )
+
+ 1. Let S be the this value.
+ 2. If Type(S) is not Object, throw a TypeError exception.
+
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.has.call(Symbol(), 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.has.call(Symbol(), 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-undefined.js b/js/src/tests/test262/built-ins/Set/prototype/has/this-not-object-throw-undefined.js
new file mode 100644
index 0000000000..bee6d27e3e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/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-set.prototype.has
+description: >
+ Set.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() {
+ Set.prototype.has.call(undefined, 1);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.has.call(undefined, 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/add-not-called.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/add-not-called.js
new file mode 100644
index 0000000000..dc75b2e0e1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/add-not-called.js
@@ -0,0 +1,30 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection should not call Set.prototype.add
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [2];
+
+const originalAdd = Set.prototype.add;
+let count = 0;
+Set.prototype.add = function (...rest) {
+ count++;
+ return originalAdd.apply(this, rest);
+};
+
+const combined = s1.intersection(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(count, 0, "Add is never called");
+
+Set.prototype.add = originalAdd;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/allows-set-like-class.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/allows-set-like-class.js
new file mode 100644
index 0000000000..0e8218d421
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/allows-set-like-class.js
@@ -0,0 +1,38 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: GetSetRecord allows instances of Set-like classes
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+ 2. Let rawSize be ? Get(obj, "size").
+ ...
+ 7. Let has be ? Get(obj, "has").
+ ...
+ 9. Let keys be ? Get(obj, "keys").
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new class {
+ get size() {
+ return 2;
+ }
+ has(v) {
+ if (v === 1) return false;
+ if (v === 2) return true;
+ throw new Test262Error("Set.prototype.intersection should only call its argument's has method with contents of this");
+ }
+ * keys() {
+ throw new Test262Error("Set.prototype.intersection should not call its argument's keys iterator when this.size ≤ arg.size");
+ }
+};
+const expected = [2];
+const combined = s1.intersection(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/allows-set-like-object.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/allows-set-like-object.js
new file mode 100644
index 0000000000..f108b29740
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/allows-set-like-object.js
@@ -0,0 +1,36 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: GetSetRecord allows Set-like objects
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+ 2. Let rawSize be ? Get(obj, "size").
+ ...
+ 7. Let has be ? Get(obj, "has").
+ ...
+ 9. Let keys be ? Get(obj, "keys").
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: (v) => {
+ if (v === 1) return false;
+ if (v === 2) return true;
+ throw new Test262Error("Set.prototype.intersection should only call its argument's has method with contents of this");
+ },
+ keys: function* keys() {
+ throw new Test262Error("Set.prototype.intersection should not call its argument's keys iterator when this.size ≤ arg.size");
+ },
+};
+const expected = [2];
+const combined = s1.intersection(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/array-throws.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/array-throws.js
new file mode 100644
index 0000000000..4685db47c2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/array-throws.js
@@ -0,0 +1,20 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection doesn't work with arrays
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = [3];
+assert.throws(
+ TypeError,
+ function () {
+ s1.intersection(s2);
+ },
+ "Throws an error when an array is used"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/browser.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/builtins.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/builtins.js
new file mode 100644
index 0000000000..4c1d0bf399
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/builtins.js
@@ -0,0 +1,28 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Tests that Set.prototype.intersection meets the requirements for built-in objects
+features: [set-methods]
+---*/
+
+assert.sameValue(
+ Object.isExtensible(Set.prototype.intersection),
+ true,
+ "Built-in objects must be extensible."
+);
+
+assert.sameValue(
+ Object.prototype.toString.call(Set.prototype.intersection),
+ "[object Function]",
+ "Object.prototype.toString"
+);
+
+assert.sameValue(
+ Object.getPrototypeOf(Set.prototype.intersection),
+ Function.prototype,
+ "prototype"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/called-with-object.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/called-with-object.js
new file mode 100644
index 0000000000..fa1acafd6c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/called-with-object.js
@@ -0,0 +1,69 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws if obj is not an object
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+let s1 = new Set([1]);
+assert.throws(
+ TypeError,
+ function () {
+ s1.intersection(1);
+ },
+ "number"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.intersection("");
+ },
+ "string"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.intersection(1n);
+ },
+ "bigint"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.intersection(false);
+ },
+ "boolean"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.intersection(undefined);
+ },
+ "undefined"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.intersection(null);
+ },
+ "null"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.intersection(Symbol("test"));
+ },
+ "symbol"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-Map.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-Map.js
new file mode 100644
index 0000000000..483210a159
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-Map.js
@@ -0,0 +1,22 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection combines with Map
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const m1 = new Map([
+ [2, "two"],
+ [3, "three"],
+]);
+const expected = [2];
+const combined = s1.intersection(m1);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-empty-sets.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-empty-sets.js
new file mode 100644
index 0000000000..ae67658ea8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-empty-sets.js
@@ -0,0 +1,35 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection can combine empty Sets
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([]);
+const s2 = new Set([1, 2]);
+let expected = [];
+let combined = s1.intersection(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+const s3 = new Set([1, 2]);
+const s4 = new Set([]);
+expected = [];
+combined = s3.intersection(s4);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+const s5 = new Set([]);
+const s6 = new Set([]);
+expected = [];
+combined = s5.intersection(s6);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-itself.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-itself.js
new file mode 100644
index 0000000000..f268c3f0e8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-itself.js
@@ -0,0 +1,19 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection is successful when called on itself
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const expected = [1, 2];
+const combined = s1.intersection(s1);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(combined === s1, false, "The returned object is a new object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-same-sets.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-same-sets.js
new file mode 100644
index 0000000000..099c95881e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-same-sets.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection can combine Sets that have the same content
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([1, 2]);
+const expected = [1, 2];
+const combined = s1.intersection(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(combined === s1, false, "The returned object is a new object");
+assert.sameValue(combined === s2, false, "The returned object is a new object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-sets.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-sets.js
new file mode 100644
index 0000000000..c2b7276488
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/combines-sets.js
@@ -0,0 +1,19 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection combines Sets
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [2];
+const combined = s1.intersection(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/converts-negative-zero.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/converts-negative-zero.js
new file mode 100644
index 0000000000..4eded4a10b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/converts-negative-zero.js
@@ -0,0 +1,31 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection converts -0𝔽 to +0𝔽
+info: |
+ 7.c.ii.2 If nextValue is -0𝔽, set nextValue to +0𝔽.
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const setlikeWithMinusZero = {
+ size: 1,
+ has: function () {
+ throw new Test262Error("Set.prototype.intersection should not invoke .has on its argument when this.size > arg.size");
+ },
+ keys: function () {
+ // we use an array here because the Set constructor would normalize away -0
+ return [-0].values();
+ },
+};
+
+const s1 = new Set([0, 1, 2]);
+let expected = [+0];
+let combined = s1.intersection(setlikeWithMinusZero);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/has-is-callable.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/has-is-callable.js
new file mode 100644
index 0000000000..5a90f12de7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/has-is-callable.js
@@ -0,0 +1,39 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object's 'has' property is not callable
+info: |
+ 7. Let has be ? Get(obj, "has").
+ 8. If IsCallable(has) is false, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: undefined,
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.intersection(s2);
+ },
+ "GetSetRecord throws an error when has is undefined"
+);
+
+s2.has = {};
+assert.throws(
+ TypeError,
+ function () {
+ s1.intersection(s2);
+ },
+ "GetSetRecord throws an error when has is not callable"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/intersection.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/intersection.js
new file mode 100644
index 0000000000..1dd257d322
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/intersection.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection properties
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+
+assert.sameValue(
+ typeof Set.prototype.intersection,
+ "function",
+ "`typeof Set.prototype.intersection` is `'function'`"
+);
+
+verifyProperty(Set.prototype, "intersection", {
+ enumerable: false,
+ writable: true,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/keys-is-callable.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/keys-is-callable.js
new file mode 100644
index 0000000000..3c1c9a3ed3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/keys-is-callable.js
@@ -0,0 +1,36 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object's 'keys' property is not callable
+info: |
+ 9. Let keys be ? Get(obj, "keys").
+ 10. If IsCallable(keys) is false, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: () => {},
+ keys: undefined,
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.intersection(s2);
+ },
+ "GetSetRecord throws an error when keys is undefined"
+);
+
+s2.keys = {};
+assert.throws(
+ TypeError,
+ function () {
+ s1.intersection(s2);
+ },
+ "GetSetRecord throws an error when keys is not callable"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/length.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/length.js
new file mode 100644
index 0000000000..132c53c627
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/length.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection length property
+info: |
+ Set.prototype.intersection ( other )
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+assert.sameValue(typeof Set.prototype.intersection, "function");
+
+verifyProperty(Set.prototype.intersection, "length", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 1,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/name.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/name.js
new file mode 100644
index 0000000000..031beaffc1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/name.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection name property
+info: |
+ Set.prototype.intersection ( other )
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+assert.sameValue(typeof Set.prototype.intersection, "function");
+
+verifyProperty(Set.prototype.intersection, "name", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: "intersection",
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/not-a-constructor.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/not-a-constructor.js
new file mode 100644
index 0000000000..0a8b82b058
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/not-a-constructor.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection does not implement [[Construct]], is not new-able
+includes: [isConstructor.js]
+features: [Reflect.construct, set-methods]
+---*/
+
+assert.sameValue(
+ isConstructor(Set.prototype.intersection),
+ false,
+ "isConstructor(Set.prototype.intersection) must return false"
+);
+
+assert.throws(
+ TypeError,
+ () => {
+ new Set.prototype.intersection();
+ },
+ "`new Set.prototype.intersection()` throws TypeError"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/receiver-not-set.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/receiver-not-set.js
new file mode 100644
index 0000000000..8be6d1fa4b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/receiver-not-set.js
@@ -0,0 +1,47 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection throws when receiver is not a Set
+features: [set-methods]
+---*/
+
+class MySetLike {
+ constructor() {
+ this.size = 2;
+ this.has = () => {};
+ this.keys = function* keys() {
+ yield 2;
+ yield 3;
+ };
+ }
+}
+
+const s1 = new MySetLike();
+const s2 = new Set();
+assert.throws(
+ TypeError,
+ () => {
+ Set.prototype.intersection.call(s1, s2);
+ },
+ "Set-like class"
+);
+
+const s3 = {
+ size: 2,
+ has: () => {},
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ () => {
+ Set.prototype.intersection.call(s3, s2);
+ },
+ "Set-like object"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/require-internal-slot.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/require-internal-slot.js
new file mode 100644
index 0000000000..e63cc02ac0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/require-internal-slot.js
@@ -0,0 +1,30 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection RequireInternalSlot
+info: |
+ 2. Perform ? RequireInternalSlot(O, [[SetData]])
+features: [set-methods]
+---*/
+
+const intersection = Set.prototype.intersection;
+
+assert.sameValue(typeof intersection, "function");
+
+const realSet = new Set([]);
+
+assert.throws(TypeError, () => intersection.call(undefined, realSet), "undefined");
+assert.throws(TypeError, () => intersection.call(null, realSet), "null");
+assert.throws(TypeError, () => intersection.call(true, realSet), "true");
+assert.throws(TypeError, () => intersection.call("", realSet), "empty string");
+assert.throws(TypeError, () => intersection.call(Symbol(), realSet), "symbol");
+assert.throws(TypeError, () => intersection.call(1, realSet), "1");
+assert.throws(TypeError, () => intersection.call(1n, realSet), "1n");
+assert.throws(TypeError, () => intersection.call({}, realSet), "plain object");
+assert.throws(TypeError, () => intersection.call([], realSet), "array");
+assert.throws(TypeError, () => intersection.call(new Map(), realSet), "map");
+assert.throws(TypeError, () => intersection.call(Set.prototype, realSet), "Set.prototype");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/result-order.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/result-order.js
new file mode 100644
index 0000000000..bf3cbf6f73
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/result-order.js
@@ -0,0 +1,56 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection result ordering
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+// when this.size ≤ other.size, results are ordered as in this
+{
+ const s1 = new Set([1, 3, 5]);
+ const s2 = new Set([3, 2, 1]);
+
+ assert.compareArray([...s1.intersection(s2)], [1, 3]);
+}
+
+{
+ const s1 = new Set([3, 2, 1]);
+ const s2 = new Set([1, 3, 5]);
+
+ assert.compareArray([...s1.intersection(s2)], [3, 1]);
+}
+
+{
+ const s1 = new Set([1, 3, 5]);
+ const s2 = new Set([3, 2, 1, 0]);
+
+ assert.compareArray([...s1.intersection(s2)], [1, 3]);
+}
+
+{
+ const s1 = new Set([3, 2, 1]);
+ const s2 = new Set([1, 3, 5, 7]);
+
+ assert.compareArray([...s1.intersection(s2)], [3, 1]);
+}
+
+
+// when this.size > other.size, results are ordered as in other
+{
+ const s1 = new Set([3, 2, 1, 0]);
+ const s2 = new Set([1, 3, 5]);
+
+ assert.compareArray([...s1.intersection(s2)], [1, 3]);
+}
+
+{
+ const s1 = new Set([1, 3, 5, 7]);
+ const s2 = new Set([3, 2, 1]);
+
+ assert.compareArray([...s1.intersection(s2)], [3, 1]);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/set-like-array.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/set-like-array.js
new file mode 100644
index 0000000000..b65b410f1c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/set-like-array.js
@@ -0,0 +1,29 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection consumes a set-like array as a set-like, not an array
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = [5, 6];
+s2.size = 3;
+s2.has = function (v) {
+ if (v === 1) return false;
+ if (v === 2) return true;
+ throw new Test262Error("Set.prototype.intersection should only call its argument's has method with contents of this");
+};
+s2.keys = function () {
+ throw new Test262Error("Set.prototype.intersection should not call its argument's keys iterator when this.size ≤ arg.size");
+};
+
+const expected = [2];
+const combined = s1.intersection(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/set-like-class-mutation.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/set-like-class-mutation.js
new file mode 100644
index 0000000000..feddea54e0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/set-like-class-mutation.js
@@ -0,0 +1,52 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection maintains values even when a custom Set-like class mutates the receiver
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const baseSet = new Set(["a", "b", "c", "d", "e"]);
+
+function mutatingIterator() {
+ let index = 0;
+ let values = ["x", "b", "b"];
+ return {
+ next() {
+ if (index === 0) {
+ baseSet.delete("b");
+ baseSet.delete("c");
+ baseSet.add("b");
+ baseSet.add("d");
+ }
+ return {
+ done: index >= values.length,
+ value: values[index++],
+ };
+ },
+ };
+}
+
+const evilSetLike = {
+ size: 3,
+ get has() {
+ baseSet.add("q");
+ return function () {
+ throw new Test262Error("Set.prototype.intersection should not invoke .has on its argument when this.size > other.size");
+ };
+ },
+ keys() {
+ return mutatingIterator();
+ },
+};
+
+const combined = baseSet.intersection(evilSetLike);
+const expectedCombined = ["b"];
+assert.compareArray([...combined], expectedCombined);
+
+const expectedNewBase = ["a", "d", "e", "q", "b"];
+assert.compareArray([...baseSet], expectedNewBase);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/set-like-class-order.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/set-like-class-order.js
new file mode 100644
index 0000000000..eec243a4e9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/set-like-class-order.js
@@ -0,0 +1,143 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection calls a Set-like class's methods in order
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+let observedOrder = [];
+
+function observableIterator() {
+ let values = ["a", "b", "c"];
+ let index = 0;
+ return {
+ get next() {
+ observedOrder.push("getting next");
+ return function () {
+ observedOrder.push("calling next");
+ return {
+ get done() {
+ observedOrder.push("getting done");
+ return index >= values.length;
+ },
+ get value() {
+ observedOrder.push("getting value");
+ return values[index++];
+ },
+ };
+ };
+ },
+ };
+}
+
+class MySetLike {
+ get size() {
+ observedOrder.push("getting size");
+ return {
+ valueOf: function () {
+ observedOrder.push("ToNumber(size)");
+ return 3;
+ },
+ };
+ }
+ get has() {
+ observedOrder.push("getting has");
+ return function (v) {
+ observedOrder.push("calling has");
+ return ["a", "b", "c"].indexOf(v) !== -1;
+ };
+ }
+ get keys() {
+ observedOrder.push("getting keys");
+ return function () {
+ observedOrder.push("calling keys");
+ return observableIterator();
+ };
+ }
+}
+
+// this is smaller than argument
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "d"]);
+ const s2 = new MySetLike();
+ const combined = s1.intersection(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ // two calls to has
+ "calling has",
+ "calling has",
+ ];
+
+ assert.compareArray([...combined], ["a"]);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is same size as argument
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "b", "d"]);
+ const s2 = new MySetLike();
+ const combined = s1.intersection(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ // three calls to has
+ "calling has",
+ "calling has",
+ "calling has",
+ ];
+
+ assert.compareArray([...combined], ["a", "b"]);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is larger than argument
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "b", "c", "d"]);
+ const s2 = new MySetLike();
+ const combined = s1.intersection(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ "calling keys",
+ "getting next",
+ // first iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // second iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // third iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // fourth iteration, no value; ends
+ "calling next",
+ "getting done",
+ ];
+
+ assert.compareArray([...combined], ["a", "b", "c"]);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/shell.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/size-is-a-number.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/size-is-a-number.js
new file mode 100644
index 0000000000..22fed88ed1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/size-is-a-number.js
@@ -0,0 +1,75 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object has a size that is coerced to NaN
+info: |
+ 2. Let rawSize be ? Get(obj, "size").
+ 3. Let numSize be ? ToNumber(rawSize).
+ 4. NOTE: If rawSize is undefined, then numSize will be NaN.
+ 5. If numSize is NaN, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: undefined,
+ has: () => {},
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.intersection(s2);
+ },
+ "GetSetRecord throws an error when size is undefined"
+);
+
+s2.size = NaN;
+assert.throws(
+ TypeError,
+ function () {
+ s1.intersection(s2);
+ },
+ "GetSetRecord throws an error when size is NaN"
+);
+
+let coercionCalls = 0;
+s2.size = {
+ valueOf: function() {
+ ++coercionCalls;
+ return NaN;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.intersection(s2);
+ },
+ "GetSetRecord throws an error when size coerces to NaN"
+);
+assert.sameValue(coercionCalls, 1, "GetSetRecord coerces size");
+
+s2.size = 0n;
+assert.throws(
+ TypeError,
+ function () {
+ s1.intersection(s2);
+ },
+ "GetSetRecord throws an error when size is a BigInt"
+);
+
+s2.size = "string";
+assert.throws(
+ TypeError,
+ function () {
+ s1.intersection(s2);
+ },
+ "GetSetRecord throws an error when size is a non-numeric string"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/subclass-receiver-methods.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/subclass-receiver-methods.js
new file mode 100644
index 0000000000..61febe306b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/subclass-receiver-methods.js
@@ -0,0 +1,48 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection works on subclasses of Set, but never calls the receiver's size/has/keys methods
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+let sizeCount = 0;
+let hasCount = 0;
+let keysCount = 0;
+
+class MySet extends Set {
+ size(...rest) {
+ sizeCount++;
+ return super.size(...rest);
+ }
+
+ has(...rest) {
+ hasCount++;
+ return super.has(...rest);
+ }
+
+ keys(...rest) {
+ keysCount++;
+ return super.keys(...rest);
+ }
+}
+
+const s1 = new MySet([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [2];
+const combined = s1.intersection(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(
+ combined instanceof MySet,
+ false,
+ "The returned object is a Set, not a subclass"
+);
+assert.sameValue(sizeCount, 0, "size should not be called on the receiver");
+assert.sameValue(hasCount, 0, "has should not be called on the receiver");
+assert.sameValue(keysCount, 0, "keys should not be called on the receiver");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/subclass-symbol-species.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/subclass-symbol-species.js
new file mode 100644
index 0000000000..ca5ff974ff
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/subclass-symbol-species.js
@@ -0,0 +1,32 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection works on subclasses of Set, but returns an instance of Set even when Symbol.species is overridden.
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+var count = 0;
+class MySet extends Set {
+ static get [Symbol.species]() {
+ count++;
+ return Set;
+ }
+}
+
+const s1 = new MySet([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [2];
+const combined = s1.intersection(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(count, 0, "Symbol.species is never called");
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(
+ combined instanceof MySet,
+ false,
+ "The returned object is a Set, not a subclass"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/intersection/subclass.js b/js/src/tests/test262/built-ins/Set/prototype/intersection/subclass.js
new file mode 100644
index 0000000000..5fae153a2b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/intersection/subclass.js
@@ -0,0 +1,26 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.intersection
+description: Set.prototype.intersection works on subclasses of Set, but returns an instance of Set
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+class MySet extends Set {}
+
+const s1 = new MySet([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [2];
+const combined = s1.intersection(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(
+ combined instanceof MySet,
+ false,
+ "The returned object is a Set, not a subclass"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/allows-set-like-class.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/allows-set-like-class.js
new file mode 100644
index 0000000000..fc5595273f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/allows-set-like-class.js
@@ -0,0 +1,33 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: GetSetRecord allows instances of Set-like classes
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+ 2. Let rawSize be ? Get(obj, "size").
+ ...
+ 7. Let has be ? Get(obj, "has").
+ ...
+ 9. Let keys be ? Get(obj, "keys").
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new class {
+ get size() {
+ return 2;
+ }
+ has(v) {
+ if (v === 1 || v === 2) return false;
+ throw new Test262Error("Set.prototype.isDisjointFrom should only call its argument's has method with contents of this");
+ }
+ * keys() {
+ throw new Test262Error("Set.prototype.isDisjointFrom should not call its argument's keys iterator when this.size ≤ arg.size");
+ }
+};
+
+assert.sameValue(s1.isDisjointFrom(s2), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/allows-set-like-object.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/allows-set-like-object.js
new file mode 100644
index 0000000000..8af2c03d12
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/allows-set-like-object.js
@@ -0,0 +1,31 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: GetSetRecord allows Set-like objects
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+ 2. Let rawSize be ? Get(obj, "size").
+ ...
+ 7. Let has be ? Get(obj, "has").
+ ...
+ 9. Let keys be ? Get(obj, "keys").
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: (v) => {
+ if (v === 1 || v === 2) return false;
+ throw new Test262Error("Set.prototype.isDisjointFrom should only call its argument's has method with contents of this");
+ },
+ keys: function* keys() {
+ throw new Test262Error("Set.prototype.isDisjointFrom should not call its argument's keys iterator when this.size ≤ arg.size");
+ },
+};
+
+assert.sameValue(s1.isDisjointFrom(s2), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/array-throws.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/array-throws.js
new file mode 100644
index 0000000000..50c4b05248
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/array-throws.js
@@ -0,0 +1,20 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Set.prototype.isDisjointFrom doesn't work with arrays
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = [3];
+assert.throws(
+ TypeError,
+ function () {
+ s1.isDisjointFrom(s2);
+ },
+ "Throws an error when an array is used"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/browser.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/builtins.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/builtins.js
new file mode 100644
index 0000000000..3483d7644f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/builtins.js
@@ -0,0 +1,28 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Tests that Set.prototype.isDisjointFrom meets the requirements for built-in objects
+features: [set-methods]
+---*/
+
+assert.sameValue(
+ Object.isExtensible(Set.prototype.isDisjointFrom),
+ true,
+ "Built-in objects must be extensible."
+);
+
+assert.sameValue(
+ Object.prototype.toString.call(Set.prototype.isDisjointFrom),
+ "[object Function]",
+ "Object.prototype.toString"
+);
+
+assert.sameValue(
+ Object.getPrototypeOf(Set.prototype.isDisjointFrom),
+ Function.prototype,
+ "prototype"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/called-with-object.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/called-with-object.js
new file mode 100644
index 0000000000..6b8a25bcb9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/called-with-object.js
@@ -0,0 +1,69 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws if obj is not an object
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+let s1 = new Set([1]);
+assert.throws(
+ TypeError,
+ function () {
+ s1.isDisjointFrom(1);
+ },
+ "number"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isDisjointFrom("");
+ },
+ "string"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isDisjointFrom(1n);
+ },
+ "bigint"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isDisjointFrom(false);
+ },
+ "boolean"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isDisjointFrom(undefined);
+ },
+ "undefined"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isDisjointFrom(null);
+ },
+ "null"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isDisjointFrom(Symbol("test"));
+ },
+ "symbol"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-Map.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-Map.js
new file mode 100644
index 0000000000..3737d7dbdf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-Map.js
@@ -0,0 +1,18 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Set.prototype.isDisjointFrom compares with Map
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const m1 = new Map([
+ [2, "two"],
+ [3, "three"],
+]);
+
+assert.sameValue(s1.isDisjointFrom(m1), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-empty-sets.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-empty-sets.js
new file mode 100644
index 0000000000..4138598a3a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-empty-sets.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Set.prototype.isDisjointFrom can compare empty Sets
+features: [set-methods]
+---*/
+
+const s1 = new Set([]);
+const s2 = new Set([1, 2]);
+
+assert.sameValue(s1.isDisjointFrom(s2), true);
+
+const s3 = new Set([1, 2]);
+const s4 = new Set([]);
+
+assert.sameValue(s3.isDisjointFrom(s4), true);
+
+const s5 = new Set([]);
+const s6 = new Set([]);
+
+assert.sameValue(s5.isDisjointFrom(s6), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-itself.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-itself.js
new file mode 100644
index 0000000000..a723e7c52c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-itself.js
@@ -0,0 +1,14 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Set.prototype.isDisjointFrom is successful when called on itself
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+
+assert.sameValue(s1.isDisjointFrom(s1), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-same-sets.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-same-sets.js
new file mode 100644
index 0000000000..60816cc776
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-same-sets.js
@@ -0,0 +1,15 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Set.prototype.isDisjointFrom can compare Sets that have the same content
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([1, 2]);
+
+assert.sameValue(s1.isDisjointFrom(s2), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-sets.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-sets.js
new file mode 100644
index 0000000000..d1900fa53d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/compares-sets.js
@@ -0,0 +1,19 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Set.prototype.isDisjointFrom compares Sets
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([2, 3]);
+
+assert.sameValue(s1.isDisjointFrom(s2), false);
+
+const s3 = new Set([3]);
+
+assert.sameValue(s1.isDisjointFrom(s3), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/converts-negative-zero.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/converts-negative-zero.js
new file mode 100644
index 0000000000..e6e6d4c65d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/converts-negative-zero.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Set.prototype.isDisjointFrom converts -0𝔽 to +0𝔽
+features: [set-methods]
+---*/
+
+const setlikeWithMinusZero = {
+ size: 1,
+ has: function () {
+ throw new Test262Error("Set.prototype.isDisjointFrom should not call its argument's has method when this.size > arg.size");
+ },
+ keys: function () {
+ // we use an array here because the Set constructor would normalize away -0
+ return [-0].values();
+ },
+};
+
+const s1 = new Set([+0, 1]);
+
+assert.sameValue(s1.isDisjointFrom(setlikeWithMinusZero), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/has-is-callable.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/has-is-callable.js
new file mode 100644
index 0000000000..263e45a40c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/has-is-callable.js
@@ -0,0 +1,39 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object's 'has' property is not callable
+info: |
+ 7. Let has be ? Get(obj, "has").
+ 8. If IsCallable(has) is false, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: undefined,
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isDisjointFrom(s2);
+ },
+ "GetSetRecord throws an error when has is undefined"
+);
+
+s2.has = {};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isDisjointFrom(s2);
+ },
+ "GetSetRecord throws an error when has is not callable"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/isDisjointFrom.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/isDisjointFrom.js
new file mode 100644
index 0000000000..f16f0c17a1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/isDisjointFrom.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Set.prototype.isDisjointFrom properties
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+
+assert.sameValue(
+ typeof Set.prototype.isDisjointFrom,
+ "function",
+ "`typeof Set.prototype.isDisjointFrom` is `'function'`"
+);
+
+verifyProperty(Set.prototype, "isDisjointFrom", {
+ enumerable: false,
+ writable: true,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/keys-is-callable.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/keys-is-callable.js
new file mode 100644
index 0000000000..735316fe94
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/keys-is-callable.js
@@ -0,0 +1,36 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object's 'keys' property is not callable
+info: |
+ 9. Let keys be ? Get(obj, "keys").
+ 10. If IsCallable(keys) is false, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: () => {},
+ keys: undefined,
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isDisjointFrom(s2);
+ },
+ "GetSetRecord throws an error when keys is undefined"
+);
+
+s2.keys = {};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isDisjointFrom(s2);
+ },
+ "GetSetRecord throws an error when keys is not callable"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/length.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/length.js
new file mode 100644
index 0000000000..0af5107ccb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/length.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Set.prototype.isDisjointFrom length property
+info: |
+ Set.prototype.isDisjointFrom ( other )
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+assert.sameValue(typeof Set.prototype.isDisjointFrom, "function");
+
+verifyProperty(Set.prototype.isDisjointFrom, "length", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 1,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/name.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/name.js
new file mode 100644
index 0000000000..0b686073de
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/name.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Set.prototype.isDisjointFrom name property
+info: |
+ Set.prototype.isDisjointFrom ( other )
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+assert.sameValue(typeof Set.prototype.isDisjointFrom, "function");
+
+verifyProperty(Set.prototype.isDisjointFrom, "name", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: "isDisjointFrom",
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/not-a-constructor.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/not-a-constructor.js
new file mode 100644
index 0000000000..bcb7d8f159
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/not-a-constructor.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Set.prototype.isDisjointFrom does not implement [[Construct]], is not new-able
+includes: [isConstructor.js]
+features: [Reflect.construct, set-methods]
+---*/
+
+assert.sameValue(
+ isConstructor(Set.prototype.isDisjointFrom),
+ false,
+ "isConstructor(Set.prototype.isDisjointFrom) must return false"
+);
+
+assert.throws(
+ TypeError,
+ () => {
+ new Set.prototype.isDisjointFrom();
+ },
+ "`new Set.prototype.isDisjointFrom()` throws TypeError"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/receiver-not-set.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/receiver-not-set.js
new file mode 100644
index 0000000000..f98f98c0e7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/receiver-not-set.js
@@ -0,0 +1,47 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Set.prototype.isDisjointFrom throws when receiver is not a Set
+features: [set-methods]
+---*/
+
+class MySetLike {
+ constructor() {
+ this.size = 2;
+ this.has = () => {};
+ this.keys = function* keys() {
+ yield 2;
+ yield 3;
+ };
+ }
+}
+
+const s1 = new MySetLike();
+const s2 = new Set();
+assert.throws(
+ TypeError,
+ () => {
+ Set.prototype.isDisjointFrom.call(s1, s2);
+ },
+ "Set-like class"
+);
+
+const s3 = {
+ size: 2,
+ has: () => {},
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ () => {
+ Set.prototype.isDisjointFrom.call(s3, s2);
+ },
+ "Set-like object"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/require-internal-slot.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/require-internal-slot.js
new file mode 100644
index 0000000000..95cfb33b06
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/require-internal-slot.js
@@ -0,0 +1,30 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Set.prototype.isDisjointFrom RequireInternalSlot
+info: |
+ 2. Perform ? RequireInternalSlot(O, [[SetData]])
+features: [set-methods]
+---*/
+
+const isDisjointFrom = Set.prototype.isDisjointFrom;
+
+assert.sameValue(typeof isDisjointFrom, "function");
+
+const realSet = new Set([]);
+
+assert.throws(TypeError, () => isDisjointFrom.call(undefined, realSet), "undefined");
+assert.throws(TypeError, () => isDisjointFrom.call(null, realSet), "null");
+assert.throws(TypeError, () => isDisjointFrom.call(true, realSet), "true");
+assert.throws(TypeError, () => isDisjointFrom.call("", realSet), "empty string");
+assert.throws(TypeError, () => isDisjointFrom.call(Symbol(), realSet), "symbol");
+assert.throws(TypeError, () => isDisjointFrom.call(1, realSet), "1");
+assert.throws(TypeError, () => isDisjointFrom.call(1n, realSet), "1n");
+assert.throws(TypeError, () => isDisjointFrom.call({}, realSet), "plain object");
+assert.throws(TypeError, () => isDisjointFrom.call([], realSet), "array");
+assert.throws(TypeError, () => isDisjointFrom.call(new Map(), realSet), "map");
+assert.throws(TypeError, () => isDisjointFrom.call(Set.prototype, realSet), "Set.prototype");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/set-like-array.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/set-like-array.js
new file mode 100644
index 0000000000..613026617b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/set-like-array.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Set.prototype.isDisjointFrom consumes a set-like array as a set-like, not an array
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = [5, 6];
+s2.size = 3;
+s2.has = function (v) {
+ if (v === 1 || v === 2) return true;
+ throw new Test262Error("Set.prototype.isDisjointFrom should only call its argument's has method with contents of this");
+};
+s2.keys = function () {
+ throw new Test262Error("Set.prototype.isDisjointFrom should not call its argument's keys iterator when this.size ≤ arg.size");
+};
+
+assert.sameValue(s1.isDisjointFrom(s2), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/set-like-class-mutation.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/set-like-class-mutation.js
new file mode 100644
index 0000000000..7b44bed58c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/set-like-class-mutation.js
@@ -0,0 +1,41 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Set.prototype.isDisjointFrom behavior when a custom Set-like class mutates the receiver
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const baseSet = new Set(["a", "b", "c"]);
+
+const evilSetLike = {
+ size: 3,
+ has(v) {
+ if (v === "a") {
+ baseSet.delete("b");
+ baseSet.delete("c");
+ baseSet.add("b");
+ return false;
+ }
+ if (v === "b") {
+ return false;
+ }
+ if (v === "c") {
+ throw new Test262Error("Set.prototype.isDisjointFrom should not call its argument's has method with values from this which have been deleted before visiting");
+ }
+ throw new Test262Error("Set.prototype.isDisjointFrom should only call its argument's has method with contents of this");
+ },
+ * keys() {
+ throw new Test262Error("Set.prototype.isDisjointFrom should not call its argument's keys iterator when this.size ≤ arg.size");
+ },
+};
+
+const result = baseSet.isDisjointFrom(evilSetLike);
+assert.sameValue(result, true);
+
+const expectedNewBase = ["a", "b"];
+assert.compareArray([...baseSet], expectedNewBase);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/set-like-class-order.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/set-like-class-order.js
new file mode 100644
index 0000000000..cc575ce6c5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/set-like-class-order.js
@@ -0,0 +1,194 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Set.prototype.isDisjointFrom calls a Set-like class's methods in order
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+let observedOrder = [];
+
+function observableIterator() {
+ let values = ["a", "b", "c"];
+ let index = 0;
+ return {
+ get next() {
+ observedOrder.push("getting next");
+ return function () {
+ observedOrder.push("calling next");
+ return {
+ get done() {
+ observedOrder.push("getting done");
+ return index >= values.length;
+ },
+ get value() {
+ observedOrder.push("getting value");
+ return values[index++];
+ },
+ };
+ };
+ },
+ };
+}
+
+class MySetLike {
+ get size() {
+ observedOrder.push("getting size");
+ return {
+ valueOf: function () {
+ observedOrder.push("ToNumber(size)");
+ return 3;
+ },
+ };
+ }
+ get has() {
+ observedOrder.push("getting has");
+ return function (v) {
+ observedOrder.push("calling has");
+ return ["a", "b", "c"].indexOf(v) !== -1;
+ };
+ }
+ get keys() {
+ observedOrder.push("getting keys");
+ return function () {
+ observedOrder.push("calling keys");
+ return observableIterator();
+ };
+ }
+}
+
+// this is smaller than argument
+{
+ observedOrder = [];
+
+ const s1 = new Set(["x", "b"]);
+ const s2 = new MySetLike();
+ const result = s1.isDisjointFrom(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ // two calls to has
+ "calling has",
+ "calling has",
+ ];
+
+ assert.sameValue(result, false);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is same size as argument - stops eagerly
+{
+ observedOrder = [];
+
+ const s1 = new Set(["x", "b", "y"]);
+ const s2 = new MySetLike();
+ const result = s1.isDisjointFrom(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ // two calls to has
+ "calling has",
+ "calling has",
+ ];
+
+ assert.sameValue(result, false);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is same size as argument - full run
+{
+ observedOrder = [];
+
+ const s1 = new Set(["x", "y", "z"]);
+ const s2 = new MySetLike();
+ const result = s1.isDisjointFrom(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ // three calls to has
+ "calling has",
+ "calling has",
+ "calling has",
+ ];
+
+ assert.sameValue(result, true);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is larger than argument - stops eagerly
+{
+ observedOrder = [];
+
+ const s1 = new Set(["x", "b", "y", "z"]);
+ const s2 = new MySetLike();
+ const result = s1.isDisjointFrom(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ "calling keys",
+ "getting next",
+ // first iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // second iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ ];
+
+ assert.sameValue(result, false);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is larger than argument - full run
+{
+ observedOrder = [];
+
+ const s1 = new Set(["x", "y", "z", "w"]);
+ const s2 = new MySetLike();
+ const result = s1.isDisjointFrom(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ "calling keys",
+ "getting next",
+ // first iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // second iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // third iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // fourth iteration, done
+ "calling next",
+ "getting done",
+ ];
+
+ assert.sameValue(result, true);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/shell.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/size-is-a-number.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/size-is-a-number.js
new file mode 100644
index 0000000000..857974f291
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/size-is-a-number.js
@@ -0,0 +1,75 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object has a size that is coerced to NaN
+info: |
+ 2. Let rawSize be ? Get(obj, "size").
+ 3. Let numSize be ? ToNumber(rawSize).
+ 4. NOTE: If rawSize is undefined, then numSize will be NaN.
+ 5. If numSize is NaN, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: undefined,
+ has: () => {},
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isDisjointFrom(s2);
+ },
+ "GetSetRecord throws an error when size is undefined"
+);
+
+s2.size = NaN;
+assert.throws(
+ TypeError,
+ function () {
+ s1.isDisjointFrom(s2);
+ },
+ "GetSetRecord throws an error when size is NaN"
+);
+
+let coercionCalls = 0;
+s2.size = {
+ valueOf: function() {
+ ++coercionCalls;
+ return NaN;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isDisjointFrom(s2);
+ },
+ "GetSetRecord throws an error when size coerces to NaN"
+);
+assert.sameValue(coercionCalls, 1, "GetSetRecord coerces size");
+
+s2.size = 0n;
+assert.throws(
+ TypeError,
+ function () {
+ s1.isDisjointFrom(s2);
+ },
+ "GetSetRecord throws an error when size is a BigInt"
+);
+
+s2.size = "string";
+assert.throws(
+ TypeError,
+ function () {
+ s1.isDisjointFrom(s2);
+ },
+ "GetSetRecord throws an error when size is a non-numeric string"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/subclass-receiver-methods.js b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/subclass-receiver-methods.js
new file mode 100644
index 0000000000..be19666d67
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isDisjointFrom/subclass-receiver-methods.js
@@ -0,0 +1,40 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.isdisjointfrom
+description: Set.prototype.isDisjointFrom works on subclasses of Set, but never calls the receiver's size/has/keys methods
+features: [set-methods]
+---*/
+
+let sizeCount = 0;
+let hasCount = 0;
+let keysCount = 0;
+
+class MySet extends Set {
+ size(...rest) {
+ sizeCount++;
+ return super.size(...rest);
+ }
+
+ has(...rest) {
+ hasCount++;
+ return super.has(...rest);
+ }
+
+ keys(...rest) {
+ keysCount++;
+ return super.keys(...rest);
+ }
+}
+
+const s1 = new MySet([1, 2]);
+const s2 = new Set([2, 3]);
+const result = s1.isDisjointFrom(s2);
+assert.sameValue(result, false);
+
+assert.sameValue(sizeCount, 0, "size should not be called on the receiver");
+assert.sameValue(hasCount, 0, "has should not be called on the receiver");
+assert.sameValue(keysCount, 0, "keys should not be called on the receiver");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/allows-set-like-class.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/allows-set-like-class.js
new file mode 100644
index 0000000000..3df596fab4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/allows-set-like-class.js
@@ -0,0 +1,34 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: GetSetRecord allows instances of Set-like classes
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+ 2. Let rawSize be ? Get(obj, "size").
+ ...
+ 7. Let has be ? Get(obj, "has").
+ ...
+ 9. Let keys be ? Get(obj, "keys").
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new class {
+ get size() {
+ return 3;
+ }
+ has(v) {
+ if (v === 1) return false;
+ if (v === 2) return true;
+ throw new Test262Error("Set.prototype.isSubsetOf should only call its argument's has method with contents of this");
+ }
+ * keys() {
+ throw new Test262Error("Set.prototype.isSubsetOf should not call its argument's keys iterator");
+ }
+};
+
+assert.sameValue(s1.isSubsetOf(s2), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/allows-set-like-object.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/allows-set-like-object.js
new file mode 100644
index 0000000000..c7e92f1ed6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/allows-set-like-object.js
@@ -0,0 +1,32 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: GetSetRecord allows Set-like objects
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+ 2. Let rawSize be ? Get(obj, "size").
+ ...
+ 7. Let has be ? Get(obj, "has").
+ ...
+ 9. Let keys be ? Get(obj, "keys").
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: (v) => {
+ if (v === 1) return false;
+ if (v === 2) return true;
+ throw new Test262Error("Set.prototype.isSubsetOf should only call its argument's has method with contents of this");
+ },
+ keys: function* keys() {
+ throw new Test262Error("Set.prototype.isSubsetOf should not call its argument's keys iterator");
+ },
+};
+
+assert.sameValue(s1.isSubsetOf(s2), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/array-throws.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/array-throws.js
new file mode 100644
index 0000000000..03c5562fe7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/array-throws.js
@@ -0,0 +1,20 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: Set.prototype.isSubsetOf doesn't work with arrays
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = [3];
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSubsetOf(s2);
+ },
+ "Throws an error when an array is used"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/browser.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/builtins.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/builtins.js
new file mode 100644
index 0000000000..fb5ee4ce4d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/builtins.js
@@ -0,0 +1,28 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: Tests that Set.prototype.isSubsetOf meets the requirements for built-in objects
+features: [set-methods]
+---*/
+
+assert.sameValue(
+ Object.isExtensible(Set.prototype.isSubsetOf),
+ true,
+ "Built-in objects must be extensible."
+);
+
+assert.sameValue(
+ Object.prototype.toString.call(Set.prototype.isSubsetOf),
+ "[object Function]",
+ "Object.prototype.toString"
+);
+
+assert.sameValue(
+ Object.getPrototypeOf(Set.prototype.isSubsetOf),
+ Function.prototype,
+ "prototype"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/called-with-object.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/called-with-object.js
new file mode 100644
index 0000000000..d276c13541
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/called-with-object.js
@@ -0,0 +1,69 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws if obj is not an object
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+let s1 = new Set([1]);
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSubsetOf(1);
+ },
+ "number"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSubsetOf("");
+ },
+ "string"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSubsetOf(1n);
+ },
+ "bigint"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSubsetOf(false);
+ },
+ "boolean"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSubsetOf(undefined);
+ },
+ "undefined"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSubsetOf(null);
+ },
+ "null"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSubsetOf(Symbol("test"));
+ },
+ "symbol"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-Map.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-Map.js
new file mode 100644
index 0000000000..c515742c03
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-Map.js
@@ -0,0 +1,18 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: Set.prototype.isSubsetOf compares with Map
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const m1 = new Map([
+ [2, "two"],
+ [3, "three"],
+]);
+
+assert.sameValue(s1.isSubsetOf(m1), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-empty-sets.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-empty-sets.js
new file mode 100644
index 0000000000..1656b35c13
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-empty-sets.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: Set.prototype.isSubsetOf can compare empty Sets
+features: [set-methods]
+---*/
+
+const s1 = new Set([]);
+const s2 = new Set([1, 2]);
+
+assert.sameValue(s1.isSubsetOf(s2), true);
+
+const s3 = new Set([1, 2]);
+const s4 = new Set([]);
+
+assert.sameValue(s3.isSubsetOf(s4), false);
+
+const s5 = new Set([]);
+const s6 = new Set([]);
+
+assert.sameValue(s5.isSubsetOf(s6), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-itself.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-itself.js
new file mode 100644
index 0000000000..7431c9e9fc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-itself.js
@@ -0,0 +1,14 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: Set.prototype.isSubsetOf is successful when called on itself
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+
+assert.sameValue(s1.isSubsetOf(s1), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-same-sets.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-same-sets.js
new file mode 100644
index 0000000000..3ebcad9379
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-same-sets.js
@@ -0,0 +1,15 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: Set.prototype.isSubsetOf can compare Sets that have the same content
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([1, 2]);
+
+assert.sameValue(s1.isSubsetOf(s2), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-sets.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-sets.js
new file mode 100644
index 0000000000..7a93be8b57
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/compares-sets.js
@@ -0,0 +1,19 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: Set.prototype.isSubsetOf compares Sets
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([2, 3]);
+
+assert.sameValue(s1.isSubsetOf(s2), false);
+
+const s3 = new Set([1, 2, 3]);
+
+assert.sameValue(s1.isSubsetOf(s3), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/has-is-callable.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/has-is-callable.js
new file mode 100644
index 0000000000..a272bff61f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/has-is-callable.js
@@ -0,0 +1,39 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object's 'has' property is not callable
+info: |
+ 7. Let has be ? Get(obj, "has").
+ 8. If IsCallable(has) is false, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: undefined,
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSubsetOf(s2);
+ },
+ "GetSetRecord throws an error when has is undefined"
+);
+
+s2.has = {};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSubsetOf(s2);
+ },
+ "GetSetRecord throws an error when has is not callable"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/isSubsetOf.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/isSubsetOf.js
new file mode 100644
index 0000000000..31711b07e1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/isSubsetOf.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: Set.prototype.isSubsetOf properties
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+
+assert.sameValue(
+ typeof Set.prototype.isSubsetOf,
+ "function",
+ "`typeof Set.prototype.isSubsetOf` is `'function'`"
+);
+
+verifyProperty(Set.prototype, "isSubsetOf", {
+ enumerable: false,
+ writable: true,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/keys-is-callable.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/keys-is-callable.js
new file mode 100644
index 0000000000..399fd012c9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/keys-is-callable.js
@@ -0,0 +1,36 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object's 'keys' property is not callable
+info: |
+ 9. Let keys be ? Get(obj, "keys").
+ 10. If IsCallable(keys) is false, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: () => {},
+ keys: undefined,
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSubsetOf(s2);
+ },
+ "GetSetRecord throws an error when keys is undefined"
+);
+
+s2.keys = {};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSubsetOf(s2);
+ },
+ "GetSetRecord throws an error when keys is not callable"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/length.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/length.js
new file mode 100644
index 0000000000..c68b21fd20
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/length.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: Set.prototype.isSubsetOf length property
+info: |
+ Set.prototype.isSubsetOf ( other )
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+assert.sameValue(typeof Set.prototype.isSubsetOf, "function");
+
+verifyProperty(Set.prototype.isSubsetOf, "length", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 1,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/name.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/name.js
new file mode 100644
index 0000000000..e044f9d5e8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/name.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: Set.prototype.isSubsetOf name property
+info: |
+ Set.prototype.isSubsetOf ( other )
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+assert.sameValue(typeof Set.prototype.isSubsetOf, "function");
+
+verifyProperty(Set.prototype.isSubsetOf, "name", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: "isSubsetOf",
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/not-a-constructor.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/not-a-constructor.js
new file mode 100644
index 0000000000..9bb00a7a45
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/not-a-constructor.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: Set.prototype.isSubsetOf does not implement [[Construct]], is not new-able
+includes: [isConstructor.js]
+features: [Reflect.construct, set-methods]
+---*/
+
+assert.sameValue(
+ isConstructor(Set.prototype.isSubsetOf),
+ false,
+ "isConstructor(Set.prototype.isSubsetOf) must return false"
+);
+
+assert.throws(
+ TypeError,
+ () => {
+ new Set.prototype.isSubsetOf();
+ },
+ "`new Set.prototype.isSubsetOf()` throws TypeError"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/receiver-not-set.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/receiver-not-set.js
new file mode 100644
index 0000000000..6b55d46e2a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/receiver-not-set.js
@@ -0,0 +1,47 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: Set.prototype.isSubsetOf throws when receiver is not a Set
+features: [set-methods]
+---*/
+
+class MySetLike {
+ constructor() {
+ this.size = 2;
+ this.has = () => {};
+ this.keys = function* keys() {
+ yield 2;
+ yield 3;
+ };
+ }
+}
+
+const s1 = new MySetLike();
+const s2 = new Set();
+assert.throws(
+ TypeError,
+ () => {
+ Set.prototype.isSubsetOf.call(s1, s2);
+ },
+ "Set-like class"
+);
+
+const s3 = {
+ size: 2,
+ has: () => {},
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ () => {
+ Set.prototype.isSubsetOf.call(s3, s2);
+ },
+ "Set-like object"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/require-internal-slot.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/require-internal-slot.js
new file mode 100644
index 0000000000..caefa8b0fb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/require-internal-slot.js
@@ -0,0 +1,30 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: Set.prototype.isSubsetOf RequireInternalSlot
+info: |
+ 2. Perform ? RequireInternalSlot(O, [[SetData]])
+features: [set-methods]
+---*/
+
+const isSubsetOf = Set.prototype.isSubsetOf;
+
+assert.sameValue(typeof isSubsetOf, "function");
+
+const realSet = new Set([]);
+
+assert.throws(TypeError, () => isSubsetOf.call(undefined, realSet), "undefined");
+assert.throws(TypeError, () => isSubsetOf.call(null, realSet), "null");
+assert.throws(TypeError, () => isSubsetOf.call(true, realSet), "true");
+assert.throws(TypeError, () => isSubsetOf.call("", realSet), "empty string");
+assert.throws(TypeError, () => isSubsetOf.call(Symbol(), realSet), "symbol");
+assert.throws(TypeError, () => isSubsetOf.call(1, realSet), "1");
+assert.throws(TypeError, () => isSubsetOf.call(1n, realSet), "1n");
+assert.throws(TypeError, () => isSubsetOf.call({}, realSet), "plain object");
+assert.throws(TypeError, () => isSubsetOf.call([], realSet), "array");
+assert.throws(TypeError, () => isSubsetOf.call(new Map(), realSet), "map");
+assert.throws(TypeError, () => isSubsetOf.call(Set.prototype, realSet), "Set.prototype");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/set-like-array.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/set-like-array.js
new file mode 100644
index 0000000000..caad7df291
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/set-like-array.js
@@ -0,0 +1,24 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: Set.prototype.isSubsetOf consumes a set-like array as a set-like, not an array
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = [5, 6];
+s2.size = 3;
+s2.has = function (v) {
+ if (v === 1) return true;
+ if (v === 2) return true;
+ throw new Test262Error("Set.prototype.isSubsetOf should only call its argument's has method with contents of this");
+};
+s2.keys = function () {
+ throw new Test262Error("Set.prototype.isSubsetOf should not call its argument's keys iterator when this.size ≤ arg.size");
+};
+
+assert.sameValue(s1.isSubsetOf(s2), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/set-like-class-mutation.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/set-like-class-mutation.js
new file mode 100644
index 0000000000..ac6f7b593a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/set-like-class-mutation.js
@@ -0,0 +1,32 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: Set.prototype.isSubsetOf behavior when a custom Set-like class mutates the receiver
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const baseSet = new Set(["a", "b", "c"]);
+
+const evilSetLike = {
+ size: 3,
+ has(v) {
+ if (v === "a") {
+ baseSet.delete("c");
+ }
+ return ["x", "a", "b"].includes(v);
+ },
+ * keys() {
+ throw new Test262Error("Set.prototype.isSubsetOf should not call its argument's keys iterator");
+ },
+};
+
+const result = baseSet.isSubsetOf(evilSetLike);
+assert.sameValue(result, true);
+
+const expectedNewBase = ["a", "b"];
+assert.compareArray([...baseSet], expectedNewBase);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/set-like-class-order.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/set-like-class-order.js
new file mode 100644
index 0000000000..612b30f267
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/set-like-class-order.js
@@ -0,0 +1,124 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: Set.prototype.isSubsetOf calls a Set-like class's methods in order
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+let observedOrder = [];
+
+class MySetLike {
+ get size() {
+ observedOrder.push("getting size");
+ return {
+ valueOf: function () {
+ observedOrder.push("ToNumber(size)");
+ return 3;
+ },
+ };
+ }
+ get has() {
+ observedOrder.push("getting has");
+ return function (v) {
+ observedOrder.push("calling has");
+ return ["a", "b", "c"].indexOf(v) !== -1;
+ };
+ }
+ get keys() {
+ observedOrder.push("getting keys");
+ return function () {
+ throw new Test262Error("Set.prototype.isSubsetOf should not call its argument's keys iterator");
+ };
+ }
+}
+
+// this is smaller than argument - stops eagerly
+{
+ observedOrder = [];
+
+ const s1 = new Set(["d", "a"]);
+ const s2 = new MySetLike();
+ const result = s1.isSubsetOf(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ // one call to has
+ "calling has",
+ ];
+
+ assert.sameValue(result, false);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is smaller than argument - full run
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "b"]);
+ const s2 = new MySetLike();
+ const result = s1.isSubsetOf(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ // two calls to has
+ "calling has",
+ "calling has",
+ ];
+
+ assert.sameValue(result, true);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is same size as argument
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "b", "c"]);
+ const s2 = new MySetLike();
+ const result = s1.isSubsetOf(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ // three calls to has
+ "calling has",
+ "calling has",
+ "calling has",
+ ];
+
+ assert.sameValue(result, true);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is larger than argument
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "b", "c", "d"]);
+ const s2 = new MySetLike();
+ const result = s1.isSubsetOf(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ // no calls to has
+ ];
+
+ assert.sameValue(result, false);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/shell.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/size-is-a-number.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/size-is-a-number.js
new file mode 100644
index 0000000000..a0beb5f76b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/size-is-a-number.js
@@ -0,0 +1,75 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object has a size that is coerced to NaN
+info: |
+ 2. Let rawSize be ? Get(obj, "size").
+ 3. Let numSize be ? ToNumber(rawSize).
+ 4. NOTE: If rawSize is undefined, then numSize will be NaN.
+ 5. If numSize is NaN, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: undefined,
+ has: () => {},
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSubsetOf(s2);
+ },
+ "GetSetRecord throws an error when size is undefined"
+);
+
+s2.size = NaN;
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSubsetOf(s2);
+ },
+ "GetSetRecord throws an error when size is NaN"
+);
+
+let coercionCalls = 0;
+s2.size = {
+ valueOf: function() {
+ ++coercionCalls;
+ return NaN;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSubsetOf(s2);
+ },
+ "GetSetRecord throws an error when size coerces to NaN"
+);
+assert.sameValue(coercionCalls, 1, "GetSetRecord coerces size");
+
+s2.size = 0n;
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSubsetOf(s2);
+ },
+ "GetSetRecord throws an error when size is a BigInt"
+);
+
+s2.size = "string";
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSubsetOf(s2);
+ },
+ "GetSetRecord throws an error when size is a non-numeric string"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/subclass-receiver-methods.js b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/subclass-receiver-methods.js
new file mode 100644
index 0000000000..a62280d584
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSubsetOf/subclass-receiver-methods.js
@@ -0,0 +1,40 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issubsetof
+description: Set.prototype.isSubsetOf works on subclasses of Set, but never calls the receiver's size/has/keys methods
+features: [set-methods]
+---*/
+
+let sizeCount = 0;
+let hasCount = 0;
+let keysCount = 0;
+
+class MySet extends Set {
+ size(...rest) {
+ sizeCount++;
+ return super.size(...rest);
+ }
+
+ has(...rest) {
+ hasCount++;
+ return super.has(...rest);
+ }
+
+ keys(...rest) {
+ keysCount++;
+ return super.keys(...rest);
+ }
+}
+
+const s1 = new MySet([1, 2]);
+const s2 = new Set([2, 3]);
+const result = s1.isSubsetOf(s2);
+assert.sameValue(result, false);
+
+assert.sameValue(sizeCount, 0, "size should not be called on the receiver");
+assert.sameValue(hasCount, 0, "has should not be called on the receiver");
+assert.sameValue(keysCount, 0, "keys should not be called on the receiver");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/allows-set-like-class.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/allows-set-like-class.js
new file mode 100644
index 0000000000..cd5a45492c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/allows-set-like-class.js
@@ -0,0 +1,32 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: GetSetRecord allows instances of Set-like classes
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+ 2. Let rawSize be ? Get(obj, "size").
+ ...
+ 7. Let has be ? Get(obj, "has").
+ ...
+ 9. Let keys be ? Get(obj, "keys").
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new class {
+ get size() {
+ return 1;
+ }
+ has(v) {
+ throw new Test262Error("Set.prototype.isSupersetOf should not call its argument's has method");
+ }
+ * keys() {
+ yield 1;
+ }
+};
+
+assert.sameValue(s1.isSupersetOf(s2), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/allows-set-like-object.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/allows-set-like-object.js
new file mode 100644
index 0000000000..85e2710b65
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/allows-set-like-object.js
@@ -0,0 +1,30 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: GetSetRecord allows Set-like objects
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+ 2. Let rawSize be ? Get(obj, "size").
+ ...
+ 7. Let has be ? Get(obj, "has").
+ ...
+ 9. Let keys be ? Get(obj, "keys").
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 1,
+ has: (v) => {
+ throw new Test262Error("Set.prototype.isSupersetOf should not call its argument's has method");
+ },
+ keys: function* keys() {
+ yield 1;
+ },
+};
+
+assert.sameValue(s1.isSupersetOf(s2), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/array-throws.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/array-throws.js
new file mode 100644
index 0000000000..8bf37de79f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/array-throws.js
@@ -0,0 +1,20 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Set.prototype.isSupersetOf doesn't work with arrays
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = [3];
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSupersetOf(s2);
+ },
+ "Throws an error when an array is used"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/browser.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/builtins.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/builtins.js
new file mode 100644
index 0000000000..e781af6ba6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/builtins.js
@@ -0,0 +1,28 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Tests that Set.prototype.isSupersetOf meets the requirements for built-in objects
+features: [set-methods]
+---*/
+
+assert.sameValue(
+ Object.isExtensible(Set.prototype.isSupersetOf),
+ true,
+ "Built-in objects must be extensible."
+);
+
+assert.sameValue(
+ Object.prototype.toString.call(Set.prototype.isSupersetOf),
+ "[object Function]",
+ "Object.prototype.toString"
+);
+
+assert.sameValue(
+ Object.getPrototypeOf(Set.prototype.isSupersetOf),
+ Function.prototype,
+ "prototype"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/called-with-object.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/called-with-object.js
new file mode 100644
index 0000000000..bb38549c24
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/called-with-object.js
@@ -0,0 +1,69 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws if obj is not an object
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+let s1 = new Set([1]);
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSupersetOf(1);
+ },
+ "number"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSupersetOf("");
+ },
+ "string"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSupersetOf(1n);
+ },
+ "bigint"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSupersetOf(false);
+ },
+ "boolean"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSupersetOf(undefined);
+ },
+ "undefined"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSupersetOf(null);
+ },
+ "null"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSupersetOf(Symbol("test"));
+ },
+ "symbol"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-Map.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-Map.js
new file mode 100644
index 0000000000..74736112ed
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-Map.js
@@ -0,0 +1,18 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Set.prototype.isSupersetOf compares with Map
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const m1 = new Map([
+ [2, "two"],
+ [3, "three"],
+]);
+
+assert.sameValue(s1.isSupersetOf(m1), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-empty-sets.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-empty-sets.js
new file mode 100644
index 0000000000..c8d2a856bb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-empty-sets.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Set.prototype.isSupersetOf can compare empty Sets
+features: [set-methods]
+---*/
+
+const s1 = new Set([]);
+const s2 = new Set([1, 2]);
+
+assert.sameValue(s1.isSupersetOf(s2), false);
+
+const s3 = new Set([1, 2]);
+const s4 = new Set([]);
+
+assert.sameValue(s3.isSupersetOf(s4), true);
+
+const s5 = new Set([]);
+const s6 = new Set([]);
+
+assert.sameValue(s5.isSupersetOf(s6), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-itself.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-itself.js
new file mode 100644
index 0000000000..82bf66083a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-itself.js
@@ -0,0 +1,14 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Set.prototype.isSupersetOf is successful when called on itself
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+
+assert.sameValue(s1.isSupersetOf(s1), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-same-sets.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-same-sets.js
new file mode 100644
index 0000000000..d9bb33ad01
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-same-sets.js
@@ -0,0 +1,15 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Set.prototype.isSupersetOf can compare Sets that have the same content
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([1, 2]);
+
+assert.sameValue(s1.isSupersetOf(s2), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-sets.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-sets.js
new file mode 100644
index 0000000000..62a37851c6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/compares-sets.js
@@ -0,0 +1,19 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Set.prototype.isSupersetOf compares Sets
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([2, 3]);
+
+assert.sameValue(s1.isSupersetOf(s2), false);
+
+const s3 = new Set([1]);
+
+assert.sameValue(s1.isSupersetOf(s3), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/converts-negative-zero.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/converts-negative-zero.js
new file mode 100644
index 0000000000..ccf08f51c4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/converts-negative-zero.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Set.prototype.isSupersetOf converts -0𝔽 to +0𝔽
+features: [set-methods]
+---*/
+
+const setlikeWithMinusZero = {
+ size: 1,
+ has: function () {
+ throw new Test262Error("Set.prototype.isSupersetOf should not call its argument's has method");
+ },
+ keys: function () {
+ // we use an array here because the Set constructor would normalize away -0
+ return [-0].values();
+ },
+};
+
+const s1 = new Set([+0, 1]);
+
+assert.sameValue(s1.isSupersetOf(setlikeWithMinusZero), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/has-is-callable.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/has-is-callable.js
new file mode 100644
index 0000000000..d48d987d98
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/has-is-callable.js
@@ -0,0 +1,39 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object's 'has' property is not callable
+info: |
+ 7. Let has be ? Get(obj, "has").
+ 8. If IsCallable(has) is false, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: undefined,
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSupersetOf(s2);
+ },
+ "GetSetRecord throws an error when has is undefined"
+);
+
+s2.has = {};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSupersetOf(s2);
+ },
+ "GetSetRecord throws an error when has is not callable"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/isSupersetOf.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/isSupersetOf.js
new file mode 100644
index 0000000000..0bdc78466d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/isSupersetOf.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Set.prototype.isSupersetOf properties
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+
+assert.sameValue(
+ typeof Set.prototype.isSupersetOf,
+ "function",
+ "`typeof Set.prototype.isSupersetOf` is `'function'`"
+);
+
+verifyProperty(Set.prototype, "isSupersetOf", {
+ enumerable: false,
+ writable: true,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/keys-is-callable.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/keys-is-callable.js
new file mode 100644
index 0000000000..9078aba389
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/keys-is-callable.js
@@ -0,0 +1,36 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object's 'keys' property is not callable
+info: |
+ 9. Let keys be ? Get(obj, "keys").
+ 10. If IsCallable(keys) is false, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: () => {},
+ keys: undefined,
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSupersetOf(s2);
+ },
+ "GetSetRecord throws an error when keys is undefined"
+);
+
+s2.keys = {};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSupersetOf(s2);
+ },
+ "GetSetRecord throws an error when keys is not callable"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/length.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/length.js
new file mode 100644
index 0000000000..48c43a3514
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/length.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Set.prototype.isSupersetOf length property
+info: |
+ Set.prototype.isSupersetOf ( other )
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+assert.sameValue(typeof Set.prototype.isSupersetOf, "function");
+
+verifyProperty(Set.prototype.isSupersetOf, "length", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 1,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/name.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/name.js
new file mode 100644
index 0000000000..6938c91375
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/name.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Set.prototype.isSupersetOf name property
+info: |
+ Set.prototype.isSupersetOf ( other )
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+assert.sameValue(typeof Set.prototype.isSupersetOf, "function");
+
+verifyProperty(Set.prototype.isSupersetOf, "name", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: "isSupersetOf",
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/not-a-constructor.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/not-a-constructor.js
new file mode 100644
index 0000000000..9ce1d37913
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/not-a-constructor.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Set.prototype.isSupersetOf does not implement [[Construct]], is not new-able
+includes: [isConstructor.js]
+features: [Reflect.construct, set-methods]
+---*/
+
+assert.sameValue(
+ isConstructor(Set.prototype.isSupersetOf),
+ false,
+ "isConstructor(Set.prototype.isSupersetOf) must return false"
+);
+
+assert.throws(
+ TypeError,
+ () => {
+ new Set.prototype.isSupersetOf();
+ },
+ "`new Set.prototype.isSupersetOf()` throws TypeError"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/receiver-not-set.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/receiver-not-set.js
new file mode 100644
index 0000000000..fff87951c9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/receiver-not-set.js
@@ -0,0 +1,47 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Set.prototype.isSupersetOf throws when receiver is not a Set
+features: [set-methods]
+---*/
+
+class MySetLike {
+ constructor() {
+ this.size = 2;
+ this.has = () => {};
+ this.keys = function* keys() {
+ yield 2;
+ yield 3;
+ };
+ }
+}
+
+const s1 = new MySetLike();
+const s2 = new Set();
+assert.throws(
+ TypeError,
+ () => {
+ Set.prototype.isSupersetOf.call(s1, s2);
+ },
+ "Set-like class"
+);
+
+const s3 = {
+ size: 2,
+ has: () => {},
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ () => {
+ Set.prototype.isSupersetOf.call(s3, s2);
+ },
+ "Set-like object"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/require-internal-slot.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/require-internal-slot.js
new file mode 100644
index 0000000000..d8507a58bc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/require-internal-slot.js
@@ -0,0 +1,30 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Set.prototype.isSupersetOf RequireInternalSlot
+info: |
+ 2. Perform ? RequireInternalSlot(O, [[SetData]])
+features: [set-methods]
+---*/
+
+const isSupersetOf = Set.prototype.isSupersetOf;
+
+assert.sameValue(typeof isSupersetOf, "function");
+
+const realSet = new Set([]);
+
+assert.throws(TypeError, () => isSupersetOf.call(undefined, realSet), "undefined");
+assert.throws(TypeError, () => isSupersetOf.call(null, realSet), "null");
+assert.throws(TypeError, () => isSupersetOf.call(true, realSet), "true");
+assert.throws(TypeError, () => isSupersetOf.call("", realSet), "empty string");
+assert.throws(TypeError, () => isSupersetOf.call(Symbol(), realSet), "symbol");
+assert.throws(TypeError, () => isSupersetOf.call(1, realSet), "1");
+assert.throws(TypeError, () => isSupersetOf.call(1n, realSet), "1n");
+assert.throws(TypeError, () => isSupersetOf.call({}, realSet), "plain object");
+assert.throws(TypeError, () => isSupersetOf.call([], realSet), "array");
+assert.throws(TypeError, () => isSupersetOf.call(new Map(), realSet), "map");
+assert.throws(TypeError, () => isSupersetOf.call(Set.prototype, realSet), "Set.prototype");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/set-like-array.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/set-like-array.js
new file mode 100644
index 0000000000..506cf11697
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/set-like-array.js
@@ -0,0 +1,24 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Set.prototype.isSupersetOf consumes a set-like array as a set-like, not an array
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = [1];
+s2.size = 3;
+s2.has = function (v) {
+ if (v === 1) return true;
+ if (v === 2) return true;
+ throw new Test262Error("Set.prototype.isSupersetOf should only call its argument's has method with contents of this");
+};
+s2.keys = function () {
+ throw new Test262Error("Set.prototype.isSupersetOf should not call its argument's keys iterator when this.size ≤ arg.size");
+};
+
+assert.sameValue(s1.isSupersetOf(s2), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/set-like-class-mutation.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/set-like-class-mutation.js
new file mode 100644
index 0000000000..aa5743efe7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/set-like-class-mutation.js
@@ -0,0 +1,33 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Set.prototype.isSupersetOf behavior when a custom Set-like class mutates the receiver
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const baseSet = new Set(["a", "b", "c"]);
+
+const evilSetLike = {
+ size: 3,
+ has(v) {
+ throw new Test262Error("Set.prototype.isSupersetOf should not call its argument's has method");
+ },
+ * keys() {
+ yield "a";
+ baseSet.delete("b");
+ baseSet.delete("c");
+ baseSet.add("b");
+ yield "b";
+ },
+};
+
+const result = baseSet.isSupersetOf(evilSetLike);
+assert.sameValue(result, true);
+
+const expectedNewBase = ["a", "b"];
+assert.compareArray([...baseSet], expectedNewBase);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/set-like-class-order.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/set-like-class-order.js
new file mode 100644
index 0000000000..e688569c7b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/set-like-class-order.js
@@ -0,0 +1,182 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Set.prototype.isSupersetOf calls a Set-like class's methods in order
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+let observedOrder = [];
+
+function observableIterator() {
+ let values = ["a", "b", "c"];
+ let index = 0;
+ return {
+ get next() {
+ observedOrder.push("getting next");
+ return function () {
+ observedOrder.push("calling next");
+ return {
+ get done() {
+ observedOrder.push("getting done");
+ return index >= values.length;
+ },
+ get value() {
+ observedOrder.push("getting value");
+ return values[index++];
+ },
+ };
+ };
+ },
+ };
+}
+
+class MySetLike {
+ get size() {
+ observedOrder.push("getting size");
+ return {
+ valueOf: function () {
+ observedOrder.push("ToNumber(size)");
+ return 3;
+ },
+ };
+ }
+ get has() {
+ observedOrder.push("getting has");
+ return function (v) {
+ throw new Test262Error("Set.prototype.isSupersetOf should not call its argument's has method");
+ };
+ }
+ get keys() {
+ observedOrder.push("getting keys");
+ return function () {
+ observedOrder.push("calling keys");
+ return observableIterator();
+ };
+ }
+}
+
+// this is smaller than argument
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "b"]);
+ const s2 = new MySetLike();
+ const result = s1.isSupersetOf(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ // no iteration
+ ];
+
+ assert.sameValue(result, false);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is same size as argument - stops eagerly
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "x", "c"]);
+ const s2 = new MySetLike();
+ const result = s1.isSupersetOf(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ "calling keys",
+ "getting next",
+ // first iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // second iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ ];
+
+ assert.sameValue(result, false);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is same size as argument - full run
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "b", "c"]);
+ const s2 = new MySetLike();
+ const result = s1.isSupersetOf(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ "calling keys",
+ "getting next",
+ // first iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // second iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // third iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // fourth iteration, no value; ends
+ "calling next",
+ "getting done",
+ ];
+
+ assert.sameValue(result, true);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is larger than argument
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "b", "c", "d"]);
+ const s2 = new MySetLike();
+ const result = s1.isSupersetOf(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ "calling keys",
+ "getting next",
+ // first iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // second iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // third iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // fourth iteration, no value; ends
+ "calling next",
+ "getting done",
+ ];
+
+ assert.sameValue(result, true);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/shell.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/size-is-a-number.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/size-is-a-number.js
new file mode 100644
index 0000000000..a0a02e42da
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/size-is-a-number.js
@@ -0,0 +1,75 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object has a size that is coerced to NaN
+info: |
+ 2. Let rawSize be ? Get(obj, "size").
+ 3. Let numSize be ? ToNumber(rawSize).
+ 4. NOTE: If rawSize is undefined, then numSize will be NaN.
+ 5. If numSize is NaN, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: undefined,
+ has: () => {},
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSupersetOf(s2);
+ },
+ "GetSetRecord throws an error when size is undefined"
+);
+
+s2.size = NaN;
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSupersetOf(s2);
+ },
+ "GetSetRecord throws an error when size is NaN"
+);
+
+let coercionCalls = 0;
+s2.size = {
+ valueOf: function() {
+ ++coercionCalls;
+ return NaN;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSupersetOf(s2);
+ },
+ "GetSetRecord throws an error when size coerces to NaN"
+);
+assert.sameValue(coercionCalls, 1, "GetSetRecord coerces size");
+
+s2.size = 0n;
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSupersetOf(s2);
+ },
+ "GetSetRecord throws an error when size is a BigInt"
+);
+
+s2.size = "string";
+assert.throws(
+ TypeError,
+ function () {
+ s1.isSupersetOf(s2);
+ },
+ "GetSetRecord throws an error when size is a non-numeric string"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/subclass-receiver-methods.js b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/subclass-receiver-methods.js
new file mode 100644
index 0000000000..8bb54ea4ad
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/isSupersetOf/subclass-receiver-methods.js
@@ -0,0 +1,40 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.issupersetof
+description: Set.prototype.isSupersetOf works on subclasses of Set, but never calls the receiver's size/has/keys methods
+features: [set-methods]
+---*/
+
+let sizeCount = 0;
+let hasCount = 0;
+let keysCount = 0;
+
+class MySet extends Set {
+ size(...rest) {
+ sizeCount++;
+ return super.size(...rest);
+ }
+
+ has(...rest) {
+ hasCount++;
+ return super.has(...rest);
+ }
+
+ keys(...rest) {
+ keysCount++;
+ return super.keys(...rest);
+ }
+}
+
+const s1 = new MySet([1, 2]);
+const s2 = new Set([2, 3]);
+const result = s1.isSupersetOf(s2);
+assert.sameValue(result, false);
+
+assert.sameValue(sizeCount, 0, "size should not be called on the receiver");
+assert.sameValue(hasCount, 0, "has should not be called on the receiver");
+assert.sameValue(keysCount, 0, "keys should not be called on the receiver");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/keys/browser.js b/js/src/tests/test262/built-ins/Set/prototype/keys/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/keys/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/keys/keys.js b/js/src/tests/test262/built-ins/Set/prototype/keys/keys.js
new file mode 100644
index 0000000000..0f4325be91
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/keys/keys.js
@@ -0,0 +1,17 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-set.prototype.keys
+description: >
+ The initial value of the keys property is the same function object as the
+ initial value of the values property.
+---*/
+
+assert.sameValue(
+ Set.prototype.keys,
+ Set.prototype.values,
+ "The value of `Set.prototype.keys` is `Set.prototype.values`"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/keys/shell.js b/js/src/tests/test262/built-ins/Set/prototype/keys/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/keys/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/shell.js b/js/src/tests/test262/built-ins/Set/prototype/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/size/browser.js b/js/src/tests/test262/built-ins/Set/prototype/size/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/size/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/size/length.js b/js/src/tests/test262/built-ins/Set/prototype/size/length.js
new file mode 100644
index 0000000000..4b0b0675dd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/size/length.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-get-set.prototype.size
+description: >
+ get Set.prototype.size
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+var descriptor = Object.getOwnPropertyDescriptor(Set.prototype, "size");
+
+
+assert.sameValue(descriptor.get.length, 0, "The value of `Set.prototype.size.length` is `0`");
+
+verifyNotEnumerable(descriptor.get, "length");
+verifyNotWritable(descriptor.get, "length");
+verifyConfigurable(descriptor.get, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/size/name.js b/js/src/tests/test262/built-ins/Set/prototype/size/name.js
new file mode 100644
index 0000000000..79723d8f0e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/size/name.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-get-set.prototype.size
+description: >
+ get Set.prototype.size
+
+ 17 ECMAScript Standard Built-in Objects
+
+ Functions that are specified as get or set accessor functions of built-in
+ properties have "get " or "set " prepended to the property name string.
+
+includes: [propertyHelper.js]
+---*/
+
+var descriptor = Object.getOwnPropertyDescriptor(Set.prototype, "size");
+
+
+assert.sameValue(descriptor.get.name, "get size", "The value of `descriptor.get.name` is `'get size'`");
+
+verifyNotEnumerable(descriptor.get, "name");
+verifyNotWritable(descriptor.get, "name");
+verifyConfigurable(descriptor.get, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-before-after-add-delete.js b/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-before-after-add-delete.js
new file mode 100644
index 0000000000..6a6c083bae
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-before-after-add-delete.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-get-set.prototype.size
+description: >
+ get Set.prototype.size
+
+ 5. Let count be 0.
+ 6. For each e that is an element of entries
+ a. If e is not empty, set count to count+1.
+
+ Before and after add(), delete()
+---*/
+
+var s = new Set();
+
+assert.sameValue(s.size, 0, "The value of `s.size` is `0`");
+
+s.add(0);
+
+assert.sameValue(s.size, 1, "The value of `s.size` is `1`, after executing `s.add(0)`");
+
+s.delete(0);
+
+assert.sameValue(s.size, 0, "The value of `s.size` is `0`, after executing `s.delete(0)`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-by-insertion.js b/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-by-insertion.js
new file mode 100644
index 0000000000..b1ea12fc5f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-by-insertion.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-get-set.prototype.size
+description: >
+ get Set.prototype.size
+
+ 5. Let count be 0.
+ 6. For each e that is an element of entries
+ a. If e is not empty, set count to count+1.
+
+features: [Symbol]
+---*/
+
+var s = new Set();
+
+s.add(0);
+s.add(undefined);
+s.add(false);
+s.add(NaN);
+s.add(null);
+s.add("");
+s.add(Symbol());
+
+assert.sameValue(s.size, 7, "The value of `s.size` is `7`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-by-iterable.js b/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-by-iterable.js
new file mode 100644
index 0000000000..9ef5423a70
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/size/returns-count-of-present-values-by-iterable.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-get-set.prototype.size
+description: >
+ get Set.prototype.size
+
+ 5. Let count be 0.
+ 6. For each e that is an element of entries
+ a. If e is not empty, set count to count+1.
+
+features: [Symbol]
+---*/
+
+var s = new Set([0, undefined, false, NaN, null, "", Symbol()]);
+
+assert.sameValue(s.size, 7, "The value of `s.size` is `7`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/size/shell.js b/js/src/tests/test262/built-ins/Set/prototype/size/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/size/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/size/size.js b/js/src/tests/test262/built-ins/Set/prototype/size/size.js
new file mode 100644
index 0000000000..18b0566e2c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/size/size.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-set.prototype.size
+description: >
+ get Set.prototype.size
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+var descriptor = Object.getOwnPropertyDescriptor(Set.prototype, "size");
+
+assert.sameValue(
+ typeof descriptor.get,
+ "function",
+ "`typeof descriptor.get` is `'function'`"
+);
+assert.sameValue(
+ typeof descriptor.set,
+ "undefined",
+ "`typeof descriptor.set` is `\"undefined\"`"
+);
+
+verifyNotEnumerable(Set.prototype, "size");
+verifyConfigurable(Set.prototype, "size");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/add-not-called.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/add-not-called.js
new file mode 100644
index 0000000000..6bf0f99e35
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/add-not-called.js
@@ -0,0 +1,30 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference should not call Set.prototype.add
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [1, 3];
+
+const originalAdd = Set.prototype.add;
+let count = 0;
+Set.prototype.add = function (...rest) {
+ count++;
+ return originalAdd.apply(this, rest);
+};
+
+const combined = s1.symmetricDifference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(count, 0, "Add is never called");
+
+Set.prototype.add = originalAdd;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/allows-set-like-class.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/allows-set-like-class.js
new file mode 100644
index 0000000000..939c73916a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/allows-set-like-class.js
@@ -0,0 +1,37 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: GetSetRecord allows instances of Set-like classes
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+ 2. Let rawSize be ? Get(obj, "size").
+ ...
+ 7. Let has be ? Get(obj, "has").
+ ...
+ 9. Let keys be ? Get(obj, "keys").
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new class {
+ get size() {
+ return 2;
+ }
+ has(v) {
+ throw new Test262Error("Set.prototype.symmetricDifference should not invoke .has on its argument");
+ }
+ * keys() {
+ yield 2;
+ yield 3;
+ }
+};
+const expected = [1, 3];
+const combined = s1.symmetricDifference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/allows-set-like-object.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/allows-set-like-object.js
new file mode 100644
index 0000000000..60ac9f1eb0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/allows-set-like-object.js
@@ -0,0 +1,35 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: GetSetRecord allows Set-like objects
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+ 2. Let rawSize be ? Get(obj, "size").
+ ...
+ 7. Let has be ? Get(obj, "has").
+ ...
+ 9. Let keys be ? Get(obj, "keys").
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: (v) => {
+ throw new Test262Error("Set.prototype.symmetricDifference should not invoke .has on its argument");
+ },
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+const expected = [1, 3];
+const combined = s1.symmetricDifference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/array-throws.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/array-throws.js
new file mode 100644
index 0000000000..d15c9c7e77
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/array-throws.js
@@ -0,0 +1,20 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference doesn't work with arrays
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = [3];
+assert.throws(
+ TypeError,
+ function () {
+ s1.symmetricDifference(s2);
+ },
+ "Throws an error when an array is used"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/browser.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/builtins.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/builtins.js
new file mode 100644
index 0000000000..36913dbc32
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/builtins.js
@@ -0,0 +1,28 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Tests that Set.prototype.symmetricDifference meets the requirements for built-in objects
+features: [set-methods]
+---*/
+
+assert.sameValue(
+ Object.isExtensible(Set.prototype.symmetricDifference),
+ true,
+ "Built-in objects must be extensible."
+);
+
+assert.sameValue(
+ Object.prototype.toString.call(Set.prototype.symmetricDifference),
+ "[object Function]",
+ "Object.prototype.toString"
+);
+
+assert.sameValue(
+ Object.getPrototypeOf(Set.prototype.symmetricDifference),
+ Function.prototype,
+ "prototype"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/called-with-object.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/called-with-object.js
new file mode 100644
index 0000000000..459f2632f5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/called-with-object.js
@@ -0,0 +1,69 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws if obj is not an object
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+let s1 = new Set([1]);
+assert.throws(
+ TypeError,
+ function () {
+ s1.symmetricDifference(1);
+ },
+ "number"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.symmetricDifference("");
+ },
+ "string"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.symmetricDifference(1n);
+ },
+ "bigint"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.symmetricDifference(false);
+ },
+ "boolean"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.symmetricDifference(undefined);
+ },
+ "undefined"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.symmetricDifference(null);
+ },
+ "null"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.symmetricDifference(Symbol("test"));
+ },
+ "symbol"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-Map.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-Map.js
new file mode 100644
index 0000000000..a572bfc43a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-Map.js
@@ -0,0 +1,22 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference combines with Map
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const m1 = new Map([
+ [2, "two"],
+ [3, "three"],
+]);
+const expected = [1, 3];
+const combined = s1.symmetricDifference(m1);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-empty-sets.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-empty-sets.js
new file mode 100644
index 0000000000..89c784a89f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-empty-sets.js
@@ -0,0 +1,35 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference can combine empty Sets
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([]);
+const s2 = new Set([1, 2]);
+let expected = [1, 2];
+let combined = s1.symmetricDifference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+const s3 = new Set([1, 2]);
+const s4 = new Set([]);
+expected = [1, 2];
+combined = s3.symmetricDifference(s4);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+const s5 = new Set([]);
+const s6 = new Set([]);
+expected = [];
+combined = s5.symmetricDifference(s6);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-itself.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-itself.js
new file mode 100644
index 0000000000..0c7e107089
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-itself.js
@@ -0,0 +1,19 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference is successful when called on itself
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const expected = [];
+const combined = s1.symmetricDifference(s1);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(combined === s1, false, "The returned object is a new object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-same-sets.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-same-sets.js
new file mode 100644
index 0000000000..b8d2d942bc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-same-sets.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference can combine Sets that have the same content
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([1, 2]);
+const expected = [];
+const combined = s1.symmetricDifference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(combined === s1, false, "The returned object is a new object");
+assert.sameValue(combined === s2, false, "The returned object is a new object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-sets.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-sets.js
new file mode 100644
index 0000000000..4cfb06d692
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/combines-sets.js
@@ -0,0 +1,19 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference combines Sets
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [1, 3];
+const combined = s1.symmetricDifference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/converts-negative-zero.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/converts-negative-zero.js
new file mode 100644
index 0000000000..f2a1758ecf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/converts-negative-zero.js
@@ -0,0 +1,31 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference converts -0𝔽 to +0𝔽
+info: |
+ 7.b.ii If nextValue is -0𝔽, set nextValue to +0𝔽.
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const setlikeWithMinusZero = {
+ size: 1,
+ has: function () {
+ throw new Test262Error("Set.prototype.symmetricDifference should not invoke .has on its argument");
+ },
+ keys: function () {
+ // we use an array here because the Set constructor would normalize away -0
+ return [-0].values();
+ },
+};
+
+const s1 = new Set([1, 2]);
+let expected = [1, 2, +0];
+let combined = s1.symmetricDifference(setlikeWithMinusZero);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/has-is-callable.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/has-is-callable.js
new file mode 100644
index 0000000000..f088ec512a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/has-is-callable.js
@@ -0,0 +1,39 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object's 'has' property is not callable
+info: |
+ 7. Let has be ? Get(obj, "has").
+ 8. If IsCallable(has) is false, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: undefined,
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.symmetricDifference(s2);
+ },
+ "GetSetRecord throws an error when has is undefined"
+);
+
+s2.has = {};
+assert.throws(
+ TypeError,
+ function () {
+ s1.symmetricDifference(s2);
+ },
+ "GetSetRecord throws an error when has is not callable"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/keys-is-callable.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/keys-is-callable.js
new file mode 100644
index 0000000000..5287340363
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/keys-is-callable.js
@@ -0,0 +1,36 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object's 'keys' property is not callable
+info: |
+ 9. Let keys be ? Get(obj, "keys").
+ 10. If IsCallable(keys) is false, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: () => {},
+ keys: undefined,
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.symmetricDifference(s2);
+ },
+ "GetSetRecord throws an error when keys is undefined"
+);
+
+s2.keys = {};
+assert.throws(
+ TypeError,
+ function () {
+ s1.symmetricDifference(s2);
+ },
+ "GetSetRecord throws an error when keys is not callable"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/length.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/length.js
new file mode 100644
index 0000000000..53eaec28c2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/length.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference length property
+info: |
+ Set.prototype.symmetricDifference ( other )
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+assert.sameValue(typeof Set.prototype.symmetricDifference, "function");
+
+verifyProperty(Set.prototype.symmetricDifference, "length", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 1,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/name.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/name.js
new file mode 100644
index 0000000000..7de10c3f48
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/name.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference name property
+info: |
+ Set.prototype.symmetricDifference ( other )
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+assert.sameValue(typeof Set.prototype.symmetricDifference, "function");
+
+verifyProperty(Set.prototype.symmetricDifference, "name", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: "symmetricDifference",
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/not-a-constructor.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/not-a-constructor.js
new file mode 100644
index 0000000000..495beeac4b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/not-a-constructor.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference does not implement [[Construct]], is not new-able
+includes: [isConstructor.js]
+features: [Reflect.construct, set-methods]
+---*/
+
+assert.sameValue(
+ isConstructor(Set.prototype.symmetricDifference),
+ false,
+ "isConstructor(Set.prototype.symmetricDifference) must return false"
+);
+
+assert.throws(
+ TypeError,
+ () => {
+ new Set.prototype.symmetricDifference();
+ },
+ "`new Set.prototype.symmetricDifference()` throws TypeError"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/receiver-not-set.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/receiver-not-set.js
new file mode 100644
index 0000000000..5a199a7f38
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/receiver-not-set.js
@@ -0,0 +1,47 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference throws when receiver is not a Set
+features: [set-methods]
+---*/
+
+class MySetLike {
+ constructor() {
+ this.size = 2;
+ this.has = () => {};
+ this.keys = function* keys() {
+ yield 2;
+ yield 3;
+ };
+ }
+}
+
+const s1 = new MySetLike();
+const s2 = new Set();
+assert.throws(
+ TypeError,
+ () => {
+ Set.prototype.symmetricDifference.call(s1, s2);
+ },
+ "Set-like class"
+);
+
+const s3 = {
+ size: 2,
+ has: () => {},
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ () => {
+ Set.prototype.symmetricDifference.call(s3, s2);
+ },
+ "Set-like object"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/require-internal-slot.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/require-internal-slot.js
new file mode 100644
index 0000000000..1481580c9c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/require-internal-slot.js
@@ -0,0 +1,30 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference RequireInternalSlot
+info: |
+ 2. Perform ? RequireInternalSlot(O, [[SetData]])
+features: [set-methods]
+---*/
+
+const symmetricDifference = Set.prototype.symmetricDifference;
+
+assert.sameValue(typeof symmetricDifference, "function");
+
+const realSet = new Set([]);
+
+assert.throws(TypeError, () => symmetricDifference.call(undefined, realSet), "undefined");
+assert.throws(TypeError, () => symmetricDifference.call(null, realSet), "null");
+assert.throws(TypeError, () => symmetricDifference.call(true, realSet), "true");
+assert.throws(TypeError, () => symmetricDifference.call("", realSet), "empty string");
+assert.throws(TypeError, () => symmetricDifference.call(Symbol(), realSet), "symbol");
+assert.throws(TypeError, () => symmetricDifference.call(1, realSet), "1");
+assert.throws(TypeError, () => symmetricDifference.call(1n, realSet), "1n");
+assert.throws(TypeError, () => symmetricDifference.call({}, realSet), "plain object");
+assert.throws(TypeError, () => symmetricDifference.call([], realSet), "array");
+assert.throws(TypeError, () => symmetricDifference.call(new Map(), realSet), "map");
+assert.throws(TypeError, () => symmetricDifference.call(Set.prototype, realSet), "Set.prototype");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/result-order.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/result-order.js
new file mode 100644
index 0000000000..b94f1f37ba
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/result-order.js
@@ -0,0 +1,26 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference result ordering
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+// results are ordered as in this, then as in other
+{
+ const s1 = new Set([1, 2, 3, 4]);
+ const s2 = new Set([6, 5, 4, 3]);
+
+ assert.compareArray([...s1.symmetricDifference(s2)], [1, 2, 6, 5]);
+}
+
+{
+ const s1 = new Set([6, 5, 4, 3]);
+ const s2 = new Set([1, 2, 3, 4]);
+
+ assert.compareArray([...s1.symmetricDifference(s2)], [6, 5, 1, 2]);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-array.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-array.js
new file mode 100644
index 0000000000..01a9edd5db
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-array.js
@@ -0,0 +1,27 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference consumes a set-like array as a set-like, not an array
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = [5];
+s2.size = 3;
+s2.has = function (v) {
+ throw new Test262Error("Set.prototype.symmetricDifference should not invoke .has on its argument");
+};
+s2.keys = function () {
+ return [2, 3, 4].values();
+};
+
+const expected = [1, 3, 4];
+const combined = s1.symmetricDifference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-class-mutation.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-class-mutation.js
new file mode 100644
index 0000000000..f75783bbed
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-class-mutation.js
@@ -0,0 +1,52 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference maintains values even when a custom Set-like class mutates the receiver
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const baseSet = new Set(["a", "b", "c", "d", "e"]);
+
+function mutatingIterator() {
+ let index = 0;
+ let values = ["x", "b", "c", "c"];
+ return {
+ next() {
+ if (index === 0) {
+ baseSet.delete("b");
+ baseSet.delete("c");
+ baseSet.add("b");
+ baseSet.add("d");
+ }
+ return {
+ done: index >= values.length,
+ value: values[index++],
+ };
+ },
+ };
+}
+
+const evilSetLike = {
+ size: 4,
+ get has() {
+ baseSet.add("q");
+ return function () {
+ throw new Test262Error("Set.prototype.symmetricDifference should not invoke .has on its argument");
+ };
+ },
+ keys() {
+ return mutatingIterator();
+ },
+};
+
+const combined = baseSet.symmetricDifference(evilSetLike);
+const expectedCombined = ["a", "c", "d", "e", "q", "x"];
+assert.compareArray([...combined], expectedCombined);
+
+const expectedNewBase = ["a", "d", "e", "q", "b"];
+assert.compareArray([...baseSet], expectedNewBase);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-class-order.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-class-order.js
new file mode 100644
index 0000000000..5b904810a9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/set-like-class-order.js
@@ -0,0 +1,169 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference calls a Set-like class's methods in order
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+let observedOrder = [];
+
+function observableIterator() {
+ let values = ["a", "b", "c"];
+ let index = 0;
+ return {
+ get next() {
+ observedOrder.push("getting next");
+ return function () {
+ observedOrder.push("calling next");
+ return {
+ get done() {
+ observedOrder.push("getting done");
+ return index >= values.length;
+ },
+ get value() {
+ observedOrder.push("getting value");
+ return values[index++];
+ },
+ };
+ };
+ },
+ };
+}
+
+class MySetLike {
+ get size() {
+ observedOrder.push("getting size");
+ return {
+ valueOf: function () {
+ observedOrder.push("ToNumber(size)");
+ return 2;
+ },
+ };
+ }
+ get has() {
+ observedOrder.push("getting has");
+ return function () {
+ throw new Test262Error("Set.prototype.symmetricDifference should not invoke .has on its argument");
+ };
+ }
+ get keys() {
+ observedOrder.push("getting keys");
+ return function () {
+ observedOrder.push("calling keys");
+ return observableIterator();
+ };
+ }
+}
+
+// this is smaller than argument
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "d"]);
+ const s2 = new MySetLike();
+ const combined = s1.symmetricDifference(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ "calling keys",
+ "getting next",
+ // first iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // second iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // third iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // fourth iteration, no value; ends
+ "calling next",
+ "getting done",
+ ];
+
+ assert.compareArray([...combined], ["d", "b", "c"]);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is same size as argument
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "b", "d"]);
+ const s2 = new MySetLike();
+ const combined = s1.symmetricDifference(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ "calling keys",
+ "getting next",
+ // first iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // second iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // third iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // fourth iteration, no value; ends
+ "calling next",
+ "getting done",
+ ];
+
+ assert.compareArray([...combined], ["d", "c"]);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is larger than argument
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "b", "d", "e"]);
+ const s2 = new MySetLike();
+ const combined = s1.symmetricDifference(s2);
+
+ const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ "calling keys",
+ "getting next",
+ // first iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // second iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // third iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // fourth iteration, no value; ends
+ "calling next",
+ "getting done",
+ ];
+
+ assert.compareArray([...combined], ["d", "e", "c"]);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/shell.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/size-is-a-number.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/size-is-a-number.js
new file mode 100644
index 0000000000..9a97773efc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/size-is-a-number.js
@@ -0,0 +1,75 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object has a size that is coerced to NaN
+info: |
+ 2. Let rawSize be ? Get(obj, "size").
+ 3. Let numSize be ? ToNumber(rawSize).
+ 4. NOTE: If rawSize is undefined, then numSize will be NaN.
+ 5. If numSize is NaN, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: undefined,
+ has: () => {},
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.symmetricDifference(s2);
+ },
+ "GetSetRecord throws an error when size is undefined"
+);
+
+s2.size = NaN;
+assert.throws(
+ TypeError,
+ function () {
+ s1.symmetricDifference(s2);
+ },
+ "GetSetRecord throws an error when size is NaN"
+);
+
+let coercionCalls = 0;
+s2.size = {
+ valueOf: function() {
+ ++coercionCalls;
+ return NaN;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.symmetricDifference(s2);
+ },
+ "GetSetRecord throws an error when size coerces to NaN"
+);
+assert.sameValue(coercionCalls, 1, "GetSetRecord coerces size");
+
+s2.size = 0n;
+assert.throws(
+ TypeError,
+ function () {
+ s1.symmetricDifference(s2);
+ },
+ "GetSetRecord throws an error when size is a BigInt"
+);
+
+s2.size = "string";
+assert.throws(
+ TypeError,
+ function () {
+ s1.symmetricDifference(s2);
+ },
+ "GetSetRecord throws an error when size is a non-numeric string"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/subclass-receiver-methods.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/subclass-receiver-methods.js
new file mode 100644
index 0000000000..03a30d8b54
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/subclass-receiver-methods.js
@@ -0,0 +1,48 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference works on subclasses of Set, but never calls the receiver's size/has/keys methods
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+let sizeCount = 0;
+let hasCount = 0;
+let keysCount = 0;
+
+class MySet extends Set {
+ size(...rest) {
+ sizeCount++;
+ return super.size(...rest);
+ }
+
+ has(...rest) {
+ hasCount++;
+ return super.has(...rest);
+ }
+
+ keys(...rest) {
+ keysCount++;
+ return super.keys(...rest);
+ }
+}
+
+const s1 = new MySet([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [1, 3];
+const combined = s1.symmetricDifference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(
+ combined instanceof MySet,
+ false,
+ "The returned object is a Set, not a subclass"
+);
+assert.sameValue(sizeCount, 0, "size should not be called on the receiver");
+assert.sameValue(hasCount, 0, "has should not be called on the receiver");
+assert.sameValue(keysCount, 0, "keys should not be called on the receiver");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/subclass-symbol-species.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/subclass-symbol-species.js
new file mode 100644
index 0000000000..be7bf72ff9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/subclass-symbol-species.js
@@ -0,0 +1,32 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference works on subclasses of Set, but returns an instance of Set even when Symbol.species is overridden.
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+var count = 0;
+class MySet extends Set {
+ static get [Symbol.species]() {
+ count++;
+ return Set;
+ }
+}
+
+const s1 = new MySet([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [1, 3];
+const combined = s1.symmetricDifference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(count, 0, "Symbol.species is never called");
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(
+ combined instanceof MySet,
+ false,
+ "The returned object is a Set, not a subclass"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/subclass.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/subclass.js
new file mode 100644
index 0000000000..a6c06ef638
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/subclass.js
@@ -0,0 +1,26 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference works on subclasses of Set, but returns an instance of Set
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+class MySet extends Set {}
+
+const s1 = new MySet([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [1, 3];
+const combined = s1.symmetricDifference(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(
+ combined instanceof MySet,
+ false,
+ "The returned object is a Set, not a subclass"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/symmetricDifference.js b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/symmetricDifference.js
new file mode 100644
index 0000000000..5208757c7b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/symmetricDifference/symmetricDifference.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner and Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.symmetricdifference
+description: Set.prototype.symmetricDifference properties
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+
+assert.sameValue(
+ typeof Set.prototype.symmetricDifference,
+ "function",
+ "`typeof Set.prototype.symmetricDifference` is `'function'`"
+);
+
+verifyProperty(Set.prototype, "symmetricDifference", {
+ enumerable: false,
+ writable: true,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/add-not-called.js b/js/src/tests/test262/built-ins/Set/prototype/union/add-not-called.js
new file mode 100644
index 0000000000..31b767ea20
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/add-not-called.js
@@ -0,0 +1,30 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union should not call Set.prototype.add
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [1, 2, 3];
+
+const originalAdd = Set.prototype.add;
+let count = 0;
+Set.prototype.add = function (...rest) {
+ count++;
+ return originalAdd.apply(this, rest);
+};
+
+const combined = s1.union(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(count, 0, "Add is never called");
+
+Set.prototype.add = originalAdd;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/allows-set-like-class.js b/js/src/tests/test262/built-ins/Set/prototype/union/allows-set-like-class.js
new file mode 100644
index 0000000000..d4ecd03a43
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/allows-set-like-class.js
@@ -0,0 +1,37 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: GetSetRecord allows instances of Set-like classes
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+ 2. Let rawSize be ? Get(obj, "size").
+ ...
+ 7. Let has be ? Get(obj, "has").
+ ...
+ 9. Let keys be ? Get(obj, "keys").
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new class {
+ get size() {
+ return 2;
+ }
+ has() {
+ throw new Test262Error("Set.prototype.union should not invoke .has on its argument");
+ }
+ * keys() {
+ yield 2;
+ yield 3;
+ }
+};
+const expected = [1, 2, 3];
+const combined = s1.union(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/allows-set-like-object.js b/js/src/tests/test262/built-ins/Set/prototype/union/allows-set-like-object.js
new file mode 100644
index 0000000000..7b2c473bc3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/allows-set-like-object.js
@@ -0,0 +1,35 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: GetSetRecord allows Set-like objects
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+ 2. Let rawSize be ? Get(obj, "size").
+ ...
+ 7. Let has be ? Get(obj, "has").
+ ...
+ 9. Let keys be ? Get(obj, "keys").
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: () => {
+ throw new Test262Error("Set.prototype.union should not invoke .has on its argument");
+ },
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+const expected = [1, 2, 3];
+const combined = s1.union(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/appends-new-values.js b/js/src/tests/test262/built-ins/Set/prototype/union/appends-new-values.js
new file mode 100644
index 0000000000..abecddcaa6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/appends-new-values.js
@@ -0,0 +1,33 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union appends new values to a copy of the original Set
+info: |
+ 7.b.iii.1 Append nextValue to resultSetData.
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([-1, 0, 3]);
+const expected = [1, 2, -1, 0, 3];
+const combined = s1.union(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+const s3 = new Set([1, 2, -3]);
+const s4 = new Set([-1, 0]);
+const expected2 = [1, 2, -3, -1, 0];
+const combined2 = s3.union(s4);
+
+assert.compareArray([...combined2], expected2);
+assert.sameValue(
+ combined2 instanceof Set,
+ true,
+ "The returned object is a Set"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/array-throws.js b/js/src/tests/test262/built-ins/Set/prototype/union/array-throws.js
new file mode 100644
index 0000000000..473a2666c6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/array-throws.js
@@ -0,0 +1,20 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union doesn't work with arrays
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = [3];
+assert.throws(
+ TypeError,
+ function () {
+ s1.union(s2);
+ },
+ "Throws an error when an array is used"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/browser.js b/js/src/tests/test262/built-ins/Set/prototype/union/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/builtins.js b/js/src/tests/test262/built-ins/Set/prototype/union/builtins.js
new file mode 100644
index 0000000000..2968f970f7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/builtins.js
@@ -0,0 +1,28 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Tests that Set.prototype.union meets the requirements for built-in objects
+features: [set-methods]
+---*/
+
+assert.sameValue(
+ Object.isExtensible(Set.prototype.union),
+ true,
+ "Built-in objects must be extensible."
+);
+
+assert.sameValue(
+ Object.prototype.toString.call(Set.prototype.union),
+ "[object Function]",
+ "Object.prototype.toString"
+);
+
+assert.sameValue(
+ Object.getPrototypeOf(Set.prototype.union),
+ Function.prototype,
+ "prototype"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/called-with-object.js b/js/src/tests/test262/built-ins/Set/prototype/union/called-with-object.js
new file mode 100644
index 0000000000..68439a2d01
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/called-with-object.js
@@ -0,0 +1,69 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws if obj is not an object
+info: |
+ 1. If obj is not an Object, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+let s1 = new Set([1]);
+assert.throws(
+ TypeError,
+ function () {
+ s1.union(1);
+ },
+ "number"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.union("");
+ },
+ "string"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.union(1n);
+ },
+ "bigint"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.union(false);
+ },
+ "boolean"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.union(undefined);
+ },
+ "undefined"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.union(null);
+ },
+ "null"
+);
+
+assert.throws(
+ TypeError,
+ function () {
+ s1.union(Symbol("test"));
+ },
+ "symbol"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/combines-Map.js b/js/src/tests/test262/built-ins/Set/prototype/union/combines-Map.js
new file mode 100644
index 0000000000..c2d6414269
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/combines-Map.js
@@ -0,0 +1,22 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union combines with Map
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const m1 = new Map([
+ [2, "two"],
+ [3, "three"],
+]);
+const expected = [1, 2, 3];
+const combined = s1.union(m1);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/combines-empty-sets.js b/js/src/tests/test262/built-ins/Set/prototype/union/combines-empty-sets.js
new file mode 100644
index 0000000000..759370921b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/combines-empty-sets.js
@@ -0,0 +1,35 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union can combine empty Sets
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([]);
+const s2 = new Set([1, 2]);
+let expected = [1, 2];
+let combined = s1.union(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+const s3 = new Set([1, 2]);
+const s4 = new Set([]);
+expected = [1, 2];
+combined = s3.union(s4);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+const s5 = new Set([]);
+const s6 = new Set([]);
+expected = [];
+combined = s5.union(s6);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/combines-itself.js b/js/src/tests/test262/built-ins/Set/prototype/union/combines-itself.js
new file mode 100644
index 0000000000..6171720f6b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/combines-itself.js
@@ -0,0 +1,19 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union is successful when called on itself
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const expected = [1, 2];
+const combined = s1.union(s1);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(combined === s1, false, "The returned object is a new object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/combines-same-sets.js b/js/src/tests/test262/built-ins/Set/prototype/union/combines-same-sets.js
new file mode 100644
index 0000000000..0f2ed4deb4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/combines-same-sets.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union can combine Sets that have the same content
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([1, 2]);
+const expected = [1, 2];
+const combined = s1.union(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(combined === s1, false, "The returned object is a new object");
+assert.sameValue(combined === s2, false, "The returned object is a new object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/combines-sets.js b/js/src/tests/test262/built-ins/Set/prototype/union/combines-sets.js
new file mode 100644
index 0000000000..07760f6517
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/combines-sets.js
@@ -0,0 +1,19 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union combines Sets
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [1, 2, 3];
+const combined = s1.union(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/converts-negative-zero.js b/js/src/tests/test262/built-ins/Set/prototype/union/converts-negative-zero.js
new file mode 100644
index 0000000000..17cecff0ba
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/converts-negative-zero.js
@@ -0,0 +1,38 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union converts -0𝔽 to +0𝔽
+info: |
+ 7.b.ii. If nextValue is -0𝔽, set nextValue to +0𝔽.
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const setlikeWithMinusZero = {
+ size: 1,
+ has: function () {
+ throw new Test262Error("Set.prototype.union should not invoke .has on its argument");
+ },
+ keys: function () {
+ // we use an array here because the Set constructor would normalize away -0
+ return [-0].values();
+ },
+};
+
+const s1 = new Set([1]);
+let expected = [1, +0];
+let combined = s1.union(setlikeWithMinusZero);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+const s2 = new Set([+0]);
+expected = [+0];
+combined = s2.union(setlikeWithMinusZero);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/has-is-callable.js b/js/src/tests/test262/built-ins/Set/prototype/union/has-is-callable.js
new file mode 100644
index 0000000000..0d9900da88
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/has-is-callable.js
@@ -0,0 +1,39 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object's 'has' property is not callable
+info: |
+ 7. Let has be ? Get(obj, "has").
+ 8. If IsCallable(has) is false, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: undefined,
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.union(s2);
+ },
+ "GetSetRecord throws an error when has is undefined"
+);
+
+s2.has = {};
+assert.throws(
+ TypeError,
+ function () {
+ s1.union(s2);
+ },
+ "GetSetRecord throws an error when has is not callable"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/keys-is-callable.js b/js/src/tests/test262/built-ins/Set/prototype/union/keys-is-callable.js
new file mode 100644
index 0000000000..a90f365d14
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/keys-is-callable.js
@@ -0,0 +1,36 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object's 'keys' property is not callable
+info: |
+ 9. Let keys be ? Get(obj, "keys").
+ 10. If IsCallable(keys) is false, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: 2,
+ has: () => {},
+ keys: undefined,
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.union(s2);
+ },
+ "GetSetRecord throws an error when keys is undefined"
+);
+
+s2.keys = {};
+assert.throws(
+ TypeError,
+ function () {
+ s1.union(s2);
+ },
+ "GetSetRecord throws an error when keys is not callable"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/length.js b/js/src/tests/test262/built-ins/Set/prototype/union/length.js
new file mode 100644
index 0000000000..89925db7ad
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/length.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union length property
+info: |
+ Set.prototype.union ( other )
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+assert.sameValue(typeof Set.prototype.union, "function");
+
+verifyProperty(Set.prototype.union, "length", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 1,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/name.js b/js/src/tests/test262/built-ins/Set/prototype/union/name.js
new file mode 100644
index 0000000000..2a7a433071
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/name.js
@@ -0,0 +1,21 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union name property
+info: |
+ Set.prototype.union ( other )
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+assert.sameValue(typeof Set.prototype.union, "function");
+
+verifyProperty(Set.prototype.union, "name", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: "union",
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/not-a-constructor.js b/js/src/tests/test262/built-ins/Set/prototype/union/not-a-constructor.js
new file mode 100644
index 0000000000..9c4f4d7baf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/not-a-constructor.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union does not implement [[Construct]], is not new-able
+includes: [isConstructor.js]
+features: [Reflect.construct, set-methods]
+---*/
+
+assert.sameValue(
+ isConstructor(Set.prototype.union),
+ false,
+ "isConstructor(Set.prototype.union) must return false"
+);
+
+assert.throws(
+ TypeError,
+ () => {
+ new Set.prototype.union();
+ },
+ "`new Set.prototype.union()` throws TypeError"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/receiver-not-set.js b/js/src/tests/test262/built-ins/Set/prototype/union/receiver-not-set.js
new file mode 100644
index 0000000000..8bdc030eb7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/receiver-not-set.js
@@ -0,0 +1,47 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Kevin Gibbons, Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union throws when receiver is not a Set
+features: [set-methods]
+---*/
+
+class MySetLike {
+ constructor() {
+ this.size = 2;
+ this.has = () => {};
+ this.keys = function* keys() {
+ yield 2;
+ yield 3;
+ };
+ }
+}
+
+const s1 = new MySetLike();
+const s2 = new Set();
+assert.throws(
+ TypeError,
+ () => {
+ Set.prototype.union.call(s1, s2);
+ },
+ "Set-like class"
+);
+
+const s3 = {
+ size: 2,
+ has: () => {},
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ () => {
+ Set.prototype.union.call(s3, s2);
+ },
+ "Set-like object"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/require-internal-slot.js b/js/src/tests/test262/built-ins/Set/prototype/union/require-internal-slot.js
new file mode 100644
index 0000000000..56e659dce3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/require-internal-slot.js
@@ -0,0 +1,30 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union RequireInternalSlot
+info: |
+ 2. Perform ? RequireInternalSlot(O, [[SetData]])
+features: [set-methods]
+---*/
+
+const union = Set.prototype.union;
+
+assert.sameValue(typeof union, "function");
+
+const realSet = new Set([]);
+
+assert.throws(TypeError, () => union.call(undefined, realSet), "undefined");
+assert.throws(TypeError, () => union.call(null, realSet), "null");
+assert.throws(TypeError, () => union.call(true, realSet), "true");
+assert.throws(TypeError, () => union.call("", realSet), "empty string");
+assert.throws(TypeError, () => union.call(Symbol(), realSet), "symbol");
+assert.throws(TypeError, () => union.call(1, realSet), "1");
+assert.throws(TypeError, () => union.call(1n, realSet), "1n");
+assert.throws(TypeError, () => union.call({}, realSet), "plain object");
+assert.throws(TypeError, () => union.call([], realSet), "array");
+assert.throws(TypeError, () => union.call(new Map(), realSet), "map");
+assert.throws(TypeError, () => union.call(Set.prototype, realSet), "Set.prototype");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/result-order.js b/js/src/tests/test262/built-ins/Set/prototype/union/result-order.js
new file mode 100644
index 0000000000..1f447ceb90
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/result-order.js
@@ -0,0 +1,39 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union result ordering
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+{
+ const s1 = new Set([1, 2]);
+ const s2 = new Set([2, 3]);
+
+ assert.compareArray([...s1.union(s2)], [1, 2, 3]);
+}
+
+{
+ const s1 = new Set([2, 3]);
+ const s2 = new Set([1, 2]);
+
+ assert.compareArray([...s1.union(s2)], [2, 3, 1]);
+}
+
+{
+ const s1 = new Set([1, 2]);
+ const s2 = new Set([3]);
+
+ assert.compareArray([...s1.union(s2)], [1, 2, 3]);
+}
+
+{
+ const s1 = new Set([3]);
+ const s2 = new Set([1, 2]);
+
+ assert.compareArray([...s1.union(s2)], [3, 1, 2]);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/set-like-array.js b/js/src/tests/test262/built-ins/Set/prototype/union/set-like-array.js
new file mode 100644
index 0000000000..67510ca9c6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/set-like-array.js
@@ -0,0 +1,27 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Kevin Gibbons, Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union consumes a set-like array as a set-like, not an array
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = [5, 6];
+s2.size = 3;
+s2.has = function () {
+ throw new Test262Error("Set.prototype.union should not invoke .has on its argument");
+};
+s2.keys = function () {
+ return [2, 3, 4].values();
+};
+
+const expected = [1, 2, 3, 4];
+const combined = s1.union(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/set-like-class-mutation.js b/js/src/tests/test262/built-ins/Set/prototype/union/set-like-class-mutation.js
new file mode 100644
index 0000000000..c2fadf786a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/set-like-class-mutation.js
@@ -0,0 +1,50 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Kevin Gibbons, Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union maintains values even when a custom Set-like class mutates the receiver
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+const baseSet = new Set(["a", "b", "c", "d", "e"]);
+
+function mutatingIterator() {
+ let index = 0;
+ let values = ["x", "y"];
+ return {
+ next() {
+ baseSet.delete("b");
+ baseSet.delete("c");
+ baseSet.add("b");
+ baseSet.add("d");
+ return {
+ done: index >= 2,
+ value: values[index++],
+ };
+ },
+ };
+}
+
+const evilSetLike = {
+ size: 2,
+ get has() {
+ baseSet.add("q");
+ return function () {
+ throw new Test262Error("Set.prototype.union should not invoke .has on its argument");
+ };
+ },
+ keys() {
+ return mutatingIterator();
+ },
+};
+
+const combined = baseSet.union(evilSetLike);
+const expectedCombined = ["a", "b", "c", "d", "e", "q", "x", "y"];
+assert.compareArray([...combined], expectedCombined);
+
+const expectedNewBase = ["a", "d", "e", "q", "b"];
+assert.compareArray([...baseSet], expectedNewBase);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/set-like-class-order.js b/js/src/tests/test262/built-ins/Set/prototype/union/set-like-class-order.js
new file mode 100644
index 0000000000..47269809d4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/set-like-class-order.js
@@ -0,0 +1,121 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Kevin Gibbons, Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union calls a Set-like class's methods in order
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+let observedOrder = [];
+
+function observableIterator() {
+ let values = ["a", "b", "c"];
+ let index = 0;
+ return {
+ get next() {
+ observedOrder.push("getting next");
+ return function () {
+ observedOrder.push("calling next");
+ return {
+ get done() {
+ observedOrder.push("getting done");
+ return index >= values.length;
+ },
+ get value() {
+ observedOrder.push("getting value");
+ return values[index++];
+ },
+ };
+ };
+ },
+ };
+}
+
+class MySetLike {
+ get size() {
+ observedOrder.push("getting size");
+ return {
+ valueOf: function () {
+ observedOrder.push("ToNumber(size)");
+ return 2;
+ },
+ };
+ }
+ get has() {
+ observedOrder.push("getting has");
+ return function () {
+ throw new Test262Error("Set.prototype.union should not invoke .has on its argument");
+ };
+ }
+ get keys() {
+ observedOrder.push("getting keys");
+ return function () {
+ observedOrder.push("calling keys");
+ return observableIterator();
+ };
+ }
+}
+
+const expectedOrder = [
+ "getting size",
+ "ToNumber(size)",
+ "getting has",
+ "getting keys",
+ "calling keys",
+ "getting next",
+ // first iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // second iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // third iteration, has value
+ "calling next",
+ "getting done",
+ "getting value",
+ // fourth iteration, no value; ends
+ "calling next",
+ "getting done",
+];
+
+// this is smaller than argument
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "d"]);
+ const s2 = new MySetLike();
+ const combined = s1.union(s2);
+
+ assert.compareArray([...combined], ["a", "d", "b", "c"]);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is same size as argument
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "b", "d"]);
+ const s2 = new MySetLike();
+ const combined = s1.union(s2);
+
+ assert.compareArray([...combined], ["a", "b", "d", "c"]);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+// this is larger than argument
+{
+ observedOrder = [];
+
+ const s1 = new Set(["a", "b", "d", "e"]);
+ const s2 = new MySetLike();
+ const combined = s1.union(s2);
+
+ assert.compareArray([...combined], ["a", "b", "d", "e", "c"]);
+ assert.compareArray(observedOrder, expectedOrder);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/shell.js b/js/src/tests/test262/built-ins/Set/prototype/union/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/size-is-a-number.js b/js/src/tests/test262/built-ins/Set/prototype/union/size-is-a-number.js
new file mode 100644
index 0000000000..a6d35f655f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/size-is-a-number.js
@@ -0,0 +1,75 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getsetrecord
+description: GetSetRecord throws an exception if the Set-like object has a size that is coerced to NaN
+info: |
+ 2. Let rawSize be ? Get(obj, "size").
+ 3. Let numSize be ? ToNumber(rawSize).
+ 4. NOTE: If rawSize is undefined, then numSize will be NaN.
+ 5. If numSize is NaN, throw a TypeError exception.
+features: [set-methods]
+---*/
+
+const s1 = new Set([1, 2]);
+const s2 = {
+ size: undefined,
+ has: () => {},
+ keys: function* keys() {
+ yield 2;
+ yield 3;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.union(s2);
+ },
+ "GetSetRecord throws an error when size is undefined"
+);
+
+s2.size = NaN;
+assert.throws(
+ TypeError,
+ function () {
+ s1.union(s2);
+ },
+ "GetSetRecord throws an error when size is NaN"
+);
+
+let coercionCalls = 0;
+s2.size = {
+ valueOf: function() {
+ ++coercionCalls;
+ return NaN;
+ },
+};
+assert.throws(
+ TypeError,
+ function () {
+ s1.union(s2);
+ },
+ "GetSetRecord throws an error when size coerces to NaN"
+);
+assert.sameValue(coercionCalls, 1, "GetSetRecord coerces size");
+
+s2.size = 0n;
+assert.throws(
+ TypeError,
+ function () {
+ s1.union(s2);
+ },
+ "GetSetRecord throws an error when size is a BigInt"
+);
+
+s2.size = "string";
+assert.throws(
+ TypeError,
+ function () {
+ s1.union(s2);
+ },
+ "GetSetRecord throws an error when size is a non-numeric string"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/subclass-receiver-methods.js b/js/src/tests/test262/built-ins/Set/prototype/union/subclass-receiver-methods.js
new file mode 100644
index 0000000000..ac1a35a830
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/subclass-receiver-methods.js
@@ -0,0 +1,48 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union works on subclasses of Set, but never calls the receiver's size/has/keys methods
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+let sizeCount = 0;
+let hasCount = 0;
+let keysCount = 0;
+
+class MySet extends Set {
+ size(...rest) {
+ sizeCount++;
+ return super.size(...rest);
+ }
+
+ has(...rest) {
+ hasCount++;
+ return super.has(...rest);
+ }
+
+ keys(...rest) {
+ keysCount++;
+ return super.keys(...rest);
+ }
+}
+
+const s1 = new MySet([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [1, 2, 3];
+const combined = s1.union(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(
+ combined instanceof MySet,
+ false,
+ "The returned object is a Set, not a subclass"
+);
+assert.sameValue(sizeCount, 0, "size should not be called on the receiver");
+assert.sameValue(hasCount, 0, "has should not be called on the receiver");
+assert.sameValue(keysCount, 0, "keys should not be called on the receiver");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/subclass-symbol-species.js b/js/src/tests/test262/built-ins/Set/prototype/union/subclass-symbol-species.js
new file mode 100644
index 0000000000..1462bb443c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/subclass-symbol-species.js
@@ -0,0 +1,32 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union works on subclasses of Set, but returns an instance of Set even when Symbol.species is overridden.
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+var count = 0;
+class MySet extends Set {
+ static get [Symbol.species]() {
+ count++;
+ return Set;
+ }
+}
+
+const s1 = new MySet([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [1, 2, 3];
+const combined = s1.union(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(count, 0, "Symbol.species is never called");
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(
+ combined instanceof MySet,
+ false,
+ "The returned object is a Set, not a subclass"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/subclass.js b/js/src/tests/test262/built-ins/Set/prototype/union/subclass.js
new file mode 100644
index 0000000000..27162af19d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/subclass.js
@@ -0,0 +1,26 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union works on subclasses of Set, but returns an instance of Set
+features: [set-methods]
+includes: [compareArray.js]
+---*/
+
+class MySet extends Set {}
+
+const s1 = new MySet([1, 2]);
+const s2 = new Set([2, 3]);
+const expected = [1, 2, 3];
+const combined = s1.union(s2);
+
+assert.compareArray([...combined], expected);
+assert.sameValue(combined instanceof Set, true, "The returned object is a Set");
+assert.sameValue(
+ combined instanceof MySet,
+ false,
+ "The returned object is a Set, not a subclass"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/union.js b/js/src/tests/test262/built-ins/Set/prototype/union/union.js
new file mode 100644
index 0000000000..9e76c9c897
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/union/union.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- set-methods is not supported
+// Copyright (C) 2023 Anthony Frehner. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.union
+description: Set.prototype.union properties
+includes: [propertyHelper.js]
+features: [set-methods]
+---*/
+
+assert.sameValue(
+ typeof Set.prototype.union,
+ "function",
+ "`typeof Set.prototype.union` is `'function'`"
+);
+
+verifyProperty(Set.prototype, "union", {
+ enumerable: false,
+ writable: true,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/browser.js b/js/src/tests/test262/built-ins/Set/prototype/values/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/browser.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-array.js b/js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-array.js
new file mode 100644
index 0000000000..8c09871a1a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-array.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.values
+description: >
+ Set.prototype.values ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ ...
+ 2. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.values.call([]);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.values.call([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-map.js b/js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-map.js
new file mode 100644
index 0000000000..ba9452f718
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-map.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.values
+description: >
+ Set.prototype.values ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ ...
+ 2. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.values.call(new Map());
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.values.call(new Map());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-object.js b/js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-object.js
new file mode 100644
index 0000000000..8c96537bd7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-object.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.values
+description: >
+ Set.prototype.values ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ ...
+ 2. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.values.call({});
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.values.call({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-set-prototype.js b/js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-set-prototype.js
new file mode 100644
index 0000000000..6d9fcceecb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-set-prototype.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.values
+description: >
+ Set.prototype.values ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ ...
+ 2. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.values.call(Set.prototype);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.values.call(Set.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-weakset.js b/js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-weakset.js
new file mode 100644
index 0000000000..24a79a9138
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-weakset.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.values
+description: >
+ Set.prototype.values ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ ...
+ 2. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
+ ...
+features: [WeakSet]
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.values.call(new WeakSet());
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.values.call(new WeakSet());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/length.js b/js/src/tests/test262/built-ins/Set/prototype/values/length.js
new file mode 100644
index 0000000000..8e49d1bc51
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/length.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.values
+description: >
+ Set.prototype.values ( )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Set.prototype.values.length, 0, "The value of `Set.prototype.values.length` is `0`");
+
+verifyNotEnumerable(Set.prototype.values, "length");
+verifyNotWritable(Set.prototype.values, "length");
+verifyConfigurable(Set.prototype.values, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/name.js b/js/src/tests/test262/built-ins/Set/prototype/values/name.js
new file mode 100644
index 0000000000..a2458e9505
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/name.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-set.prototype.values
+description: >
+ Set.prototype.values ( )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Set.prototype.values.name, "values", "The value of `Set.prototype.values.name` is `'values'`");
+
+verifyNotEnumerable(Set.prototype.values, "name");
+verifyNotWritable(Set.prototype.values, "name");
+verifyConfigurable(Set.prototype.values, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/not-a-constructor.js b/js/src/tests/test262/built-ins/Set/prototype/values/not-a-constructor.js
new file mode 100644
index 0000000000..f21399ca9f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/not-a-constructor.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Set.prototype.values does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, Set, arrow-function]
+---*/
+
+assert.sameValue(isConstructor(Set.prototype.values), false, 'isConstructor(Set.prototype.values) must return false');
+
+assert.throws(TypeError, () => {
+ let s = new Set([]); new s.values();
+}, '`let s = new Set([]); new s.values()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/returns-iterator-empty.js b/js/src/tests/test262/built-ins/Set/prototype/values/returns-iterator-empty.js
new file mode 100644
index 0000000000..92c4dff059
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/returns-iterator-empty.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-set.prototype.values
+description: >
+ Returns an iterator that's already done if Set is empty.
+---*/
+
+var set = new Set();
+var iterator = set.values();
+var result = iterator.next();
+assert.sameValue(result.value, undefined, "The value of `result.value` is `undefined`");
+assert.sameValue(result.done, true, "The value of `result.done` is `true`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/returns-iterator.js b/js/src/tests/test262/built-ins/Set/prototype/values/returns-iterator.js
new file mode 100644
index 0000000000..319cbbddbe
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/returns-iterator.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-set.prototype.values
+description: >
+ The method should return a valid iterator with the context as the
+ IteratedObject.
+---*/
+
+var set = new Set();
+set.add(1);
+set.add(2);
+set.add(3);
+
+var iterator = set.values();
+var result;
+
+result = iterator.next();
+assert.sameValue(result.value, 1, 'First result `value`');
+assert.sameValue(result.done, false, 'First result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value, 2, 'Second result `value`');
+assert.sameValue(result.done, false, 'Second result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value, 3, 'Third result `value`');
+assert.sameValue(result.done, false, 'Third result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value, undefined, 'Exhausted result `value`');
+assert.sameValue(result.done, true, 'Exhausted result `done` flag');
+
+result = iterator.next();
+assert.sameValue(
+ result.value, undefined, 'Exhausted result `value` (repeated request)'
+);
+assert.sameValue(
+ result.done, true, 'Exhausted result `done` flag (repeated request)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/shell.js b/js/src/tests/test262/built-ins/Set/prototype/values/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/shell.js
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-boolean.js b/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-boolean.js
new file mode 100644
index 0000000000..83828a339d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-boolean.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.values
+description: >
+ Set.prototype.values ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ 1. If Type(set) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.values.call(false);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.values.call(false);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-null.js b/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-null.js
new file mode 100644
index 0000000000..253f10a31d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-null.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-set.prototype.values
+description: >
+ Set.prototype.values ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ 1. If Type(set) is not Object, throw a TypeError exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.values.call(null);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.values.call(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-number.js b/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-number.js
new file mode 100644
index 0000000000..1c8319a523
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-number.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-set.prototype.values
+description: >
+ Set.prototype.values ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ 1. If Type(set) is not Object, throw a TypeError exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.values.call(0);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.values.call(0);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-string.js b/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-string.js
new file mode 100644
index 0000000000..e6e81fdba2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-string.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-set.prototype.values
+description: >
+ Set.prototype.values ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ 1. If Type(set) is not Object, throw a TypeError exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.values.call("");
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.values.call("");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-symbol.js b/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-symbol.js
new file mode 100644
index 0000000000..bd88d0fabf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-symbol.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.values
+description: >
+ Set.prototype.values ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ 1. If Type(set) is not Object, throw a TypeError exception.
+ ...
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.values.call(Symbol());
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.values.call(Symbol());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-undefined.js b/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-undefined.js
new file mode 100644
index 0000000000..14c2ec0a0e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/this-not-object-throw-undefined.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-set.prototype.values
+description: >
+ Set.prototype.values ( )
+
+ ...
+ 2. Return CreateSetIterator(S, "value").
+
+
+ 23.2.5.1 CreateSetIterator Abstract Operation
+
+ 1. If Type(set) is not Object, throw a TypeError exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ Set.prototype.values.call(undefined);
+});
+
+assert.throws(TypeError, function() {
+ var s = new Set();
+ s.values.call(undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/values-iteration-mutable.js b/js/src/tests/test262/built-ins/Set/prototype/values/values-iteration-mutable.js
new file mode 100644
index 0000000000..c0ba8093c5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/values-iteration-mutable.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-set.prototype.values
+description: >
+ When an item is added to the set after the iterator is created but before
+ the iterator is "done" (as defined by 23.2.5.2.1), the new item should be
+ accessible via iteration. When an item is added to the set after the
+ iterator is "done", the new item should not be accessible via iteration.
+---*/
+
+var set = new Set();
+set.add(1);
+set.add(2);
+
+var iterator = set.values();
+var result;
+
+result = iterator.next();
+assert.sameValue(result.value, 1, 'First result `value`');
+assert.sameValue(result.done, false, 'First result `done` flag');
+
+set.add(3);
+
+result = iterator.next();
+assert.sameValue(result.value, 2, 'Second result `value`');
+assert.sameValue(result.done, false, 'Second result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value, 3, 'Third result `value`');
+assert.sameValue(result.done, false, 'Third result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value, undefined, 'Exhausted result `value`');
+assert.sameValue(result.done, true, 'Exhausted result `done` flag');
+
+set.add(4);
+
+result = iterator.next();
+assert.sameValue(
+ result.value, undefined, 'Exhausted result `value` (repeated request)'
+);
+assert.sameValue(
+ result.done, true, 'Exhausted result `done` flag (repeated request)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Set/prototype/values/values.js b/js/src/tests/test262/built-ins/Set/prototype/values/values.js
new file mode 100644
index 0000000000..4a02e37d00
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/values/values.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-set.prototype.values
+description: >
+ Set.prototype.values ( )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof Set.prototype.values,
+ "function",
+ "`typeof Set.prototype.values` is `'function'`"
+);
+
+verifyNotEnumerable(Set.prototype, "values");
+verifyWritable(Set.prototype, "values");
+verifyConfigurable(Set.prototype, "values");
+
+reportCompare(0, 0);