don't double-process 'styleUpdated' in manager
This commit is contained in:
parent
dc1cd890ee
commit
4493c9e9f0
|
@ -159,7 +159,7 @@ function notifyAllTabs(msg) {
|
||||||
const affectsIcon = affectsAll || msg.affects.icon;
|
const affectsIcon = affectsAll || msg.affects.icon;
|
||||||
const affectsPopup = affectsAll || msg.affects.popup;
|
const affectsPopup = affectsAll || msg.affects.popup;
|
||||||
const affectsSelf = affectsPopup || msg.prefs;
|
const affectsSelf = affectsPopup || msg.prefs;
|
||||||
// notify background page and all open popups
|
// notify all open extension pages and popups
|
||||||
if (affectsSelf) {
|
if (affectsSelf) {
|
||||||
msg.tabId = undefined;
|
msg.tabId = undefined;
|
||||||
sendMessage(msg, ignoreChromeError);
|
sendMessage(msg, ignoreChromeError);
|
||||||
|
@ -167,9 +167,9 @@ function notifyAllTabs(msg) {
|
||||||
// notify tabs
|
// notify tabs
|
||||||
if (affectsTabs || affectsIcon) {
|
if (affectsTabs || affectsIcon) {
|
||||||
const notifyTab = tab => {
|
const notifyTab = tab => {
|
||||||
// own pages will be notified via runtime.sendMessage later
|
|
||||||
if (!styleUpdated
|
if (!styleUpdated
|
||||||
&& (affectsTabs || URLS.optionsUI.includes(tab.url))
|
&& (affectsTabs || URLS.optionsUI.includes(tab.url))
|
||||||
|
// own pages are already notified via sendMessage
|
||||||
&& !(affectsSelf && tab.url.startsWith(URLS.ownOrigin))
|
&& !(affectsSelf && tab.url.startsWith(URLS.ownOrigin))
|
||||||
// skip lazy-loaded aka unloaded tabs that seem to start loading on message in FF
|
// skip lazy-loaded aka unloaded tabs that seem to start loading on message in FF
|
||||||
&& (!FIREFOX || tab.width)) {
|
&& (!FIREFOX || tab.width)) {
|
||||||
|
|
|
@ -514,8 +514,11 @@ Object.assign(handleEvent, {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function handleUpdate(style, {reason, method} = {}) {
|
function handleUpdate(style, {reason, method, codeIsUpdated} = {}) {
|
||||||
if (reason === 'editPreview') return;
|
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 entry;
|
||||||
let oldEntry = $(ENTRY_ID_PREFIX + style.id);
|
let oldEntry = $(ENTRY_ID_PREFIX + style.id);
|
||||||
if (oldEntry && method === 'styleUpdated') {
|
if (oldEntry && method === 'styleUpdated') {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user