From a8769e375bc3cb5a638e1b9cf13c50494cb1d4c5 Mon Sep 17 00:00:00 2001 From: tophf Date: Sun, 25 Feb 2018 16:51:07 +0300 Subject: [PATCH] browser.runtime.getBrowserInfo was added in FF 51 --- js/messaging.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/messaging.js b/js/messaging.js index cc4c317f..7c289f5f 100644 --- a/js/messaging.js +++ b/js/messaging.js @@ -18,8 +18,9 @@ if (!CHROME && !chrome.browserAction.openPopup) { // in FF pre-57 legacy addons can override useragent so we assume the worst // until we know for sure in the async getBrowserInfo() // (browserAction.openPopup was added in 57) - FIREFOX = 50; - browser.runtime.getBrowserInfo().then(info => { + FIREFOX = browser.runtime.getBrowserInfo ? 51 : 50; + // getBrowserInfo was added in FF 51 + Promise.resolve(FIREFOX >= 51 ? browser.runtime.getBrowserInfo() : {version: 50}).then(info => { FIREFOX = parseFloat(info.version); document.documentElement.classList.add('moz-appearance-bug', FIREFOX && FIREFOX < 54); });