Bug 1191145 - Stop blocking scripts in CPOW IPCs (r=dvander)

This commit is contained in:
Bill McCloskey 2015-07-14 14:05:04 -07:00
parent a3ddeba4a7
commit b182116fad
3 changed files with 0 additions and 56 deletions

View File

@ -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;

View File

@ -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<Message> 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()
{

View File

@ -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;