A service worker is either selected based on the "client" doing the request, or in case of request for a client, it's selected based on the URL.
Workers are clients. Dedicated workers didn't have to be a client necessarily, but shared workers had to be, because they can span multiple clients that might each have their own service worker and then selecting a service worker for them would not necessarily be as deterministic as can be. Anyway, we made dedicated workers clients too for consistency. This also has some benefits with referrer setup and such.
So since workers are clients, we cannot allow cross-origin URLs for them, as that would also mean we'd end up with a cross-origin service worker, which would violate all kinds of rules.
This was discovered in whatwg/fetch#527.
cc @wanderview @jakearchibald
A service worker is either selected based on the "client" doing the request, or in case of request for a client, it's selected based on the URL.
Workers are clients. Dedicated workers didn't have to be a client necessarily, but shared workers had to be, because they can span multiple clients that might each have their own service worker and then selecting a service worker for them would not necessarily be as deterministic as can be. Anyway, we made dedicated workers clients too for consistency. This also has some benefits with referrer setup and such.
So since workers are clients, we cannot allow cross-origin URLs for them, as that would also mean we'd end up with a cross-origin service worker, which would violate all kinds of rules.
This was discovered in whatwg/fetch#527.
cc @wanderview @jakearchibald