API to monitor subresources


#21

Anyway what I proposed does not expose urls, just domains (hosts). I was suggesting a notification of {domain, tsrObj} pairs. tsrObj being null if the TSR is absent or unparsable.


#22

Here is the possible WebIDL of this API

partial interface Navigator { SubresourceNotification StartSubresourceNotification(); }

interface SubresourceNotification : EventTarget { readonly attribute sequence Subresources; }

interface Subresources { readonly attribute DOMString domain; readonly attribute TrackingStatusObject?; }

}

// Subresouces is an array of Subresource objects indicating all the subresources requested since the last SubresourceNotification event or call to StartSubresourceNotification. // Each Subresource object contains a string representing the domain name component of the subresource URL, and an object TrackingStatus resulting from parsing the JSON encoded Tracking Status Resource of that subresource. // TrackingStatus is null if a subresource does not have a Tracking Status Resource, or if it is not valid JSON. // All subresources of this browsing context are notified, including those embedded in child subresources.


#23

Slightly changed so it shows the parent domain for grandchildren:

partial interface Navigator { SubresourceNotification StartSubresourceNotification(); }

interface SubresourceNotification : EventTarget { readonly attribute sequence Subresources; }

interface Subresources { readonly attribute DOMString domain; readonly attribute DomString parentDomain?; readonly attribute TrackingStatusObject? TSR; }

// Subresources is an array of Subresource objects indicating all the subresources requested since the last // SubresourceNotification event or call to StartSubresourceNotification. // Each Subresource object contains a string “domain” representing the domain name component of the // subresource URL, a nullable string “parentDomain” representing the domain name of the parent origin of // this subresource, and a nullable object reference “TSR” resulting from parsing the JSON encoded // Tracking Status Resource https://www.w3.org/2011/tracking-protection/drafts/tracking-dnt.html#status-resource // of the subresource. // “TSR” is null if a subresource does not have a Tracking Status Resource, or if it is not valid JSON. // “parentDomain” is null if the subresource is a child of the top level browsing context. // This API notifies all subresources initiated by this browsing context, // including those embedded in child subresources.