diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 8f792be6b32..460e486523c 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -646,10 +646,6 @@ ContentChild::Init(MessageLoop* aIOLoop, } sSingleton = this; - // Make sure there's an nsAutoScriptBlocker on the stack when dispatching - // urgent messages. - GetIPCChannel()->BlockScripts(); - // If communications with the parent have broken down, take the process // down so it's not hanging around. bool abortOnError = true; diff --git a/ipc/glue/MessageChannel.cpp b/ipc/glue/MessageChannel.cpp index 87bc69db644..1563f576f4d 100644 --- a/ipc/glue/MessageChannel.cpp +++ b/ipc/glue/MessageChannel.cpp @@ -275,31 +275,6 @@ private: CxxStackFrame& operator=(const CxxStackFrame&) = delete; }; -namespace { - -class MOZ_RAII MaybeScriptBlocker { -public: - explicit MaybeScriptBlocker(MessageChannel *aChannel, bool aBlock - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : mBlocked(aChannel->ShouldBlockScripts() && aBlock) - { - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - if (mBlocked) { - nsContentUtils::AddScriptBlocker(); - } - } - ~MaybeScriptBlocker() { - if (mBlocked) { - nsContentUtils::RemoveScriptBlocker(); - } - } -private: - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER - bool mBlocked; -}; - -} // namespace - MessageChannel::MessageChannel(MessageListener *aListener) : mListener(aListener), mChannelState(ChannelClosed), @@ -325,7 +300,6 @@ MessageChannel::MessageChannel(MessageListener *aListener) mSawInterruptOutMsg(false), mIsWaitingForIncoming(false), mAbortOnError(false), - mBlockScripts(false), mFlags(REQUIRE_DEFAULT), mPeerPidSet(false), mPeerPid(-1) @@ -841,9 +815,6 @@ MessageChannel::Send(Message* aMsg, Message* aReply) { nsAutoPtr msg(aMsg); - // See comment in DispatchSyncMessage. - MaybeScriptBlocker scriptBlocker(this, true); - // Sanity checks. AssertWorkerThread(); mMonitor->AssertNotCurrentThreadOwns(); @@ -1325,13 +1296,7 @@ MessageChannel::DispatchSyncMessage(const Message& aMsg, Message*& aReply) AssertWorkerThread(); int prio = aMsg.priority(); - - // We don't want to run any code that might run a nested event loop here, so - // we avoid running event handlers. Once we've sent the response to the - // urgent message, it's okay to run event handlers again since the parent is - // no longer blocked. MOZ_ASSERT_IF(prio > IPC::Message::PRIORITY_NORMAL, NS_IsMainThread()); - MaybeScriptBlocker scriptBlocker(this, prio > IPC::Message::PRIORITY_NORMAL); MessageChannel* dummy; MessageChannel*& blockingVar = NS_IsMainThread() ? gMainThreadBlocker : dummy; @@ -1889,13 +1854,6 @@ MessageChannel::CloseWithTimeout() mChannelState = ChannelTimeout; } -void -MessageChannel::BlockScripts() -{ - MOZ_ASSERT(NS_IsMainThread()); - mBlockScripts = true; -} - void MessageChannel::Close() { diff --git a/ipc/glue/MessageChannel.h b/ipc/glue/MessageChannel.h index 3aad5d8064c..128cb118aa7 100644 --- a/ipc/glue/MessageChannel.h +++ b/ipc/glue/MessageChannel.h @@ -107,13 +107,6 @@ class MessageChannel : HasResultCodes void SetChannelFlags(ChannelFlags aFlags) { mFlags = aFlags; } ChannelFlags GetChannelFlags() { return mFlags; } - void BlockScripts(); - - bool ShouldBlockScripts() const - { - return mBlockScripts; - } - // Asynchronously send a message to the other side of the channel bool Send(Message* aMsg); @@ -736,9 +729,6 @@ class MessageChannel : HasResultCodes // a channel error occurs? bool mAbortOnError; - // Should we prevent scripts from running while dispatching urgent messages? - bool mBlockScripts; - // See SetChannelFlags ChannelFlags mFlags;