This commit is contained in:
Raymond Hill 2018-04-22 10:01:33 -04:00
parent e95b3f955c
commit 48426469de
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 8 additions and 9 deletions

View File

@ -30,6 +30,12 @@
var µb = µBlock; var µb = µBlock;
var cosmeticSurveyingMissCountMax = parseInt(vAPI.localStorage.getItem('cosmeticSurveyingMissCountMax'), 10) || 15; var cosmeticSurveyingMissCountMax = parseInt(vAPI.localStorage.getItem('cosmeticSurveyingMissCountMax'), 10) || 15;
var supportsUserStylesheets = vAPI.webextFlavor.soup.has('user_stylesheet');
// https://www.reddit.com/r/uBlockOrigin/comments/8dkvqn/116_broken_loading_custom_filters_from_my_filters/
window.addEventListener('webextFlavor', function() {
supportsUserStylesheets = vAPI.webextFlavor.soup.has('user_stylesheet');
}, { once: true });
/******************************************************************************/ /******************************************************************************/
/* /*
var histogram = function(label, buckets) { var histogram = function(label, buckets) {
@ -416,8 +422,6 @@ var FilterContainer = function() {
this.netSelectorCacheCountMax = netSelectorCacheHighWaterMark; this.netSelectorCacheCountMax = netSelectorCacheHighWaterMark;
this.selectorCacheTimer = null; this.selectorCacheTimer = null;
this.supportsUserStylesheets = vAPI.supportsUserStylesheets;
// generic exception filters // generic exception filters
this.genericDonthideSet = new Set(); this.genericDonthideSet = new Set();
@ -543,11 +547,6 @@ FilterContainer.prototype.freeze = function() {
this.highlyGeneric.simple.str = µb.arrayFrom(this.highlyGeneric.simple.dict).join(',\n'); this.highlyGeneric.simple.str = µb.arrayFrom(this.highlyGeneric.simple.dict).join(',\n');
this.highlyGeneric.complex.str = µb.arrayFrom(this.highlyGeneric.complex.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; this.frozen = true;
}; };
@ -1201,7 +1200,7 @@ FilterContainer.prototype.retrieveGenericSelectors = function(request) {
// If user stylesheets are supported in the current process, inject the // If user stylesheets are supported in the current process, inject the
// cosmetic filters now. // cosmetic filters now.
if ( if (
this.supportsUserStylesheets && supportsUserStylesheets &&
request.tabId !== undefined && request.tabId !== undefined &&
request.frameId !== undefined request.frameId !== undefined
) { ) {
@ -1416,7 +1415,7 @@ FilterContainer.prototype.retrieveDomainSelectors = function(
// If user stylesheets are supported in the current process, inject the // If user stylesheets are supported in the current process, inject the
// cosmetic filters now. // cosmetic filters now.
if ( if (
this.supportsUserStylesheets && supportsUserStylesheets &&
request.tabId !== undefined && request.tabId !== undefined &&
request.frameId !== undefined request.frameId !== undefined
) { ) {