Fix handling of cname-aliased URLs in click-to-load widget

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1455
This commit is contained in:
Raymond Hill 2021-01-22 09:37:12 -05:00
parent bac7873edd
commit 40c145d76a
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
3 changed files with 11 additions and 6 deletions

View File

@ -31,13 +31,16 @@
if ( typeof vAPI !== 'object' ) { return; } if ( typeof vAPI !== 'object' ) { return; }
const url = new URL(self.location.href); const url = new URL(self.location.href);
const frameURL = url.searchParams.get('url'); const actualURL = url.searchParams.get('url');
const frameURL = url.searchParams.get('aliasURL') || actualURL;
const frameURLElem = document.getElementById('frameURL'); const frameURLElem = document.getElementById('frameURL');
frameURLElem.children[0].textContent = frameURL; frameURLElem.children[0].textContent = actualURL;
frameURLElem.children[1].href = frameURL;
document.body.setAttribute('title', frameURL); frameURLElem.children[1].href = frameURL;
frameURLElem.children[1].title = frameURL;
document.body.setAttribute('title', actualURL);
const onWindowResize = function() { const onWindowResize = function() {
document.body.style.width = `${self.innerWidth}px`; document.body.style.width = `${self.innerWidth}px`;

View File

@ -596,7 +596,9 @@ const PageStore = class {
return 1; return 1;
} }
const cacheableResult = this.cacheableResults.has(fctxt.itype); const cacheableResult =
this.cacheableResults.has(fctxt.itype) &&
fctxt.aliasURL === undefined;
if ( cacheableResult ) { if ( cacheableResult ) {
const entry = this.netFilteringCache.lookupResult(fctxt); const entry = this.netFilteringCache.lookupResult(fctxt);

View File

@ -69,7 +69,7 @@ const redirectableResources = new Map([
alias: 'static.chartbeat.com/chartbeat.js', alias: 'static.chartbeat.com/chartbeat.js',
} ], } ],
[ 'click2load.html', { [ 'click2load.html', {
params: [ 'url' ], params: [ 'aliasURL', 'url' ],
} ], } ],
[ 'doubleclick_instream_ad_status.js', { [ 'doubleclick_instream_ad_status.js', {
alias: 'doubleclick.net/instream/ad_status.js', alias: 'doubleclick.net/instream/ad_status.js',