From ca5f8c941b29fd59b61e093bcd7b583f5d825b53 Mon Sep 17 00:00:00 2001 From: tophf Date: Mon, 29 Jan 2018 04:37:24 +0300 Subject: [PATCH] don't refresh own tabs twice fixes #336 --- background/refresh-all-tabs.js | 3 ++- js/messaging.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/background/refresh-all-tabs.js b/background/refresh-all-tabs.js index 12829795..c7fcf3bb 100644 --- a/background/refresh-all-tabs.js +++ b/background/refresh-all-tabs.js @@ -30,7 +30,7 @@ global updateIcon function run(tabs, msg, resolve) { - const {style, codeIsUpdated} = msg; + const {style, codeIsUpdated, refreshOwnTabs} = msg; // the style was updated/saved so we need to remove the old copy of the original style if (msg.method === 'styleUpdated' && msg.reason !== 'editPreview') { @@ -80,6 +80,7 @@ global updateIcon const last = tabs[tabs.length - 1]; for (const tab of tabs) { if (FIREFOX && !tab.width) continue; + if (refreshOwnTabs === false && tab.url.startsWith(URLS.ownOrigin)) continue; chrome.webNavigation.getAllFrames({tabId: tab.id}, frames => refreshFrame(tab, frames, msg, tab === last && resolve)); } diff --git a/js/messaging.js b/js/messaging.js index ea21328f..cc4c317f 100644 --- a/js/messaging.js +++ b/js/messaging.js @@ -202,6 +202,7 @@ function notifyAllTabs(msg) { } // propagate saved style state/code efficiently if (styleUpdated) { + msg.refreshOwnTabs = false; API.refreshAllTabs(msg); } }