Modify Script files and web-pages before rendering with StreamFilter (webRequest)

with the code listed here: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/webRequest/StreamFilter/onstart

I can modify the body of page encoded in UTF-8 but same code doesn’t work with js files peobably cuz they are encoded by gzip,

also I modified headers to “accept_encoding: UTF8” it only works with online requests but when the file get cached it doesn’t work

I tried using pako and zlib but of no use … any help?