Bug 778085 - Use the Handle API in a few more places in Proxy. r=efaust

--HG--
extra : rebase_source : 28c969ca61def36a14df6ee06681b17a44e2f993
This commit is contained in:
Bobby Holley 2012-08-10 13:55:55 +02:00
parent bed323fe4c
commit 3461a53566
5 changed files with 23 additions and 21 deletions

View File

@ -853,7 +853,7 @@ JS_GetPropertyDescArray(JSContext *cx, JSObject *obj_, JSPropertyDescArray *pda)
pd[i].id = IdToValue(props[i]);
if (!js_AddRoot(cx, &pd[i].value, NULL))
goto bad;
if (!Proxy::get(cx, obj, obj, props[i], &pd[i].value))
if (!Proxy::get(cx, obj, obj, props.handleAt(i), MutableHandleValue::fromMarkedLocation(&pd[i].value)))
goto bad;
}

View File

@ -676,7 +676,7 @@ GetIterator(JSContext *cx, HandleObject obj, unsigned flags, MutableHandleValue
miss:
if (obj->isProxy()) {
types::MarkIteratorUnknown(cx);
return Proxy::iterate(cx, obj, flags, vp.address());
return Proxy::iterate(cx, obj, flags, vp);
}
if (!GetCustomIterator(cx, obj, flags, vp))
return false;

View File

@ -4709,7 +4709,7 @@ js_GetPropertyHelperInline(JSContext *cx, HandleObject obj, HandleObject receive
if (!obj2->isNative()) {
return obj2->isProxy()
? Proxy::get(cx, obj2, receiver, id, vp.address())
? Proxy::get(cx, obj2, receiver, id, vp)
: obj2->getGeneric(cx, id, vp);
}

View File

@ -1149,28 +1149,30 @@ Proxy::hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp)
}
bool
Proxy::get(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, Value *vp)
Proxy::get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id,
MutableHandleValue vp)
{
JS_CHECK_RECURSION(cx, return false);
AutoPendingProxyOperation pending(cx, proxy);
return GetProxyHandler(proxy)->get(cx, proxy, receiver, id, vp);
return GetProxyHandler(proxy)->get(cx, proxy, receiver, id, vp.address());
}
bool
Proxy::getElementIfPresent(JSContext *cx, JSObject *proxy, JSObject *receiver, uint32_t index,
Value *vp, bool *present)
Proxy::getElementIfPresent(JSContext *cx, HandleObject proxy, HandleObject receiver, uint32_t index,
MutableHandleValue vp, bool *present)
{
JS_CHECK_RECURSION(cx, return false);
AutoPendingProxyOperation pending(cx, proxy);
return GetProxyHandler(proxy)->getElementIfPresent(cx, proxy, receiver, index, vp, present);
return GetProxyHandler(proxy)->getElementIfPresent(cx, proxy, receiver, index, vp.address(), present);
}
bool
Proxy::set(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, bool strict, Value *vp)
Proxy::set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, bool strict,
MutableHandleValue vp)
{
JS_CHECK_RECURSION(cx, return false);
AutoPendingProxyOperation pending(cx, proxy);
return GetProxyHandler(proxy)->set(cx, proxy, receiver, id, strict, vp);
return GetProxyHandler(proxy)->set(cx, proxy, receiver, id, strict, vp.address());
}
bool
@ -1182,11 +1184,11 @@ Proxy::keys(JSContext *cx, JSObject *proxy, AutoIdVector &props)
}
bool
Proxy::iterate(JSContext *cx, JSObject *proxy, unsigned flags, Value *vp)
Proxy::iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp)
{
JS_CHECK_RECURSION(cx, return false);
AutoPendingProxyOperation pending(cx, proxy);
return GetProxyHandler(proxy)->iterate(cx, proxy, flags, vp);
return GetProxyHandler(proxy)->iterate(cx, proxy, flags, vp.address());
}
bool
@ -1372,7 +1374,7 @@ static JSBool
proxy_GetGeneric(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id,
MutableHandleValue vp)
{
return Proxy::get(cx, obj, receiver, id, vp.address());
return Proxy::get(cx, obj, receiver, id, vp);
}
static JSBool
@ -1397,7 +1399,7 @@ static JSBool
proxy_GetElementIfPresent(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index,
MutableHandleValue vp, bool *present)
{
return Proxy::getElementIfPresent(cx, obj, receiver, index, vp.address(), present);
return Proxy::getElementIfPresent(cx, obj, receiver, index, vp, present);
}
static JSBool
@ -1412,7 +1414,7 @@ static JSBool
proxy_SetGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, JSBool strict)
{
return Proxy::set(cx, obj, obj, id, strict, vp.address());
return Proxy::set(cx, obj, obj, id, strict, vp);
}
static JSBool

View File

@ -215,13 +215,13 @@ class Proxy {
/* ES5 Harmony derived proxy traps. */
static bool has(JSContext *cx, JSObject *proxy, jsid id, bool *bp);
static bool hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp);
static bool get(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, Value *vp);
static bool getElementIfPresent(JSContext *cx, JSObject *proxy, JSObject *receiver,
uint32_t index, Value *vp, bool *present);
static bool set(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, bool strict,
Value *vp);
static bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, MutableHandleValue vp);
static bool getElementIfPresent(JSContext *cx, HandleObject proxy, HandleObject receiver,
uint32_t index, MutableHandleValue vp, bool *present);
static bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, bool strict,
MutableHandleValue vp);
static bool keys(JSContext *cx, JSObject *proxy, AutoIdVector &props);
static bool iterate(JSContext *cx, JSObject *proxy, unsigned flags, Value *vp);
static bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp);
/* Spidermonkey extensions. */
static bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value *vp);