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

Unified Diff: ext/background.js

Issue 29511561: Issue 5347 - Check for contextMenus API support (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Minimize changes and add comments Created Aug. 16, 2017, 12:07 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 | « no previous file | lib/filterComposer.js » ('j') | lib/filterComposer.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ext/background.js
===================================================================
--- a/ext/background.js
+++ b/ext/background.js
@@ -70,17 +70,21 @@
/* Pages */
let Page = ext.Page = function(tab)
{
this.id = tab.id;
this._url = tab.url && new URL(tab.url);
this.browserAction = new BrowserAction(tab.id);
- this.contextMenus = new ContextMenus(this);
+
+ // Firefox for Android does not support context menus.
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1269062
+ if ("contextMenus" in chrome)
Wladimir Palant 2017/08/16 13:21:56 I don't think that this change is necessary. It sh
Manish Jethani 2017/08/16 19:39:09 Done.
+ this.contextMenus = new ContextMenus(this);
};
Page.prototype = {
get url()
{
// usually our Page objects are created from Chrome's Tab objects, which
// provide the url. So we can return the url given in the constructor.
if (this._url)
return this._url;
@@ -418,17 +422,19 @@
/* Context menus */
let contextMenuItems = new ext.PageMap();
let contextMenuUpdating = false;
let updateContextMenu = () =>
{
- if (contextMenuUpdating)
+ // Firefox for Android does not support context menus.
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1269062
+ if (!("contextMenus" in chrome) || contextMenuUpdating)
return;
contextMenuUpdating = true;
chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs =>
{
chrome.contextMenus.removeAll(() =>
{
« no previous file with comments | « no previous file | lib/filterComposer.js » ('j') | lib/filterComposer.js » ('J')

Powered by Google App Engine
This is Rietveld