Allow call to removeCSS in Chromium

Related discussion:
- https://github.com/gorhill/uBlock/issues/3588#issuecomment-702218677
This commit is contained in:
Raymond Hill 2020-10-02 12:16:47 -04:00
parent bafbb7d62c
commit db0d200fcb
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 4 additions and 5 deletions

View File

@ -1027,11 +1027,9 @@ vAPI.messaging = {
details.code = cssText;
promises.push(vAPI.tabs.insertCSS(tabId, details));
}
if ( typeof webext.tabs.removeCSS === 'function' ) {
for ( const cssText of msg.remove ) {
details.code = cssText;
promises.push(vAPI.tabs.removeCSS(tabId, details));
}
for ( const cssText of msg.remove ) {
details.code = cssText;
promises.push(vAPI.tabs.removeCSS(tabId, details));
}
Promise.all(promises).then(( ) => {
callback();

View File

@ -93,6 +93,7 @@ const webext = {
get: promisifyNoFail(chrome.tabs, 'get', tab => tab instanceof Object ? tab : null),
executeScript: promisifyNoFail(chrome.tabs, 'executeScript'),
insertCSS: promisifyNoFail(chrome.tabs, 'insertCSS'),
removeCSS: promisifyNoFail(chrome.tabs, 'removeCSS'),
query: promisifyNoFail(chrome.tabs, 'query', tabs => Array.isArray(tabs) ? tabs : []),
reload: promisifyNoFail(chrome.tabs, 'reload'),
remove: promisifyNoFail(chrome.tabs, 'remove'),