Frame Hierarchy

Frame Hierarchy

Frame hierarchy is a concept developed by eyeo that represents a list of URLs where each element is embedded by the next one.

Example

Consider this scenario:

  • Main page: https://example.com

  • Embedded iframe: src = https://iframe.com/content.html

  • Resource within iframe: src = https://ads.com/ad.png

The image at https://ads.com/ad.png has a frame hierarchy of:

  • https://iframe.com/content.html

  • https://example.com

By convention, the first element is the immediate parent frame of the resource.

Purpose

The Browser Ad-Filtering Solution uses frame hierarchy to identify whether allowing filters exist for a resource's parents.

Example scenario:

A blocking filter like ||ads.com/ad.png matches the image URL and blocks the request.

An allowing filter such as @@||example.com^$document permits content on example.com, overriding blocking filters.

When both exist, the resource classifier should allow the ad from this particular frame hierarchy to load. But the same ad loaded from a different frame hierarchy might still be blocked.

The classifier searches for blocking and allowing filters matching not only the resource URL, but also $document-type allowing filters matching parent frames. This approach is essential for implementing Acceptable Ads allowlists correctly.

Implementation

Frame hierarchy is assembled by recursively following content::RenderFrameHost::GetParent() results.

Reference: FrameHierarchyBuilder