Bug 968335 - Use an AutoCxPusher directly in Auto{Entry,Incumbent}Global. r=bz

This will let us ask whether the AutoCxPusher is stack-top.
This commit is contained in:
Bobby Holley 2014-02-14 16:13:37 -08:00
parent 0f0ffa8525
commit 36891c136e
2 changed files with 4 additions and 4 deletions

View File

@ -177,7 +177,7 @@ AutoEntryScript::AutoEntryScript(nsIGlobalObject* aGlobalObject,
} }
} }
if (aIsMainThread) { if (aIsMainThread) {
mCxPusher.Push(aCx); mCxPusher.construct(aCx);
} }
mAc.construct(aCx, aGlobalObject->GetGlobalJSObject()); mAc.construct(aCx, aGlobalObject->GetGlobalJSObject());
mStack.Push(&mEntry); mStack.Push(&mEntry);
@ -207,7 +207,7 @@ AutoSystemCaller::AutoSystemCaller(bool aIsMainThread)
: mStack(ScriptSettingsStack::Ref()) : mStack(ScriptSettingsStack::Ref())
{ {
if (aIsMainThread) { if (aIsMainThread) {
mCxPusher.PushNull(); mCxPusher.construct(nullptr, /* aAllowNull = */ true);
} }
mStack.PushSystem(); mStack.PushSystem();
} }

View File

@ -82,7 +82,7 @@ public:
private: private:
dom::ScriptSettingsStack& mStack; dom::ScriptSettingsStack& mStack;
dom::ScriptSettingsStackEntry mEntry; dom::ScriptSettingsStackEntry mEntry;
nsCxPusher mCxPusher; mozilla::Maybe<AutoCxPusher> mCxPusher;
mozilla::Maybe<JSAutoCompartment> mAc; // This can de-Maybe-fy when mCxPusher mozilla::Maybe<JSAutoCompartment> mAc; // This can de-Maybe-fy when mCxPusher
// goes away. // goes away.
}; };
@ -111,7 +111,7 @@ public:
~AutoSystemCaller(); ~AutoSystemCaller();
private: private:
dom::ScriptSettingsStack& mStack; dom::ScriptSettingsStack& mStack;
nsCxPusher mCxPusher; mozilla::Maybe<AutoCxPusher> mCxPusher;
}; };
} // namespace dom } // namespace dom