|
|
|
|
| 2 |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
2 |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
3 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 |
|
4 |
|
| 5 |
// 23.4.3.1 |
5 |
// 23.4.3.1 |
| 6 |
function WeakSet_add(value) { |
6 |
function WeakSet_add(value) { |
| 7 |
// Steps 1-3. |
7 |
// Steps 1-3. |
| 8 |
var S = this; |
8 |
var S = this; |
| 9 |
if (!IsObject(S) || !IsWeakSet(S)) |
9 |
if (!IsObject(S) || !IsWeakSet(S)) |
| 10 |
ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "WeakSet", "add", typeof S); |
10 |
return callFunction(CallWeakSetMethodIfWrapped, this, value, "WeakSet_add"); |
| 11 |
|
11 |
|
| 12 |
// Step 4.,6. |
12 |
// Step 4.,6. |
| 13 |
let entries = UnsafeGetReservedSlot(this, WEAKSET_MAP_SLOT); |
13 |
let entries = UnsafeGetReservedSlot(this, WEAKSET_MAP_SLOT); |
| 14 |
if (!entries) |
14 |
if (!entries) |
| 15 |
ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "WeakSet", "add", typeof S); |
15 |
ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "WeakSet", "add", typeof S); |
| 16 |
|
16 |
|
| 17 |
// Step 5. |
17 |
// Step 5. |
| 18 |
if (!IsObject(value)) |
18 |
if (!IsObject(value)) |
|
Lines 25-41
function WeakSet_add(value) {
|
Link Here
|
|---|
|
| 25 |
return S; |
25 |
return S; |
| 26 |
} |
26 |
} |
| 27 |
|
27 |
|
| 28 |
// 23.4.3.2 |
28 |
// 23.4.3.2 |
| 29 |
function WeakSet_clear() { |
29 |
function WeakSet_clear() { |
| 30 |
// Step 1-3. |
30 |
// Step 1-3. |
| 31 |
var S = this; |
31 |
var S = this; |
| 32 |
if (!IsObject(S) || !IsWeakSet(S)) |
32 |
if (!IsObject(S) || !IsWeakSet(S)) |
| 33 |
ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "WeakSet", "clear", typeof S); |
33 |
return callFunction(CallWeakSetMethodIfWrapped, this, "WeakSet_clear"); |
| 34 |
|
34 |
|
| 35 |
// Step 4. |
35 |
// Step 4. |
| 36 |
let entries = UnsafeGetReservedSlot(this, WEAKSET_MAP_SLOT); |
36 |
let entries = UnsafeGetReservedSlot(this, WEAKSET_MAP_SLOT); |
| 37 |
if (!entries) |
37 |
if (!entries) |
| 38 |
ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "WeakSet", "clear", typeof S); |
38 |
ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "WeakSet", "clear", typeof S); |
| 39 |
|
39 |
|
| 40 |
// Step 5. |
40 |
// Step 5. |
| 41 |
callFunction(std_WeakMap_clear, entries); |
41 |
callFunction(std_WeakMap_clear, entries); |
|
Lines 44-60
function WeakSet_clear() {
|
Link Here
|
|---|
|
| 44 |
return undefined; |
44 |
return undefined; |
| 45 |
} |
45 |
} |
| 46 |
|
46 |
|
| 47 |
// 23.4.3.4 |
47 |
// 23.4.3.4 |
| 48 |
function WeakSet_delete(value) { |
48 |
function WeakSet_delete(value) { |
| 49 |
// Steps 1-3. |
49 |
// Steps 1-3. |
| 50 |
var S = this; |
50 |
var S = this; |
| 51 |
if (!IsObject(S) || !IsWeakSet(S)) |
51 |
if (!IsObject(S) || !IsWeakSet(S)) |
| 52 |
ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "WeakSet", "delete", typeof S); |
52 |
return callFunction(CallWeakSetMethodIfWrapped, this, value, "WeakSet_delete"); |
| 53 |
|
53 |
|
| 54 |
// Step 4.,6. |
54 |
// Step 4.,6. |
| 55 |
let entries = UnsafeGetReservedSlot(this, WEAKSET_MAP_SLOT); |
55 |
let entries = UnsafeGetReservedSlot(this, WEAKSET_MAP_SLOT); |
| 56 |
if (!entries) |
56 |
if (!entries) |
| 57 |
ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "WeakSet", "delete", typeof S); |
57 |
ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "WeakSet", "delete", typeof S); |
| 58 |
|
58 |
|
| 59 |
// Step 5. |
59 |
// Step 5. |
| 60 |
if (!IsObject(value)) |
60 |
if (!IsObject(value)) |
|
Lines 64-80
function WeakSet_delete(value) {
|
Link Here
|
|---|
|
| 64 |
return callFunction(std_WeakMap_delete, entries, value); |
64 |
return callFunction(std_WeakMap_delete, entries, value); |
| 65 |
} |
65 |
} |
| 66 |
|
66 |
|
| 67 |
// 23.4.3.5 |
67 |
// 23.4.3.5 |
| 68 |
function WeakSet_has(value) { |
68 |
function WeakSet_has(value) { |
| 69 |
// Steps 1-3. |
69 |
// Steps 1-3. |
| 70 |
var S = this; |
70 |
var S = this; |
| 71 |
if (!IsObject(S) || !IsWeakSet(S)) |
71 |
if (!IsObject(S) || !IsWeakSet(S)) |
| 72 |
ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "WeakSet", "has", typeof S); |
72 |
return callFunction(CallWeakSetMethodIfWrapped, this, value, "WeakSet_has"); |
| 73 |
|
73 |
|
| 74 |
// Step 4-5. |
74 |
// Step 4-5. |
| 75 |
let entries = UnsafeGetReservedSlot(this, WEAKSET_MAP_SLOT); |
75 |
let entries = UnsafeGetReservedSlot(this, WEAKSET_MAP_SLOT); |
| 76 |
if (!entries) |
76 |
if (!entries) |
| 77 |
ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "WeakSet", "has", typeof S); |
77 |
ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "WeakSet", "has", typeof S); |
| 78 |
|
78 |
|
| 79 |
// Step 6. |
79 |
// Step 6. |
| 80 |
if (!IsObject(value)) |
80 |
if (!IsObject(value)) |