Bug 937317 - Return null from ToWebIDLCallback if one doesn't already exist. r=bz

This commit is contained in:
Bobby Holley 2013-12-11 17:51:58 -08:00
parent 904374035f
commit d843f5b707

View File

@ -348,29 +348,7 @@ public:
nsRefPtr<WebIDLCallbackT> callback = GetWebIDLCallback();
return callback.forget();
}
XPCOMCallbackT* callback = GetXPCOMCallback();
if (!callback) {
return nullptr;
}
nsCOMPtr<nsIXPConnectWrappedJS> wrappedJS = do_QueryInterface(callback);
if (!wrappedJS) {
return nullptr;
}
AutoSafeJSContext cx;
JS::Rooted<JSObject*> obj(cx, wrappedJS->GetJSObject());
if (!obj) {
return nullptr;
}
JSAutoCompartment ac(cx, obj);
// XXXbholley - This goes away in the next patch.
nsRefPtr<WebIDLCallbackT> newCallback = new WebIDLCallbackT(obj, /* aIncumbentGlobal = */ nullptr);
return newCallback.forget();
return nullptr;
}
private: