Bug 1526928 - Check for TabParent destruction before trying to send a message on it. r=botond a=test-only
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 10 Apr 2019 18:40:42 +0000
changeset 526136 2eab15e5f47346689253571aa69966ab25bdc749
parent 526135 8902e572afdbc2a9195ed7dc983e49afd805d631
child 526137 9edc7979cb5cbf02c84802e12985d4eb7722e556
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond, test-only
bugs1526928
milestone67.0
Bug 1526928 - Check for TabParent destruction before trying to send a message on it. r=botond a=test-only Differential Revision: https://phabricator.services.mozilla.com/D26830
dom/ipc/TabParent.cpp
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1335,17 +1335,20 @@ class SynthesizedEventObserver : public 
   NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
                      const char16_t* aData) override {
     if (!mTabParent || !mObserverId) {
       // We already sent the notification, or we don't actually need to
       // send any notification at all.
       return NS_OK;
     }
 
-    if (!mTabParent->SendNativeSynthesisResponse(mObserverId,
+    if (mTabParent->IsDestroyed()) {
+      // If this happens it's probably a bug in the test that's triggering this.
+      NS_WARNING("TabParent was unexpectedly destroyed during event synthesization!");
+    } else if (!mTabParent->SendNativeSynthesisResponse(mObserverId,
                                                  nsCString(aTopic))) {
       NS_WARNING("Unable to send native event synthesization response!");
     }
     // Null out tabparent to indicate we already sent the response
     mTabParent = nullptr;
     return NS_OK;
   }