From f145e625e4ab2118c811ef4403c0939a1d30b5a7 Mon Sep 17 00:00:00 2001 From: hackademix Date: Mon, 1 Apr 2019 19:12:20 +0200 Subject: Limit wrappedJSObject usages to compatible browsers. --- src/content/ftp.js | 2 +- src/content/onScriptDisabled.js | 2 +- src/content/staticNS.js | 2 +- src/lib/UA.js | 2 +- 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) { -- cgit v1.2.3