Bug 1471671 - Avoid crash with WebRender when the scroll metadata is unavailable. r=kats
authorAndrew Osmond <aosmond@mozilla.com>
Wed, 24 Oct 2018 13:45:39 -0400
changeset 491322 6d897bc50f753ff04a58d8fae3e7996b72a5e81d
parent 491321 0bc87bd86202e86e7d07ffc3dcea6bc0a0303c2d
child 491323 84d5f2504bcafc4bd142ad168616acbd6e55018b
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
Bug 1471671 - Avoid crash with WebRender when the scroll metadata is unavailable. r=kats We are seeing crash reports in the wild where there is no scroll metadata available for an ASR for a display item and its clip. It appears that in the non-WR path, it skips such items, so we should probably do the same thing with WebRender. If the scrolling ends up being wrong, hopefully a reproducible use case will make its way to use to further debug, as the crash reports have not yielded anything to date. Differential Revision: https://phabricator.services.mozilla.com/D9699
--- a/gfx/layers/wr/ClipManager.cpp
+++ b/gfx/layers/wr/ClipManager.cpp
@@ -287,19 +287,22 @@ ClipManager::DefineScrollLayers(const Ac
     // If we've already defined this scroll layer before, we can early-exit
     return scrollId;
   // Recurse to define the ancestors
   Maybe<wr::WrClipId> ancestorScrollId = DefineScrollLayers(aASR->mParent, aItem, aSc);
   Maybe<ScrollMetadata> metadata = aASR->mScrollableFrame->ComputeScrollMetadata(
       mManager, aItem->ReferenceFrame(), Nothing(), nullptr);
-  MOZ_ASSERT(metadata);
+  if (!metadata) {
+    MOZ_ASSERT_UNREACHABLE("Expected scroll metadata to be available!");
+    return ancestorScrollId;
+  }
   FrameMetrics& metrics = metadata->GetMetrics();
   if (!metrics.IsScrollable()) {
     // This item is a scrolling no-op, skip over it in the ASR chain.
     return ancestorScrollId;
   LayoutDeviceRect contentRect =
       metrics.GetExpandedScrollableRect() * metrics.GetDevPixelsPerCSSPixel();
   LayoutDeviceRect clipBounds =