Bug 902249 - Fix some exact rooting hazards in js/ipc; r=jonco

This commit is contained in:
Terrence Cole
2013-08-07 16:15:57 -07:00
parent 311831c0c9
commit 7edcc85b2d
3 changed files with 21 additions and 14 deletions

View File

@@ -112,14 +112,14 @@ class JavaScriptShared
virtual bool makeId(JSContext *cx, JSObject *obj, ObjectId *idp) = 0;
virtual JSObject *unwrap(JSContext *cx, ObjectId id) = 0;
bool unwrap(JSContext *cx, ObjectId id, JSObject **objp) {
bool unwrap(JSContext *cx, ObjectId id, JS::MutableHandle<JSObject*> objp) {
if (!id) {
*objp = NULL;
objp.set(NULL);
return true;
}
*objp = unwrap(cx, id);
return !!*objp;
objp.set(unwrap(cx, id));
return bool(objp.get());
}
static void ConvertID(const nsID &from, JSIID *to);