New issue
Advanced search Search tips

Issue 918891 link

Starred by 4 users

Issue metadata

Status: WontFix
Owner:
Closed: Jan 15
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Service workers using direct import scripts are unable to display push notifications

Reported by mathan.v...@lemnisk.co, Jan 3

Issue description



Chrome Version       : 71.0.3578.98
URLs (if applicable) : https://banking.lemnisk.co/vizurySDKWorker.js
Other browsers tested:
  Add OK or FAIL, along with the version, after other browsers where you
have tested this issue:
     Safari:
    Firefox:
       Edge:

What steps will reproduce the problem?
(1) Wrap the original service worker code inside an import script
(2) Place this content in the final service worker on the website
(3)

What is the expected result?
Push Notification should be displayed successfully

What happens instead?
Push notifications are not displayed since the service worker first attempts to run import scripts which results in an exception as the feature (use of import scripts after installing a service worker) has been deprecated since 71.

If this feature is deprecated, please allow the support for import scripts for next few releases so that we can migrate all the users to the new service worker (w/o using import scripts).

If not, please suggest a workaround for recovering the users from this impact. Currently, we are not able to deliver impressions to millions of our users as all the service workers are using import scripts, and hence we do not see a way of updating the users' service workers until they revisit our site. 

Please provide any additional information below. Attach a screenshot if
possible.

 
The random query param is preventing the service worker from loading the importScripts() from offline storage.  Your import scripts URL needs to match an import script URL used during script evaluation or at install event time.

See step 3 here:

https://w3c.github.io/ServiceWorker/#importscripts
Labels: Needs-Triage-M71
Yes, we were using the random query param as a means to ensure that the user always gets the latest version of our service worker, and it no longer works starting M71. 

Hence, we are in seek of solutions for:

1. Getting users out of limbo: Sending notifications to users who have a copy of the random-query-param based service workers running their browsers, and they do not revisit the website ( for us to push any service-worker fixes to these users)

2. In future, how do we ensure that service-workers remain up-to-date with our latest versions. Please recommend best-practices here.
Service worker scripts and importScripts are not allowed to change without installing a new version via the life cycle described here:

https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle

The importScripts being able to read from the network changed to conform to the spec in this intent:

https://groups.google.com/a/chromium.org/d/msg/blink-dev/a6P-niHWgF4/CtJEHCnKDwAJ

The spec also requires the browser to perform a byte-for-byte check on importScripts to detect changes there, but I don't think that is implemented in chrome yet.  See bug 648295.

Until bug 648295 is implemented I think your best bet is to generate stable hashed names for your importScripts on the server side.  Your main script would then have to change to reference the new name which will trigger the service worker update.
Labels: Needs-Feedback
For comment 3's question 1, you should be able to get out of limbo automatically after about 24 hours of updating the service worker on the server, since Chrome does an update check when starting a service worker if one hasn't been performed in the past 24 hours. This should get and install the new version from the server.

Sorry for the breakage, but we don't have plans to rollback the importScripts() deprecation. Do these workarounds work for you?
Cc: -falken@chromium.org
Labels: M-71
Owner: falken@chromium.org
Status: Assigned (was: Unconfirmed)
Status: WontFix (was: Assigned)
Marking WontFix as the symptoms described here are WAI.

We definitely need to fix bug 648295 to make this easier, which is being worked on.

Sign in to add a comment