mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-22 18:32:45 +01:00
Mind that tabs.sendMessage
can throw
This commit is contained in:
parent
9146134874
commit
3f7374c1f1
@ -19,8 +19,6 @@
|
||||
Home: https://github.com/gorhill/uBlock
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// `webext` is a promisified api of `chrome`. Entries are added as
|
||||
// the promisification of uBO progress.
|
||||
|
||||
@ -104,6 +102,7 @@ const webext = {
|
||||
query: promisifyNoFail(chrome.tabs, 'query', tabs => Array.isArray(tabs) ? tabs : []),
|
||||
reload: promisifyNoFail(chrome.tabs, 'reload'),
|
||||
remove: promisifyNoFail(chrome.tabs, 'remove'),
|
||||
sendMessage: promisifyNoFail(chrome.tabs, 'sendMessage'),
|
||||
update: promisifyNoFail(chrome.tabs, 'update', tab => tab instanceof Object ? tab : null),
|
||||
},
|
||||
// https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webNavigation
|
||||
|
@ -19,10 +19,6 @@
|
||||
Home: https://github.com/gorhill/uBlock
|
||||
*/
|
||||
|
||||
/* globals browser */
|
||||
|
||||
'use strict';
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
// Broadcast a message to all uBO contexts
|
||||
@ -47,7 +43,7 @@ export async function broadcastToAll(message) {
|
||||
});
|
||||
const bcmessage = Object.assign({ broadcast: true }, message);
|
||||
for ( const tab of tabs ) {
|
||||
browser.tabs.sendMessage(tab.id, bcmessage);
|
||||
webext.tabs.sendMessage(tab.id, bcmessage).catch(( ) => { });
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user