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 // 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)
FIREFOX = 50; FIREFOX = browser.runtime.getBrowserInfo ? 51 : 50;
browser.runtime.getBrowserInfo().then(info => { // getBrowserInfo was added in FF 51
Promise.resolve(FIREFOX >= 51 ? browser.runtime.getBrowserInfo() : {version: 50}).then(info => {
FIREFOX = parseFloat(info.version); FIREFOX = parseFloat(info.version);
document.documentElement.classList.add('moz-appearance-bug', FIREFOX && FIREFOX < 54); document.documentElement.classList.add('moz-appearance-bug', FIREFOX && FIREFOX < 54);
}); });