From 091141f2cfd750383b6ab84a0f6e8197f169316f Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Sun, 5 Mar 2017 12:33:11 +0000 Subject: [PATCH] Make adding context menus redundent and fix enable/disable bug --- .../src/extension-common/80-context-menus.js | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/80-context-menus.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/80-context-menus.js index fba8207..a91ad03 100644 --- a/extensions/chromium/runet-censorship-bypass/src/extension-common/80-context-menus.js +++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/80-context-menus.js @@ -2,7 +2,7 @@ { - const timeouted = window.utils.timeouted; + const chromified = window.utils.chromified; let seqId = 0; @@ -10,21 +10,17 @@ const id = (++seqId).toString(); - chrome.runtime.onInstalled.addListener( - () => chrome.contextMenus.create({ - id: id, - title: title, - contexts: ['browser_action'], - }, timeouted(() => { + chrome.contextMenus.create({ + id: id, + title: title, + contexts: ['browser_action'], + }, chromified((err) => { - const err = chrome.runtime.lastError; - if(err) { - console.warn('Context menu error:', err); - throw err; - } + if(err) { + console.warn('Context menu error ignored:', err); + } - })) - ); + })); chrome.contextMenus.onClicked.addListener((info, tab) => {