code review for #420: mind that the rule can apply everywhere

This commit is contained in:
gorhill 2014-12-17 10:47:52 -05:00
parent b9c1f2e397
commit 0d3dd3d2ec
2 changed files with 10 additions and 6 deletions

View File

@ -929,12 +929,16 @@ FilterContainer.prototype.addToSelectorCache = function(details) {
/******************************************************************************/
FilterContainer.prototype.removeFromSelectorCache = function(hostname, type) {
var entry = this.selectorCache[hostname];
if ( entry === undefined ) {
return;
FilterContainer.prototype.removeFromSelectorCache = function(targetHostname, type) {
for ( var hostname in this.selectorCache ) {
if ( this.selectorCache.hasOwnProperty(hostname) === false ) {
continue;
}
if ( targetHostname !== '*' && hostname !== targetHostname ) {
continue;
}
this.selectorCache[hostname].remove(type);
}
entry.remove(type);
};
/******************************************************************************/

View File

@ -323,7 +323,7 @@ var matchWhitelistDirective = function(url, hostname, directive) {
// https://github.com/gorhill/uBlock/issues/420
if ( details.requestType === 'sub_frame' && !details.block ) {
this.cosmeticFilteringEngine.removeFromSelectorCache(details.pageHostname, 'net');
this.cosmeticFilteringEngine.removeFromSelectorCache(details.hostname, 'net');
}
};