Bug 787856 - Use static JSObject::getProto in proxy code; r=wmccloskey

This commit is contained in:
Eddy Bruel 2012-09-30 17:51:26 +02:00
Родитель ef2beecd2b
Коммит dfa8197300
1 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -1603,7 +1603,9 @@ ScriptedDirectProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *proxy
return false;
if (desc->obj)
return true;
JSObject *proto = proxy->getProto();
RootedObject proto(cx);
if (!JSObject::getProto(cx, proxy, &proto))
return false;
if (!proto) {
JS_ASSERT(!desc->obj);
return true;
@ -3125,14 +3127,16 @@ proxy(JSContext *cx, unsigned argc, jsval *vp)
"Proxy", "1", "s");
return false;
}
JSObject *target = NonNullObject(cx, args[0]);
RootedObject target(cx, NonNullObject(cx, args[0]));
if (!target)
return false;
JSObject *handler = NonNullObject(cx, args[1]);
RootedObject handler(cx, NonNullObject(cx, args[1]));
if (!handler)
return false;
JSObject *proto = target->getProto();
JSObject *fun = target->isCallable() ? target : NULL;
RootedObject proto(cx);
if (!JSObject::getProto(cx, target, &proto))
return false;
RootedObject fun(cx, target->isCallable() ? target : (JSObject *) NULL);
JSObject *proxy = NewProxyObject(cx, &ScriptedDirectProxyHandler::singleton,
ObjectValue(*target), proto, proto->getParent(),
fun, fun);