Bug 1050340 - Handle boxed values with a new proxy trap. r=luke
This commit is contained in:
@@ -329,6 +329,13 @@ BaseProxyHandler::regexp_toShared(JSContext *cx, HandleObject proxy,
|
||||
MOZ_CRASH("This should have been a wrapped regexp");
|
||||
}
|
||||
|
||||
bool
|
||||
BaseProxyHandler::boxedValue_unbox(JSContext *cx, HandleObject proxy, MutableHandleValue vp) const
|
||||
{
|
||||
vp.setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BaseProxyHandler::defaultValue(JSContext *cx, HandleObject proxy, JSType hint,
|
||||
MutableHandleValue vp) const
|
||||
@@ -558,6 +565,13 @@ DirectProxyHandler::regexp_toShared(JSContext *cx, HandleObject proxy,
|
||||
return RegExpToShared(cx, target, g);
|
||||
}
|
||||
|
||||
bool
|
||||
DirectProxyHandler::boxedValue_unbox(JSContext *cx, HandleObject proxy, MutableHandleValue vp) const
|
||||
{
|
||||
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
||||
return Unbox(cx, target, vp);
|
||||
}
|
||||
|
||||
JSObject *
|
||||
DirectProxyHandler::weakmapKeyDelegate(JSObject *proxy) const
|
||||
{
|
||||
@@ -2609,6 +2623,13 @@ Proxy::regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g)
|
||||
return proxy->as<ProxyObject>().handler()->regexp_toShared(cx, proxy, g);
|
||||
}
|
||||
|
||||
bool
|
||||
Proxy::boxedValue_unbox(JSContext *cx, HandleObject proxy, MutableHandleValue vp)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
return proxy->as<ProxyObject>().handler()->boxedValue_unbox(cx, proxy, vp);
|
||||
}
|
||||
|
||||
bool
|
||||
Proxy::defaultValue(JSContext *cx, HandleObject proxy, JSType hint, MutableHandleValue vp)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user