mirror of https://github.com/gorhill/uBlock.git
Remove bad fast-path optimization in redirect engine
This was reported internally by @okiehsch, and cause was pinpointed by @gwarser. The issue could cause redirection rules to be ignored under some circumstances. The repro steps were: - Navigate `https://adblockplus.org` Result: A delay before the page renders. Expected: No delay before the page renders, because uBO is supposed to redirect to a local neutered version of `googletagmanager.com/gtm.js`.
This commit is contained in:
parent
ac56aabd7c
commit
ac7825c789
|
@ -1 +1 @@
|
||||||
1.22.0
|
1.22.2
|
||||||
|
|
|
@ -279,7 +279,6 @@ RedirectEngine.prototype.reset = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
RedirectEngine.prototype.resetCache = function() {
|
RedirectEngine.prototype.resetCache = function() {
|
||||||
this._missedQueryHash = '';
|
|
||||||
this._src = '';
|
this._src = '';
|
||||||
this._srcAll = [ '*' ];
|
this._srcAll = [ '*' ];
|
||||||
this._des = '';
|
this._des = '';
|
||||||
|
@ -321,26 +320,16 @@ RedirectEngine.prototype.lookup = function(fctxt) {
|
||||||
const src = fctxt.getDocHostname();
|
const src = fctxt.getDocHostname();
|
||||||
const des = fctxt.getHostname();
|
const des = fctxt.getHostname();
|
||||||
const type = fctxt.type;
|
const type = fctxt.type;
|
||||||
const queryHash = `${src} ${des} ${type}`;
|
|
||||||
if ( queryHash === this._missedQueryHash ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( src !== this._src ) {
|
if ( src !== this._src ) {
|
||||||
this._src = src;
|
this._src = src;
|
||||||
this.decomposeHostname(src, this.ruleSources, this._srcAll);
|
this.decomposeHostname(src, this.ruleSources, this._srcAll);
|
||||||
}
|
}
|
||||||
if ( this._srcAll.length === 0 ) {
|
if ( this._srcAll.length === 0 ) { return; }
|
||||||
this._missedQueryHash = queryHash;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( des !== this._des ) {
|
if ( des !== this._des ) {
|
||||||
this._des = des;
|
this._des = des;
|
||||||
this.decomposeHostname(des, this.ruleDestinations, this._desAll);
|
this.decomposeHostname(des, this.ruleDestinations, this._desAll);
|
||||||
}
|
}
|
||||||
if ( this._desAll.length === 0 ) {
|
if ( this._desAll.length === 0 ) { return; }
|
||||||
this._missedQueryHash = queryHash;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const reqURL = fctxt.url;
|
const reqURL = fctxt.url;
|
||||||
for ( const src of this._srcAll ) {
|
for ( const src of this._srcAll ) {
|
||||||
for ( const des of this._desAll ) {
|
for ( const des of this._desAll ) {
|
||||||
|
@ -356,7 +345,6 @@ RedirectEngine.prototype.lookup = function(fctxt) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._missedQueryHash = queryHash;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
RedirectEngine.prototype.lookupRule = function(entries, reqURL) {
|
RedirectEngine.prototype.lookupRule = function(entries, reqURL) {
|
||||||
|
|
Loading…
Reference in New Issue