diff options
author | Yuchen Pei <hi@ypei.me> | 2022-09-27 11:58:12 +1000 |
---|---|---|
committer | Yuchen Pei <hi@ypei.me> | 2022-09-27 11:59:00 +1000 |
commit | ad1a6ea51386feccfb1da0bc0fc4f5ace101b71b (patch) | |
tree | f8bd240e8ed7166f4b12297f7110036db0240f1b /bg | |
parent | 2424408902a4d073e4addd758201bd31963d86c7 (diff) |
A better fix for bugs #58131
Diffstat (limited to 'bg')
-rw-r--r-- | bg/ResponseProcessor.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bg/ResponseProcessor.js b/bg/ResponseProcessor.js index 922ff19..3c90d9c 100644 --- a/bg/ResponseProcessor.js +++ b/bg/ResponseProcessor.js @@ -83,6 +83,8 @@ class ResponseTextFilter { if (res) return res; const { requestId } = request; + // create a filter to modify response data, see + // Mozilla/Add-ons/WebExtensions/API/webRequest/filterResponseData const filter = browser.webRequest.filterResponseData(requestId); let buffer = []; @@ -118,7 +120,7 @@ class ResponseTextFilter { } catch (e) { console.error(e); } - if (editedText !== null && editedText.indexOf('/* LibreJS: script accepted') !== 0) { + if (editedText !== null && editedText !== response.text) { // we changed the content, let's re-encode const encoded = new TextEncoder().encode(editedText); // pre-pending the UTF-8 BOM will force the charset per HTML 5 specs |