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

Clarify session.subscribe and session.unsubscribe #628

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Lightning00Blade
Copy link
Contributor

@Lightning00Blade Lightning00Blade commented Dec 19, 2023

Closes #617.


Preview | Diff

events: [*text],
? contexts: [*browsingContext.BrowsingContext],
events: [+text],
? contexts: [+browsingContext.BrowsingContext],
Copy link
Contributor Author

@Lightning00Blade Lightning00Blade Dec 19, 2023

Choose a reason for hiding this comment

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

If we encounter events: [] or contexts: [] we should throw errors. Will add WPT tests for these cases.

Copy link
Contributor

@juliandescottes juliandescottes left a comment

Choose a reason for hiding this comment

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

For session subscribe/unsubscribe, the update the event map algorithm is already making sure to skip duplicated events and contexts. It also has additional logic to deal with the fact that we only subscribe to top level context.

So I don't think we have to switch to sets to skip duplicates. Since it adds some complexity, maybe we should reconsider this?

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
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.

Ignore duplicated contexts entries in script.addPreloadScript, session.subscribe and session.unsubscribe
2 participants