Skip to content
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

Add "get unpartitioned cookie enabled state" algo #1

Closed
wants to merge 5 commits into from

Conversation

shuranhuang
Copy link
Owner

  • At least two implementers are interested (and none opposed):
  • Tests are written and can be reviewed and commented upon at:
  • Implementation bugs are filed:
    • Chromium: …
    • Gecko: …
    • WebKit: …

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

storage-access.bs Outdated Show resolved Hide resolved
@@ -147,6 +147,12 @@ partial interface Document {
};
</pre>

Let |get unpartitioned cookie enabled state| be an algorithm that, given {{Document}} |doc| and [=cookie store=], runs the following steps:
1. Let |global| be |doc|'s [=relevant global object=].
1. Let |cookie enabled state| be the result of [=queuing a global task=] on the [=cookie store=] with |global|'s [=environment/has storage access=].

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't queue a task on the cookie store, only on a task source, see https://html.spec.whatwg.org/multipage/webappapis.html#task-source for some info (but yes it's complicated, the important bit here is that you need a task source to queue tasks, which is what you do when you want to manipulate renderer state after stepping into the browser process using "in parallel").

However, it's not entirely clear to me what this step does and why it's needed. I suppose this is still WIP and you would list out steps to get unpartitioned cookie state here?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I am trying to translate what Chrome code is currently doing into text: https://source.chromium.org/chromium/chromium/src/+/refs/heads/main:third_party/blink/renderer/core/dom/document.cc;l=5890-5897;drc=b8a0323a84f483b25e94b3a24d80fda16c5dd1ae.

It's currently making a sync function call to the CookieStore to get whether unpartitioned cookies are available.
Like you said in another comment, the cookie store concept is only loosely translated, and IIUC we want to make the spec queuing tasks to get info from other sources, this is the closest text I could come up with for now...

Copy link
Owner Author

@shuranhuang shuranhuang Jun 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL the latest draft PR, in which I did the following:

  1. Made the get unpartitioned cookie enabled state algorithm incorporate more checks from hSA, and synchronous by checking Navigator.cookieEnabled; I am not sure what other spec source could be linked here, because AFAIK there is nothing to hold on to regarding the cookie part. This is also the current Chrome implementation.
  2. In hSA, added back the step that queues a task to permissions task source; I am not sure if this step should be removed; if we don't, then hSA is technically a sync method which reopens the issues hasStorageAccess() always queues a task to resolve with the environment's boolean? privacycg/storage-access#164 and Synchronous hasStorageAccess? privacycg/storage-access#146.
  3. In rSA, moved up the step that calls get unpartitioned cookie enabled state so that it does not run in parallel (because the algorithm is sync now).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants