diff --git a/js/messaging.js b/js/messaging.js index 40075974..ea21328f 100644 --- a/js/messaging.js +++ b/js/messaging.js @@ -159,7 +159,7 @@ function notifyAllTabs(msg) { const affectsIcon = affectsAll || msg.affects.icon; const affectsPopup = affectsAll || msg.affects.popup; const affectsSelf = affectsPopup || msg.prefs; - // notify background page and all open popups + // notify all open extension pages and popups if (affectsSelf) { msg.tabId = undefined; sendMessage(msg, ignoreChromeError); @@ -167,9 +167,9 @@ function notifyAllTabs(msg) { // notify tabs if (affectsTabs || affectsIcon) { const notifyTab = tab => { - // own pages will be notified via runtime.sendMessage later if (!styleUpdated && (affectsTabs || URLS.optionsUI.includes(tab.url)) + // own pages are already notified via sendMessage && !(affectsSelf && tab.url.startsWith(URLS.ownOrigin)) // skip lazy-loaded aka unloaded tabs that seem to start loading on message in FF && (!FIREFOX || tab.width)) { diff --git a/manage/manage.js b/manage/manage.js index c2dbd3d4..cb24dbb9 100644 --- a/manage/manage.js +++ b/manage/manage.js @@ -514,8 +514,11 @@ Object.assign(handleEvent, { }); -function handleUpdate(style, {reason, method} = {}) { +function handleUpdate(style, {reason, method, codeIsUpdated} = {}) { if (reason === 'editPreview') return; + // the style was toggled and refreshAllTabs() sent a mini-notification, + // but we've already processed 'styleUpdated' sent directly from notifyAllTabs() + if (!style.sections) return; let entry; let oldEntry = $(ENTRY_ID_PREFIX + style.id); if (oldEntry && method === 'styleUpdated') {