mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
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:
parent
2e091fbe26
commit
e0bd7114ae
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user