Search code examples
javascriptwebrequestfirefox-addon-webextensions

Using browser.webRequest on a createObjectURL url match


Can an object url from window.URL.createObjectURL be used in a browser.webRequest url match to intercept a download request of a url blob?

If so, how is the match written?

The object urls have the form of blob:null/839459f5-7f47-4548-986c-5830fdeaa009; all seem to start with "blob:null".

For the match

<scheme>://<host><path>,

I haven't been able to find anything that works to catch the download of the object url.

I've tried

"<all_urls">, "*://*/*", "blob:null/*".

I can catch the browser.downloads.onCreated event but nothing with webRequest. The webRequest statement is as follows.

browser.webRequest.onBeforeSendHeaders.addListener(

 listener,

 { urls : ["<all_urls>"] },

["blocking"] );

And, the permissions in the manifest.json are:

  "permissions" : [ "downloads", "webRequest", "webRequestBlocking", "<all_urls>" ],

Any idea what I'm doing wrong or not doing?

Thank you.


Solution

  • No, Blob URIs are not a network request. It's the same with cached pages, you can't intercept those either.