Bug 1405814 - Avoid crash with WebRender when the scroll metadata is unavailable. r=kats
authorAndrew Osmond <aosmond@mozilla.com>
Thu, 25 Oct 2018 13:51:08 -0400
changeset 443044 b1cb5cc2e2d56593315da5be4be25d19e2617ce8
parent 443043 d197f134bdc0578cf92ec223ec7e84d39d1e0175
child 443045 fd95f65239ed4bfeb679cc35d627883eddf738d2
push id109285
push useraosmond@gmail.com
push dateFri, 26 Oct 2018 00:01:15 +0000
treeherdermozilla-inbound@b1cb5cc2e2d5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1405814, 1471671
milestone65.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 1405814 - Avoid crash with WebRender when the scroll metadata is unavailable. r=kats Similar to bug 1471671, we are seeing missing scroll metadata in cases we do not expect that, and have been observing low volume crashes in the wild as a result. It appears that in the non-WR path, it skips such items, so we should probably do the same thing with WebRender. If it is a real problem, we will hopefully get a reproducible test case from a user if scrolling fails for them. Differential Revision: https://phabricator.services.mozilla.com/D9815
gfx/layers/wr/WebRenderScrollData.cpp
--- a/gfx/layers/wr/WebRenderScrollData.cpp
+++ b/gfx/layers/wr/WebRenderScrollData.cpp
@@ -64,19 +64,22 @@ WebRenderLayerScrollData::Initialize(Web
     FrameMetrics::ViewID scrollId = asr->GetViewId();
     if (Maybe<size_t> index = aOwner.HasMetadataFor(scrollId)) {
       mScrollIds.AppendElement(index.ref());
     } else {
       Maybe<ScrollMetadata> metadata = asr->mScrollableFrame->ComputeScrollMetadata(
           aOwner.GetManager(), aItem->ReferenceFrame(),
           Nothing(), nullptr);
       asr->mScrollableFrame->NotifyApzTransaction();
-      MOZ_ASSERT(metadata);
-      MOZ_ASSERT(metadata->GetMetrics().GetScrollId() == scrollId);
-      mScrollIds.AppendElement(aOwner.AddMetadata(metadata.ref()));
+      if (metadata) {
+        MOZ_ASSERT(metadata->GetMetrics().GetScrollId() == scrollId);
+        mScrollIds.AppendElement(aOwner.AddMetadata(metadata.ref()));
+      } else {
+        MOZ_ASSERT_UNREACHABLE("Expected scroll metadata to be available!");
+      }
     }
     asr = asr->mParent;
   }
 
   // aAncestorTransform, if present, is the transform from an ancestor
   // nsDisplayTransform that was stored on the stacking context in order to
   // propagate it downwards in the tree. (i.e. |aItem| is a strict descendant of
   // the nsDisplayTranform which produced aAncestorTransform). We store this