Bug 1370968 - Guard against possible NULL values when IntersecionObserver API is used in XUL pages. r=mstange
authorTobias Schneider <schneider@jancona.com>
Wed, 07 Jun 2017 15:16:59 -0700
changeset 411050 217c7653e6ec6bc13dc146d17b7f798be1fe55a4
parent 411049 42388ab3ebfe247d5ccba418ff7bbb807906b61e
child 411051 5c606fafb195dc6f460ba27b5f56a594c017a863
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)
reviewersmstange
bugs1370968
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 1370968 - Guard against possible NULL values when IntersecionObserver API is used in XUL pages. r=mstange
dom/base/DOMIntersectionObserver.cpp
--- a/dom/base/DOMIntersectionObserver.cpp
+++ b/dom/base/DOMIntersectionObserver.cpp
@@ -409,18 +409,20 @@ DOMIntersectionObserver::Update(nsIDocum
       );
       intersectionRect = EdgeInclusiveIntersection(
         intersectionRectRelativeToRoot,
         rootIntersectionRect
       );
       if (intersectionRect.isSome() && !isSameDoc) {
         nsRect rect = intersectionRect.value();
         nsPresContext* presContext = targetFrame->PresContext();
-        nsLayoutUtils::TransformRect(rootFrame,
-          presContext->PresShell()->GetRootScrollFrame(), rect);
+        nsIFrame* rootScrollFrame = presContext->PresShell()->GetRootScrollFrame();
+        if (rootScrollFrame) {
+          nsLayoutUtils::TransformRect(rootFrame, rootScrollFrame, rect);
+        }
         intersectionRect = Some(rect);
       }
     }
 
     double targetArea = targetRect.width * targetRect.height;
     double intersectionArea = !intersectionRect ?
       0 : intersectionRect->width * intersectionRect->height;