1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-06 09:37:12 +02:00

better/safer fix for #587

This commit is contained in:
gorhill 2015-01-23 15:02:47 -05:00
parent 448931248d
commit f718e8e1f2
2 changed files with 7 additions and 2 deletions

View File

@ -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();

View File

@ -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,