From 6e82b3775ee6bf7896749d68f255fbbd1b506dc1 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Sun, 15 Nov 2015 09:56:06 -0800 Subject: [PATCH] Back out 2 changesets (bug 1221852, bug 1224825) for Android hangs and desktop RunWatchdog crashes in test_upgrade_insecure_reporting.html CLOSED TREE Backed out changeset 6ad589dcf3c1 (bug 1221852) Backed out changeset e7aadf89146b (bug 1224825) --- dom/messagechannel/MessagePort.cpp | 57 +++--------------- dom/messagechannel/MessagePort.h | 5 -- dom/messagechannel/MessagePortService.cpp | 42 +------------- dom/messagechannel/tests/mochitest.ini | 1 - .../tests/test_messageChannel_bug1224825.html | 58 ------------------- dom/workers/SharedWorker.cpp | 1 + dom/workers/test/sharedWorker_ports.js | 1 - dom/workers/test/test_sharedWorker_ports.html | 3 - 8 files changed, 11 insertions(+), 157 deletions(-) delete mode 100644 dom/messagechannel/tests/test_messageChannel_bug1224825.html diff --git a/dom/messagechannel/MessagePort.cpp b/dom/messagechannel/MessagePort.cpp index 274bec425200..d7d5202e7522 100644 --- a/dom/messagechannel/MessagePort.cpp +++ b/dom/messagechannel/MessagePort.cpp @@ -97,26 +97,6 @@ public: NS_IMETHOD Run() override - { - nsresult rv = SendEvent(); - NS_WARN_IF(NS_FAILED(rv)); - - mPort->MaybeClose(); - - return NS_OK; - } - - NS_IMETHOD - Cancel() override - { - mPort = nullptr; - mData = nullptr; - return NS_OK; - } - -private: - nsresult - SendEvent() { nsCOMPtr globalObject; @@ -172,6 +152,15 @@ private: return NS_OK; } + NS_IMETHOD + Cancel() override + { + mPort = nullptr; + mData = nullptr; + return NS_OK; + } + +private: ~PostMessageRunnable() {} @@ -292,7 +281,6 @@ MessagePort::MessagePort(nsPIDOMWindow* aWindow) , mInnerID(0) , mMessageQueueEnabled(false) , mIsKeptAlive(false) - , mClosing(false) { mIdentifier = new MessagePortIdentifier(); mIdentifier->neutered() = true; @@ -469,12 +457,6 @@ MessagePort::PostMessage(JSContext* aCx, JS::Handle aMessage, return; } - // Just processing pending messages, then closing. This message must be - // ignored. - if (mClosing) { - return; - } - RemoveDocFromBFCache(); // Not entangled yet. @@ -552,12 +534,6 @@ MessagePort::Close() return; } - // If we have some messages to send, we cannot close this port immediatelly. - if (!mMessages.IsEmpty()) { - mClosing = true; - return; - } - // We don't care about stopping the sending of messages because from now all // the incoming messages will be ignored. mState = eStateDisentangled; @@ -660,7 +636,6 @@ void MessagePort::MessagesReceived(nsTArray& aMessages) { MOZ_ASSERT(mState == eStateEntangled || mState == eStateDisentangling); - // We cannot have a next-step because this must be processed by Entangled(). MOZ_ASSERT(mNextStep == eNextStepNone); MOZ_ASSERT(mMessagesForTheOtherPort.IsEmpty()); @@ -729,11 +704,6 @@ MessagePort::CloneAndDisentangle(MessagePortIdentifier& aIdentifier) return; } - // If Close() has been called. - if (mClosing) { - return; - } - aIdentifier.uuid() = mIdentifier->uuid(); aIdentifier.destinationUuid() = mIdentifier->destinationUuid(); aIdentifier.sequenceId() = mIdentifier->sequenceId() + 1; @@ -926,14 +896,5 @@ MessagePort::ForceClose(const MessagePortIdentifier& aIdentifier) ForceCloseHelper::ForceClose(aIdentifier); } -void -MessagePort::MaybeClose() -{ - // All the other checks are done in Close(): - if (mClosing && mMessages.IsEmpty()) { - Close(); - } -} - } // namespace dom } // namespace mozilla diff --git a/dom/messagechannel/MessagePort.h b/dom/messagechannel/MessagePort.h index e6805e2c4ea5..34e3731bef97 100644 --- a/dom/messagechannel/MessagePort.h +++ b/dom/messagechannel/MessagePort.h @@ -25,7 +25,6 @@ class DispatchEventRunnable; class MessagePortChild; class MessagePortIdentifier; class MessagePortMessage; -class PostMessageRunnable; class SharedMessagePortMessage; namespace workers { @@ -37,7 +36,6 @@ class MessagePort final : public DOMEventTargetHelper , public nsIObserver { friend class DispatchEventRunnable; - friend class PostMessageRunnable; public: NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK @@ -150,8 +148,6 @@ private: return mIsKeptAlive; } - void MaybeClose(); - nsAutoPtr mWorkerFeature; RefPtr mDispatchRunnable; @@ -180,7 +176,6 @@ private: bool mMessageQueueEnabled; bool mIsKeptAlive; - bool mClosing; }; } // namespace dom diff --git a/dom/messagechannel/MessagePortService.cpp b/dom/messagechannel/MessagePortService.cpp index 302406616175..809b4a8a0f08 100644 --- a/dom/messagechannel/MessagePortService.cpp +++ b/dom/messagechannel/MessagePortService.cpp @@ -36,9 +36,6 @@ public: : mDestinationUUID(aDestinationUUID) , mSequenceID(1) , mParent(nullptr) - // By default we don't know the next parent. - , mWaitingForNewParent(true) - , mNextStepCloseAll(false) { MOZ_COUNT_CTOR(MessagePortServiceData); } @@ -65,9 +62,6 @@ public: FallibleTArray mNextParents; FallibleTArray> mMessages; - - bool mWaitingForNewParent; - bool mNextStepCloseAll; }; /* static */ MessagePortService* @@ -119,49 +113,31 @@ MessagePortService::RequestEntangling(MessagePortParent* aParent, // This is a security check. if (!data->mDestinationUUID.Equals(aDestinationUUID)) { MOZ_ASSERT(false, "DestinationUUIDs do not match!"); - CloseAll(aParent->ID()); return false; } if (aSequenceID < data->mSequenceID) { MOZ_ASSERT(false, "Invalid sequence ID!"); - CloseAll(aParent->ID()); return false; } if (aSequenceID == data->mSequenceID) { if (data->mParent) { MOZ_ASSERT(false, "Two ports cannot have the same sequenceID."); - CloseAll(aParent->ID()); return false; } // We activate this port, sending all the messages. data->mParent = aParent; - data->mWaitingForNewParent = false; FallibleTArray array; if (!SharedMessagePortMessage::FromSharedToMessagesParent(aParent, data->mMessages, array)) { - CloseAll(aParent->ID()); return false; } data->mMessages.Clear(); - - // We can entangle the port. - if (!aParent->Entangled(array)) { - CloseAll(aParent->ID()); - return false; - } - - // If we were waiting for this parent in order to close this channel, this - // is the time to do it. - if (data->mNextStepCloseAll) { - CloseAll(aParent->ID()); - } - - return true; + return aParent->Entangled(array); } // This new parent will be the next one when a Disentangle request is @@ -169,7 +145,6 @@ MessagePortService::RequestEntangling(MessagePortParent* aParent, MessagePortServiceData::NextParent* nextParent = data->mNextParents.AppendElement(mozilla::fallible); if (!nextParent) { - CloseAll(aParent->ID()); return false; } @@ -218,7 +193,6 @@ MessagePortService::DisentanglePort( // We didn't find the parent. if (!nextParent) { data->mMessages.SwapElements(aMessages); - data->mWaitingForNewParent = true; data->mParent = nullptr; return true; } @@ -293,20 +267,6 @@ MessagePortService::CloseAll(const nsID& aUUID) } nsID destinationUUID = data->mDestinationUUID; - - // If we have informations about the other port and that port has some - // pending messages to deliver but the parent has not processed them yet, - // because its entangling request didn't arrive yet), we cannot close this - // channel. - MessagePortServiceData* destinationData; - if (mPorts.Get(destinationUUID, &destinationData) && - !destinationData->mMessages.IsEmpty() && - destinationData->mWaitingForNewParent) { - MOZ_ASSERT(!destinationData->mNextStepCloseAll); - destinationData->mNextStepCloseAll = true; - return; - } - mPorts.Remove(aUUID); CloseAll(destinationUUID); diff --git a/dom/messagechannel/tests/mochitest.ini b/dom/messagechannel/tests/mochitest.ini index 1d608847c950..3839c7c74f1a 100644 --- a/dom/messagechannel/tests/mochitest.ini +++ b/dom/messagechannel/tests/mochitest.ini @@ -24,4 +24,3 @@ support-files = [test_messageChannel_any.html] [test_messageChannel_forceClose.html] [test_messageChannel_bug1178076.html] -[test_messageChannel_bug1224825.html] diff --git a/dom/messagechannel/tests/test_messageChannel_bug1224825.html b/dom/messagechannel/tests/test_messageChannel_bug1224825.html deleted file mode 100644 index 76ed99272292..000000000000 --- a/dom/messagechannel/tests/test_messageChannel_bug1224825.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - Test for Bug 1224825 - - - - -Mozilla Bug 1224825 -
-
-
- - - diff --git a/dom/workers/SharedWorker.cpp b/dom/workers/SharedWorker.cpp index f50c2687fe67..568844ac3fd8 100644 --- a/dom/workers/SharedWorker.cpp +++ b/dom/workers/SharedWorker.cpp @@ -136,6 +136,7 @@ SharedWorker::Close() if (mMessagePort) { mMessagePort->Close(); + mMessagePort = nullptr; } } diff --git a/dom/workers/test/sharedWorker_ports.js b/dom/workers/test/sharedWorker_ports.js index 64672e6abb27..a0d29e29a2dc 100644 --- a/dom/workers/test/sharedWorker_ports.js +++ b/dom/workers/test/sharedWorker_ports.js @@ -17,7 +17,6 @@ onconnect = function(evt) { test: (evtFromPort2.data.type == "connected"), msg: "The original message received" }); port.postMessage({type: "finish"}); - close(); } } } diff --git a/dom/workers/test/test_sharedWorker_ports.html b/dom/workers/test/test_sharedWorker_ports.html index 32698ab5277e..8233b3f71f38 100644 --- a/dom/workers/test/test_sharedWorker_ports.html +++ b/dom/workers/test/test_sharedWorker_ports.html @@ -28,9 +28,6 @@ sw1.port.onmessage = function(event) { } if (event.data.type == "finish") { - info("Finished!"); - ok(sw1.port, "The port still exists"); - sw1.port.foo = sw1; // Just a test to see if we leak. SimpleTest.finish(); } }