[w3c/ServiceWorker] Detect Abort Events in Service Worker (#1284)

It would be great if Service Workers could detect the "abort" event that _should_ fire on the DOM when users cancel a document load (e.g. `window.stop()`, ESC key, browser stop button).  Perhaps:
1. SWs could detect "abort" events directly.
1. SWs could detect "aborts" indirectly (via "onmessage" event handlers triggered by application). This doesn't currently seem possible, because the "abort" event doesn't currently fire on the DOM  (See https://github.com/whatwg/html/issues/3525).

This would be specifically useful when implementing custom Streams in Service Workers.  The SW could detect "abort" events, close open streams, do cleanup, or send notifications to the underlying application.

For example, this SW progress indicator demo (https://fetch-progress.anthum.com/sw-basic/) implements a `ReadableStream` and has no way to for the SW to respond when the document load is aborted.  Additionally, the network transfer continues in Chrome (Firefox successfully stops it), which may be different issue entirely.



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1284

Received on Monday, 5 March 2018 20:58:54 UTC