Bug 1459701 - Don't crash if ContentParent::UnregisterRemoteFrame is called with a ContentParentId that doesn't exist; r?jimm draft
authorAlex Gaynor <agaynor@mozilla.com>
Wed, 25 Apr 2018 11:35:56 -0400
changeset 792156 9e8985a0d8bacd3a16fb6aa90355ce9f7b20e36c
parent 792033 43e0ab28dfe2589e85ff83349c15eacd624e18b4
push id109012
push userbmo:agaynor@mozilla.com
push dateMon, 07 May 2018 18:51:50 +0000
reviewersjimm
bugs1459701
milestone61.0a1
Bug 1459701 - Don't crash if ContentParent::UnregisterRemoteFrame is called with a ContentParentId that doesn't exist; r?jimm MozReview-Commit-ID: AUnuR6W2S5S
dom/ipc/ContentParent.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -4403,16 +4403,20 @@ ContentParent::NotifyUpdatedFonts()
 ContentParent::UnregisterRemoteFrame(const TabId& aTabId,
                                const ContentParentId& aCpId,
                                bool aMarkedDestroying)
 {
   if (XRE_IsParentProcess()) {
     ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
     ContentParent* cp = cpm->GetContentProcessById(aCpId);
 
+    if (!cp) {
+      return;
+    }
+
     cp->NotifyTabDestroyed(aTabId, aMarkedDestroying);
 
     ContentProcessManager::GetSingleton()->UnregisterRemoteFrame(aCpId, aTabId);
   } else {
     ContentChild::GetSingleton()->SendUnregisterRemoteFrame(aTabId, aCpId,
                                                       aMarkedDestroying);
   }
 }