mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 17:17:57 +01:00
this fixes #420
This commit is contained in:
parent
ceb36732cc
commit
b9c1f2e397
2 changed files with 31 additions and 3 deletions
|
@ -363,6 +363,17 @@ SelectorCacheEntry.prototype.add = function(selectors, type) {
|
|||
}
|
||||
};
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/420
|
||||
SelectorCacheEntry.prototype.remove = function(type) {
|
||||
this.lastAccessTime = Date.now();
|
||||
if ( type === 'cosmetic' ) {
|
||||
this.cosmetic = {};
|
||||
} else {
|
||||
this.net = {};
|
||||
this.netCount = 0;
|
||||
}
|
||||
};
|
||||
|
||||
SelectorCacheEntry.prototype.retrieve = function(type, out) {
|
||||
this.lastAccessTime = Date.now();
|
||||
var dict = type === 'cosmetic' ? this.cosmetic : this.net;
|
||||
|
@ -918,6 +929,16 @@ FilterContainer.prototype.addToSelectorCache = function(details) {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
FilterContainer.prototype.removeFromSelectorCache = function(hostname, type) {
|
||||
var entry = this.selectorCache[hostname];
|
||||
if ( entry === undefined ) {
|
||||
return;
|
||||
}
|
||||
entry.remove(type);
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
FilterContainer.prototype.retrieveFromSelectorCache = function(hostname, type, out) {
|
||||
var entry = this.selectorCache[hostname];
|
||||
if ( entry === undefined ) {
|
||||
|
|
|
@ -314,9 +314,16 @@ var matchWhitelistDirective = function(url, hostname, directive) {
|
|||
} else {
|
||||
changed = this.netFilteringEngine.dynamicFilterUnblock(details.hostname, details.requestType, details.firstParty);
|
||||
}
|
||||
if ( changed ) {
|
||||
this.userSettings.dynamicFilteringSelfie = this.netFilteringEngine.selfieFromDynamicFilters();
|
||||
this.XAL.keyvalSetOne('dynamicFilteringSelfie', this.userSettings.dynamicFilteringSelfie);
|
||||
if ( !changed ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.userSettings.dynamicFilteringSelfie = this.netFilteringEngine.selfieFromDynamicFilters();
|
||||
this.XAL.keyvalSetOne('dynamicFilteringSelfie', this.userSettings.dynamicFilteringSelfie);
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/420
|
||||
if ( details.requestType === 'sub_frame' && !details.block ) {
|
||||
this.cosmeticFilteringEngine.removeFromSelectorCache(details.pageHostname, 'net');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue