summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhackademix2019-04-01 19:12:20 +0200
committerhackademix2019-04-01 19:12:20 +0200
commitf145e625e4ab2118c811ef4403c0939a1d30b5a7 (patch)
treebf1b1a1c7131475d00b9a597d9fc38ba26f6ea1e
parent688f7a31fab74ee1b1ffbc6c5dfb8fd418dcc844 (diff)
downloadnoscript-f145e625e4ab2118c811ef4403c0939a1d30b5a7.tar.gz
noscript-f145e625e4ab2118c811ef4403c0939a1d30b5a7.tar.xz
noscript-f145e625e4ab2118c811ef4403c0939a1d30b5a7.zip
Limit wrappedJSObject usages to compatible browsers.
-rw-r--r--src/content/ftp.js2
-rw-r--r--src/content/onScriptDisabled.js2
-rw-r--r--src/content/staticNS.js2
-rw-r--r--src/lib/UA.js2
4 files changed, 4 insertions, 4 deletions
diff --git a/src/content/ftp.js b/src/content/ftp.js
index 73ef5e8..cb29f13 100644
--- a/src/content/ftp.js
+++ b/src/content/ftp.js
@@ -1,4 +1,4 @@
-(() => {
+if (UA.isMozilla) (() => {
// see https://dxr.mozilla.org/mozilla-central/rev/d03b538b6b417ba892d0a92fd693945b741246e1/netwerk/streamconv/converters/nsIndexedToHTML.cpp#381
'use strict';
var gTable, gOrderBy, gTBody, gRows, gUI_showHidden;
diff --git a/src/content/onScriptDisabled.js b/src/content/onScriptDisabled.js
index c0d5899..6083466 100644
--- a/src/content/onScriptDisabled.js
+++ b/src/content/onScriptDisabled.js
@@ -15,7 +15,7 @@ function onScriptDisabled() {
if (refresh) {
let html = document.documentElement.outerHTML;
window.addEventListener("load", e => {
- let document = window.wrappedJSObject.document;
+ let document = window.wrappedJSObject ? window.wrappedJSObject.document : window.document;
document.open();
document.write(html);
document.close();
diff --git a/src/content/staticNS.js b/src/content/staticNS.js
index e169087..3561162 100644
--- a/src/content/staticNS.js
+++ b/src/content/staticNS.js
@@ -65,7 +65,7 @@
} catch (e) {
error(e);
}
- } else if (window !== window.top) {
+ } else if (UA.isMozilla && window !== window.top) {
// The cookie hack won't work for non-HTTP subframes (issue #48),
// or the cookie might have been deleted in a race condition,
// so here we try to check the parent
diff --git a/src/lib/UA.js b/src/lib/UA.js
index 1a1771a..438eaf6 100644
--- a/src/lib/UA.js
+++ b/src/lib/UA.js
@@ -1,5 +1,5 @@
var UA = {
- isMozilla: document.URL.startsWith("moz-"),
+ isMozilla: document.URL.startsWith("moz-") || typeof window.wrappedJSObject === "object",
}
if (!UA.isMozilla) {