Lately I’ve been looking for a way to create a stream as a URL that is usable in a .src. I posted more generally over on StackOverflow, where a helpful individual pointed out you could use a ServiceWorker + FetchEvent.respondWith + a ReadableStream to make this work. While that is a clever solution, I can’t use directly use ServiceWorkers in the plugin. I suppose it would be possible to do this in a content script somehow but that would do bad things for the performance of the plugin as whole - which is what I’m trying to improve.
So, another potential option would be to either:
- Hook a virtual page like an extension page also using webRequest and pretend it is a stream. Unfortunately, only http/https and ws/wss are allowable for webRequest so I don’t think this is possible?
- Somehow create a webRequest that never actually reaches out to the web with an invalid address and then write to a FilterStream. Unfortunately, I don’t think this is possible either.
In the same vein as #2 I could open a request to some arbitrary HTTP address and then wholly rewrite the stream but that seems bad as it forces an outbound call and makes my extension dependent on some arbitrary address.
Surely there’s some way to make a webRequest - either by design or by hack - that can be completely virtual?