Fix: broadcastError -> ignoreError
This commit is contained in:
parent
ecb622c93c
commit
39d21c3d29
|
@ -92,7 +92,7 @@ navigatorUtil.onUrlChange(({tabId, frameId}, type) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
msg.sendTab(tabId, {method: 'urlChanged'}, {frameId})
|
msg.sendTab(tabId, {method: 'urlChanged'}, {frameId})
|
||||||
.catch(msg.broadcastError);
|
.catch(msg.ignoreError);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (FIREFOX) {
|
if (FIREFOX) {
|
||||||
|
@ -156,7 +156,7 @@ navigatorUtil.onUrlChange(({tabId, frameId, transitionQualifiers}, type) => {
|
||||||
// `apply.js` doesn't notify the background to update the icon,
|
// `apply.js` doesn't notify the background to update the icon,
|
||||||
// so we have to refresh it manually.
|
// so we have to refresh it manually.
|
||||||
if (transitionQualifiers.includes('forward_back')) {
|
if (transitionQualifiers.includes('forward_back')) {
|
||||||
msg.sendTab(tabId, {method: 'updateCount'}).catch(msg.broadcastError);
|
msg.sendTab(tabId, {method: 'updateCount'}).catch(msg.ignoreError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -258,6 +258,10 @@ const APPLY = (() => {
|
||||||
// we don't care about iframes
|
// we don't care about iframes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (STYLE_VIA_API) {
|
||||||
|
API.styleViaAPI({method: 'updateCount'});
|
||||||
|
return;
|
||||||
|
}
|
||||||
let count = 0;
|
let count = 0;
|
||||||
for (const id of styleElements.keys()) {
|
for (const id of styleElements.keys()) {
|
||||||
if (!disabledElements.has(id)) {
|
if (!disabledElements.has(id)) {
|
||||||
|
@ -269,7 +273,7 @@ const APPLY = (() => {
|
||||||
method: 'invokeAPI',
|
method: 'invokeAPI',
|
||||||
name: 'updateIconBadge',
|
name: 'updateIconBadge',
|
||||||
args: [count]
|
args: [count]
|
||||||
}).catch(() => {});
|
}).catch(msg.ignoreError);
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyStyleState({id, enabled}) {
|
function applyStyleState({id, enabled}) {
|
||||||
|
|
10
js/msg.js
10
js/msg.js
|
@ -37,7 +37,7 @@ const msg = (() => {
|
||||||
broadcast,
|
broadcast,
|
||||||
broadcastTab,
|
broadcastTab,
|
||||||
broadcastExtension,
|
broadcastExtension,
|
||||||
broadcastError,
|
ignoreError,
|
||||||
on,
|
on,
|
||||||
onTab,
|
onTab,
|
||||||
onExtension,
|
onExtension,
|
||||||
|
@ -87,7 +87,7 @@ const msg = (() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function broadcastError(err) {
|
function ignoreError(err) {
|
||||||
if (err.message && (
|
if (err.message && (
|
||||||
RX_NO_RECEIVER.test(err.message) ||
|
RX_NO_RECEIVER.test(err.message) ||
|
||||||
RX_PORT_CLOSED.test(err.message)
|
RX_PORT_CLOSED.test(err.message)
|
||||||
|
@ -99,7 +99,7 @@ const msg = (() => {
|
||||||
|
|
||||||
function broadcast(data, filter) {
|
function broadcast(data, filter) {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
send(data, 'both').catch(broadcastError),
|
send(data, 'both').catch(ignoreError),
|
||||||
broadcastTab(data, filter, null, true, 'both')
|
broadcastTab(data, filter, null, true, 'both')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -134,14 +134,14 @@ const msg = (() => {
|
||||||
if (message.id) {
|
if (message.id) {
|
||||||
request = withCleanup(request, () => bg._msg.storage.delete(message.id));
|
request = withCleanup(request, () => bg._msg.storage.delete(message.id));
|
||||||
}
|
}
|
||||||
requests.push(request.catch(broadcastError));
|
requests.push(request.catch(ignoreError));
|
||||||
}
|
}
|
||||||
return Promise.all(requests);
|
return Promise.all(requests);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function broadcastExtension(...args) {
|
function broadcastExtension(...args) {
|
||||||
return send(...args).catch(broadcastError);
|
return send(...args).catch(ignoreError);
|
||||||
}
|
}
|
||||||
|
|
||||||
function on(fn) {
|
function on(fn) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user