summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhackademix2018-07-03 17:02:58 +0200
committerhackademix2018-07-03 17:02:58 +0200
commite0ae64871e317d356c0fbd48a0e4c911d1089708 (patch)
treee10cf0ef0dc2d0b8928727452a9554f2794c70cf
parent81bd93a72d0b49fd78908f7c467ae9f324791e23 (diff)
downloadnoscript-e0ae64871e317d356c0fbd48a0e4c911d1089708.tar.gz
noscript-e0ae64871e317d356c0fbd48a0e4c911d1089708.tar.xz
noscript-e0ae64871e317d356c0fbd48a0e4c911d1089708.zip
Fixed regression: dynamic script injection breaking images loaded as frame content.
-rw-r--r--src/bg/RequestUtil.js18
-rw-r--r--src/content/webglHook.js2
-rw-r--r--src/manifest.json2
3 files changed, 19 insertions, 3 deletions
diff --git a/src/bg/RequestUtil.js b/src/bg/RequestUtil.js
index 2020286..a62f139 100644
--- a/src/bg/RequestUtil.js
+++ b/src/bg/RequestUtil.js
@@ -11,6 +11,19 @@
browser.webRequest.onCompleted.addListener(cleanup, filter);
browser.webRequest.onErrorOccurred.addListener(cleanup, filter);
var RequestUtil = {
+
+ getContentMetaData(request) {
+ if (request.content) return request.content;
+ let {responseHeaders} = request;
+ let content = request.content = {};
+ for (let h of responseHeaders) {
+ if (/^\s*Content-(Type|Disposition)\s*$/i.test(h.name)) {
+ content[h.name.split("-")[1].trim().toLowerCase()] = h.value;
+ }
+ }
+ return content;
+ },
+
async executeOnStart(request, details) {
let {requestId, tabId, frameId} = request;
let scripts = pendingRequests.get(requestId);
@@ -25,8 +38,11 @@
let filter = browser.webRequest.filterResponseData(requestId);
let buffer = [];
+ let content = this.getContentMetaData(request);
filter.onstart = async event => {
- filter.write(new Uint8Array());
+ if (/ml$/i.test(content.type)) {
+ filter.write(new Uint8Array()); // work-around for https://bugzilla.mozilla.org/show_bug.cgi?id=1410755
+ }
for (let details of scripts.values()) {
details = Object.assign({
runAt: "document_start",
diff --git a/src/content/webglHook.js b/src/content/webglHook.js
index 5b83025..c3b7aaa 100644
--- a/src/content/webglHook.js
+++ b/src/content/webglHook.js
@@ -1,4 +1,4 @@
-console.log("WebGL Hook", document.URL, document.documentElement && document.documentElement.innerHTML);
+debug("WebGL Hook", document.URL, document.documentElement && document.documentElement.innerHTML);
try {
let proto = HTMLCanvasElement.prototype;
let getContext = proto.getContext;
diff --git a/src/manifest.json b/src/manifest.json
index 87549f9..64a190a 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -8,7 +8,7 @@
"strict_min_version": "59.0"
}
},
- "version": "10.1.8.3rc4",
+ "version": "10.1.8.3rc5",
"description": "__MSG_Description__",
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'none'",