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