| Index: ext/background.js |
| =================================================================== |
| --- a/ext/background.js |
| +++ b/ext/background.js |
| @@ -312,26 +312,16 @@ |
| chrome.tabs.onActivated.addListener(details => |
| { |
| ext.pages.onActivated._dispatch(new Page({id: details.tabId})); |
| }); |
| /* Browser actions */ |
| - // On Firefox for Android, open the options page directly when the browser |
| - // action is clicked. |
| - if (!("getPopup" in chrome.browserAction)) |
| - { |
| - chrome.browserAction.onClicked.addListener(() => |
| - { |
| - ext.showOptions(); |
| - }); |
| - } |
| - |
| let BrowserAction = function(tabId) |
| { |
| this._tabId = tabId; |
| this._changes = null; |
| }; |
| BrowserAction.prototype = { |
| _applyChanges() |
| { |
| @@ -697,21 +687,19 @@ |
| /* Options */ |
| ext.showOptions = callback => |
| { |
| let info = require("info"); |
| if ("openOptionsPage" in chrome.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)) |
| + // We don't use runtime.openOptionsPage on Firefox for Android because |
| + // we have a different options page for mobile. |
| + info.application != "fennec") |
|
Sebastian Noack
2017/09/11 22:40:02
Does this change still make sense? We open options
Manish Jethani
2017/09/12 12:39:18
You're right, now we can just use runtime.openOpti
|
| { |
| if (!callback) |
| { |
| chrome.runtime.openOptionsPage(); |
| } |
| else |
| { |
| chrome.runtime.openOptionsPage(() => |
| @@ -727,55 +715,52 @@ |
| callback(new Page(tabs[0])); |
| else |
| afterTabLoaded(callback)(tabs[0]); |
| } |
| }); |
| }); |
| } |
| } |
| - else if ("windows" in chrome) |
| + else |
| { |
| // Edge does not yet support runtime.openOptionsPage (tested version 38) |
| - // and so this workaround needs to stay for now. |
| - // We are not using extension.getURL to get the absolute path here |
| - // because of the Edge issue: |
| - // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10276332/ |
| let optionsUrl = "options.html"; |
| - let fullOptionsUrl = ext.getURL(optionsUrl); |
| chrome.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 |
| + let fullOptionsUrl = ext.getURL(optionsUrl); |
| let tab = tabs.find(element => element.url == fullOptionsUrl); |
| if (tab) |
| { |
| - chrome.windows.update(tab.windowId, {focused: true}); |
| + // Firefox for Android doesn't support the windows API, and the |
| + // mobile browser has only one window anyway. |
| + if ("windows" in chrome) |
| + chrome.windows.update(tab.windowId, {focused: true}); |
| + |
| chrome.tabs.update(tab.id, {active: true}); |
| if (callback) |
| callback(new Page(tab)); |
| } |
| else |
| { |
| + // We don't use fullOptionsUrl here because of this Edge issue: |
| + // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10276332 |
| ext.pages.open(optionsUrl, callback); |
| } |
| }); |
| } |
| - else |
| - { |
| - // 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. |
| - ext.pages.open("options.html", callback); |
| - } |
| }; |
| /* Windows */ |
| ext.windows = { |
| create(createData, callback) |
| { |
| chrome.windows.create(createData, createdWindow => |
| { |