summaryrefslogtreecommitdiff
path: root/src/bg
diff options
context:
space:
mode:
authorhackademix2018-07-03 19:36:39 +0200
committerhackademix2018-07-03 19:36:39 +0200
commit57eaa94dde7f2a2865c74dbb6c895fdf93162cab (patch)
treedda4c4524775c50c17053c1f80544bfdb89c44d9 /src/bg
parent8ae9513f75fa8c975a5960684bfaa575ceaa6f6d (diff)
downloadnoscript-57eaa94dde7f2a2865c74dbb6c895fdf93162cab.tar.gz
noscript-57eaa94dde7f2a2865c74dbb6c895fdf93162cab.tar.xz
noscript-57eaa94dde7f2a2865c74dbb6c895fdf93162cab.zip
Backport dynamic script injection to Tor Browser / Fx ESR60.
Diffstat (limited to 'src/bg')
-rw-r--r--src/bg/RequestUtil.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/bg/RequestUtil.js b/src/bg/RequestUtil.js
index a62f139..13a017e 100644
--- a/src/bg/RequestUtil.js
+++ b/src/bg/RequestUtil.js
@@ -39,10 +39,8 @@
let filter = browser.webRequest.filterResponseData(requestId);
let buffer = [];
let content = this.getContentMetaData(request);
- filter.onstart = async event => {
- if (/ml$/i.test(content.type)) {
- filter.write(new Uint8Array()); // work-around for https://bugzilla.mozilla.org/show_bug.cgi?id=1410755
- }
+ let first = true;
+ let execute = async () => {
for (let details of scripts.values()) {
details = Object.assign({
runAt: "document_start",
@@ -64,7 +62,17 @@
buffer = null;
}
};
+ filter.onstart = event => {
+ if (/ml$/i.test(content.type)) {
+ filter.write(new Uint8Array()); // work-around for https://bugzilla.mozilla.org/show_bug.cgi?id=1410755
+ }
+ }
filter.ondata = event => {
+ if (first) {
+ execute();
+ first = false;
+ }
+
if (buffer) {
buffer.push(event.data);
return;