Skip to content
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

Attempt standard-compliant worker install & activation #46

Open
jakearchibald opened this issue Jan 13, 2014 · 1 comment
Open

Attempt standard-compliant worker install & activation #46

jakearchibald opened this issue Jan 13, 2014 · 1 comment

Comments

@jakearchibald
Copy link
Collaborator

Some of this isn't well specced yet:

w3c/ServiceWorker#144
w3c/ServiceWorker#143

…but I'd like to try and get the "wait for all windows using v1 to go before activating v2" working.

@jakearchibald
Copy link
Collaborator Author

As part of this I'd like to move the registration/install/activation code into WorkerRegistry and WorkerRegistration.

registry register():

  • Abort if worker url and glob are already registered
  • Abort if worker url is on different origin to page url
  • Abort if glob url is on different origin to page url
  • If glob already registered, update
  • else create & add registration (glob+url)
  • Call update

registration update():

  • Fetch worker from url
  • If network fail, abort silently (offline case)
  • If off-domain redirect, abort silently (captive portal)
  • If same-domain redirect ???
  • If 404 ???
  • If != 200 abort silently
  • If byte content is identical to active worker, abort
  • Eval new worker
  • If error thrown ???
  • Call oninstall
  • Worker is now installing worker
  • If error thrown ???
  • If waitUntil called, wait on promise
    • If promise rejects ???
  • Mark worker as "installed"

Tab load and unload:

  • If tab does not match registered glob, abort
  • If other tab matches registered glob, abort
  • If no installing worker, abort
  • If installing worker hasn't finished installing, abort
  • Installing worker becomes active worker
  • Call onactivate
  • If error thrown ??
  • If waitUntil called, wait on promise
    • If promise rejects ???
  • Mark worker as "activated"

On fetch:

  • If page url does not match glob, request normally
  • If no active worker, request normally
  • If worker not activated, wait on promise
    • If promise rejects ???
  • call onfetch
  • If forwardTo called, do redirect
  • If respondWith called, wait for promise, use response, network failure on rejection

jakearchibald added a commit to jakearchibald/serviceworker-demo that referenced this issue Jan 14, 2014
* Moving as much code out of server.js as possible
* Removed need for ast stuff in importScripts

Working towards tgvashworth#46
jakearchibald added a commit to jakearchibald/serviceworker-demo that referenced this issue Jan 14, 2014
* Moving as much code out of server.js as possible
* Removed need for ast stuff in importScripts

Working towards tgvashworth#46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant