From 9baf17fa2accb83162aefe1157936e2d20303c69 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Thu, 26 Apr 2018 12:01:31 -0400 Subject: [PATCH] patch firefox/legacy for changes in e5f2e9701dac --- platform/chromium/vapi-usercss.js | 6 ++++-- platform/debian/vapi-usercss.js | 6 ++++-- platform/webext/vapi-usercss.js | 4 +++- tools/make-firefox.sh | 6 +++++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/platform/chromium/vapi-usercss.js b/platform/chromium/vapi-usercss.js index 25e6e10cc..1a2d73a41 100644 --- a/platform/chromium/vapi-usercss.js +++ b/platform/chromium/vapi-usercss.js @@ -28,5 +28,7 @@ // Chromium 66 and above supports user stylesheets: // https://github.com/gorhill/uBlock/issues/3588 -vAPI.supportsUserStylesheets = - /\bChrom(?:e|ium)\/(?:6[6789]|[789]|1\d\d)/.test(navigator.userAgent); +if ( typeof vAPI === 'object' ) { + vAPI.supportsUserStylesheets = + /\bChrom(?:e|ium)\/(?:6[6789]|[789]|1\d\d)/.test(navigator.userAgent); +} diff --git a/platform/debian/vapi-usercss.js b/platform/debian/vapi-usercss.js index 3013e50eb..0f3b4c283 100644 --- a/platform/debian/vapi-usercss.js +++ b/platform/debian/vapi-usercss.js @@ -28,5 +28,7 @@ // Chromium 66 and above supports user stylesheets: // https://github.com/gorhill/uBlock/issues/3588 -vAPI.supportsUserStylesheets = - /\bChrom(?:e|ium)\/(?:6[6789]|[789]|1\d\d)|\bFirefox\/\d/.test(navigator.userAgent); +if ( typeof vAPI === 'object' ) { + vAPI.supportsUserStylesheets = + /\bChrom(?:e|ium)\/(?:6[6789]|[789]|1\d\d)|\bFirefox\/\d/.test(navigator.userAgent); +} diff --git a/platform/webext/vapi-usercss.js b/platform/webext/vapi-usercss.js index 0daf2f7d2..b3a3ce91e 100644 --- a/platform/webext/vapi-usercss.js +++ b/platform/webext/vapi-usercss.js @@ -23,4 +23,6 @@ // User stylesheets are always supported with Firefox/webext . -vAPI.supportsUserStylesheets = true; +if ( typeof vAPI === 'object' ) { + vAPI.supportsUserStylesheets = true; +} diff --git a/tools/make-firefox.sh b/tools/make-firefox.sh index e0b68872b..b6f8c8398 100755 --- a/tools/make-firefox.sh +++ b/tools/make-firefox.sh @@ -22,6 +22,7 @@ cp platform/firefox/css/* $DES/css/ cp platform/firefox/polyfill.js $DES/js/ cp platform/firefox/vapi-*.js $DES/js/ cp platform/chromium/vapi-usercss.real.js $DES/js/ +cp platform/webext/vapi-usercss.js $DES/js/ cp platform/firefox/bootstrap.js $DES/ cp platform/firefox/processScript.js $DES/ cp platform/firefox/frame*.js $DES/ @@ -32,10 +33,13 @@ cp platform/firefox/*.xul $DES/ cp LICENSE.txt $DES/ echo "*** uBlock0.firefox: concatenating content scripts" -cat $DES/js/vapi-usercss.real.js > /tmp/contentscript.js +cat $DES/js/vapi-usercss.js > /tmp/contentscript.js +echo >> /tmp/contentscript.js +grep -v "^'use strict';$" $DES/js/vapi-usercss.real.js >> /tmp/contentscript.js echo >> /tmp/contentscript.js grep -v "^'use strict';$" $DES/js/contentscript.js >> /tmp/contentscript.js mv /tmp/contentscript.js $DES/js/contentscript.js +rm $DES/js/vapi-usercss.js rm $DES/js/vapi-usercss.real.js echo "*** uBlock0.firefox: Generating meta..."