[ServiceWorker] Create service worker from Blob/String URL (#578)

I guess it's a security decision, however it could be really useful for better and easier approach when developing generic libraries which needs to abstract implementation details to end developers which uses the ServiceWorker to provide functionalities such as transpartent assets caching or HTTP traffic interceptor/modification on the flight

Taking a look to its parent implementations (Workers and SharedWorkers), any developer can create them using different ways to dynamically serialize code o transforming it as a binary Blob. I think that the same feature for service workers will be great match. The scope limitation has no sense in this cases

An example:
```js
var workerBlob = new Blob([ serviceWorkerFn.toString() ], { type: 'text/javascript' })
navigator.serviceWorker(URL.createObjectURL(workerBlob))
```



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

Received on Sunday, 7 December 2014 21:32:52 UTC