[ServiceWorker] Interception of the fallback requests initiated from a SW for cross-origin resources (#684)

While discussing use cases for `navigator.connect()`, we've encountered a case where interception of the fallback requests to a third-party resources and serving them through a cross-origin SW would greatly help the overall resource management. Here's the use case and the proposed extension API that enables the communication between a _client_ SW and a _service_ SW: 
https://github.com/mkruisselbrink/navigator-connect/blob/gh-pages/explainer.md#solving-the-fonts-problem

A _service_ opts in to handle _clients_' fallback requests by calling `e.handleFallThroughRequests` from within its `oninstall` event listener. Then, the requests initiated from a _client_ SW are intercepted, and fetch events tagged with `e.isFallThrough` set to true are dispatched to the _service_ SW instead of going out to the network.

It was originally discussed as part of the `navigator.connect()` spec, but agreed to be proposed as an extension to the SW API (v2): https://github.com/mkruisselbrink/navigator-connect/issues/28

Comments would be appreciated.

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

Received on Wednesday, 22 April 2015 06:03:43 UTC