mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-04 01:59:38 +02:00
This commit is contained in:
parent
26e5b3f45d
commit
5386558e68
@ -49,6 +49,12 @@ vAPI.resetLastError = function() {
|
||||
};
|
||||
|
||||
vAPI.supportsUserStylesheets = vAPI.webextFlavor.soup.has('user_stylesheet');
|
||||
// The real actual webextFlavor value may not be set in stone, so listen
|
||||
// for possible future changes.
|
||||
window.addEventListener('webextFlavor', function() {
|
||||
vAPI.supportsUserStylesheets =
|
||||
vAPI.webextFlavor.soup.has('user_stylesheet');
|
||||
}, { once: true });
|
||||
|
||||
vAPI.insertCSS = function(tabId, details) {
|
||||
return chrome.tabs.insertCSS(tabId, details, vAPI.resetLastError);
|
||||
@ -721,8 +727,7 @@ vAPI.messaging.listen = function(listenerName, callback) {
|
||||
/******************************************************************************/
|
||||
|
||||
vAPI.messaging.onPortMessage = (function() {
|
||||
var messaging = vAPI.messaging,
|
||||
supportsUserStylesheets = vAPI.supportsUserStylesheets;
|
||||
var messaging = vAPI.messaging;
|
||||
|
||||
// Use a wrapper to avoid closure and to allow reuse.
|
||||
var CallbackWrapper = function(port, request) {
|
||||
@ -806,7 +811,7 @@ vAPI.messaging.onPortMessage = (function() {
|
||||
frameId: sender.frameId,
|
||||
matchAboutBlank: true
|
||||
};
|
||||
if ( supportsUserStylesheets ) {
|
||||
if ( vAPI.supportsUserStylesheets ) {
|
||||
details.cssOrigin = 'user';
|
||||
}
|
||||
if ( msg.add ) {
|
||||
|
@ -69,7 +69,9 @@ vAPI.webextFlavor = {
|
||||
flavor.major = parseInt(info.version, 10) || 0;
|
||||
soup.add(info.vendor.toLowerCase())
|
||||
.add(info.name.toLowerCase());
|
||||
soup.delete('user_stylesheet');
|
||||
if ( flavor.major >= 53 ) { soup.add('user_stylesheet'); }
|
||||
soup.delete('html_filtering');
|
||||
if ( flavor.major >= 57 ) { soup.add('html_filtering'); }
|
||||
dispatch();
|
||||
});
|
||||
|
@ -543,6 +543,11 @@ FilterContainer.prototype.freeze = function() {
|
||||
this.highlyGeneric.simple.str = µb.arrayFrom(this.highlyGeneric.simple.dict).join(',\n');
|
||||
this.highlyGeneric.complex.str = µb.arrayFrom(this.highlyGeneric.complex.dict).join(',\n');
|
||||
|
||||
// https://www.reddit.com/r/uBlockOrigin/comments/8dkvqn/116_broken_loading_custom_filters_from_my_filters/
|
||||
// Just in case. This can be removed once Firefox 60 ESR is out
|
||||
// and widespread.
|
||||
this.supportsUserStylesheets = vAPI.supportsUserStylesheets;
|
||||
|
||||
this.frozen = true;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user