Index: lib/options.js |
=================================================================== |
--- a/lib/options.js |
+++ b/lib/options.js |
@@ -23,17 +23,17 @@ |
const {checkWhitelisted} = require("whitelisting"); |
const {port} = require("messaging"); |
const info = require("info"); |
const optionsUrl = "options.html"; |
function findOptionsTab(callback) |
{ |
- chrome.tabs.query({}, tabs => |
+ browser.tabs.query({}, tabs => |
{ |
// We find a tab ourselves because Edge has a bug when quering tabs with |
// extension URL protocol: |
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8094141/ |
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8604703/ |
// Firefox won't let us query for moz-extension:// pages either, though |
// starting with Firefox 56 an extension can query for its own URLs: |
// https://bugzilla.mozilla.org/show_bug.cgi?id=1271354 |
@@ -82,58 +82,58 @@ |
* |
* @param {function} callback |
*/ |
exports.showOptions = callback => |
{ |
findOptionsTab(optionsTab => |
{ |
// Edge does not yet support runtime.openOptionsPage (tested version 38) |
- if ("openOptionsPage" in chrome.runtime && |
+ if ("openOptionsPage" in browser.runtime && |
// Some versions of Firefox for Android before version 57 do have a |
// runtime.openOptionsPage but it doesn't do anything. |
// https://bugzilla.mozilla.org/show_bug.cgi?id=1364945 |
(info.application != "fennec" || |
parseInt(info.applicationVersion, 10) >= 57)) |
{ |
- chrome.runtime.openOptionsPage(() => |
+ browser.runtime.openOptionsPage(() => |
{ |
returnShowOptionsCall(optionsTab, callback); |
}); |
} |
else if (optionsTab) |
{ |
// Firefox for Android before version 57 does not support |
// runtime.openOptionsPage, nor does it support the windows API. |
// Since there is effectively only one window on the mobile browser, |
// there's no need to bring it into focus. |
- if ("windows" in chrome) |
- chrome.windows.update(optionsTab.windowId, {focused: true}); |
+ if ("windows" in browser) |
+ browser.windows.update(optionsTab.windowId, {focused: true}); |
- chrome.tabs.update(optionsTab.id, {active: true}); |
+ browser.tabs.update(optionsTab.id, {active: true}); |
returnShowOptionsCall(optionsTab, callback); |
} |
else |
{ |
// We use a relative URL here because of this Edge issue: |
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10276332 |
- chrome.tabs.create({url: optionsUrl}, () => |
+ browser.tabs.create({url: optionsUrl}, () => |
{ |
returnShowOptionsCall(optionsTab, callback); |
}); |
} |
}); |
}; |
// On Firefox for Android, open the options page directly when the browser |
// action is clicked. |
-chrome.browserAction.onClicked.addListener(() => |
+browser.browserAction.onClicked.addListener(() => |
{ |
- chrome.tabs.query({active: true, lastFocusedWindow: true}, ([tab]) => |
+ browser.tabs.query({active: true, lastFocusedWindow: true}, ([tab]) => |
{ |
let currentPage = new ext.Page(tab); |
showOptions(optionsPage => |
{ |
if (!/^https?:$/.test(currentPage.url.protocol)) |
return; |