Closed Bug 1263052 Opened 8 years ago Closed 4 years ago

add mode that forces service worker update on refresh before document loads

Categories

(DevTools :: about:debugging, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1459956

People

(Reporter: bkelly, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [btpp-backlog])

As described in bug 1263048 comment 0, a lot of developer frustration comes from trying iteratively write a service worker and test those changes.  The update on navigation is delayed till after document load normally, so if the developer must refresh at least twice to see any change.

I don't think we maintain a controlled client through refresh right now because we control documents.  If we ever implement controlling windows as described in bug 1237498, then we would maintain a controlled client through refresh.  This creates further problems because the updated service worker will never become activated.

I'd like to see us add a devtools mode that does this:

* User selects "force update service worker on refresh" in settings
* If user refreshes a page controlled by a service worker then:
* Load an intermediate about: page that shows "updating service worker".
* Navigate back to previous URL once update is complete.

The navigation to the intermediate page would do two things.

1) It would ensure we're not controlling the current client.  (It won't help if other clients are being controlled, but see bug 1263048.)
2) It allows us to gracefully handle the time it takes to perform the update.  We can't easily perform the update in parallel with the navigate because it would be very racy.
3) Its clear to the user what is happening.  The page could even have a button to disable the mode.
Jake tells me the chrome version of this does:

> User hits refresh => service worker fetched => service worker treated as new version, even it's it's byte identical => Installs, forces skipWaiting() => page refreshes

And the window stays on the previous page until the new service worker activates.
Priority: -- → P3
Whiteboard: [btpp-backlog]
Julian, is this a bug you'd be interested in mentoring? I'm not sure how easy it is to implement though.
Component: Developer Tools → Developer Tools: about:debugging
Flags: needinfo?(jdescottes)
Flags: needinfo?(jdescottes)
Product: Firefox → DevTools
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.