Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Unified Diff: third_party/WebKit/Source/core/dom/IntersectionObserver.cpp

Issue 1985173002: [MERGE 2704] IntersectionObserver: check for constructed Frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@2704
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/intersection-observer/incomplete-document-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/IntersectionObserver.cpp
diff --git a/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp b/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp
index b0b42f34f122259d9f5fc04d6fc616a3a6ff49ec..dfab75ba4455b8a2123dc93e6dde922f8d0798ae 100644
--- a/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp
+++ b/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp
@@ -177,7 +177,11 @@ void IntersectionObserver::observe(Element* target)
if (target->ensureIntersectionObserverData().getObservationFor(*this))
return;
- bool shouldReportRootBounds = target->document().frame()->securityContext()->getSecurityOrigin()->canAccess(rootNode()->document().frame()->securityContext()->getSecurityOrigin());
+ bool shouldReportRootBounds = false;
+ LocalFrame* targetFrame = target->document().frame();
+ LocalFrame* rootFrame = rootNode()->document().frame();
+ if (targetFrame && rootFrame)
+ shouldReportRootBounds = targetFrame->securityContext()->getSecurityOrigin()->canAccess(rootFrame->securityContext()->getSecurityOrigin());
IntersectionObservation* observation = new IntersectionObservation(*this, *target, shouldReportRootBounds);
target->ensureIntersectionObserverData().addObservation(*observation);
m_observations.add(observation);
« no previous file with comments | « third_party/WebKit/LayoutTests/intersection-observer/incomplete-document-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698