Bug 1323983 part 2 - Avoid sending response for native synthesis if there is no observer. r=smaug draft
authorXidorn Quan <me@upsuper.org>
Mon, 19 Dec 2016 17:29:48 +1100
changeset 451805 4bc50c6f6723114c417471e27b4d5d35bb0e0c75
parent 451804 47159f623c46549b48c786b28b5c00c246288076
child 451806 640000a9b503fd65f8f61b05f9397b79c5020286
child 452252 473b95205b23b9cf555a333048a1e5c45a9ba92c
push id39301
push userxquan@mozilla.com
push dateWed, 21 Dec 2016 01:03:21 +0000
reviewerssmaug
bugs1323983
milestone53.0a1
Bug 1323983 part 2 - Avoid sending response for native synthesis if there is no observer. r=smaug MozReview-Commit-ID: 4skR41IaOs7
dom/ipc/TabParent.cpp
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1243,18 +1243,19 @@ public:
   {
     MOZ_ASSERT(mTabParent);
   }
 
   NS_IMETHOD Observe(nsISupports* aSubject,
                      const char* aTopic,
                      const char16_t* aData) override
   {
-    if (!mTabParent) {
-      // We already sent the notification
+    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, nsCString(aTopic))) {
       NS_WARNING("Unable to send native event synthesization response!");
     }
     // Null out tabparent to indicate we already sent the response
     mTabParent = nullptr;