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

Update ServiceWorker if its href or scope changes #747

Merged
merged 7 commits into from
Feb 24, 2021

Commits on Feb 23, 2021

  1. Added comments to shouldInstallWorker

    * No code changes
    * Documenting the current state before I introduce a change in my next
    commit
    jkasten2 committed Feb 23, 2021
    Configuration menu
    Copy the full SHA
    615c719 View commit details
    Browse the repository at this point in the history
  2. ServiceWorkerHelper.getServiceWorkerHref refactor

    * Moved logic into smaller parts that is used the generate the full href
    for the OneSignal ServiceWorker.
       - No result changes.
    * Simplied the else part where we check for ServiceWorkerActiveState
       - As we always want to install service worker A in all other cases.
    * The benifits of this refactor will be used in the next commit
    jkasten2 committed Feb 23, 2021
    Configuration menu
    Copy the full SHA
    4997ab4 View commit details
    Browse the repository at this point in the history

Commits on Feb 24, 2021

  1. Added SW param check to shouldInstallWorker

    * Added a new changedServiceWorkerParams method which check if;
       - OneSignal ServiceWorker path, filename, or query params changed.
       - OneSignal ServierWorker scope changed
    * This is a new check that was added to shouldInstallWorker
    * A developer might change the OneSignal service worker params to take
    advantage of the PR #745 "Remove ServiceWorker Page Control Requirement"
      - This way the new OneSignal SW scope can be setup while their new
      root scoped SW can be installed at the same time.
    jkasten2 committed Feb 24, 2021
    Configuration menu
    Copy the full SHA
    4d42034 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    dd39b2a View commit details
    Browse the repository at this point in the history
  3. Multiple registartions MockServiceWorkerContainer

    * Multiple service workers are possible with browsers, if their scopes
    are different. Updated the mock to handle this.
    jkasten2 committed Feb 24, 2021
    Configuration menu
    Copy the full SHA
    50dd84f View commit details
    Browse the repository at this point in the history
  4. Scope fallback to MockServiceWorkerContainer

    * MockServiceWorkerContainer.getRegistration  - Added match any SW's
    that are at a higher scope than the one we are querying for as they are
    under it's control.
       - This was observed behavoir when testing on real browsers.
    jkasten2 committed Feb 24, 2021
    Configuration menu
    Copy the full SHA
    3bc851c View commit details
    Browse the repository at this point in the history
  5. Added scope changed test

    jkasten2 committed Feb 24, 2021
    Configuration menu
    Copy the full SHA
    e1b89b1 View commit details
    Browse the repository at this point in the history