From 668e3a7b56b92ad774ba55dbd2c28fb9eab58278 Mon Sep 17 00:00:00 2001 From: tophf Date: Wed, 29 Mar 2017 03:57:21 +0300 Subject: [PATCH] ignoreChromeError -> messaging; use it in editor's menu update --- .eslintrc | 1 + background.js | 7 +------ edit.js | 2 +- messaging.js | 5 +++++ 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.eslintrc b/.eslintrc index 962225ec..85e21a98 100644 --- a/.eslintrc +++ b/.eslintrc @@ -23,6 +23,7 @@ globals: activateTab: false stringAsRegExp: false wildcardAsRegExp: false + ignoreChromeError: false # localization.js template: false t: false diff --git a/background.js b/background.js index c0a8908c..ad737a8a 100644 --- a/background.js +++ b/background.js @@ -79,7 +79,7 @@ function onBackgroundMessage(request, sender, sendResponse) { case 'prefChanged': // eslint-disable-next-line no-use-before-define if (typeof request.value == 'boolean' && contextMenus[request.prefName]) { - chrome.contextMenus.update(request.prefName, {checked: request.value}); + chrome.contextMenus.update(request.prefName, {checked: request.value}, ignoreChromeError); } break; } @@ -228,8 +228,3 @@ function injectContentScripts() { } }); } - - -function ignoreChromeError() { - chrome.runtime.lastError; // eslint-disable-line no-unused-expressions -} diff --git a/edit.js b/edit.js index 44a03fc7..7d9fbc28 100644 --- a/edit.js +++ b/edit.js @@ -1214,7 +1214,7 @@ function toggleContextMenuDelete(event) { this.selectionStart != this.selectionEnd || this.somethingSelected && this.somethingSelected() ), - }); + }, ignoreChromeError); } } diff --git a/messaging.js b/messaging.js index 09eaeabd..cf8ad623 100644 --- a/messaging.js +++ b/messaging.js @@ -191,6 +191,11 @@ function wildcardAsRegExp(s, flags) { } +function ignoreChromeError() { + chrome.runtime.lastError; // eslint-disable-line no-unused-expressions +} + + const configureCommands = { url: navigator.userAgent.includes('OPR') ? 'opera://settings/configureCommands'