mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 834732 - Remove PushBehavior. r=mrbkap
Now that we only have ALWAYS_PUSH and ASSERT_SCRIPT_CONTEXT, we have uniform release-mode behavior everywhere. Remove the crap.
This commit is contained in:
parent
99fefbe87b
commit
784a476fb8
@ -2195,7 +2195,6 @@ typedef nsCharSeparatedTokenizerTemplate<nsContentUtils::IsHTMLWhitespace>
|
||||
class NS_STACK_CLASS nsCxPusher
|
||||
{
|
||||
public:
|
||||
enum PushBehavior { ALWAYS_PUSH, REQUIRE_SCRIPT_CONTEXT, ASSERT_SCRIPT_CONTEXT };
|
||||
nsCxPusher();
|
||||
~nsCxPusher(); // Calls Pop();
|
||||
|
||||
@ -2206,7 +2205,7 @@ public:
|
||||
bool RePush(nsIDOMEventTarget *aCurrentTarget);
|
||||
// If a null JSContext is passed to Push(), that will cause no
|
||||
// push to happen and false to be returned.
|
||||
bool Push(JSContext *cx, PushBehavior behavior);
|
||||
bool Push(JSContext *cx);
|
||||
// Explicitly push a null JSContext on the the stack
|
||||
bool PushNull();
|
||||
|
||||
|
@ -3021,7 +3021,7 @@ nsCxPusher::Push(nsIDOMEventTarget *aCurrentTarget)
|
||||
// in the process or being torn down. We don't want to notify the
|
||||
// script context about scripts having been evaluated in such a
|
||||
// case, calling with a null cx is fine in that case.
|
||||
return Push(cx, ASSERT_SCRIPT_CONTEXT);
|
||||
return Push(cx);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -3053,7 +3053,7 @@ nsCxPusher::RePush(nsIDOMEventTarget *aCurrentTarget)
|
||||
}
|
||||
|
||||
bool
|
||||
nsCxPusher::Push(JSContext *cx, PushBehavior behavior)
|
||||
nsCxPusher::Push(JSContext *cx)
|
||||
{
|
||||
if (mPushedSomething) {
|
||||
NS_ERROR("Whaaa! No double pushing with nsCxPusher::Push()!");
|
||||
@ -3069,11 +3069,6 @@ nsCxPusher::Push(JSContext *cx, PushBehavior behavior)
|
||||
// XXXbz do we really need to? If we don't get one of these in Pop(), is
|
||||
// that really a problem? Or do we need to do this to effectively root |cx|?
|
||||
mScx = GetScriptContextFromJSContext(cx);
|
||||
MOZ_ASSERT_IF(behavior == ASSERT_SCRIPT_CONTEXT, mScx);
|
||||
if (!mScx && behavior == REQUIRE_SCRIPT_CONTEXT) {
|
||||
// Should probably return false. See bug 416916.
|
||||
return true;
|
||||
}
|
||||
|
||||
return DoPush(cx);
|
||||
}
|
||||
@ -6833,7 +6828,7 @@ AutoJSContext::Init(bool aSafe MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
|
||||
|
||||
if (!mCx) {
|
||||
mCx = nsContentUtils::GetSafeJSContext();
|
||||
bool result = mPusher.Push(mCx, nsCxPusher::ALWAYS_PUSH);
|
||||
bool result = mPusher.Push(mCx);
|
||||
if (!result || !mCx) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
@ -651,7 +651,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
||||
continue;
|
||||
}
|
||||
nsCxPusher pusher;
|
||||
NS_ENSURE_STATE(pusher.Push(ctx, nsCxPusher::ALWAYS_PUSH));
|
||||
NS_ENSURE_STATE(pusher.Push(ctx));
|
||||
|
||||
JSAutoRequest ar(ctx);
|
||||
JSAutoCompartment ac(ctx, object);
|
||||
|
@ -2571,7 +2571,7 @@ nsObjectLoadingContent::NotifyContentObjectWrapper()
|
||||
|
||||
JSContext *cx = scx->GetNativeContext();
|
||||
nsCxPusher pusher;
|
||||
pusher.Push(cx, nsCxPusher::ASSERT_SCRIPT_CONTEXT);
|
||||
pusher.Push(cx);
|
||||
|
||||
nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
|
||||
nsContentUtils::XPConnect()->
|
||||
|
@ -818,7 +818,7 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
|
||||
}
|
||||
|
||||
nsCxPusher pusher;
|
||||
if (aNeedsCxPush && !pusher.Push(cx, nsCxPusher::ASSERT_SCRIPT_CONTEXT)) {
|
||||
if (aNeedsCxPush && !pusher.Push(cx)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -943,7 +943,7 @@ nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocumen
|
||||
JSContext *cx = context->GetNativeContext();
|
||||
|
||||
nsCxPusher pusher;
|
||||
pusher.Push(cx, nsCxPusher::ASSERT_SCRIPT_CONTEXT);
|
||||
pusher.Push(cx);
|
||||
|
||||
JSObject* scriptObject = mBoundElement->GetWrapper();
|
||||
if (scriptObject) {
|
||||
|
@ -10202,7 +10202,7 @@ nsDocShell::AddState(nsIVariant *aData, const nsAString& aTitle,
|
||||
nsCxPusher pusher;
|
||||
if (!cx) {
|
||||
cx = nsContentUtils::GetContextFromDocument(document);
|
||||
pusher.Push(cx, nsCxPusher::ASSERT_SCRIPT_CONTEXT);
|
||||
pusher.Push(cx);
|
||||
}
|
||||
rv = scContainer->InitFromVariant(aData, cx);
|
||||
|
||||
|
@ -4082,7 +4082,7 @@ BaseStubConstructor(nsIWeakReference* aWeakOwner,
|
||||
}
|
||||
|
||||
nsCxPusher pusher;
|
||||
NS_ENSURE_STATE(pusher.Push(cx, nsCxPusher::ALWAYS_PUSH));
|
||||
NS_ENSURE_STATE(pusher.Push(cx));
|
||||
|
||||
JSAutoRequest ar(cx);
|
||||
JSAutoCompartment ac(cx, object);
|
||||
@ -7776,7 +7776,7 @@ public:
|
||||
nsCxPusher pusher;
|
||||
JSContext* cx = mContext ? mContext->GetNativeContext()
|
||||
: nsContentUtils::GetSafeJSContext();
|
||||
pusher.Push(cx, nsCxPusher::ALWAYS_PUSH);
|
||||
pusher.Push(cx);
|
||||
|
||||
JSObject* obj = nullptr;
|
||||
mWrapper->GetJSObject(&obj);
|
||||
|
@ -2077,7 +2077,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
bool thisChrome = IsChromeWindow();
|
||||
|
||||
nsCxPusher cxPusher;
|
||||
if (!cxPusher.Push(cx, nsCxPusher::ASSERT_SCRIPT_CONTEXT)) {
|
||||
if (!cxPusher.Push(cx)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -1260,7 +1260,7 @@ nsJSContext::EvaluateString(const nsAString& aScript,
|
||||
}
|
||||
|
||||
nsCxPusher pusher;
|
||||
if (!pusher.Push(mContext, nsCxPusher::ASSERT_SCRIPT_CONTEXT))
|
||||
if (!pusher.Push(mContext))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
xpc_UnmarkGrayObject(&aScopeObject);
|
||||
@ -1515,7 +1515,7 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, JSObject* aScope,
|
||||
// all now, and never were in some cases.
|
||||
|
||||
nsCxPusher pusher;
|
||||
if (!pusher.Push(mContext, nsCxPusher::ASSERT_SCRIPT_CONTEXT))
|
||||
if (!pusher.Push(mContext))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// check if the event handler can be run on the object in question
|
||||
|
@ -91,7 +91,7 @@ CallbackObject::CallSetup::CallSetup(JSObject* const aCallback,
|
||||
mAr.construct(cx);
|
||||
|
||||
// Make sure our JSContext is pushed on the stack.
|
||||
if (!mCxPusher.Push(cx, nsCxPusher::ALWAYS_PUSH)) {
|
||||
if (!mCxPusher.Push(cx)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -523,7 +523,7 @@ SmsRequest::NotifyThreadList(const InfallibleTArray<ThreadListItem>& aItems)
|
||||
NS_ENSURE_TRUE_VOID(ownerObj);
|
||||
|
||||
nsCxPusher pusher;
|
||||
NS_ENSURE_TRUE_VOID(pusher.Push(cx, nsCxPusher::ALWAYS_PUSH));
|
||||
NS_ENSURE_TRUE_VOID(pusher.Push(cx));
|
||||
|
||||
JSAutoRequest ar(cx);
|
||||
JSAutoCompartment ac(cx, ownerObj);
|
||||
|
@ -42,7 +42,7 @@ namespace {
|
||||
JSOPTION_DONT_REPORT_UNCAUGHT)))
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
mStack.Push(cx, nsCxPusher::ALWAYS_PUSH);
|
||||
mStack.Push(cx);
|
||||
}
|
||||
|
||||
~AutoContextPusher() {
|
||||
|
@ -406,7 +406,7 @@ def write_cpp(iface, fd):
|
||||
" }\n\n"
|
||||
" JSObject* obj = &aVal->toObject();\n"
|
||||
" nsCxPusher pusher;\n"
|
||||
" NS_ENSURE_STATE(pusher.Push(aCx, nsCxPusher::ALWAYS_PUSH));\n"
|
||||
" NS_ENSURE_STATE(pusher.Push(aCx));\n"
|
||||
" JSAutoRequest ar(aCx);\n"
|
||||
" JSAutoCompartment ac(aCx, obj);\n")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user