From 14e321d2582cef0c3e97e2723bc60ecc1d682ba8 Mon Sep 17 00:00:00 2001 From: eight Date: Sun, 14 Oct 2018 00:40:23 +0800 Subject: [PATCH] Fix: don't update icon for popup and options --- content/apply.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/content/apply.js b/content/apply.js index a17ee2f7..dfad77f1 100644 --- a/content/apply.js +++ b/content/apply.js @@ -203,11 +203,13 @@ const APPLY = (() => { break; case 'backgroundReady': - initializing.catch(err => { - if (msg.RX_NO_RECEIVER.test(err.message)) { - init(); - } - }); + initializing + .catch(err => { + if (msg.RX_NO_RECEIVER.test(err.message)) { + return init(); + } + }) + .catch(console.error); break; case 'updateCount': @@ -258,8 +260,12 @@ const APPLY = (() => { // we don't care about iframes return; } + if (/^\w+?-extension:\/\/.+(popup|options)\.html$/.test(location.href)) { + // popup and the option page are not tabs + return; + } if (STYLE_VIA_API) { - API.styleViaAPI({method: 'updateCount'}); + API.styleViaAPI({method: 'updateCount'}).catch(msg.ignoreError); return; } let count = 0;