mirror of https://github.com/tc39/test262.git
Proxy.revocable
This commit is contained in:
parent
9bbe7c6272
commit
c3e71dcb0b
|
@ -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.
|
||||
/*---
|
||||
es6id: 26.2.2.1
|
||||
description: >
|
||||
The returned object has a proxy property which is the created Proxy object
|
||||
built with the given target and handler given parameters.
|
||||
info: >
|
||||
Proxy.revocable ( target, handler )
|
||||
|
||||
6. Perform CreateDataProperty(result, "proxy", p).
|
||||
---*/
|
||||
|
||||
var target = {
|
||||
attr: "foo"
|
||||
};
|
||||
var r = Proxy.revocable(target, {
|
||||
get: function(t, prop) {
|
||||
return t[prop] + "!";
|
||||
}
|
||||
});
|
||||
|
||||
assert.sameValue(r.proxy.attr, "foo!");
|
|
@ -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.
|
||||
/*---
|
||||
es6id: 26.2.2.1.1
|
||||
description: >
|
||||
Calling the revoked function again will return undefined
|
||||
info: >
|
||||
Proxy Revocation Functions
|
||||
|
||||
...
|
||||
1. Let p be the value of F’s [[RevocableProxy]] internal slot.
|
||||
2. If p is null, return undefined.
|
||||
---*/
|
||||
|
||||
var r = Proxy.revocable({}, {});
|
||||
|
||||
r.revoke();
|
||||
|
||||
assert.sameValue(r.revoke(), undefined);
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 26.2.2.1.1
|
||||
description: >
|
||||
Calling the revoked function returns undefined
|
||||
info: >
|
||||
Proxy Revocation Functions
|
||||
|
||||
...
|
||||
7. Return undefined.
|
||||
---*/
|
||||
|
||||
var r = Proxy.revocable({}, {});
|
||||
|
||||
assert.sameValue(r.revoke(), undefined);
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 26.2.2.1
|
||||
description: >
|
||||
The returned object has a `revoked` property which is a function
|
||||
info: >
|
||||
Proxy.revocable ( target, handler )
|
||||
|
||||
7. Perform CreateDataProperty(result, "revoke", revoker).
|
||||
---*/
|
||||
|
||||
var r = Proxy.revocable({}, {});
|
||||
|
||||
assert.sameValue(typeof r.revoke, "function");
|
Loading…
Reference in New Issue