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

Unified Diff: lib/filterComposer.js

Issue 29511561: Issue 5347 - Check for contextMenus API support (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created Aug. 10, 2017, 7:34 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
« ext/background.js ('K') | « ext/background.js ('k') | 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
@@ -179,31 +179,36 @@
page.contextMenus.remove(contextMenuItem);
if (typeof filter == "undefined")
filter = checkWhitelisted(page);
if (!filter && Prefs.shouldShowBlockElementMenu && readyPages.has(page))
page.contextMenus.create(contextMenuItem);
}
-FilterNotifier.on("page.WhitelistingStateRevalidate", updateContextMenu);
-
-Prefs.on("shouldShowBlockElementMenu", () =>
+if (chrome.contextMenus)
Manish Jethani 2017/08/10 07:40:05 Again, I've only wrapped this code in "if (chrome.
{
- ext.pages.query({}, pages =>
+ FilterNotifier.on("page.WhitelistingStateRevalidate", updateContextMenu);
+
+ Prefs.on("shouldShowBlockElementMenu", () =>
{
- for (let page of pages)
- updateContextMenu(page);
+ ext.pages.query({}, pages =>
+ {
+ for (let page of pages)
+ updateContextMenu(page);
+ });
});
-});
+}
port.on("composer.ready", (message, sender) =>
{
readyPages.set(sender.page, null);
- updateContextMenu(sender.page);
+
+ if (chrome.contextMenus)
+ updateContextMenu(sender.page);
});
port.on("composer.openDialog", (message, sender) =>
{
return new Promise(resolve =>
{
ext.windows.create({
url: ext.getURL("composer.html"),
« ext/background.js ('K') | « ext/background.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld