-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider moving API to Navigator #22
Comments
The document was picked because it matches the narrowest scope of what the API manages, namely document.cookie. The fact that also network requests from the iframe carry cookies doesn't change the narrowest scope. This isn't set in stone but it was the reasoning, especially since WebKit's implementation only changes document.cookie in terms of script-accessible storage/state. There are a few reasons for why iframes have to call this API:
|
The (Even if |
Thanks a lot.
Sorry, I should have been clearer. It would still be the third party iframe requesting access for its document. In my previous example, scope is implicit, but maybe this version highlights it better:
In this way, this is not a proposal to change the behaviour of the existing spec.
If the behaviour of the spec as written were to never change, and the scope is always tied to the document and its lifecycle, then considering to move this to the more global navigator would be pointless I agree. The catalyst for this proposal was mainly this: #17 (comment). If, in a future event, the spec of the scope does increase beyond the lifecycle of a document, or different browsers wanted to define the scope differently (as is the current case for Firefox I believe), registering that access on the navigator instead (but still tied to a scope like service worker registrations) may make sense. |
Fully appreciate that this is extremely late in the game, I'm just putting it out there 🙂. This is about providing flexibility for possible forward-compatibility at a stage that might be less disruptive now. |
Given the conversation here and on this week's call, I'm going to close this issue. If anyone would like it re-opened, let @johnwilander or one of the @privacycg/chairs know. Thanks! |
Proposal
In a similar way to how a Service Worker is registered to a limited scope, via Navigator:
I'd like to put forward that storage access should be granted via Navigator too, scoped initially to the ownerDocument of the HTML Element that received a user action:
Why?
Perhaps the biggest reason is flexibility for a future spec. I believe it could match the current behaviour by limiting the scope to the ownerDocument. However, if ever the spec were to change, or if different browsers wished to implement it differently... by having storage access granted to a double-keyed origin, to all iframes on the origin, or across page loads for instance, having it on the navigator allows for this widening of scope in perhaps a more comprehensible way.
Further arguments:
For completeness:
Thanks, would be really interested to hear any thoughts.
The text was updated successfully, but these errors were encountered: