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

Unified Diff: lib/filterComposer.js

Issue 29516679: Issue 5347 - Do not show composer menu item on Firefox for Android (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Check for "Fennec" explicitly Created Aug. 24, 2017, 10:33 a.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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterComposer.js
===================================================================
--- a/lib/filterComposer.js
+++ b/lib/filterComposer.js
@@ -21,16 +21,17 @@
const {defaultMatcher} = require("matcher");
const {RegExpFilter} = require("filterClasses");
const {FilterNotifier} = require("filterNotifier");
const {Prefs} = require("prefs");
const {extractHostFromFrame, stringifyURL, isThirdParty} = require("url");
const {getKey, checkWhitelisted} = require("whitelisting");
const {port} = require("messaging");
+const info = require("info");
let readyPages = new ext.PageMap();
/**
* Checks whether the given page is ready to use the filter composer
*
* @param {Page} page
* @return {boolean}
@@ -175,18 +176,24 @@
};
function updateContextMenu(page, filter)
{
page.contextMenus.remove(contextMenuItem);
if (typeof filter == "undefined")
filter = checkWhitelisted(page);
- if (!filter && Prefs.shouldShowBlockElementMenu && readyPages.has(page))
+
+ // We don't support the filter composer on Firefox for Android, because the
+ // user experience on mobile is quite different.
+ if (info.application != "fennec" &&
+ !filter && Prefs.shouldShowBlockElementMenu && readyPages.has(page))
+ {
page.contextMenus.create(contextMenuItem);
+ }
}
FilterNotifier.on("page.WhitelistingStateRevalidate", updateContextMenu);
Prefs.on("shouldShowBlockElementMenu", () =>
{
ext.pages.query({}, pages =>
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld