From 0781292ef81f5453fb68bdc2ae4b433ec06e7c64 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Wed, 30 Jul 2014 16:19:46 -0700 Subject: [PATCH] Back out bug 950745 for crashes --- dom/events/EventDispatcher.cpp | 1 - ipc/glue/MessageChannel.cpp | 12 ------------ ipc/glue/MessageChannel.h | 3 --- js/ipc/JavaScriptChild.cpp | 16 ---------------- js/ipc/moz.build | 1 - js/src/jsfriendapi.cpp | 8 -------- js/src/jsfriendapi.h | 7 ------- js/src/vm/Interpreter.cpp | 5 ----- js/src/vm/Interpreter.h | 2 +- js/src/vm/Runtime.cpp | 3 --- js/src/vm/Runtime.h | 4 ---- widget/windows/nsWindow.cpp | 2 -- xpcom/threads/nsThread.cpp | 4 ---- 13 files changed, 1 insertion(+), 67 deletions(-) diff --git a/dom/events/EventDispatcher.cpp b/dom/events/EventDispatcher.cpp index 888a2f27eafe..28acd8290fae 100644 --- a/dom/events/EventDispatcher.cpp +++ b/dom/events/EventDispatcher.cpp @@ -25,7 +25,6 @@ #include "mozilla/EventDispatcher.h" #include "mozilla/EventListenerManager.h" #include "mozilla/InternalMutationEvent.h" -#include "mozilla/ipc/MessageChannel.h" #include "mozilla/MiscEvents.h" #include "mozilla/MouseEvents.h" #include "mozilla/TextEvents.h" diff --git a/ipc/glue/MessageChannel.cpp b/ipc/glue/MessageChannel.cpp index 0455454b2d27..41e475da12ed 100644 --- a/ipc/glue/MessageChannel.cpp +++ b/ipc/glue/MessageChannel.cpp @@ -36,8 +36,6 @@ struct RunnableMethodTraits DebugAbort(__FILE__, __LINE__, #_cond,## __VA_ARGS__); \ } while (0) -static uintptr_t gDispatchingUrgentMessageCount; - namespace mozilla { namespace ipc { @@ -1101,13 +1099,9 @@ MessageChannel::DispatchUrgentMessage(const Message& aMsg) Message *reply = nullptr; - MOZ_ASSERT(NS_IsMainThread()); - - gDispatchingUrgentMessageCount++; mDispatchingUrgentMessageCount++; Result rv = mListener->OnCallReceived(aMsg, reply); mDispatchingUrgentMessageCount--; - gDispatchingUrgentMessageCount--; if (!MaybeHandleError(rv, "DispatchUrgentMessage")) { delete reply; @@ -1758,11 +1752,5 @@ MessageChannel::DumpInterruptStack(const char* const pfx) const } } -bool -ProcessingUrgentMessages() -{ - return gDispatchingUrgentMessageCount > 0; -} - } // ipc } // mozilla diff --git a/ipc/glue/MessageChannel.h b/ipc/glue/MessageChannel.h index be5bcdf32bb2..e93ead05ac9e 100644 --- a/ipc/glue/MessageChannel.h +++ b/ipc/glue/MessageChannel.h @@ -641,9 +641,6 @@ class MessageChannel : HasResultCodes bool mAbortOnError; }; -bool -ProcessingUrgentMessages(); - } // namespace ipc } // namespace mozilla diff --git a/js/ipc/JavaScriptChild.cpp b/js/ipc/JavaScriptChild.cpp index a8d65997637c..42921787544f 100644 --- a/js/ipc/JavaScriptChild.cpp +++ b/js/ipc/JavaScriptChild.cpp @@ -8,12 +8,10 @@ #include "JavaScriptChild.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/dom/BindingUtils.h" -#include "mozilla/ipc/MessageChannel.h" #include "nsContentUtils.h" #include "xpcprivate.h" #include "jsfriendapi.h" #include "nsCxPusher.h" -#include "AccessCheck.h" using namespace JS; using namespace mozilla; @@ -21,17 +19,6 @@ using namespace mozilla::jsipc; using mozilla::AutoSafeJSContext; -#ifdef NIGHTLY_BUILD -static void -UrgentMessageCheck(JSContext *cx, HandleScript script) -{ - // We're only allowed to enter chrome JS code while processing urgent - // messages. - if (ipc::ProcessingUrgentMessages()) - MOZ_RELEASE_ASSERT(xpc::AccessCheck::isChrome(js::GetContextCompartment(cx))); -} -#endif - static void FinalizeChild(JSFreeOp *fop, JSFinalizeStatus status, bool isCompartment, void *data) { @@ -44,9 +31,6 @@ JavaScriptChild::JavaScriptChild(JSRuntime *rt) : JavaScriptShared(rt), JavaScriptBase(rt) { -#ifdef NIGHTLY_BUILD - js::SetAssertOnScriptEntryHook(rt, UrgentMessageCheck); -#endif } JavaScriptChild::~JavaScriptChild() diff --git a/js/ipc/moz.build b/js/ipc/moz.build index 4d322e7762d2..d13d32f43bcf 100644 --- a/js/ipc/moz.build +++ b/js/ipc/moz.build @@ -30,6 +30,5 @@ LOCAL_INCLUDES += [ '/js/ipc', '/js/public', '/js/xpconnect/src', - '/js/xpconnect/wrappers', ] diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index ab5d475e3f8e..37f61eb3aee7 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -63,14 +63,6 @@ js::ForgetSourceHook(JSRuntime *rt) return Move(rt->sourceHook); } -#ifdef NIGHTLY_BUILD -JS_FRIEND_API(void) -js::SetAssertOnScriptEntryHook(JSRuntime *rt, AssertOnScriptEntryHook hook) -{ - rt->assertOnScriptEntryHook_ = hook; -} -#endif - JS_FRIEND_API(void) JS_SetGrayGCRootsTracer(JSRuntime *rt, JSTraceDataOp traceOp, void *data) { diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index caa1cadeecac..6abba69ceffc 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -418,13 +418,6 @@ SetSourceHook(JSRuntime *rt, mozilla::UniquePtr hook); extern JS_FRIEND_API(mozilla::UniquePtr) ForgetSourceHook(JSRuntime *rt); -#ifdef NIGHTLY_BUILD -typedef void (*AssertOnScriptEntryHook)(JSContext *cx, JS::HandleScript script); - -extern JS_FRIEND_API(void) -SetAssertOnScriptEntryHook(JSRuntime *rt, AssertOnScriptEntryHook hook); -#endif - extern JS_FRIEND_API(JS::Zone *) GetCompartmentZone(JSCompartment *comp); diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index 6274f091d68a..85f309b49f21 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -374,11 +374,6 @@ js::RunScript(JSContext *cx, RunState &state) { JS_CHECK_RECURSION(cx, return false); -#ifdef NIGHTLY_BUILD - if (AssertOnScriptEntryHook hook = cx->runtime()->assertOnScriptEntryHook_) - (*hook)(cx, state.script()); -#endif - SPSEntryMarker marker(cx->runtime(), state.script()); state.script()->ensureNonLazyCanonicalFunction(cx); diff --git a/js/src/vm/Interpreter.h b/js/src/vm/Interpreter.h index ad38683ff761..45ba88091ffe 100644 --- a/js/src/vm/Interpreter.h +++ b/js/src/vm/Interpreter.h @@ -203,7 +203,7 @@ class RunState return (GeneratorState *)this; } - JS::HandleScript script() const { return script_; } + JSScript *script() const { return script_; } virtual InterpreterFrame *pushInterpreterFrame(JSContext *cx) = 0; virtual void setReturnValue(Value v) = 0; diff --git a/js/src/vm/Runtime.cpp b/js/src/vm/Runtime.cpp index 35f1acc16db8..1c21055db17b 100644 --- a/js/src/vm/Runtime.cpp +++ b/js/src/vm/Runtime.cpp @@ -172,9 +172,6 @@ JSRuntime::JSRuntime(JSRuntime *parentRuntime) negativeInfinityValue(DoubleValue(NegativeInfinity())), positiveInfinityValue(DoubleValue(PositiveInfinity())), emptyString(nullptr), -#ifdef NIGHTLY_BUILD - assertOnScriptEntryHook_(nullptr), -#endif debugMode(false), spsProfiler(thisFromCtor()), profilingScripts(false), diff --git a/js/src/vm/Runtime.h b/js/src/vm/Runtime.h index 2485d0f2de61..69c01d0e42bf 100644 --- a/js/src/vm/Runtime.h +++ b/js/src/vm/Runtime.h @@ -1010,10 +1010,6 @@ struct JSRuntime : public JS::shadow::Runtime, mozilla::UniquePtr sourceHook; -#ifdef NIGHTLY_BUILD - js::AssertOnScriptEntryHook assertOnScriptEntryHook_; -#endif - /* If true, new compartments are initially in debug mode. */ bool debugMode; diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index f835473e7a76..ccb678bd65a9 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -4341,8 +4341,6 @@ inline static mozilla::HangMonitor::ActivityType ActivityTypeForMessage(UINT msg // and http://msdn.microsoft.com/en-us/library/ms633573%28VS.85%29.aspx LRESULT CALLBACK nsWindow::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - MOZ_RELEASE_ASSERT(!ipc::ProcessingUrgentMessages()); - HangMonitor::NotifyActivity(ActivityTypeForMessage(msg)); return mozilla::CallWindowProcCrashProtected(WindowProcInternal, hWnd, msg, wParam, lParam); diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp index b9b7ef686569..d62e923160eb 100644 --- a/xpcom/threads/nsThread.cpp +++ b/xpcom/threads/nsThread.cpp @@ -25,7 +25,6 @@ #include "nsIObserverService.h" #include "mozilla/HangMonitor.h" #include "mozilla/IOInterposer.h" -#include "mozilla/ipc/MessageChannel.h" #include "mozilla/Services.h" #include "nsXPCOMPrivate.h" #include "mozilla/ChaosMode.h" @@ -687,9 +686,6 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult) { LOG(("THRD(%p) ProcessNextEvent [%u %u]\n", this, aMayWait, mRunningEvent)); - // If we're on the main thread, we shouldn't be dispatching CPOWs. - MOZ_RELEASE_ASSERT(mIsMainThread != MAIN_THREAD || !ipc::ProcessingUrgentMessages()); - if (NS_WARN_IF(PR_GetCurrentThread() != mThread)) { return NS_ERROR_NOT_SAME_THREAD; }