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

Support user contexts #570

Merged
merged 44 commits into from
Jan 22, 2024
Merged

Support user contexts #570

merged 44 commits into from
Jan 22, 2024

Conversation

OrKoN
Copy link
Contributor

@OrKoN OrKoN commented Oct 10, 2023

User Contexts allow basic isolation of the web content state and parallelization of test runs without paying the costs of launching a fresh/multiple browser processes. In this proposal, there is no session created for the user context: multiple user contexts are managed by the same session. The advantage is that the same session can create a fresh state for its operations. In practical terms, we want to have something that would allow us to implement https://pptr.dev/api/puppeteer.browsercontext/#example In Chrome, that corresponds to an incognito window (but you can have multiple for automation).

Issue #289

Related links:

Open questions/TODOs:

  • move to the storage domain?
  • support for context names?
  • define what happens to contexts if the browser is closed

Preview | Diff

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
@OrKoN OrKoN changed the title WIP partitions WIP user contexts Oct 30, 2023
index.bs Outdated Show resolved Hide resolved
index.bs Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
@OrKoN OrKoN force-pushed the orkon/partitions branch 3 times, most recently from 78bd343 to 9eb17f0 Compare October 30, 2023 14:08
@jgraham jgraham mentioned this pull request Nov 1, 2023
@OrKoN OrKoN force-pushed the orkon/partitions branch 2 times, most recently from dd1533d to a1240f9 Compare November 7, 2023 12:23
@OrKoN OrKoN changed the title WIP user contexts Add user contexts Nov 7, 2023
@OrKoN OrKoN force-pushed the orkon/partitions branch 2 times, most recently from 2df3c2e to 13b5804 Compare November 8, 2023 12:59
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
@OrKoN OrKoN marked this pull request as ready for review November 9, 2023 07:10
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
@OrKoN OrKoN force-pushed the orkon/partitions branch 3 times, most recently from a7d6f50 to 57acfff Compare November 28, 2023 07:12
@OrKoN OrKoN changed the title Add user contexts Support user contexts Nov 28, 2023
index.bs Outdated

User contexts other than the [=default user context=] have a <dfn>user context
id</dfn>, which is a string set upon context creation. The [=default user
context=]'s does not have a [=user context id=].
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it might be easier to treat the default context id as undefined.

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
OrKoN and others added 4 commits January 18, 2024 09:28
This gives us an explicit set of top-level user contexts to work with,
and makes the association between nagigables and user contexts clearer.
This returns a list of all user contexts. At the moment it doesn't
contain any information about the browsing contexts in each user
context (so you'd have to cross-reference with
browsingContext.getTree).
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
Copy link
Member

@jgraham jgraham left a comment

Choose a reason for hiding this comment

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

This looks good, thanks!

I added a suggestion for making the lookup of user context by id more explicit, but I'm happy to approve the PR since I think basically all the behaviour makes sense.

Copy link
Member

@jgraham jgraham left a comment

Choose a reason for hiding this comment

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

Thanks!

@OrKoN OrKoN merged commit 55adba6 into main Jan 22, 2024
5 checks passed
@OrKoN OrKoN deleted the orkon/partitions branch January 22, 2024 16:21
github-actions bot added a commit that referenced this pull request Jan 22, 2024
SHA: 55adba6
Reason: push, by OrKoN

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

None yet