browser.runtime.getBrowserInfo was added in FF 51

This commit is contained in:
tophf 2018-02-25 16:51:07 +03:00
parent f40c9f9a16
commit a8769e375b

View File

@ -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);
});