aboutsummaryrefslogtreecommitdiff
path: root/bg/ResponseProcessor.js
diff options
context:
space:
mode:
Diffstat (limited to 'bg/ResponseProcessor.js')
-rw-r--r--bg/ResponseProcessor.js4
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