diff --git a/src/js/contentscript.js b/src/js/contentscript.js index 665a806a8..675fdde18 100644 --- a/src/js/contentscript.js +++ b/src/js/contentscript.js @@ -969,12 +969,21 @@ vAPI.domCollapser = (function() { var send = function() { vAPI.executionCost.start(); timer = null; + // https://github.com/gorhill/uBlock/issues/1927 + // Normalize hostname to avoid trailing dot of FQHN. + var pageHostname = window.location.hostname || ''; + if ( + pageHostname.length && + pageHostname.charCodeAt(pageHostname.length - 1) === 0x2e + ) { + pageHostname = pageHostname.slice(0, -1); + } messaging.send( 'contentscript', { what: 'filterRequests', pageURL: window.location.href, - pageHostname: window.location.hostname, + pageHostname: pageHostname, requests: roundtripRequests }, onProcessed ); @@ -1016,10 +1025,8 @@ vAPI.domCollapser = (function() { return; } } - // Some data: URI can be quite large: no point in taking into account - // the whole URI. - if ( src.lastIndexOf('data:', 0) === 0 ) { - src = src.slice(0, 255); + if ( src.lastIndexOf('http', 0) !== 0 ) { + return; } var key = tag + ' ' + prop + ' ' + src, entry = pendingRequests[key]; diff --git a/src/js/messaging.js b/src/js/messaging.js index 317f1356c..5717e4704 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -477,13 +477,8 @@ var filterRequests = function(pageStore, details) { var i = requests.length; while ( i-- ) { request = requests[i]; - if ( request.url.startsWith('data:') ) { - context.requestURL = request.url; - context.requestHostname = context.pageHostname; - } else { - context.requestURL = punycodeURL(request.url); - context.requestHostname = hostnameFromURI(context.requestURL); - } + context.requestURL = punycodeURL(request.url); + context.requestHostname = hostnameFromURI(context.requestURL); context.requestType = tagNameToRequestTypeMap[request.tag]; r = pageStore.filterRequest(context); if ( typeof r !== 'string' || r.charAt(1) !== 'b' ) {