Bug 1335745 - Guard against a null rootPresContext. r?tnikkel draft
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 23 Mar 2017 11:54:17 -0400
changeset 503829 31e9884d86c1ee90126a41a30d006d6b381dc31c
parent 503828 283ca0666c06b05616e23af2f873652c30d54988
child 550512 0946cb6e698c4642e0cdf161496043b3085f1b03
push id50666
push userkgupta@mozilla.com
push dateThu, 23 Mar 2017 15:54:58 +0000
Bug 1335745 - Guard against a null rootPresContext. r?tnikkel With WebRender enabled, the DidComposite notification message can be delayed because of the extra indirection of the WR Render thread. This can result in the DidComposite notification arriving for a popup window after it has already been put into the bfcache and no longer has a root prescontext. This results in an intermittent crash or assertion failure during crashtests. A null guard here should avoid the problem. MozReview-Commit-ID: 2bwD36LarAv
--- a/view/nsView.cpp
+++ b/view/nsView.cpp
@@ -1077,18 +1077,19 @@ nsView::DidCompositeWindow(uint64_t aTra
                            const TimeStamp& aCompositeEnd)
   nsIPresShell* presShell = mViewManager->GetPresShell();
   if (presShell) {
     nsAutoScriptBlocker scriptBlocker;
     nsPresContext* context = presShell->GetPresContext();
     nsRootPresContext* rootContext = context->GetRootPresContext();
-    MOZ_ASSERT(rootContext, "rootContext must be valid.");
-    rootContext->NotifyDidPaintForSubtree(aTransactionId, aCompositeEnd);
+    if (rootContext) {
+      rootContext->NotifyDidPaintForSubtree(aTransactionId, aCompositeEnd);
+    }
     // If the two timestamps are identical, this was likely a fake composite
     // event which wouldn't be terribly useful to display.
     if (aCompositeStart == aCompositeEnd) {
     nsIDocShell* docShell = context->GetDocShell();