aboutsummaryrefslogtreecommitdiff
path: root/bg/ResponseProcessor.js
diff options
context:
space:
mode:
Diffstat (limited to 'bg/ResponseProcessor.js')
-rw-r--r--bg/ResponseProcessor.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/bg/ResponseProcessor.js b/bg/ResponseProcessor.js
index d10d46d..1aa89de 100644
--- a/bg/ResponseProcessor.js
+++ b/bg/ResponseProcessor.js
@@ -106,10 +106,10 @@ class ResponseTextFilter {
response.text = await (await fetch(request.url, {cache: "reload", credentials: "include"})).text();
} else {
console.debug("It's a %s, trying to decode it as UTF-16.", request.type);
- response.text = new TextDecoder("utf-16be").decode(allBytes);
+ response.text = new TextDecoder("utf-16be").decode(allBytes, {stream: true});
}
} else {
- response.text = metaData.createDecoder().decode(allBytes, {stream: true});
+ response.text = metaData.decode(allBytes);
}
let editedText = null;
try {
@@ -122,7 +122,7 @@ class ResponseTextFilter {
let encoded = new TextEncoder().encode(editedText);
// pre-pending the UTF-8 BOM will force the charset per HTML 5 specs
allBytes = new Uint8Array(encoded.byteLength + 3);
- allBytes.set(new Uint8Array([0xEF, 0xBB, 0xBF]), 0); // UTF-8 BOM
+ allBytes.set(ResponseMetaData.UTF8BOM, 0); // UTF-8 BOM
allBytes.set(encoded, 3);
}
filter.write(allBytes);