Skip to content
Snippets Groups Projects
Commit c3e71dcb authored by Leonardo Balter's avatar Leonardo Balter
Browse files

Proxy.revocable

parent 9bbe7c62
No related branches found
No related tags found
No related merge requests found
// 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!");
// 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);
// 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);
// 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");
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment