diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index bccd9a6e7c70..ac9749909020 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -39,6 +39,7 @@ #include "nsXPCOMCIDInternal.h" #include "nsIXULRuntime.h" #include "nsTextFormatter.h" +#include "ScriptSettings.h" #include "xpcpublic.h" @@ -1632,7 +1633,9 @@ nsresult nsJSContext::InitClasses(JS::Handle aGlobalObj) { JSOptionChangedCallback(js_options_dot_str, this); - AutoPushJSContext cx(mContext); + AutoJSAPI jsapi; + JSContext* cx = jsapi.cx(); + JSAutoCompartment ac(cx, aGlobalObj); // Attempt to initialize profiling functions ::JS_DefineProfilingFunctions(cx, aGlobalObj);