mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
[mv3] No need to retry sending messages with top-level listener
This commit is contained in:
parent
f40b989dc8
commit
0ee6e3044d
4 changed files with 20 additions and 30 deletions
|
|
@ -103,18 +103,14 @@ for ( const selector of exceptedSelectors ) {
|
|||
|
||||
if ( sheetText.length === 0 ) { return; }
|
||||
|
||||
(function uBOL_injectCSS(css, count = 10) {
|
||||
chrome.runtime.sendMessage({ what: 'insertCSS', css }).catch(( ) => {
|
||||
count -= 1;
|
||||
if ( count === 0 ) { return; }
|
||||
uBOL_injectCSS(css, count);
|
||||
});
|
||||
})(sheetText.join('\n'));
|
||||
chrome.runtime.sendMessage({
|
||||
what: 'insertCSS',
|
||||
css: sheetText.join('\n'),
|
||||
}).catch(( ) => {
|
||||
});
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
})();
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
void 0;
|
||||
|
|
|
|||
|
|
@ -214,11 +214,11 @@ const uBOL_processChanges = mutations => {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
const uBOL_injectCSS = (css, count = 10) => {
|
||||
chrome.runtime.sendMessage({ what: 'insertCSS', css }).catch(( ) => {
|
||||
count -= 1;
|
||||
if ( count === 0 ) { return; }
|
||||
uBOL_injectCSS(css, count);
|
||||
const uBOL_injectCSS = css => {
|
||||
chrome.runtime.sendMessage({
|
||||
what: 'insertCSS',
|
||||
css,
|
||||
}).catch(( ) => {
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -65,11 +65,11 @@ if ( exceptedSelectors.length === 0 ) { return; }
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
const uBOL_injectCSS = (css, count = 10) => {
|
||||
chrome.runtime.sendMessage({ what: 'insertCSS', css }).catch(( ) => {
|
||||
count -= 1;
|
||||
if ( count === 0 ) { return; }
|
||||
uBOL_injectCSS(css, count);
|
||||
const uBOL_injectCSS = css => {
|
||||
chrome.runtime.sendMessage({
|
||||
what: 'insertCSS',
|
||||
css,
|
||||
}).catch(( ) => {
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -63,20 +63,14 @@ const exceptedSelectors = exceptions.length !== 0
|
|||
: selectors;
|
||||
if ( exceptedSelectors.length === 0 ) { return; }
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
(function uBOL_injectCSS(css, count = 10) {
|
||||
chrome.runtime.sendMessage({ what: 'insertCSS', css }).catch(( ) => {
|
||||
count -= 1;
|
||||
if ( count === 0 ) { return; }
|
||||
uBOL_injectCSS(css, count);
|
||||
});
|
||||
})(`${exceptedSelectors.join(',')}{display:none!important;}`);
|
||||
chrome.runtime.sendMessage({
|
||||
what: 'insertCSS',
|
||||
css: `${exceptedSelectors.join(',')}{display:none!important;}`,
|
||||
}).catch(( ) => {
|
||||
});
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
})();
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
void 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue