fixup d2b9b302: prevent setting version var to 'undefined'
This commit is contained in:
parent
12e2fbdd37
commit
94ed435e75
|
@ -11,6 +11,7 @@ env:
|
||||||
globals:
|
globals:
|
||||||
# messaging.js
|
# messaging.js
|
||||||
KEEP_CHANNEL_OPEN: false
|
KEEP_CHANNEL_OPEN: false
|
||||||
|
CHROME: false
|
||||||
FIREFOX: false
|
FIREFOX: false
|
||||||
OPERA: false
|
OPERA: false
|
||||||
URLS: false
|
URLS: false
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* global getStyles */
|
/* global getStyles */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const styleViaAPI = !chrome.app && (() => {
|
const styleViaAPI = !CHROME && (() => {
|
||||||
const ACTIONS = {
|
const ACTIONS = {
|
||||||
styleApply,
|
styleApply,
|
||||||
styleDeleted,
|
styleDeleted,
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
// keep message channel open for sendResponse in chrome.runtime.onMessage listener
|
// keep message channel open for sendResponse in chrome.runtime.onMessage listener
|
||||||
const KEEP_CHANNEL_OPEN = true;
|
const KEEP_CHANNEL_OPEN = true;
|
||||||
|
|
||||||
let FIREFOX = !chrome.app && parseFloat(navigator.userAgent.match(/\bFirefox\/(\d+\.\d+)|$/)[1]);
|
const CHROME = Boolean(chrome.app) && parseInt(navigator.userAgent.match(/Chrom\w+\/(?:\d+\.){2}(\d+)|$/)[1]);
|
||||||
const OPERA = chrome.app && parseFloat(navigator.userAgent.match(/\bOPR\/(\d+\.\d+)|$/)[1]);
|
const OPERA = CHROME && parseFloat(navigator.userAgent.match(/\bOPR\/(\d+\.\d+)|$/)[1]);
|
||||||
|
let FIREFOX = !CHROME && parseFloat(navigator.userAgent.match(/\bFirefox\/(\d+\.\d+)|$/)[1]);
|
||||||
|
|
||||||
if (!chrome.app && !chrome.browserAction.openPopup) {
|
if (!CHROME && !chrome.browserAction.openPopup) {
|
||||||
// in FF pre-57 legacy addons can override useragent so we assume the worst
|
// in FF pre-57 legacy addons can override useragent so we assume the worst
|
||||||
// until we know for sure in the async getBrowserInfo()
|
// until we know for sure in the async getBrowserInfo()
|
||||||
// (browserAction.openPopup was added in 57)
|
// (browserAction.openPopup was added in 57)
|
||||||
|
@ -39,9 +40,7 @@ const URLS = {
|
||||||
|
|
||||||
// Chrome 61.0.3161+ doesn't run content scripts on NTP https://crrev.com/2978953002/
|
// Chrome 61.0.3161+ doesn't run content scripts on NTP https://crrev.com/2978953002/
|
||||||
// TODO: remove when "minimum_chrome_version": "61" or higher
|
// TODO: remove when "minimum_chrome_version": "61" or higher
|
||||||
chromeProtectsNTP:
|
chromeProtectsNTP: CHROME >= 3161,
|
||||||
chrome.app &&
|
|
||||||
parseInt(navigator.userAgent.match(/Chrom\w+\/(?:\d+\.){2}(\d+)|$/)[1]) >= 3161,
|
|
||||||
|
|
||||||
supported: url => (
|
supported: url => (
|
||||||
url.startsWith('http') && !url.startsWith(URLS.browserWebStore) ||
|
url.startsWith('http') && !url.startsWith(URLS.browserWebStore) ||
|
||||||
|
@ -64,7 +63,7 @@ if (!BG || BG !== window) {
|
||||||
document.documentElement.classList.toggle('opera', OPERA);
|
document.documentElement.classList.toggle('opera', OPERA);
|
||||||
// TODO: remove once our manifest's minimum_chrome_version is 50+
|
// TODO: remove once our manifest's minimum_chrome_version is 50+
|
||||||
// Chrome 49 doesn't report own extension pages in webNavigation apparently
|
// Chrome 49 doesn't report own extension pages in webNavigation apparently
|
||||||
if (chrome.app && navigator.userAgent.includes('Chrome/49.')) {
|
if (CHROME && CHROME < 2661) {
|
||||||
getActiveTab().then(BG.updateIcon);
|
getActiveTab().then(BG.updateIcon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,7 +320,7 @@ var prefs = new function Prefs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function contextDeleteMissing() {
|
function contextDeleteMissing() {
|
||||||
return chrome.app && (
|
return CHROME && (
|
||||||
// detect browsers without Delete by looking at the end of UA string
|
// detect browsers without Delete by looking at the end of UA string
|
||||||
/Vivaldi\/[\d.]+$/.test(navigator.userAgent) ||
|
/Vivaldi\/[\d.]+$/.test(navigator.userAgent) ||
|
||||||
// Chrome and co.
|
// Chrome and co.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user