summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/WeakSet/prototype/has
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-array.js25
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-map.js25
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-object.js25
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-set.js26
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-weakset-prototype.js25
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/has.js25
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/length.js24
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/name.js24
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-false-when-object-value-not-present.js25
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-false-when-symbol-value-not-present.js29
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-false-when-value-cannot-be-held-weakly.js22
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-true-when-object-value-present.js20
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-true-when-symbol-value-present.js24
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-boolean.js23
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-null.js23
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-number.js23
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-string.js23
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-symbol.js23
-rw-r--r--js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-undefined.js23
22 files changed, 492 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/browser.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/browser.js
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-array.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-array.js
new file mode 100644
index 0000000000..daa590bb0b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-array.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakset.prototype.has
+description: >
+ Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
+info: |
+ WeakSet.prototype.has ( value )
+
+ ...
+ 3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ WeakSet.prototype.has.call([], {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new WeakSet();
+ s.has.call([], {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-map.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-map.js
new file mode 100644
index 0000000000..1d2bc18b93
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-map.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-weakset.prototype.has
+description: >
+ Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
+info: |
+ WeakSet.prototype.has ( value )
+
+ ...
+ 3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ WeakSet.prototype.has.call(new Map(), {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new WeakSet();
+ s.has.call(new Map(), {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-object.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-object.js
new file mode 100644
index 0000000000..b8ffc9af21
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-object.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakset.prototype.has
+description: >
+ Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
+info: |
+ WeakSet.prototype.has ( value )
+
+ ...
+ 3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ WeakSet.prototype.has.call({}, {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new WeakSet();
+ s.has.call({}, {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-set.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-set.js
new file mode 100644
index 0000000000..9058742811
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-set.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakset.prototype.has
+description: >
+ Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
+info: |
+ WeakSet.prototype.has ( value )
+
+ ...
+ 3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [Set]
+---*/
+
+assert.throws(TypeError, function() {
+ WeakSet.prototype.has.call(new Set(), {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new WeakSet();
+ s.has.call(new Set(), {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-weakset-prototype.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-weakset-prototype.js
new file mode 100644
index 0000000000..85b34cc559
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-weakset-prototype.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakset.prototype.has
+description: >
+ Throws TypeError if context doesn't have a [[WeakSetData]] internal slot.
+info: |
+ WeakSet.prototype.has ( value )
+
+ ...
+ 3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ WeakSet.prototype.has.call(WeakSet.prototype, {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new WeakSet();
+ s.has.call(WeakSet.prototype, {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/has.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/has.js
new file mode 100644
index 0000000000..9436ad778e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/has.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakset.prototype.has
+description: >
+ WeakSet.prototype.has property descriptor
+info: |
+ WeakSet.prototype.has ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ typeof WeakSet.prototype.has,
+ 'function',
+ 'typeof WeakSet.prototype.has is "function"'
+);
+
+verifyNotEnumerable(WeakSet.prototype, 'has');
+verifyWritable(WeakSet.prototype, 'has');
+verifyConfigurable(WeakSet.prototype, 'has');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/length.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/length.js
new file mode 100644
index 0000000000..5e4176a5cc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/length.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakset.prototype.has
+description: >
+ WeakSet.prototype.has.length value and writability.
+info: |
+ WeakSet.prototype.has ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ WeakSet.prototype.has.length, 1,
+ 'The value of WeakSet.prototype.has.length is 1'
+);
+
+verifyNotEnumerable(WeakSet.prototype.has, 'length');
+verifyNotWritable(WeakSet.prototype.has, 'length');
+verifyConfigurable(WeakSet.prototype.has, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/name.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/name.js
new file mode 100644
index 0000000000..6fca676585
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/name.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakset.prototype.has
+description: >
+ WeakSet.prototype.has.name value and writability.
+info: |
+ WeakSet.prototype.has ( value )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(
+ WeakSet.prototype.has.name, 'has',
+ 'The value of WeakSet.prototype.has.name is "has"'
+);
+
+verifyNotEnumerable(WeakSet.prototype.has, 'name');
+verifyNotWritable(WeakSet.prototype.has, 'name');
+verifyConfigurable(WeakSet.prototype.has, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/not-a-constructor.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/not-a-constructor.js
new file mode 100644
index 0000000000..b21d7cb36f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/not-a-constructor.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ WeakSet.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, WeakSet, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(WeakSet.prototype.has),
+ false,
+ 'isConstructor(WeakSet.prototype.has) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let ws = new WeakSet(); new ws.has();
+}, '`let ws = new WeakSet(); new ws.has()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-false-when-object-value-not-present.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-false-when-object-value-not-present.js
new file mode 100644
index 0000000000..61bb52e68b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-false-when-object-value-not-present.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakset.prototype.has
+description: >
+ Return false when an Object value is not present in the WeakSet entries.
+info: |
+ WeakSet.prototype.has ( _value_ )
+ 6. Return *false*.
+features: [WeakSet]
+---*/
+
+var foo = {};
+var bar = {};
+var s = new WeakSet();
+
+assert.sameValue(s.has(foo), false);
+
+s.add(foo);
+assert.sameValue(s.has(bar), false);
+
+s.delete(foo);
+assert.sameValue(s.has(foo), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-false-when-symbol-value-not-present.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-false-when-symbol-value-not-present.js
new file mode 100644
index 0000000000..f640fc25be
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-false-when-symbol-value-not-present.js
@@ -0,0 +1,29 @@
+// |reftest| skip -- symbols-as-weakmap-keys is not supported
+// Copyright (C) 2022 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakset.prototype.has
+description: >
+ Return false when a Symbol value is not present in the WeakSet entries.
+info: |
+ WeakSet.prototype.has ( _value_ )
+ 6. Return *false*.
+features: [Symbol, WeakSet, symbols-as-weakmap-keys]
+---*/
+
+var foo = Symbol('a description');
+var bar = Symbol('a description');
+var s = new WeakSet();
+
+assert.sameValue(s.has(foo), false, 'Set is initially empty of regular symbol');
+assert.sameValue(s.has(Symbol.hasInstance), false, 'Set is initially empty of well-known symbol');
+
+s.add(foo);
+assert.sameValue(s.has(bar), false, 'Symbols with the same description are not aliased to each other');
+
+s.delete(foo);
+assert.sameValue(s.has(foo), false, 'Set is again empty of regular symbol after deleting');
+s.delete(Symbol.hasInstance);
+assert.sameValue(s.has(Symbol.hasInstance), false, 'Set is again empty of well-known symbol after deleting');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-false-when-value-cannot-be-held-weakly.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-false-when-value-cannot-be-held-weakly.js
new file mode 100644
index 0000000000..257a3084e6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-false-when-value-cannot-be-held-weakly.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakset.prototype.has
+description: >
+ Returns false if value cannot be held weakly.
+info: |
+ WeakSet.prototype.has ( _value_ )
+ 4. If CanBeHeldWeakly(_value_) is *false*, return *false*.
+features: [Symbol, WeakSet]
+---*/
+
+var s = new WeakSet();
+
+assert.sameValue(s.has(1), false);
+assert.sameValue(s.has(''), false);
+assert.sameValue(s.has(null), false);
+assert.sameValue(s.has(undefined), false);
+assert.sameValue(s.has(true), false);
+assert.sameValue(s.has(Symbol.for('registered symbol')), false, 'Registered symbol not allowed as value');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-true-when-object-value-present.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-true-when-object-value-present.js
new file mode 100644
index 0000000000..a573289c03
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-true-when-object-value-present.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakset.prototype.has
+description: >
+ Returns true when an Object value is present in the WeakSet entries list.
+info: |
+ WeakSet.prototype.has ( _value_ )
+ 5. For each element _e_ of _entries_, do
+ a. If _e_ is not ~empty~ and SameValue(_e_, _value_) is *true*, return *true*.
+features: [WeakSet]
+---*/
+
+var foo = {};
+var s = new WeakSet();
+
+s.add(foo);
+assert.sameValue(s.has(foo), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-true-when-symbol-value-present.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-true-when-symbol-value-present.js
new file mode 100644
index 0000000000..3ff3428392
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/returns-true-when-symbol-value-present.js
@@ -0,0 +1,24 @@
+// |reftest| skip -- symbols-as-weakmap-keys is not supported
+// Copyright (C) 2022 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakset.prototype.has
+description: >
+ Returns true when a Symbol value is present in the WeakSet entries list.
+info: |
+ WeakSet.prototype.has ( _value_ )
+ 5. For each element _e_ of _entries_, do
+ a. If _e_ is not ~empty~ and SameValue(_e_, _value_) is *true*, return *true*.
+features: [Symbol, WeakSet, symbols-as-weakmap-keys]
+---*/
+
+var foo = Symbol('a description');
+var s = new WeakSet();
+
+s.add(foo);
+assert.sameValue(s.has(foo), true, 'Regular symbol as value');
+
+s.add(Symbol.hasInstance);
+assert.sameValue(s.has(Symbol.hasInstance), true, 'Well-known symbol as value');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/shell.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/shell.js
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-boolean.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-boolean.js
new file mode 100644
index 0000000000..aa0ed435c9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-boolean.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-weakset.prototype.has
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakSet.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() {
+ WeakSet.prototype.has.call(false, {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new WeakSet();
+ s.has.call(false, {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-null.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-null.js
new file mode 100644
index 0000000000..5d8c2507e0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-null.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-weakset.prototype.has
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakSet.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() {
+ WeakSet.prototype.has.call(null, {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new WeakSet();
+ s.has.call(null, {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-number.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-number.js
new file mode 100644
index 0000000000..9ebc28ea00
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-number.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-weakset.prototype.has
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakSet.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() {
+ WeakSet.prototype.has.call(0, {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new WeakSet();
+ s.has.call(0, {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-string.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-string.js
new file mode 100644
index 0000000000..2be2567b3f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-string.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-weakset.prototype.has
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakSet.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() {
+ WeakSet.prototype.has.call('', {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new WeakSet();
+ s.has.call('', {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-symbol.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-symbol.js
new file mode 100644
index 0000000000..24465cdc64
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/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-weakset.prototype.has
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakSet.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() {
+ WeakSet.prototype.has.call(Symbol(), {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new WeakSet();
+ s.has.call(Symbol(), {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-undefined.js b/js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-undefined.js
new file mode 100644
index 0000000000..33669f28b9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/WeakSet/prototype/has/this-not-object-throw-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-weakset.prototype.has
+description: Throws TypeError if `this` is not Object.
+info: |
+ WeakSet.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() {
+ WeakSet.prototype.has.call(undefined, {});
+});
+
+assert.throws(TypeError, function() {
+ var s = new WeakSet();
+ s.has.call(undefined, {});
+});
+
+reportCompare(0, 0);