forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1282257 - Create accessor properties in Debugger.Object.prototype…
… to expose the target and the handler of a proxy object. r=jimb --HG-- extra : rebase_source : e321ee817cee8c2f05103249ce9fad9762aa8643
- Loading branch information
1 parent
c4b04df
commit cd54045
Showing
4 changed files
with
127 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Debugger.Object.prototype.isProxy recognizes (scripted) proxies. | ||
// Debugger.Object.prototype.proxyTarget exposes the [[Proxytarget]] of a proxy. | ||
// Debugger.Object.prototype.proxyHandler exposes the [[ProxyHandler]] of a proxy. | ||
|
||
var g = newGlobal(); | ||
var dbg = new Debugger; | ||
var gDO = dbg.addDebuggee(g); | ||
|
||
g.eval('var target = [1,2,3];'); | ||
g.eval('var handler = {has: ()=>false};'); | ||
g.eval('var proxy = new Proxy(target, handler);'); | ||
g.eval('var proxyProxy = new Proxy(proxy, proxy);'); | ||
|
||
var target = gDO.getOwnPropertyDescriptor('target').value; | ||
var handler = gDO.getOwnPropertyDescriptor('handler').value; | ||
var proxy = gDO.getOwnPropertyDescriptor('proxy').value; | ||
var proxyProxy = gDO.getOwnPropertyDescriptor('proxyProxy').value; | ||
|
||
assertEq(target.isProxy, false); | ||
assertEq(handler.isProxy, false); | ||
assertEq(proxy.isProxy, true); | ||
assertEq(proxyProxy.isProxy, true); | ||
|
||
assertEq(target.proxyTarget, undefined); | ||
assertEq(handler.proxyTarget, undefined); | ||
assertEq(proxy.proxyTarget, target); | ||
assertEq(proxyProxy.proxyTarget, proxy); | ||
|
||
assertEq(target.proxyHandler, undefined); | ||
assertEq(handler.proxyHandler, undefined); | ||
assertEq(proxy.proxyHandler, handler); | ||
assertEq(proxyProxy.proxyTarget, proxy); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters