- From: John Mellor <notifications@github.com>
- Date: Thu, 18 Dec 2014 07:44:24 -0800
- To: w3c/push-api <push-api@noreply.github.com>
Received on Thursday, 18 December 2014 15:44:53 UTC
A common case where I think we might hit this is: ```js navigator.serviceWorker.register(...).then(function(serviceWorkerRegistration) { // This is INCORRECT: serviceWorkerRegistration might not be active yet! // It should wait for navigator.serviceWorker.ready instead to get an active worker. serviceWorkerRegistration.pushManager.register(...); }); ``` Another case is that the website could keep a reference to the PushManager for an active SWR, then the SW might asynchronously uninstall (unregister) itself in the background, then the website might try to use the PushManager. The spec currently has a catch-all "If there is an error, reject promise with a DOMException whose name is "AbortError" and terminate these steps". Since the code sample above might be a common mistake, we should make sure these errors are logged with clear descriptions. @jakearchibald might have thoughts on how to avoid developers falling into this trap. --- Reply to this email directly or view it on GitHub: https://github.com/w3c/push-api/issues/100#issuecomment-67504263
Received on Thursday, 18 December 2014 15:44:53 UTC