From 7e59e09a469c16a0cdaabfa6369c7a3fd5950fcb Mon Sep 17 00:00:00 2001 From: gorhill Date: Wed, 27 Aug 2014 14:01:38 -0400 Subject: [PATCH] code review following #185 --- js/messaging-handlers.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/messaging-handlers.js b/js/messaging-handlers.js index 44f0222b6..4a23c891b 100644 --- a/js/messaging-handlers.js +++ b/js/messaging-handlers.js @@ -403,8 +403,9 @@ var getPageDetails = function(µb, tabId) { return r; } var prepareRequests = function(requests, hasher) { + var µburi = µb.URI; var r = []; - var details, pos; + var details, pos, hostname, domain; for ( var requestURL in requests ) { if ( requests.hasOwnProperty(requestURL) === false ) { continue; @@ -416,9 +417,14 @@ var getPageDetails = function(µb, tabId) { hasher.appendStr(requestURL); hasher.appendStr(details); pos = details.indexOf('\t'); + hostname = µburi.hostnameFromURI(requestURL); + domain = µburi.domainFromHostname(hostname); + if ( domain === '' ) { + domain = hostname; + } r.push({ type: details.slice(0, pos), - domain: µb.URI.domainFromURI(requestURL), + domain: domain, url: requestURL, reason: details.slice(pos + 1) });