diff --git a/dom/base/ScriptSettings.cpp b/dom/base/ScriptSettings.cpp index 8cbea9aed5bc..d3d2fa0737e3 100644 --- a/dom/base/ScriptSettings.cpp +++ b/dom/base/ScriptSettings.cpp @@ -465,8 +465,8 @@ AutoJSContext::Init(bool aSafe MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL) } if (!mCx) { - mCx = xpc->GetSafeJSContext(); - mPusher.emplace(mCx); + mJSAPI.Init(); + mCx = mJSAPI.cx(); } } diff --git a/dom/base/ScriptSettings.h b/dom/base/ScriptSettings.h index 5e53cddea816..8e5dc63630d4 100644 --- a/dom/base/ScriptSettings.h +++ b/dom/base/ScriptSettings.h @@ -300,7 +300,7 @@ protected: void Init(bool aSafe MOZ_GUARD_OBJECT_NOTIFIER_PARAM); JSContext* mCx; - Maybe mPusher; + dom::AutoJSAPI mJSAPI; MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER };