[ServiceWorker] should service worker still install if onerror event handle cancels error from uncaught exception? (#778)

In the wpt tests we're porting from the blink code base there are two tests that allow the SW installation to continue if an uncaught exception's resulting error event is canceled:

```
self.onerror = function(event) { return true; };

self.addEventListener('install', function(event) { throw new Error(); });
```

And:

```
// Ensure we can handle multiple error handlers. One error handler
// calling preventDefault should cause the event to be treated as
// handled.
self.addEventListener('error', function(event) {});
self.addEventListener('error', function(event) { event.preventDefault(); });
self.addEventListener('error', function(event) {});
self.addEventListener('install', function(event) { throw new Error(); });
```

I see nothing in the spec about allowing installation to continue if the onerror event handler "handles" the error:

> 1. If any uncaught runtime script error occurs, then:
>   1. Report the error for the script per the runtime script errors handling.
>   2. Run the Update State algorithm passing registration's installing worker and redundant as the arguments.
>   3. Set registration's installing worker to null.
>   4. Pop the top element from installation queue and installation result handle queue.
>   5. If the result of running Get Newest Worker algorithm is null, then:
>     1. Invoke Clear Registration algorithm passing registration as its argument.
>   6. Abort these steps.

If I understand things correctly, handling the error in a worker onerror handler is supposed to keep the error from bubbling to the parent document.  That seems different than life cycle management in the SW, though.  Also, the SW has no parent document for it to bubble to.

---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/778

Received on Saturday, 7 November 2015 15:02:56 UTC