Skip to content

A way to coordinate the refresh of all controlled windows to facilitate an upgrade #422

@jakearchibald

Description

@jakearchibald

This used to be clients.reloadAll(), which still feels like the right name, but I don't think we've thought about this enough to make it "version 1".

Here's what we had before I took out of the ts:

    // Assists in restarting all windows
    //
    // Return a new Promise
    // For each attached window:
    //   Fire onreloadpage against navigator.serviceWorker
    //   If onreloadpage has default prevented:
    //     Unfreeze any frozen windows
    //     reject returned promise
    //     abort these steps
    //   If waitUntil called on onreloadpage event:
    //     frozen windows may wish to indicate which window they're blocked on
    //     yeild until promise passed into waitUntil resolves
    //     if waitUntil promise is accepted:
    //       freeze window (ui may wish to grey it out)
    //     else:
    //       Unfreeze any frozen windows
    //       reject returned promise
    //       abort these steps
    //   Else:
    //     freeze window (ui may wish to grey it out)
    // Unload all windows
    // If any window fails to unload, eg via onbeforeunload:
    //   Unfreeze any frozen windows
    //   reject returned promise
    //   abort these steps
    // Close all connections between the old worker and windows
    // Activate the new worker
    // Reload all windows asynchronously
    // Resolve promise

@annevk pointed out that you can have a controlled SharedWorker being used by non-controlled pages. We don't have the concept of reloading a SharedWorker at the moment, so we need to overcome that.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions