privacycg / storage-access

The Storage Access API
https://privacycg.github.io/storage-access/
199 stars 26 forks source link

Modify Storage Access to use a "per-frame" model #141

Closed cfredric closed 1 year ago

cfredric commented 1 year ago

This is an attempt to migrate to a "per-frame" model, as discussed in https://github.com/privacycg/storage-access/issues/122. This is built on top of #138 as a starting point.

The approach is to define a flag that lives on environment, and is set by document.requestStorageAccess and read by document.hasStorageAccess. In order to propagate storage access during self-initiated, same-origin navigations, we also add a flag to the source snapshot params used during create navigation params by fetching, and conditionally copy the sourceDocument's relevant settings object's flag over to the new environment that will be created. This should let us achieve the benefits of the BrowsingContext approach discussed in #122, without having to add and clear state in BrowsingContext.

Leaving the checklist for now, though I'd like to get some feedback before I try to write WPTs:

(See WHATWG Working Mode: Changes for more details.)


Preview | Diff

johannhof commented 1 year ago

(Edited the checklist to indicate multi-browser support + the Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1401089)

johannhof commented 1 year ago

Filed https://bugzilla.mozilla.org/show_bug.cgi?id=1805861 and https://bugs.webkit.org/show_bug.cgi?id=249382 as well.

annevk commented 1 year ago

I think I would have a much easier time reviewing this once #138 lands and this is rebased given the overlap. Given that tests are not ready yet either I think it's okay that this potentially has to wait until early January. I will try to reply to all the questions above though.

johannhof commented 1 year ago

WPTs coming up in https://crrev.com/c/4117243

annevk commented 1 year ago

I was trying to be careful about the particular task source in use.

But that means this task would en up running after the rejection has already happened, right? So in the rejection task the activation wouldn't have been consumed.

I think this looks good now, but maybe @bvandersloot-mozilla can do a final read as there's been quite a bit of back-and-forth.