mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Fix calls to tab.removeCSS()
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/1375
This commit is contained in:
parent
cd168efabb
commit
3397f4b65f
1 changed files with 21 additions and 14 deletions
|
|
@ -1024,22 +1024,29 @@ vAPI.messaging = {
|
||||||
}
|
}
|
||||||
case 'userCSS':
|
case 'userCSS':
|
||||||
if ( tabId === undefined ) { break; }
|
if ( tabId === undefined ) { break; }
|
||||||
const details = {
|
|
||||||
code: undefined,
|
|
||||||
frameId: portDetails.frameId,
|
|
||||||
matchAboutBlank: true
|
|
||||||
};
|
|
||||||
if ( msg.add ) {
|
|
||||||
details.runAt = 'document_start';
|
|
||||||
}
|
|
||||||
const promises = [];
|
const promises = [];
|
||||||
for ( const cssText of msg.add ) {
|
if ( msg.add ) {
|
||||||
details.code = cssText;
|
const details = {
|
||||||
promises.push(vAPI.tabs.insertCSS(tabId, details));
|
code: undefined,
|
||||||
|
frameId: portDetails.frameId,
|
||||||
|
matchAboutBlank: true,
|
||||||
|
runAt: 'document_start',
|
||||||
|
};
|
||||||
|
for ( const cssText of msg.add ) {
|
||||||
|
details.code = cssText;
|
||||||
|
promises.push(vAPI.tabs.insertCSS(tabId, details));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for ( const cssText of msg.remove ) {
|
if ( msg.remove ) {
|
||||||
details.code = cssText;
|
const details = {
|
||||||
promises.push(vAPI.tabs.removeCSS(tabId, details));
|
code: undefined,
|
||||||
|
frameId: portDetails.frameId,
|
||||||
|
matchAboutBlank: true,
|
||||||
|
};
|
||||||
|
for ( const cssText of msg.remove ) {
|
||||||
|
details.code = cssText;
|
||||||
|
promises.push(vAPI.tabs.removeCSS(tabId, details));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Promise.all(promises).then(( ) => {
|
Promise.all(promises).then(( ) => {
|
||||||
callback();
|
callback();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue