Bug 864046 - GC: Almost the last rooting fixes in XPConnect - part 2 r=bholley

This commit is contained in:
Jon Coppeard 2013-04-20 13:08:16 +01:00
parent 721057a505
commit 1ad8c56d8b
5 changed files with 13 additions and 13 deletions

View File

@ -3190,7 +3190,8 @@ bool BindPropertyOp(JSContext *cx, Op &op, PropertyDescriptor *desc, HandleId id
// We have an actual property op. For getters, we use 0
// args, for setters we use 1 arg.
uint32_t args = (attrFlag == JSPROP_GETTER) ? 0 : 1;
func = GeneratePropertyOp(cx, desc->obj, id, args, op);
RootedObject obj(cx, desc->obj);
func = GeneratePropertyOp(cx, obj, id, args, op);
if (!func)
return false;
}

View File

@ -259,7 +259,7 @@ XPCCallContext::GetResolveName() const
}
inline jsid
XPCCallContext::SetResolveName(jsid name)
XPCCallContext::SetResolveName(JS::HandleId name)
{
CHECK_STATE(HAVE_CONTEXT);
return XPCJSRuntime::Get()->SetResolveName(name);

View File

@ -650,14 +650,15 @@ public:
}
}
void Reparent(JSContext *aCx, JSObject *aNewInner) {
void Reparent(JSContext *aCx, JSObject *aNewInnerArg) {
JS::RootedObject aNewInner(aCx, aNewInnerArg);
for (Map::Enum e(mTable); !e.empty(); e.popFront()) {
/*
* We reparent wrappers that have as their parent an inner window
* whose outer has the new inner window as its current inner.
*/
JSObject *parent = JS_GetParent(e.front().value);
JSObject *outer = JS_ObjectToOuterObject(aCx, parent);
JS::RootedObject parent(aCx, JS_GetParent(e.front().value));
JS::RootedObject outer(aCx, JS_ObjectToOuterObject(aCx, parent));
if (outer) {
JSObject *inner = JS_ObjectToInnerObject(aCx, outer);
if (inner == aNewInner && inner != parent)

View File

@ -665,7 +665,7 @@ PropertyOpForwarder(JSContext *cx, unsigned argc, jsval *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JSObject *callee = &args.callee();
JS::RootedObject callee(cx, &args.callee());
JS::RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
if (!obj)
return false;
@ -677,7 +677,7 @@ PropertyOpForwarder(JSContext *cx, unsigned argc, jsval *vp)
v = js::GetFunctionNativeReserved(callee, 1);
jsval argval = (argc > 0) ? args[0] : JSVAL_VOID;
JS::RootedValue argval(cx, (argc > 0) ? args.get(0) : JSVAL_VOID);
JS::RootedId id(cx);
if (!JS_ValueToId(cx, v, id.address()))
return false;
@ -689,7 +689,7 @@ extern JSClass PointerHolderClass;
template<typename Op>
JSObject *
GeneratePropertyOp(JSContext *cx, JSObject *obj, jsid id, unsigned argc, Op pop)
GeneratePropertyOp(JSContext *cx, JS::HandleObject obj, JS::HandleId id, unsigned argc, Op pop)
{
// The JS engine provides two reserved slots on function objects for
// XPConnect to use. Use them to stick the necessary info here.
@ -698,9 +698,7 @@ GeneratePropertyOp(JSContext *cx, JSObject *obj, jsid id, unsigned argc, Op pop)
if (!fun)
return nullptr;
JSObject *funobj = JS_GetFunctionObject(fun);
JS::AutoObjectRooter tvr(cx, funobj);
JS::RootedObject funobj(cx, JS_GetFunctionObject(fun));
// Unfortunately, we cannot guarantee that Op is aligned. Use a
// second object to work around this.

View File

@ -1202,7 +1202,7 @@ public:
inline void SetDestroyJSContextInDestructor(JSBool b);
inline jsid GetResolveName() const;
inline jsid SetResolveName(jsid name);
inline jsid SetResolveName(JS::HandleId name);
inline XPCWrappedNative* GetResolvingWrapper() const;
inline XPCWrappedNative* SetResolvingWrapper(XPCWrappedNative* w);
@ -3836,7 +3836,7 @@ private:
class MOZ_STACK_CLASS AutoResolveName
{
public:
AutoResolveName(XPCCallContext& ccx, jsid name
AutoResolveName(XPCCallContext& ccx, JS::HandleId name
MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
mOld(ccx, XPCJSRuntime::Get()->SetResolveName(name))
#ifdef DEBUG