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

Make workers (including service workers) work #21

Open
mitar opened this issue Mar 6, 2016 · 4 comments
Open

Make workers (including service workers) work #21

mitar opened this issue Mar 6, 2016 · 4 comments
Milestone

Comments

@mitar
Copy link

mitar commented Mar 6, 2016

Currently, all types of workers are prohibited to be used inside suborigins. I understand the complexity of supporting service workers, but I would urge that creation of web workers from pages served under suborigin should be allowed. Semantics is pretty clear there. Simply, the web worker would have the same suborigin as the host.

For us, this is important because it allows moving existing code without any modification under suborigins. Code which was previously outside suborigins able to create web workers and communicate with them, should be able to do that as well once served from the suborigin.

The workaround mentioned (using iframes outside suborigin) does not work because such web workers cannot access same local storage and other origin-bound APIs as the suborigin code can.

So I would suggest that web workers are allowed to be created from the suborigins, but other types of workers are left for the future.

cc @wh0

@mitar mitar closed this as completed Mar 6, 2016
@mitar mitar reopened this Mar 6, 2016
@mitar
Copy link
Author

mitar commented May 24, 2016

Any progress on this?

@mitar
Copy link
Author

mitar commented Aug 26, 2016

So I still do not understand why web workers cannot be supported. They have clear origin. Could at least those be added to this version of spec to be supported? Then it would be really easy to port existing applications to suborigins.

@annevk
Copy link
Member

annevk commented Sep 27, 2017

I think the main way we could make workers work is by enforcing that after they are fetched their response carries the same Sec-Suborigin header value as the page that initiated the request.

This should also work for service workers.

Furthermore, for service workers we could then specify that their entire scope will always be within the same suborigin, though we should probably flush that out a bit to make sure that makes sense, especially given #64. It seems rather tricky if service workers would be able to return resources in response to navigation that have different suborigins from themselves.

cc @jakearchibald

(Again, I don't think any of this applies to Origin Isolation. There everything should work as it does today.)

@annevk annevk changed the title Allow creation of web workers from suborigins Make workers (including service workers) work Sep 27, 2017
@jakearchibald
Copy link

If sub-origin identifiers weren't path-based, then for service workers I think we'd need to require that the scope was unique across the origin and all the sub origins.

When the user navigates to a URL, we need to decide which service worker to use, and we don't know anything about sub-origin at that point. Once we've identified a service worker, I guess the resulting page would be the same sub-origin as the service worker.

The sub-origin of the service worker would be the sub-origin of the client that registered it.

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

No branches or pull requests

4 participants