| 1 |
// Copyright (C) 2015 the V8 project authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
/*--- |
| 4 |
es6id: 23.4.1.1 |
| 5 |
esid: sec-weakset-iterable |
| 6 |
description: > |
| 7 |
Return abrupt after getting `add` method. |
| 8 |
info: | |
| 9 |
23.4.1.1 WeakSet ( [ iterable ] ) |
| 10 |
|
| 11 |
... |
| 12 |
5. If iterable is not present, let iterable be undefined. |
| 13 |
6. If iterable is either undefined or null, let iter be undefined. |
| 14 |
7. Else, |
| 15 |
a. Let adder be Get(set, "add"). |
| 16 |
b. ReturnIfAbrupt(adder). |
| 17 |
... |
| 18 |
---*/ |
| 19 |
|
| 20 |
Object.defineProperty(WeakSet.prototype, 'add', { |
| 21 |
get: function() { |
| 22 |
throw new Test262Error(); |
| 23 |
} |
| 24 |
}); |
| 25 |
|
| 26 |
new WeakSet(); |
| 27 |
new WeakSet(null); |
| 28 |
|
| 29 |
assert.throws(Test262Error, function() { |
| 30 |
new WeakSet([]); |
| 31 |
}); |