Bug 1390626 - Part 1: Bail out early if there are no selection listeners to notify; r=smaug
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 15 Aug 2017 16:47:30 -0400
changeset 375015 230847d248d2235fb1c2ba4ef52d3aca434527df
parent 375014 e82c11723fcf9bdc3edd24f422121ff2be52f345
child 375016 479d2103841e154147b5509cb5ade7f2ecbacc44
push id32344
push usercbook@mozilla.com
push dateWed, 16 Aug 2017 09:23:42 +0000
treeherdermozilla-central@6ebc251bd288 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1390626
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1390626 - Part 1: Bail out early if there are no selection listeners to notify; r=smaug
dom/base/Selection.cpp
--- a/dom/base/Selection.cpp
+++ b/dom/base/Selection.cpp
@@ -3772,16 +3772,20 @@ Selection::NotifySelectionListeners()
     }
   }
 
   RefPtr<nsFrameSelection> frameSelection = mFrameSelection;
   if (frameSelection->GetBatching()) {
     frameSelection->SetDirty();
     return NS_OK;
   }
+  if (mSelectionListeners.IsEmpty()) {
+    // If there are no selection listeners, we're done!
+    return NS_OK;
+  }
   AutoTArray<nsCOMPtr<nsISelectionListener>, 8>
     selectionListeners(mSelectionListeners);
 
   nsCOMPtr<nsIDOMDocument> domdoc;
   nsIPresShell* ps = GetPresShell();
   if (ps) {
     domdoc = do_QueryInterface(ps->GetDocument());
   }