Bug 1435634 - Stop refresh driver's timer and bail out if either the prescontext or the presshell was destroyed in resize event callbacks. r?tnikkel draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Mon, 05 Feb 2018 06:24:16 +0900
changeset 751038 28862fcc380b7d58fe23b8345d50604b948f5bc2
parent 751015 cac3a4e6000d7079f8cf0118a5c509b2527b3289
push id97826
push userbmo:hikezoe@mozilla.com
push dateSun, 04 Feb 2018 21:24:36 +0000
reviewerstnikkel
bugs1435634
milestone60.0a1
Bug 1435634 - Stop refresh driver's timer and bail out if either the prescontext or the presshell was destroyed in resize event callbacks. r?tnikkel MozReview-Commit-ID: 5Nn66g71SxG
layout/base/nsRefreshDriver.cpp
--- a/layout/base/nsRefreshDriver.cpp
+++ b/layout/base/nsRefreshDriver.cpp
@@ -1861,17 +1861,18 @@ nsRefreshDriver::Tick(int64_t aNowEpoch,
   }
 
   // Resize events should be fired before layout flushes or
   // calling animation frame callbacks.
   AutoTArray<nsIPresShell*, 16> observers;
   observers.AppendElements(mResizeEventFlushObservers);
   for (uint32_t i = observers.Length(); i; --i) {
     if (!mPresContext || !mPresContext->GetPresShell()) {
-      break;
+      StopTimer();
+      return;
     }
     // Make sure to not process observers which might have been removed
     // during previous iterations.
     nsIPresShell* shell = observers[i - 1];
     if (!mResizeEventFlushObservers.Contains(shell)) {
       continue;
     }
     mResizeEventFlushObservers.RemoveElement(shell);