Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: ext/background.js

Issue 29536764: Issue 5587, 5748 - Use mobile options page on Firefox for Android (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Use runtime.openOptionsPage on Firefox 57+ Created Sept. 12, 2017, 12:37 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « desktop-options.js ('k') | lib/browserAction.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
{
@@ -731,39 +721,38 @@
});
});
}
}
else if ("windows" in chrome)
{
// 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/
+ let fullOptionsUrl = ext.getURL(optionsUrl);
let tab = tabs.find(element => element.url == fullOptionsUrl);
if (tab)
{
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
« no previous file with comments | « desktop-options.js ('k') | lib/browserAction.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld