Skip to content

Commit

Permalink
Use hostname instead of host
Browse files Browse the repository at this point in the history
  • Loading branch information
wardpeet committed May 4, 2018
1 parent 3815f12 commit 6c8c56d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lighthouse-core/lib/url-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ class URLShim extends URL {
const urlAInfo = new URL(urlA);
const urlBInfo = new URL(urlB);

if (!urlAInfo.host || !urlBInfo.host) {
if (!urlAInfo.hostname || !urlBInfo.hostname) {
return false;
}

const urlARootDomain = urlAInfo.host.split('.').slice(-2).join('.');
const urlBRootDomain = urlBInfo.host.split('.').slice(-2).join('.');
const urlARootDomain = urlAInfo.hostname.split('.').slice(-2).join('.');
const urlBRootDomain = urlBInfo.hostname.split('.').slice(-2).join('.');

return urlARootDomain === urlBRootDomain;
}
Expand Down
6 changes: 3 additions & 3 deletions lighthouse-core/test/audits/uses-rel-preload-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('Performance: uses-rel-preload audit', () => {

it('should suggest preload resource', () => {
const rootNode = buildNode(1, 'http://example.com');
const mainDocumentNode = buildNode(2, 'http://www.example.com');
const mainDocumentNode = buildNode(2, 'http://www.example.com:3000');
const scriptNode = buildNode(3, 'http://www.example.com/script.js');
const scriptAddedNode = buildNode(4, 'http://www.example.com/script-added.js');
const scriptSubNode = buildNode(5, 'http://sub.example.com/script-sub.js');
Expand Down Expand Up @@ -101,14 +101,14 @@ describe('Performance: uses-rel-preload audit', () => {
};

const mainResource = Object.assign({}, defaultMainResource, {
url: 'http://www.example.com',
url: 'http://www.example.com:3000',
redirects: [''],
});
const networkRecords = [
{
requestId: '2',
_isLinkPreload: false,
url: 'http://www.example.com',
url: 'http://www.example.com:3000',
},
{
requestId: '3',
Expand Down

0 comments on commit 6c8c56d

Please sign in to comment.