Closed Bug 1237498 Opened 9 years ago Closed 7 years ago

service workers should control clients, not documents

Categories

(Core :: DOM: Service Workers, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1425975

People

(Reporter: bkelly, Unassigned)

Details

Currently we mark documents as being controlled. This is not quite right in a number of ways. As has been noted in other bugs we need to be able to control workers, etc. But it also has subtle lifecycle issues. Consider: addEventListener('fetch', function(evt) { evt.waitUntil(self.registration.unregister()); }); This unregisters the service worker on the first fetch event. If this is for the first navigation to the scope, then there are no controlled documents. This means our current algorithm can kill the worker before we complete the fetch event handling due to the unregister running quickly. In contrast, if we treated the window client as being controlled immediately before firing the fetch event as described in the spec, then this worker life cycle would be clear. The worker would remain open until the client exits or stops being controlled. Some of this is discussed in a closed spec issue I raised here: https://github.com/slightlyoff/ServiceWorker/issues/804
Assignee: nobody → dlee
Status: NEW → ASSIGNED
At the face-to-face meeting it was discussed that maybe clients really should be documents and not windows. I would wait to do anything here.
Assignee: dlee → nobody
Status: ASSIGNED → NEW
No longer blocks: ServiceWorkers-compat
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.