w3c / IntersectionObserver

Intersection Observer

Home Page:https://www.w3.org/TR/intersection-observer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clarify root bounds policy for nested iframes with A-B-A origins

szager-chromium opened this issue · comments

The existing InteresectionObserver spec uses obsolete language in defining rootBounds:

"If target belongs to the same unit of related similar-origin browsing contexts as the intersection root, this will be the root intersection rectangle. Otherwise, this will be null."

The html spec has deprecated "unit of related similar-origin browsing contexts", but it previously referred to a connected graph of same-origin browsing contexts. The closest concept in the currect spec is probably the "browsing context scope origin":

https://html.spec.whatwg.org/multipage/browsers.html#browsing-context-scope-origin

That basically describes any browsing context that is in the "unit of related similar-origin browsing contexts" as the top-level document.

The intent of the original IntersectionObserver spec language was that rootBounds should be null whenever the target is in a cross-origin iframe, even if the top document is same-origin to the target's document.

A recent WPT commit added a test which contradicts this interpretation:

web-platform-tests/wpt@57d1b42

I propose that the test be removed from WPT.

After further discussion in pull request #448, it was decided that rootBounds should be populated as long as the browsing context containing the observation target Element is same-origin-domain with the top-level browsing context. So the intersection-observer/same-origin-grand-child-iframe.sub.html test is correct.