mirror of https://github.com/tc39/test262.git
Ensure that proxying wrapped functions preserves checks
This commit is contained in:
parent
b690cb67be
commit
c768b9b8f2
|
@ -22,4 +22,11 @@ new Proxy(fn, {});
|
|||
|
||||
assert.sameValue(typeof proxyCallable, 'function', 'wrapped proxy callable object is typeof function');
|
||||
assert.sameValue(proxyCallable(), 42, 'wrappedpfn() returns 42');
|
||||
assert.sameValue(proxyCallable instanceof Proxy, false, 'the wrapped function "hides" the proxy instance');
|
||||
assert.sameValue((new Proxy(proxyCallable, {}))(), 42, 'wrapped functions can be proxied');
|
||||
|
||||
const getSecret = r.evaluate(`(obj) => { return obj.secret }`);
|
||||
const secretObj = { "secret": 496 };
|
||||
const dispatchToUnderlying = {
|
||||
apply: (target, this_, args) => { return target(args); }
|
||||
};
|
||||
assert.throws(TypeError, () => (new Proxy(getSecret, dispatchToUnderlying))(secretObj), 'Proxying a wrapped function and invoking it still performs boundary checks');
|
||||
|
|
Loading…
Reference in New Issue