From 1853bcf186f038af44a1f430171581e477d00044 Mon Sep 17 00:00:00 2001 From: Paul Irish Date: Fri, 24 Feb 2017 16:59:02 -0800 Subject: [PATCH] test --- lighthouse-core/lib/url-shim.js | 6 +++--- lighthouse-core/test/lib/url-shim-test.js | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lighthouse-core/lib/url-shim.js b/lighthouse-core/lib/url-shim.js index 551fbf6842f8..472e9342d2cf 100644 --- a/lighthouse-core/lib/url-shim.js +++ b/lighthouse-core/lib/url-shim.js @@ -95,12 +95,12 @@ URL.getDisplayName = function getDisplayName(url) { }; // There is fancy URL rewriting logic for the chrome://settings page that we need to work around. -// Why? It was to be able to swap from chrome://settings to chrome://extensions with a JavaScript +// Why? It was to be able to swap from chrome://settings to chrome://extensions with a JavaScript // pushState call without forcing a page reload. :) // As a result, the final document URL doesn't match the URL that network layer surfaces. -function rewriteChromeInternalUrl(url){ +function rewriteChromeInternalUrl(url) { if (!url.startsWith('chrome://')) return url; - return url.replace(/^chrome:\/\/chrome\//,'chrome://'); + return url.replace(/^chrome:\/\/chrome\//, 'chrome://'); } /** diff --git a/lighthouse-core/test/lib/url-shim-test.js b/lighthouse-core/test/lib/url-shim-test.js index 53da87e40466..2d2e027db07d 100644 --- a/lighthouse-core/test/lib/url-shim-test.js +++ b/lighthouse-core/test/lib/url-shim-test.js @@ -111,5 +111,13 @@ describe('URL Shim', () => { ]; unequalPairs.forEach(pair => assert.ok(!URL.equalWithExcludedFragments(...pair))); }); + + it('rewrites chrome://settings urls', () => { + const pair = [ + 'chrome://settings/', + 'chrome://chrome/settings/', + ]; + assert.ok(URL.equalWithExcludedFragments(...pair)); + }); }); });