1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-object.prototype.tostring
description: >
If Proxy is revoked during Get call, a string is returned.
info: |
Object.prototype.toString ( )
[...]
4. Let isArray be ? IsArray(O).
[...]
14. Else, let builtinTag be "Object".
15. Let tag be ? Get(O, @@toStringTag).
16. If Type(tag) is not String, set tag to builtinTag.
17. Return the string-concatenation of "[object ", tag, and "]".
IsArray ( argument )
[...]
3. If argument.[[ProxyHandler]] is null, throw a TypeError exception.
a. If argument.[[ProxyHandler]] is null, throw a TypeError exception.
b. Let target be argument.[[ProxyTarget]].
c. Return ? IsArray(target).
features: [Proxy]
---*/
var handle1 = Proxy.revocable([], {
get: function() {
handle1.revoke();
},
});
assert.sameValue(
Object.prototype.toString.call(handle1.proxy),
"[object Array]"
);
var handle2 = Proxy.revocable({}, {
get: function() {
handle2.revoke();
},
});
var handle2Proxy = new Proxy(handle2.proxy, {});
assert.sameValue(
Object.prototype.toString.call(handle2Proxy),
"[object Object]"
);
reportCompare(0, 0);
|