зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1276286. Remove the unused JSContext stuff in nsJSObjWrapper::GetNewOrUsed. r=mccr8
This commit is contained in:
Родитель
b4f5d9a2c6
Коммит
27314790c8
|
@ -472,18 +472,6 @@ GetGlobalObject(NPP npp)
|
|||
return doc->GetScopeObject();
|
||||
}
|
||||
|
||||
JSContext *
|
||||
GetJSContext(NPP npp)
|
||||
{
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(GetGlobalObject(npp));
|
||||
NS_ENSURE_TRUE(sgo, nullptr);
|
||||
|
||||
nsIScriptContext *scx = sgo->GetContext();
|
||||
NS_ENSURE_TRUE(scx, nullptr);
|
||||
|
||||
return scx->GetNativeContext();
|
||||
}
|
||||
|
||||
} // namespace parent
|
||||
} // namespace plugins
|
||||
} // namespace mozilla
|
||||
|
@ -610,7 +598,7 @@ JSValToNPVariant(NPP npp, JSContext *cx, JS::Value val, NPVariant *variant)
|
|||
obj = val.toObjectOrNull();
|
||||
}
|
||||
|
||||
NPObject *npobj = nsJSObjWrapper::GetNewOrUsed(npp, cx, obj);
|
||||
NPObject* npobj = nsJSObjWrapper::GetNewOrUsed(npp, obj);
|
||||
if (!npobj) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1103,7 +1091,7 @@ nsJSObjWrapper::NP_Construct(NPObject *npobj, const NPVariant *args,
|
|||
|
||||
// static
|
||||
NPObject *
|
||||
nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JS::Handle<JSObject*> obj)
|
||||
nsJSObjWrapper::GetNewOrUsed(NPP npp, JS::Handle<JSObject*> obj)
|
||||
{
|
||||
if (!npp) {
|
||||
NS_ERROR("Null NPP passed to nsJSObjWrapper::GetNewOrUsed()!");
|
||||
|
@ -1122,16 +1110,6 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JS::Handle<JSObject*> obj)
|
|||
}
|
||||
}
|
||||
|
||||
if (!cx) {
|
||||
cx = GetJSContext(npp);
|
||||
|
||||
if (!cx) {
|
||||
NS_ERROR("Unable to find a JSContext in nsJSObjWrapper::GetNewOrUsed()!");
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// No need to enter the right compartment here as we only get the
|
||||
// class and private from the JSObject, neither of which cares about
|
||||
// compartments.
|
||||
|
|
|
@ -58,8 +58,7 @@ public:
|
|||
const NPP mNpp;
|
||||
bool mDestroyPending;
|
||||
|
||||
static NPObject *GetNewOrUsed(NPP npp, JSContext *cx,
|
||||
JS::Handle<JSObject*> obj);
|
||||
static NPObject* GetNewOrUsed(NPP npp, JS::Handle<JSObject*> obj);
|
||||
static bool HasOwnProperty(NPObject* npobj, NPIdentifier npid);
|
||||
|
||||
void trace(JSTracer* trc) {
|
||||
|
|
|
@ -1062,9 +1062,9 @@ _getwindowobject(NPP npp)
|
|||
nsCOMPtr<nsPIDOMWindowOuter> outer = doc->GetWindow();
|
||||
NS_ENSURE_TRUE(outer, nullptr);
|
||||
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JSObject*> global(cx, nsGlobalWindow::Cast(outer)->GetGlobalJSObject());
|
||||
return nsJSObjWrapper::GetNewOrUsed(npp, cx, global);
|
||||
JS::Rooted<JSObject*> global(nsContentUtils::RootingCx(),
|
||||
nsGlobalWindow::Cast(outer)->GetGlobalJSObject());
|
||||
return nsJSObjWrapper::GetNewOrUsed(npp, global);
|
||||
}
|
||||
|
||||
NPObject*
|
||||
|
@ -1104,7 +1104,7 @@ _getpluginelement(NPP npp)
|
|||
NS_GET_IID(nsIDOMElement), obj.address());
|
||||
NS_ENSURE_TRUE(obj, nullptr);
|
||||
|
||||
return nsJSObjWrapper::GetNewOrUsed(npp, cx, obj);
|
||||
return nsJSObjWrapper::GetNewOrUsed(npp, obj);
|
||||
}
|
||||
|
||||
NPIdentifier
|
||||
|
|
Загрузка…
Ссылка в новой задаче