It's possible to interact with an installing service worker before its 'install' event is dispatched
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 3.6k
- Forks
- 324
- Avg merge
- 14d 22h
- Merged PRs (30d)
- 1
Description
Consider the following code, which results in the installation of a new a new service worker:
navigator.serviceWorker.register(script, scope)
.then(registration => {
registration.installing.postMessage('foo', []);
};
In step 6 of Install, a promise resolution task is queued to the DOM manipulation queue; in step 10 a task that dispatches the 'install' event to the worker is queued. If the same queue is used, the then callback would run before the event is dispatch. (If it's a different queue, the user can't tell in which order these events would happen.)
This is pretty confusing, since a user might expect that an installing worker will have already been notified about it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Install algorithm at steps 6 and 10, including the promise-resolution and install-event tasks. Check how the relevant task queues are defined and determine the observable ordering for postMessage and the install event. Done means the specification gives a consistent, understandable ordering for these interactions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100