Fix _onApiGetZoom when chrome.tabs.getZoom is not available

This commit is contained in:
toasted-nutbread 2020-01-11 15:34:12 -05:00
parent 74d9b0e857
commit 5afad35c4e

View File

@ -542,6 +542,15 @@ class Backend {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const tabId = sender.tab.id; const tabId = sender.tab.id;
if (!(
chrome.tabs !== null &&
typeof chrome.tabs === 'object' &&
typeof chrome.tabs.getZoom === 'function'
)) {
// Not supported
resolve({zoomFactor: 1.0});
return;
}
chrome.tabs.getZoom(tabId, (zoomFactor) => { chrome.tabs.getZoom(tabId, (zoomFactor) => {
const e = chrome.runtime.lastError; const e = chrome.runtime.lastError;
if (e) { if (e) {