Re: [ServiceWorker] why does Register algorithm step 5.3.1 check for an active worker? (#856)

Chrome's implementation seems to predate the spec here, and it does a check but it's slightly different: if there's no active worker, then continue to Update. Nothing about the newest worker.

I think I just wanted to avoid register() triggering an update when the registration was already settled. If there's no active worker, then it's considered unsettled. Our code has a comment:

```
  // "If newestWorker is not null, and scriptURL is equal to
  // newestWorker.scriptURL, then:
  // Return a promise resolved with registration."
  // We resolve only if there's an active version. If there's not,
  // then there is either no version or only a waiting version from
  // the last browser session; it makes sense to proceed with registration in
  // either case.
  DCHECK(!existing_registration->installing_version());
  if (existing_registration->active_version()) {
    ResolvePromise(status, std::string(), existing_registration.get());
    Complete(SERVICE_WORKER_OK);
    return;
  }
```

The comment mentions "no version" registrations, which should be no longer possible.

Does Firefox early exit in all cases?


---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/856#issuecomment-202187665

Received on Monday, 28 March 2016 01:45:22 UTC