Skip to content
This repository has been archived by the owner on Dec 12, 2020. It is now read-only.

Explain the lack of impact on workers #9

Merged
merged 2 commits into from
Jan 16, 2020
Merged

Explain the lack of impact on workers #9

merged 2 commits into from
Jan 16, 2020

Conversation

domenic
Copy link
Collaborator

@domenic domenic commented Jan 14, 2020

Closes #4.

@annevk, would you mind reviewing?

README.md Outdated

We mentioned above that origin isolation has no effect on workers. Here we explain why exactly that is.

First note that shared and service workers are already isolated into their own agent clusters. The only other things that exist in those agent clusters are potential nested dedicated workers. Everything is already same-origin within those shared and service worker agent clusters.
Copy link

Choose a reason for hiding this comment

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

Not quite everything, but everything that creates an agent, yes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess I meant "all other agents are already same-origin", so this should probably be merged with the previous sentence. Will update.

README.md Outdated

What remains to consider is dedicated workers which are spawned directly by documents. Those end up in the agent cluster of their owner document, and the allocation of that agent cluster is impacted by origin isolation, which makes it origin-keyed instead of site-keyed.

However, being origin-keyed has no observable impact for code inside a dedicated worker. All access to other realms is asynchronous inside a dedicated worker, so `document.domain` does not apply. And there's no way for dedicated worker code to send a `SharedArrayBuffer` to a same-site cross-origin destination, because the only thing it can communicate with is its parent document, or further nested dedicated workers, all of which are same-origin. (Note that even `BroadcastChannel`, which bypasses the need to have a direct reference to the destination, is restricted to same-origin communications.)
Copy link

Choose a reason for hiding this comment

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

With cooperation of the parent document you can use MessageChannel to communicate same-site cross-origin. However, due to the keying of the parent document's agent cluster that would be a different agent cluster and therefore fail for SharedArrayBuffer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, that's true. I explained that scenario a bit; let me know what you think of the result.

@domenic domenic merged commit c00988a into master Jan 16, 2020
@domenic domenic deleted the only-windows branch January 16, 2020 22:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shared/service workers
2 participants