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:
Bobby Holley 2013-02-26 11:04:11 -08:00
Родитель c53f414560
Коммит d2ef489c30
14 изменённых файлов: 18 добавлений и 24 удалений

Просмотреть файл

@ -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")