diff --git a/src/js/contentscript-start.js b/src/js/contentscript-start.js index a60275ddc..1e9e4d3ef 100644 --- a/src/js/contentscript-start.js +++ b/src/js/contentscript-start.js @@ -148,7 +148,7 @@ var filteringHandler = function(details) { // If no filters were found, maybe the script was injected before uBlock's // process was fully initialized. When this happens, pages won't be // cleaned right after browser launch. - vAPI.contentscriptStartInjected = details && details.cosmeticHide.length !== 0; + vAPI.contentscriptStartInjected = details && details.ready; // Cleanup before leaving localMessager.close(); diff --git a/src/js/cosmetic-filtering.js b/src/js/cosmetic-filtering.js index e8452f249..e24d58c05 100644 --- a/src/js/cosmetic-filtering.js +++ b/src/js/cosmetic-filtering.js @@ -933,7 +933,6 @@ FilterContainer.prototype.fromSelfie = function(selfie) { return dict; }; - this.frozen = true; this.acceptedCount = selfie.acceptedCount; this.duplicateCount = selfie.duplicateCount; this.hostnameFilters = dictFromSelfie(selfie.hostnameSpecificFilters); @@ -951,6 +950,7 @@ FilterContainer.prototype.fromSelfie = function(selfie) { this.highHighGenericDonthide = selfie.highHighGenericDonthide; this.highHighGenericHideCount = selfie.highHighGenericHideCount; this.highHighGenericDonthideCount = selfie.highHighGenericDonthideCount; + this.frozen = true; }; /******************************************************************************/ @@ -1127,7 +1127,12 @@ FilterContainer.prototype.retrieveDomainSelectors = function(request) { var domain = µb.URI.domainFromHostname(hostname) || hostname; var pos = domain.indexOf('.'); + // https://github.com/gorhill/uBlock/issues/587 + // r.ready will tell the content script the cosmetic filtering engine is + // up and ready. + var r = { + ready: this.frozen, domain: domain, entity: pos === -1 ? domain : domain.slice(0, pos - domain.length), skipCosmeticFiltering: this.acceptedCount === 0,