browser.webRequest.filterResponseData missing in FF Webextensions

in the implementation of WebRequests API in chrome, you can modify a page’s source before the dom tree is even being built using this function:
let filter = browser.webRequest.filterResponseData(details.requestId);
and then using filter.ondata = event => { […]
this function (browser.webRequest.filterResponseData) is completely missing in FF.

it’s quite essential for anything that rewrites the response, like some kinds of adblockers, fingerprinting protection etc.

AFAIK Chrome doesn’t even implement the browser.* API namespace. Where did you get the above statement from?

under chrome, it’s chrome instead of browser. the webRequest API does exist in both browsers.

Hi there,
as fair as i could find out, they don’t want to implement this functionaltiy (modifying the page source befiore it get’s loaded) due to security reasons.

Regards,
Dennis

It would, if it did exist at all. I couldn’t find any indication that it does. So why do you think so?

did you mean the chrome object or the function i’m refering to?
https://developer.chrome.com/extensions/webRequest

I mean webRequest.filterResponseData. The only thing I could find about this was a proposal to implement it in Firefox. I couldn’t find any reference mentioning Chrome at all.

1 Like

all right, when looking closer, i also came to the conclusion that it was a proposal. so the only possibility for replacing the actual html code, at least partitially, will stay injecting a script in the content script.

about mentioning chrome: chrome was the reference for the devlopment of webextensions in firefox. so i simply found it natural to see chrome as the primary instance.

Yeah. You could probably also hack something with nativeMessaging and a proxy on localhost …

chrome was the reference for the devlopment of webextensions in firefox

Was, yes. I think Firefox has mostly moved past the point of implementing chrome stuff. What they are implementing now is primarily “new” WebExtension stuff that Chrome doesn’t know either.