This commit is contained in:
gorhill 2016-08-22 19:13:52 -04:00
parent 4290b4b065
commit 6e916efb0a
2 changed files with 14 additions and 12 deletions

View File

@ -969,12 +969,21 @@ vAPI.domCollapser = (function() {
var send = function() { var send = function() {
vAPI.executionCost.start(); vAPI.executionCost.start();
timer = null; 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( messaging.send(
'contentscript', 'contentscript',
{ {
what: 'filterRequests', what: 'filterRequests',
pageURL: window.location.href, pageURL: window.location.href,
pageHostname: window.location.hostname, pageHostname: pageHostname,
requests: roundtripRequests requests: roundtripRequests
}, onProcessed }, onProcessed
); );
@ -1016,10 +1025,8 @@ vAPI.domCollapser = (function() {
return; return;
} }
} }
// Some data: URI can be quite large: no point in taking into account if ( src.lastIndexOf('http', 0) !== 0 ) {
// the whole URI. return;
if ( src.lastIndexOf('data:', 0) === 0 ) {
src = src.slice(0, 255);
} }
var key = tag + ' ' + prop + ' ' + src, var key = tag + ' ' + prop + ' ' + src,
entry = pendingRequests[key]; entry = pendingRequests[key];

View File

@ -477,13 +477,8 @@ var filterRequests = function(pageStore, details) {
var i = requests.length; var i = requests.length;
while ( i-- ) { while ( i-- ) {
request = requests[i]; request = requests[i];
if ( request.url.startsWith('data:') ) {
context.requestURL = request.url;
context.requestHostname = context.pageHostname;
} else {
context.requestURL = punycodeURL(request.url); context.requestURL = punycodeURL(request.url);
context.requestHostname = hostnameFromURI(context.requestURL); context.requestHostname = hostnameFromURI(context.requestURL);
}
context.requestType = tagNameToRequestTypeMap[request.tag]; context.requestType = tagNameToRequestTypeMap[request.tag];
r = pageStore.filterRequest(context); r = pageStore.filterRequest(context);
if ( typeof r !== 'string' || r.charAt(1) !== 'b' ) { if ( typeof r !== 'string' || r.charAt(1) !== 'b' ) {