-
Notifications
You must be signed in to change notification settings - Fork 312
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
InstallEvent.addRoutes is resolving/rejecting the returned promise synchronously #1742
Comments
In the Chromium implementation, Step 6 in https://w3c.github.io/ServiceWorker/#register-router-method is actually done in the browser process because the routing actually happens in the browser process for a main resource navigation. Since the browser process do not trust the renderer process (and there is mismatch of a regular expression implementation between them), the browser process verifies Step 4 and 5. However, as you pointed out, the specification is written like as-if Step 6 is a synchronous step. I am afraid if it can be too much implementation details, but I am happy to update the specification. |
Let's first wait on #1744, we can then put up a PR for this one. If the browser process is doing the validation checks, is it needed to also do them in the render process as well? In specs term, it means that either we do the checks synchronously (and implementation will actually do them twice), or we run these checks inside an I don't have a strong preference here. |
Sure.
Yeah, I also had the same question when I implemented this, and decided this way upon the following reasons:
Note that in Chromium, verifying failure in the browser process will bring the renderer to be killed except for the case caused by the regular expression implementation difference.
I suppose the time to verify is negligibly small and I currently do not come up with use case that the difference matters, but I prefer to keep it synchronous except for the persistent storage update. |
Except for the rejection due to syntax error, promise will be resolved after the list of router rules in serviceWorker has been updated. |
addRoutes currently returns a promise without using the ability to resolve/reject the promise asynchronously.
Looking at Chromium implementation, it seems that the promise is resolved asynchronously (probably after storing the route out of process).
The spec could be written as follows:
The text was updated successfully, but these errors were encountered: