[mv3] No need to retry sending messages with top-level listener

This commit is contained in:
Raymond Hill 2025-05-07 07:47:28 -04:00
parent f40b989dc8
commit 0ee6e3044d
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
4 changed files with 20 additions and 30 deletions

View file

@ -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;

View file

@ -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(( ) => {
});
};

View file

@ -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(( ) => {
});
};

View file

@ -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;