Bug 1368335 - Don't dispatch idle executor when window has suspended. r=smaug
authorAndreas Farre <farre@mozilla.com>
Mon, 29 May 2017 14:13:54 +0200
changeset 409314 40669ce64bf7786d2a96598128db61152301a3db
parent 409313 3320e2c5c0b414af4e965b8aedc7f8c66e96eb84
child 409315 7cbe2db1830c37aaf82c6af533e53c36d0f11753
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1368335
milestone55.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 1368335 - Don't dispatch idle executor when window has suspended. r=smaug
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -862,17 +862,21 @@ nsGlobalWindow::ExecuteIdleRequest(TimeS
 
   if (Performance* perf = GetPerformance()) {
     deadline = perf->GetDOMTiming()->TimeStampToDOMHighRes(aDeadline);
   }
 
   mIdleRequestExecutor->MaybeUpdateIdlePeriodLimit();
   nsresult result = RunIdleRequest(request, deadline, false);
 
-  mIdleRequestExecutor->MaybeDispatch();
+  // Running the idle callback could've suspended the window, in which
+  // case mIdleRequestExecutor will be null.
+  if (mIdleRequestExecutor) {
+    mIdleRequestExecutor->MaybeDispatch();
+  }
   return result;
 }
 
 class IdleRequestTimeoutHandler final : public TimeoutHandler
 {
 public:
   IdleRequestTimeoutHandler(JSContext* aCx,
                             IdleRequest* aIdleRequest,