Hello,
I'm a student at the university of Freiburg.
I write my master thesis about transparency of JavaScript proxies.
The topic is, that the proxies are not really transparent, because the
Equal-Operators (== and ===) compare the references of the proxies and not of
the targets. Also the WeakMap uses the proxy as key and don't allow the target
also as key, if a proxy was inserted.
First Question:
---------------
I should implement an addition for the Proxy API in form of a new Handler Trap,
which says if a proxy is really transparent or not.
The trap should look like this:
var handler = {
isTransparent: function(){
return true;
}
};
With this trap I should change the operators for comparing either the target or
the proxy, dependent of the result of the trap.
I've implemented the following Methods for the BaseProxyHandler and Proxy:
bool
BaseProxyHandler::isTransparent(JSContext *cx, HandleObject proxy, bool *bp)
{
return Proxy::isTransparent(cx, proxy, bp);
}
bool
Proxy::isTransparent(JSContext *cx, HandleObject proxy, bool *bp)
{
JS_CHECK_RECURSION(cx, return false);
return proxy->as<ProxyObject>().handler()->isTransparent(cx, proxy, bp);
}
How can I integrate the new trap into the proxy?
I've found the "const Class js::ObjectProxyObject::class_" must I do an new
entry for the trap?
Second Question:
---------------
I've found the "static JSObject * proxy_WeakmapKeyDelegate(JSObject *obj)". Can
I make a trap to use a Proxy as key in a WeakMap but use the target to get the
value with this method?
Third Question:
---------------
Is there a documentation for the Proxy API specific to the C++ implementation?
Thanks a lot
Andreas Schlegel
_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals