Bug 1559468 part 1. Move JS_DefineProfilingFunctions into InitClassesWithNewWrappedGlobal. r=mccr8

All callers of InitClassesWithNewWrappedGlobal already call it.

Differential Revision: https://phabricator.services.mozilla.com/D35457

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-06-20 21:44:03 +00:00
parent 2e091fbe26
commit e0bd7114ae
4 changed files with 10 additions and 6 deletions

View File

@ -397,8 +397,7 @@ bool XPCShellEnvironment::Init() {
JS::Rooted<Value> privateVal(cx, PrivateValue(this));
if (!JS_DefineProperty(cx, globalObj, "__XPCShellEnvironment", privateVal,
JSPROP_READONLY | JSPROP_PERMANENT) ||
!JS_DefineFunctions(cx, globalObj, gGlobalFunctions) ||
!JS_DefineProfilingFunctions(cx, globalObj)) {
!JS_DefineFunctions(cx, globalObj, gGlobalFunctions)) {
NS_ERROR("JS_DefineFunctions failed!");
return false;
}

View File

@ -588,8 +588,7 @@ void mozJSComponentLoader::CreateLoaderGlobal(JSContext* aCx,
backstagePass->SetGlobalObject(global);
JSAutoRealm ar(aCx, global);
if (!JS_DefineFunctions(aCx, global, gGlobalFun) ||
!JS_DefineProfilingFunctions(aCx, global)) {
if (!JS_DefineFunctions(aCx, global, gGlobalFun)) {
return;
}

View File

@ -1374,8 +1374,7 @@ int XRE_XPCShellMain(int argc, char** argv, char** envp,
return 1;
}
if (!JS_DefineFunctions(cx, glob, glob_functions) ||
!JS_DefineProfilingFunctions(cx, glob)) {
if (!JS_DefineFunctions(cx, glob, glob_functions)) {
return 1;
}

View File

@ -561,6 +561,13 @@ nsresult InitClassesWithNewWrappedGlobal(JSContext* aJSContext,
return UnexpectedFailure(NS_ERROR_FAILURE);
}
{ // Scope for JSAutoRealm
JSAutoRealm ar(aJSContext, global);
if (!JS_DefineProfilingFunctions(aJSContext, global)) {
return UnexpectedFailure(NS_ERROR_OUT_OF_MEMORY);
}
}
aNewGlobal.set(global);
return NS_OK;
}