From a3812543d534c61ef089bde17554fb55aecb8446 Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Wed, 16 Sep 2020 12:08:08 -0400 Subject: [PATCH 01/16] dont clear the things --- lighthouse-core/gather/driver.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lighthouse-core/gather/driver.js b/lighthouse-core/gather/driver.js index b1bfca21f3fe..6a3b7c8d2d53 100644 --- a/lighthouse-core/gather/driver.js +++ b/lighthouse-core/gather/driver.js @@ -1445,16 +1445,15 @@ class Driver { async clearDataForOrigin(url) { const origin = new URL(url).origin; - // Clear all types of storage except cookies, so the user isn't logged out. + // Clear some types of storage + // Cookies are not cleared, so the user isn't logged out + // indexeddb, websql, and localstorage are not cleared to prevent loss of the user's data // https://chromedevtools.github.io/debugger-protocol-viewer/tot/Storage/#type-StorageType const typesToClear = [ 'appcache', // 'cookies', 'file_systems', - 'indexeddb', - 'local_storage', 'shader_cache', - 'websql', 'service_workers', 'cache_storage', ].join(','); From 4e802b65321fee0b0d83b0969e6acfef2c347eb1 Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Wed, 16 Sep 2020 12:51:18 -0400 Subject: [PATCH 02/16] update comment --- lighthouse-core/gather/driver.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lighthouse-core/gather/driver.js b/lighthouse-core/gather/driver.js index 6a3b7c8d2d53..5f2ae82b0838 100644 --- a/lighthouse-core/gather/driver.js +++ b/lighthouse-core/gather/driver.js @@ -1445,9 +1445,9 @@ class Driver { async clearDataForOrigin(url) { const origin = new URL(url).origin; - // Clear some types of storage - // Cookies are not cleared, so the user isn't logged out - // indexeddb, websql, and localstorage are not cleared to prevent loss of the user's data + // Clear some types of storage. + // Cookies are not cleared, so the user isn't logged out. + // indexeddb, websql, and localstorage are not cleared to prevent loss of potentially important data. // https://chromedevtools.github.io/debugger-protocol-viewer/tot/Storage/#type-StorageType const typesToClear = [ 'appcache', From dd6ebead77d1a8fa800cdbae1cfa57d893aa823b Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Thu, 17 Sep 2020 17:05:06 -0400 Subject: [PATCH 03/16] add toplevel warning --- lighthouse-core/gather/driver.js | 29 ++++++++++++++ lighthouse-core/gather/gather-runner.js | 26 +++++++++++-- lighthouse-core/test/gather/fake-driver.js | 3 ++ .../test/gather/gather-runner-test.js | 39 ++++++++++++++++++- 4 files changed, 93 insertions(+), 4 deletions(-) diff --git a/lighthouse-core/gather/driver.js b/lighthouse-core/gather/driver.js index 5f2ae82b0838..8b5880589bf6 100644 --- a/lighthouse-core/gather/driver.js +++ b/lighthouse-core/gather/driver.js @@ -1476,6 +1476,35 @@ class Driver { } } + /** + * @param {string} url + * @return {Promise} + */ + async getImportantLocationsNotCleared(url) { + try { + const usageData = await this.sendCommand('Storage.getUsageAndQuota', { + origin: url, + }); + const locations = usageData.usageBreakdown.filter(usage => usage.usage) + .map(usage => { + switch (usage.storageType) { + case 'local_storage': + return 'Local Storage'; + case 'indexeddb': + return 'IndexedDB'; + case 'websql': + return 'Web SQL'; + default: + return ''; + } + }) + .filter(resourceString => resourceString); + return locations; + } catch (err) { + throw err; + } + } + /** * Cache native functions/objects inside window * so we are sure polyfills do not overwrite the native implementations diff --git a/lighthouse-core/gather/gather-runner.js b/lighthouse-core/gather/gather-runner.js index 6efc7eeba59e..34bc9a8d3806 100644 --- a/lighthouse-core/gather/gather-runner.js +++ b/lighthouse-core/gather/gather-runner.js @@ -29,6 +29,16 @@ const UIStrings = { */ warningTimeout: 'The page loaded too slowly to finish within the time limit. ' + 'Results may be incomplete.', + /** + * @description Warning that important data was not cleared but may have affected the scores of this run. + * @example {IndexedDB, Local Storage} importantResources + */ + warningData: `{locationCount, plural, + =1 {There may be important data in this location: {locations}. ` + + `Audit this page in an incognito window to prevent the resources from affecting your scores.} + other {There may be important data in these locations: {locations}. ` + + `Audit this page in an incognito window to prevent the resources from affecting your scores.} + }`, }; const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings); @@ -105,9 +115,10 @@ class GatherRunner { /** * @param {Driver} driver * @param {{requestedUrl: string, settings: LH.Config.Settings}} options + * @param {string[]} LighthouseRunWarnings * @return {Promise} */ - static async setupDriver(driver, options) { + static async setupDriver(driver, options, LighthouseRunWarnings) { const status = {msg: 'Initializing…', id: 'lh:gather:setupDriver'}; log.time(status); const resetStorage = !options.settings.disableStorageReset; @@ -119,7 +130,16 @@ class GatherRunner { await driver.registerPerformanceObserver(); await driver.dismissJavaScriptDialogs(); await driver.registerRequestIdleCallbackWrap(options.settings); - if (resetStorage) await driver.clearDataForOrigin(options.requestedUrl); + if (resetStorage) { + const locations = await driver.getImportantLocationsNotCleared(options.requestedUrl); + if (locations.length) { + LighthouseRunWarnings.push(str_( + UIStrings.warningData, + {locations: locations.join(', '), locationCount: locations.length} + )); + } + await driver.clearDataForOrigin(options.requestedUrl); + } log.timeEnd(status); } @@ -654,7 +674,7 @@ class GatherRunner { const baseArtifacts = await GatherRunner.initializeBaseArtifacts(options); baseArtifacts.BenchmarkIndex = await options.driver.getBenchmarkIndex(); - await GatherRunner.setupDriver(driver, options); + await GatherRunner.setupDriver(driver, options, baseArtifacts.LighthouseRunWarnings); let isFirstPass = true; for (const passConfig of passConfigs) { diff --git a/lighthouse-core/test/gather/fake-driver.js b/lighthouse-core/test/gather/fake-driver.js index 4f3f338b1786..f2608de8c28b 100644 --- a/lighthouse-core/test/gather/fake-driver.js +++ b/lighthouse-core/test/gather/fake-driver.js @@ -62,6 +62,9 @@ function makeFakeDriver({protocolGetVersionResponse}) { }, cleanBrowserCaches() {}, clearDataForOrigin() {}, + getImportantLocationsNotCleared() { + return Promise.resolve([]); + }, cacheNatives() { return Promise.resolve(); }, diff --git a/lighthouse-core/test/gather/gather-runner-test.js b/lighthouse-core/test/gather/gather-runner-test.js index 498a86bd0584..b1ae7d804809 100644 --- a/lighthouse-core/test/gather/gather-runner-test.js +++ b/lighthouse-core/test/gather/gather-runner-test.js @@ -132,7 +132,8 @@ function resetDefaultMockResponses() { .mockResponse('Network.setExtraHTTPHeaders') .mockResponse('Network.setUserAgentOverride') .mockResponse('Page.enable') - .mockResponse('ServiceWorker.enable'); + .mockResponse('ServiceWorker.enable') + .mockResponse('Storage.getUsageAndQuota', {usageBreakdown: []}); } beforeEach(() => { @@ -415,6 +416,7 @@ describe('GatherRunner', function() { clearDataForOrigin: createCheck('calledClearStorage'), blockUrlPatterns: asyncFunc, setExtraHTTPHeaders: asyncFunc, + getImportantLocationsNotCleared: () => Promise.resolve(''), }; return GatherRunner.setupDriver(driver, {settings: {}}).then(_ => { @@ -423,6 +425,41 @@ describe('GatherRunner', function() { }); }); + it('warns if important data not cleared may impact performance', () => { + const asyncFunc = () => Promise.resolve(); + driver.assertNoSameOriginServiceWorkerClients = asyncFunc; + driver.beginEmulation = asyncFunc; + driver.enableRuntimeEvents = asyncFunc; + driver.enableAsyncStacks = asyncFunc; + driver.cacheNatives = asyncFunc; + driver.registerPerformanceObserver = asyncFunc; + driver.dismissJavaScriptDialogs = asyncFunc; + driver.registerRequestIdleCallbackWrap = asyncFunc; + driver.clearDataForOrigin = asyncFunc; + + connectionStub.sendCommand = createMockSendCommandFn() + .mockResponse('Storage.getUsageAndQuota', {usageBreakdown: [ + {storageType: 'local_storage', usage: 5}, + {storageType: 'indexeddb', usage: 5}, + {storageType: 'websql', usage: 0}, + {storageType: 'appcache', usage: 5}, + {storageType: 'cookies', usage: 5}, + {storageType: 'file_systems', usage: 5}, + {storageType: 'shader_cache', usage: 5}, + {storageType: 'service_workers', usage: 5}, + {storageType: 'cache_storage', usage: 0}, + ]}); + /** @type {string[]} */ + const LighthouseRunWarnings = []; + GatherRunner.setupDriver(driver, {settings: {}}, LighthouseRunWarnings).then(_ => { + expect(LighthouseRunWarnings[0]).toBeDisplayString(new RegExp( + 'There may be important data in these locations: Local Storage, IndexedDB. ' + + 'Audit this page in an incognito window to prevent ' + + 'the resources from affecting your scores.' + )); + }); + }); + it('clears the disk & memory cache on a perf run', async () => { const asyncFunc = () => Promise.resolve(); /** @type {Record} */ From 926de0ab663500ddf11f877ea8eb6d99faf66d11 Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Thu, 17 Sep 2020 17:07:32 -0400 Subject: [PATCH 04/16] remove reduntant try block --- lighthouse-core/gather/driver.js | 40 ++++++++++++++------------------ 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/lighthouse-core/gather/driver.js b/lighthouse-core/gather/driver.js index 8b5880589bf6..31fa74680cb2 100644 --- a/lighthouse-core/gather/driver.js +++ b/lighthouse-core/gather/driver.js @@ -1481,28 +1481,24 @@ class Driver { * @return {Promise} */ async getImportantLocationsNotCleared(url) { - try { - const usageData = await this.sendCommand('Storage.getUsageAndQuota', { - origin: url, - }); - const locations = usageData.usageBreakdown.filter(usage => usage.usage) - .map(usage => { - switch (usage.storageType) { - case 'local_storage': - return 'Local Storage'; - case 'indexeddb': - return 'IndexedDB'; - case 'websql': - return 'Web SQL'; - default: - return ''; - } - }) - .filter(resourceString => resourceString); - return locations; - } catch (err) { - throw err; - } + const usageData = await this.sendCommand('Storage.getUsageAndQuota', { + origin: url, + }); + const locations = usageData.usageBreakdown.filter(usage => usage.usage) + .map(usage => { + switch (usage.storageType) { + case 'local_storage': + return 'Local Storage'; + case 'indexeddb': + return 'IndexedDB'; + case 'websql': + return 'Web SQL'; + default: + return ''; + } + }) + .filter(resourceString => resourceString); + return locations; } /** From 4ab2be194da443cb0280e679559dd57db2a7bf58 Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Thu, 17 Sep 2020 17:12:20 -0400 Subject: [PATCH 05/16] update sample --- lighthouse-core/gather/gather-runner.js | 2 +- lighthouse-core/lib/i18n/locales/en-US.json | 3 +++ lighthouse-core/lib/i18n/locales/en-XL.json | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lighthouse-core/gather/gather-runner.js b/lighthouse-core/gather/gather-runner.js index 34bc9a8d3806..ad74a15360bf 100644 --- a/lighthouse-core/gather/gather-runner.js +++ b/lighthouse-core/gather/gather-runner.js @@ -31,7 +31,7 @@ const UIStrings = { 'Results may be incomplete.', /** * @description Warning that important data was not cleared but may have affected the scores of this run. - * @example {IndexedDB, Local Storage} importantResources + * @example {IndexedDB, Local Storage} locations */ warningData: `{locationCount, plural, =1 {There may be important data in this location: {locations}. ` + diff --git a/lighthouse-core/lib/i18n/locales/en-US.json b/lighthouse-core/lib/i18n/locales/en-US.json index 4a32fbab2907..d7c981d771d1 100644 --- a/lighthouse-core/lib/i18n/locales/en-US.json +++ b/lighthouse-core/lib/i18n/locales/en-US.json @@ -1598,6 +1598,9 @@ "lighthouse-core/config/default-config.js | seoMobileGroupTitle": { "message": "Mobile Friendly" }, + "lighthouse-core/gather/gather-runner.js | warningData": { + "message": "{locationCount, plural,\n =1 {There may be important data in this location: {locations}. Audit this page in an incognito window to prevent the resources from affecting your scores.}\n other {There may be important data in these locations: {locations}. Audit this page in an incognito window to prevent the resources from affecting your scores.}\n }" + }, "lighthouse-core/gather/gather-runner.js | warningRedirected": { "message": "The page may not be loading as expected because your test URL ({requested}) was redirected to {final}. Try testing the second URL directly." }, diff --git a/lighthouse-core/lib/i18n/locales/en-XL.json b/lighthouse-core/lib/i18n/locales/en-XL.json index 58931c6cda05..dec465b44c20 100644 --- a/lighthouse-core/lib/i18n/locales/en-XL.json +++ b/lighthouse-core/lib/i18n/locales/en-XL.json @@ -1598,6 +1598,9 @@ "lighthouse-core/config/default-config.js | seoMobileGroupTitle": { "message": "M̂ób̂íl̂é F̂ŕîén̂d́l̂ý" }, + "lighthouse-core/gather/gather-runner.js | warningData": { + "message": "{locationCount, plural,\n =1 {T̂h́êŕê ḿâý b̂é îḿp̂ór̂t́âńt̂ d́ât́â ín̂ t́ĥíŝ ĺôćât́îón̂: {locations}. Áûd́ît́ t̂h́îś p̂áĝé îń âń îńĉóĝńît́ô ẃîńd̂óŵ t́ô ṕr̂év̂én̂t́ t̂h́ê ŕêśôúr̂ćêś f̂ŕôḿ âf́f̂éĉt́îńĝ ýôúr̂ śĉór̂éŝ.}\n other {T́ĥér̂é m̂áŷ b́ê ím̂ṕôŕt̂án̂t́ d̂át̂á îń t̂h́êśê ĺôćât́îón̂ś: {locations}. Âúd̂ít̂ t́ĥíŝ ṕâǵê ín̂ án̂ ín̂ćôǵn̂ít̂ó ŵín̂d́ôẃ t̂ó p̂ŕêv́êńt̂ t́ĥé r̂éŝóûŕĉéŝ f́r̂óm̂ áf̂f́êćt̂ín̂ǵ ŷóûŕ ŝćôŕêś.}\n }" + }, "lighthouse-core/gather/gather-runner.js | warningRedirected": { "message": "T̂h́ê ṕâǵê ḿâý n̂ót̂ b́ê ĺôád̂ín̂ǵ âś êx́p̂éĉt́êd́ b̂éĉáûśê ýôúr̂ t́êśt̂ ÚR̂Ĺ ({requested}) ŵáŝ ŕêd́îŕêćt̂éd̂ t́ô {final}. T́r̂ý t̂éŝt́îńĝ t́ĥé ŝéĉón̂d́ ÛŔL̂ d́îŕêćt̂ĺŷ." }, From c1071e0814e557b5e2fee61ace72bcd6104ff388 Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Thu, 24 Sep 2020 13:54:55 -0400 Subject: [PATCH 06/16] change type --- lighthouse-core/gather/gather-runner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lighthouse-core/gather/gather-runner.js b/lighthouse-core/gather/gather-runner.js index ad74a15360bf..255e751f29be 100644 --- a/lighthouse-core/gather/gather-runner.js +++ b/lighthouse-core/gather/gather-runner.js @@ -115,7 +115,7 @@ class GatherRunner { /** * @param {Driver} driver * @param {{requestedUrl: string, settings: LH.Config.Settings}} options - * @param {string[]} LighthouseRunWarnings + * @param {(string | LH.IcuMessage)[]} LighthouseRunWarnings * @return {Promise} */ static async setupDriver(driver, options, LighthouseRunWarnings) { From aef17f1b602a44ef37141102175a20b537d5c687 Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Thu, 24 Sep 2020 14:54:04 -0400 Subject: [PATCH 07/16] add clear data unit test --- lighthouse-core/test/gather/driver-test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lighthouse-core/test/gather/driver-test.js b/lighthouse-core/test/gather/driver-test.js index 168a7453860a..abad4457441c 100644 --- a/lighthouse-core/test/gather/driver-test.js +++ b/lighthouse-core/test/gather/driver-test.js @@ -913,6 +913,20 @@ describe('.goOnline', () => { }); }); +describe('.clearDataForOrigin', () => { + it('only clears data from certain locations', async () => { + let foundStorageTypes; + connectionStub.sendCommand = createMockSendCommandFn() + .mockResponse('Storage.clearDataForOrigin', ({storageTypes}) => { + foundStorageTypes = storageTypes; + }); + await driver.clearDataForOrigin('https://example.com'); + expect(foundStorageTypes).toMatchInlineSnapshot( + `"appcache,file_systems,shader_cache,service_workers,cache_storage"` + ); + }); +}); + describe('Domain.enable/disable State', () => { it('dedupes (simple)', async () => { connectionStub.sendCommand = createMockSendCommandFn() From 652f30e26a37c9eb87584b22d2ced8a62f6066ae Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Thu, 24 Sep 2020 15:02:41 -0400 Subject: [PATCH 08/16] style --- lighthouse-core/gather/driver.js | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/lighthouse-core/gather/driver.js b/lighthouse-core/gather/driver.js index 31fa74680cb2..77fc09210a40 100644 --- a/lighthouse-core/gather/driver.js +++ b/lighthouse-core/gather/driver.js @@ -1484,20 +1484,16 @@ class Driver { const usageData = await this.sendCommand('Storage.getUsageAndQuota', { origin: url, }); - const locations = usageData.usageBreakdown.filter(usage => usage.usage) - .map(usage => { - switch (usage.storageType) { - case 'local_storage': - return 'Local Storage'; - case 'indexeddb': - return 'IndexedDB'; - case 'websql': - return 'Web SQL'; - default: - return ''; - } - }) - .filter(resourceString => resourceString); + /** @type {Object.} */ + const storageTypeNames = { + local_storage: 'Local Storage', + indexeddb: 'IndexedDB', + websql: 'Web SQL', + }; + const locations = usageData.usageBreakdown + .filter(usage => usage.usage) + .map(usage => storageTypeNames[usage.storageType] || '') + .filter(Boolean); return locations; } From 1f9d99611bb7a0748142865bb4bc32a56ad0094d Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Thu, 24 Sep 2020 15:47:18 -0400 Subject: [PATCH 09/16] use await --- .../test/gather/gather-runner-test.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lighthouse-core/test/gather/gather-runner-test.js b/lighthouse-core/test/gather/gather-runner-test.js index b1ae7d804809..256a4562a499 100644 --- a/lighthouse-core/test/gather/gather-runner-test.js +++ b/lighthouse-core/test/gather/gather-runner-test.js @@ -425,7 +425,7 @@ describe('GatherRunner', function() { }); }); - it('warns if important data not cleared may impact performance', () => { + it('warns if important data not cleared may impact performance', async () => { const asyncFunc = () => Promise.resolve(); driver.assertNoSameOriginServiceWorkerClients = asyncFunc; driver.beginEmulation = asyncFunc; @@ -449,15 +449,14 @@ describe('GatherRunner', function() { {storageType: 'service_workers', usage: 5}, {storageType: 'cache_storage', usage: 0}, ]}); - /** @type {string[]} */ + /** @type {(string | LH.IcuMessage)[]} */ const LighthouseRunWarnings = []; - GatherRunner.setupDriver(driver, {settings: {}}, LighthouseRunWarnings).then(_ => { - expect(LighthouseRunWarnings[0]).toBeDisplayString(new RegExp( - 'There may be important data in these locations: Local Storage, IndexedDB. ' + - 'Audit this page in an incognito window to prevent ' + - 'the resources from affecting your scores.' - )); - }); + await GatherRunner.setupDriver(driver, {settings: {}}, LighthouseRunWarnings); + expect(LighthouseRunWarnings[0]).toBeDisplayString(new RegExp( + 'There may be important data in these locations: Local Storage, IndexedDB. ' + + 'Audit this page in an incognito window to prevent ' + + 'the resources from affecting your scores.' + )); }); it('clears the disk & memory cache on a perf run', async () => { From 22e2b99f093523591ebf7c8db928030d5d13dd29 Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Thu, 24 Sep 2020 16:34:05 -0400 Subject: [PATCH 10/16] move code --- lighthouse-core/gather/driver.js | 27 ++++++++++-- lighthouse-core/gather/gather-runner.js | 18 +------- lighthouse-core/test/gather/driver-test.js | 44 +++++++++++++++++++ lighthouse-core/test/gather/fake-driver.js | 4 +- .../test/gather/gather-runner-test.js | 42 +++--------------- types/jest.d.ts | 2 +- 6 files changed, 77 insertions(+), 60 deletions(-) diff --git a/lighthouse-core/gather/driver.js b/lighthouse-core/gather/driver.js index 77fc09210a40..696b35d12ddd 100644 --- a/lighthouse-core/gather/driver.js +++ b/lighthouse-core/gather/driver.js @@ -12,6 +12,7 @@ const LHElement = require('../lib/lh-element.js'); const LHError = require('../lib/lh-error.js'); const NetworkRequest = require('../lib/network-request.js'); const EventEmitter = require('events').EventEmitter; +const i18n = require('../lib/i18n/i18n.js'); const URL = require('../lib/url-shim.js'); const constants = require('../config/constants.js'); @@ -24,6 +25,21 @@ const pageFunctions = require('../lib/page-functions.js'); // eslint-disable-next-line no-unused-vars const Connection = require('./connections/connection.js'); +const UIStrings = { + /** + * @description Warning that important data was not cleared but may have affected the scores of this run. + * @example {IndexedDB, Local Storage} locations + */ + warningData: `{locationCount, plural, + =1 {There may be important data in this location: {locations}. ` + + `Audit this page in an incognito window to prevent the resources from affecting your scores.} + other {There may be important data in these locations: {locations}. ` + + `Audit this page in an incognito window to prevent the resources from affecting your scores.} + }`, +}; + +const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings); + // Controls how long to wait after FCP before continuing const DEFAULT_PAUSE_AFTER_FCP = 0; // Controls how long to wait after onLoad before continuing @@ -1478,9 +1494,9 @@ class Driver { /** * @param {string} url - * @return {Promise} + * @param {(LH.IcuMessage | string)[]} LighthouseRunWarnings */ - async getImportantLocationsNotCleared(url) { + async getImportantStorageWarning(url, LighthouseRunWarnings) { const usageData = await this.sendCommand('Storage.getUsageAndQuota', { origin: url, }); @@ -1494,7 +1510,12 @@ class Driver { .filter(usage => usage.usage) .map(usage => storageTypeNames[usage.storageType] || '') .filter(Boolean); - return locations; + if (locations.length) { + LighthouseRunWarnings.push(str_( + UIStrings.warningData, + {locations: locations.join(', '), locationCount: locations.length} + )); + } } /** diff --git a/lighthouse-core/gather/gather-runner.js b/lighthouse-core/gather/gather-runner.js index 255e751f29be..6b592d1b9c19 100644 --- a/lighthouse-core/gather/gather-runner.js +++ b/lighthouse-core/gather/gather-runner.js @@ -29,16 +29,6 @@ const UIStrings = { */ warningTimeout: 'The page loaded too slowly to finish within the time limit. ' + 'Results may be incomplete.', - /** - * @description Warning that important data was not cleared but may have affected the scores of this run. - * @example {IndexedDB, Local Storage} locations - */ - warningData: `{locationCount, plural, - =1 {There may be important data in this location: {locations}. ` + - `Audit this page in an incognito window to prevent the resources from affecting your scores.} - other {There may be important data in these locations: {locations}. ` + - `Audit this page in an incognito window to prevent the resources from affecting your scores.} - }`, }; const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings); @@ -131,13 +121,7 @@ class GatherRunner { await driver.dismissJavaScriptDialogs(); await driver.registerRequestIdleCallbackWrap(options.settings); if (resetStorage) { - const locations = await driver.getImportantLocationsNotCleared(options.requestedUrl); - if (locations.length) { - LighthouseRunWarnings.push(str_( - UIStrings.warningData, - {locations: locations.join(', '), locationCount: locations.length} - )); - } + await driver.getImportantStorageWarning(options.requestedUrl, LighthouseRunWarnings); await driver.clearDataForOrigin(options.requestedUrl); } log.timeEnd(status); diff --git a/lighthouse-core/test/gather/driver-test.js b/lighthouse-core/test/gather/driver-test.js index abad4457441c..cd7f4d5a07bb 100644 --- a/lighthouse-core/test/gather/driver-test.js +++ b/lighthouse-core/test/gather/driver-test.js @@ -927,6 +927,50 @@ describe('.clearDataForOrigin', () => { }); }); +describe('.getImportantDataWarning', () => { + it('properly returns warning', async () => { + connectionStub.sendCommand = createMockSendCommandFn() + .mockResponse('Storage.getUsageAndQuota', {usageBreakdown: [ + {storageType: 'local_storage', usage: 5}, + {storageType: 'indexeddb', usage: 5}, + {storageType: 'websql', usage: 0}, + {storageType: 'appcache', usage: 5}, + {storageType: 'cookies', usage: 5}, + {storageType: 'file_systems', usage: 5}, + {storageType: 'shader_cache', usage: 5}, + {storageType: 'service_workers', usage: 5}, + {storageType: 'cache_storage', usage: 0}, + ]}); + /** @type {(LH.IcuMessage | string)[]} */ + const LighthouseRunWarnings = []; + await driver.getImportantStorageWarning('https://example.com', LighthouseRunWarnings); + expect(LighthouseRunWarnings).toHaveLength(1); + expect(LighthouseRunWarnings[0]).toBeDisplayString( + 'There may be important data in these locations: Local Storage, IndexedDB. ' + + 'Audit this page in an incognito window to prevent the resources from affecting your scores.' + ); + }); + + it('only warn for certain locations', async () => { + connectionStub.sendCommand = createMockSendCommandFn() + .mockResponse('Storage.getUsageAndQuota', {usageBreakdown: [ + {storageType: 'local_storage', usage: 0}, + {storageType: 'indexeddb', usage: 0}, + {storageType: 'websql', usage: 0}, + {storageType: 'appcache', usage: 5}, + {storageType: 'cookies', usage: 5}, + {storageType: 'file_systems', usage: 5}, + {storageType: 'shader_cache', usage: 5}, + {storageType: 'service_workers', usage: 5}, + {storageType: 'cache_storage', usage: 5}, + ]}); + /** @type {(LH.IcuMessage | string)[]} */ + const LighthouseRunWarnings = []; + await driver.getImportantStorageWarning('https://example.com', LighthouseRunWarnings); + expect(LighthouseRunWarnings).toHaveLength(0); + }); +}); + describe('Domain.enable/disable State', () => { it('dedupes (simple)', async () => { connectionStub.sendCommand = createMockSendCommandFn() diff --git a/lighthouse-core/test/gather/fake-driver.js b/lighthouse-core/test/gather/fake-driver.js index f2608de8c28b..6e5141aff845 100644 --- a/lighthouse-core/test/gather/fake-driver.js +++ b/lighthouse-core/test/gather/fake-driver.js @@ -62,8 +62,8 @@ function makeFakeDriver({protocolGetVersionResponse}) { }, cleanBrowserCaches() {}, clearDataForOrigin() {}, - getImportantLocationsNotCleared() { - return Promise.resolve([]); + getImportantStorageWarning() { + return Promise.resolve(); }, cacheNatives() { return Promise.resolve(); diff --git a/lighthouse-core/test/gather/gather-runner-test.js b/lighthouse-core/test/gather/gather-runner-test.js index 256a4562a499..f5f8c8f0f3e6 100644 --- a/lighthouse-core/test/gather/gather-runner-test.js +++ b/lighthouse-core/test/gather/gather-runner-test.js @@ -111,6 +111,9 @@ class EmulationDriver extends Driver { registerRequestIdleCallbackWrap() { return Promise.resolve(); } + getImportantStorageWarning() { + return Promise.resolve(); + } } const fakeDriver = require('./fake-driver.js'); @@ -132,8 +135,7 @@ function resetDefaultMockResponses() { .mockResponse('Network.setExtraHTTPHeaders') .mockResponse('Network.setUserAgentOverride') .mockResponse('Page.enable') - .mockResponse('ServiceWorker.enable') - .mockResponse('Storage.getUsageAndQuota', {usageBreakdown: []}); + .mockResponse('ServiceWorker.enable'); } beforeEach(() => { @@ -416,7 +418,7 @@ describe('GatherRunner', function() { clearDataForOrigin: createCheck('calledClearStorage'), blockUrlPatterns: asyncFunc, setExtraHTTPHeaders: asyncFunc, - getImportantLocationsNotCleared: () => Promise.resolve(''), + getImportantStorageWarning: asyncFunc, }; return GatherRunner.setupDriver(driver, {settings: {}}).then(_ => { @@ -425,40 +427,6 @@ describe('GatherRunner', function() { }); }); - it('warns if important data not cleared may impact performance', async () => { - const asyncFunc = () => Promise.resolve(); - driver.assertNoSameOriginServiceWorkerClients = asyncFunc; - driver.beginEmulation = asyncFunc; - driver.enableRuntimeEvents = asyncFunc; - driver.enableAsyncStacks = asyncFunc; - driver.cacheNatives = asyncFunc; - driver.registerPerformanceObserver = asyncFunc; - driver.dismissJavaScriptDialogs = asyncFunc; - driver.registerRequestIdleCallbackWrap = asyncFunc; - driver.clearDataForOrigin = asyncFunc; - - connectionStub.sendCommand = createMockSendCommandFn() - .mockResponse('Storage.getUsageAndQuota', {usageBreakdown: [ - {storageType: 'local_storage', usage: 5}, - {storageType: 'indexeddb', usage: 5}, - {storageType: 'websql', usage: 0}, - {storageType: 'appcache', usage: 5}, - {storageType: 'cookies', usage: 5}, - {storageType: 'file_systems', usage: 5}, - {storageType: 'shader_cache', usage: 5}, - {storageType: 'service_workers', usage: 5}, - {storageType: 'cache_storage', usage: 0}, - ]}); - /** @type {(string | LH.IcuMessage)[]} */ - const LighthouseRunWarnings = []; - await GatherRunner.setupDriver(driver, {settings: {}}, LighthouseRunWarnings); - expect(LighthouseRunWarnings[0]).toBeDisplayString(new RegExp( - 'There may be important data in these locations: Local Storage, IndexedDB. ' + - 'Audit this page in an incognito window to prevent ' + - 'the resources from affecting your scores.' - )); - }); - it('clears the disk & memory cache on a perf run', async () => { const asyncFunc = () => Promise.resolve(); /** @type {Record} */ diff --git a/types/jest.d.ts b/types/jest.d.ts index 96e551108499..c23c5a7bf491 100644 --- a/types/jest.d.ts +++ b/types/jest.d.ts @@ -20,6 +20,6 @@ declare namespace jest { /** * Asserts that an i18n string (using en-US) matches an expected pattern. */ - toBeDisplayString: (pattern: RegExp) => R; + toBeDisplayString: (pattern: RegExp | string) => R; } } From 25fade5363855b471816c46e892c28e1770aec67 Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Thu, 24 Sep 2020 16:40:02 -0400 Subject: [PATCH 11/16] update sample --- lighthouse-core/gather/driver.js | 1 + lighthouse-core/lib/i18n/locales/en-US.json | 2 +- lighthouse-core/lib/i18n/locales/en-XL.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lighthouse-core/gather/driver.js b/lighthouse-core/gather/driver.js index 696b35d12ddd..5dd724c9f332 100644 --- a/lighthouse-core/gather/driver.js +++ b/lighthouse-core/gather/driver.js @@ -1590,3 +1590,4 @@ class Driver { } module.exports = Driver; +module.exports.UIStrings = UIStrings; diff --git a/lighthouse-core/lib/i18n/locales/en-US.json b/lighthouse-core/lib/i18n/locales/en-US.json index 1519c8cef47d..cf0dee946721 100644 --- a/lighthouse-core/lib/i18n/locales/en-US.json +++ b/lighthouse-core/lib/i18n/locales/en-US.json @@ -1598,7 +1598,7 @@ "lighthouse-core/config/default-config.js | seoMobileGroupTitle": { "message": "Mobile Friendly" }, - "lighthouse-core/gather/gather-runner.js | warningData": { + "lighthouse-core/gather/driver.js | warningData": { "message": "{locationCount, plural,\n =1 {There may be important data in this location: {locations}. Audit this page in an incognito window to prevent the resources from affecting your scores.}\n other {There may be important data in these locations: {locations}. Audit this page in an incognito window to prevent the resources from affecting your scores.}\n }" }, "lighthouse-core/gather/gather-runner.js | warningRedirected": { diff --git a/lighthouse-core/lib/i18n/locales/en-XL.json b/lighthouse-core/lib/i18n/locales/en-XL.json index fe9060b7ef26..94795c275cfb 100644 --- a/lighthouse-core/lib/i18n/locales/en-XL.json +++ b/lighthouse-core/lib/i18n/locales/en-XL.json @@ -1598,7 +1598,7 @@ "lighthouse-core/config/default-config.js | seoMobileGroupTitle": { "message": "M̂ób̂íl̂é F̂ŕîén̂d́l̂ý" }, - "lighthouse-core/gather/gather-runner.js | warningData": { + "lighthouse-core/gather/driver.js | warningData": { "message": "{locationCount, plural,\n =1 {T̂h́êŕê ḿâý b̂é îḿp̂ór̂t́âńt̂ d́ât́â ín̂ t́ĥíŝ ĺôćât́îón̂: {locations}. Áûd́ît́ t̂h́îś p̂áĝé îń âń îńĉóĝńît́ô ẃîńd̂óŵ t́ô ṕr̂év̂én̂t́ t̂h́ê ŕêśôúr̂ćêś f̂ŕôḿ âf́f̂éĉt́îńĝ ýôúr̂ śĉór̂éŝ.}\n other {T́ĥér̂é m̂áŷ b́ê ím̂ṕôŕt̂án̂t́ d̂át̂á îń t̂h́êśê ĺôćât́îón̂ś: {locations}. Âúd̂ít̂ t́ĥíŝ ṕâǵê ín̂ án̂ ín̂ćôǵn̂ít̂ó ŵín̂d́ôẃ t̂ó p̂ŕêv́êńt̂ t́ĥé r̂éŝóûŕĉéŝ f́r̂óm̂ áf̂f́êćt̂ín̂ǵ ŷóûŕ ŝćôŕêś.}\n }" }, "lighthouse-core/gather/gather-runner.js | warningRedirected": { From 10891c5c5eb6985ebe804e84d6156fc724776429 Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Fri, 25 Sep 2020 13:45:51 -0400 Subject: [PATCH 12/16] nits --- lighthouse-core/gather/driver.js | 2 +- lighthouse-core/test/gather/driver-test.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lighthouse-core/gather/driver.js b/lighthouse-core/gather/driver.js index 5dd724c9f332..681540be699d 100644 --- a/lighthouse-core/gather/driver.js +++ b/lighthouse-core/gather/driver.js @@ -1500,7 +1500,7 @@ class Driver { const usageData = await this.sendCommand('Storage.getUsageAndQuota', { origin: url, }); - /** @type {Object.} */ + /** @type {Record} */ const storageTypeNames = { local_storage: 'Local Storage', indexeddb: 'IndexedDB', diff --git a/lighthouse-core/test/gather/driver-test.js b/lighthouse-core/test/gather/driver-test.js index cd7f4d5a07bb..a55d0111a50a 100644 --- a/lighthouse-core/test/gather/driver-test.js +++ b/lighthouse-core/test/gather/driver-test.js @@ -921,6 +921,9 @@ describe('.clearDataForOrigin', () => { foundStorageTypes = storageTypes; }); await driver.clearDataForOrigin('https://example.com'); + // Should not see cookies, websql, indexeddb, or local_storage. + // Cookies are not cleared to preserve login. + // websql, indexeddb, and local_storage are not cleared to preserve important user data. expect(foundStorageTypes).toMatchInlineSnapshot( `"appcache,file_systems,shader_cache,service_workers,cache_storage"` ); From e0eed1ddd6a19b7b7223b750876e166312350beb Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Mon, 28 Sep 2020 18:15:32 -0400 Subject: [PATCH 13/16] add todo --- lighthouse-core/gather/driver.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lighthouse-core/gather/driver.js b/lighthouse-core/gather/driver.js index 681540be699d..f1322932accf 100644 --- a/lighthouse-core/gather/driver.js +++ b/lighthouse-core/gather/driver.js @@ -1511,6 +1511,7 @@ class Driver { .map(usage => storageTypeNames[usage.storageType] || '') .filter(Boolean); if (locations.length) { + // TODO: Use Intl.ListFormat with Node 12 LighthouseRunWarnings.push(str_( UIStrings.warningData, {locations: locations.join(', '), locationCount: locations.length} From 567e33c91162f9cf87fdfae66fd01e145dba4a1b Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Tue, 29 Sep 2020 19:11:57 -0400 Subject: [PATCH 14/16] nits --- lighthouse-core/gather/driver.js | 21 ++++++++++++--------- lighthouse-core/gather/gather-runner.js | 5 ++++- lighthouse-core/lib/i18n/locales/en-US.json | 2 +- lighthouse-core/lib/i18n/locales/en-XL.json | 2 +- lighthouse-core/test/gather/driver-test.js | 19 ++++++++----------- 5 files changed, 26 insertions(+), 23 deletions(-) diff --git a/lighthouse-core/gather/driver.js b/lighthouse-core/gather/driver.js index f1322932accf..3cdd8f4ab6c7 100644 --- a/lighthouse-core/gather/driver.js +++ b/lighthouse-core/gather/driver.js @@ -27,14 +27,17 @@ const Connection = require('./connections/connection.js'); const UIStrings = { /** - * @description Warning that important data was not cleared but may have affected the scores of this run. + * @description A warning that previously-saved data may have affected the measured performance and instructions on how to avoid the problem. "locations" will be a list of possible types of data storage locations, e.g. "IndexedDB", "Local Storage", or "Web SQL". * @example {IndexedDB, Local Storage} locations */ warningData: `{locationCount, plural, - =1 {There may be important data in this location: {locations}. ` + - `Audit this page in an incognito window to prevent the resources from affecting your scores.} - other {There may be important data in these locations: {locations}. ` + - `Audit this page in an incognito window to prevent the resources from affecting your scores.} + =1 {There may be stored data affecting loading performance in this location: {locations}. ` + + `Audit this page in an incognito window to prevent those resources ` + + `from affecting your scores.} + other {There may be stored data affecting loading ` + + `performance in these locations: {locations}. ` + + `Audit this page in an incognito window to prevent those resources ` + + `from affecting your scores.} }`, }; @@ -1494,9 +1497,9 @@ class Driver { /** * @param {string} url - * @param {(LH.IcuMessage | string)[]} LighthouseRunWarnings + * @return {Promise} */ - async getImportantStorageWarning(url, LighthouseRunWarnings) { + async getImportantStorageWarning(url) { const usageData = await this.sendCommand('Storage.getUsageAndQuota', { origin: url, }); @@ -1512,10 +1515,10 @@ class Driver { .filter(Boolean); if (locations.length) { // TODO: Use Intl.ListFormat with Node 12 - LighthouseRunWarnings.push(str_( + return str_( UIStrings.warningData, {locations: locations.join(', '), locationCount: locations.length} - )); + ); } } diff --git a/lighthouse-core/gather/gather-runner.js b/lighthouse-core/gather/gather-runner.js index 6b592d1b9c19..87114a72b64f 100644 --- a/lighthouse-core/gather/gather-runner.js +++ b/lighthouse-core/gather/gather-runner.js @@ -121,7 +121,10 @@ class GatherRunner { await driver.dismissJavaScriptDialogs(); await driver.registerRequestIdleCallbackWrap(options.settings); if (resetStorage) { - await driver.getImportantStorageWarning(options.requestedUrl, LighthouseRunWarnings); + const warning = await driver.getImportantStorageWarning(options.requestedUrl); + if (warning) { + LighthouseRunWarnings.push(warning); + } await driver.clearDataForOrigin(options.requestedUrl); } log.timeEnd(status); diff --git a/lighthouse-core/lib/i18n/locales/en-US.json b/lighthouse-core/lib/i18n/locales/en-US.json index cf0dee946721..6b1d29f17194 100644 --- a/lighthouse-core/lib/i18n/locales/en-US.json +++ b/lighthouse-core/lib/i18n/locales/en-US.json @@ -1599,7 +1599,7 @@ "message": "Mobile Friendly" }, "lighthouse-core/gather/driver.js | warningData": { - "message": "{locationCount, plural,\n =1 {There may be important data in this location: {locations}. Audit this page in an incognito window to prevent the resources from affecting your scores.}\n other {There may be important data in these locations: {locations}. Audit this page in an incognito window to prevent the resources from affecting your scores.}\n }" + "message": "{locationCount, plural,\n =1 {There may be stored data affecting loading performance in this location: {locations}. Audit this page in an incognito window to prevent those resources from affecting your scores.}\n other {There may be stored data affecting loading performance in these locations: {locations}. Audit this page in an incognito window to prevent those resources from affecting your scores.}\n }" }, "lighthouse-core/gather/gather-runner.js | warningRedirected": { "message": "The page may not be loading as expected because your test URL ({requested}) was redirected to {final}. Try testing the second URL directly." diff --git a/lighthouse-core/lib/i18n/locales/en-XL.json b/lighthouse-core/lib/i18n/locales/en-XL.json index 94795c275cfb..f2ed7c492edc 100644 --- a/lighthouse-core/lib/i18n/locales/en-XL.json +++ b/lighthouse-core/lib/i18n/locales/en-XL.json @@ -1599,7 +1599,7 @@ "message": "M̂ób̂íl̂é F̂ŕîén̂d́l̂ý" }, "lighthouse-core/gather/driver.js | warningData": { - "message": "{locationCount, plural,\n =1 {T̂h́êŕê ḿâý b̂é îḿp̂ór̂t́âńt̂ d́ât́â ín̂ t́ĥíŝ ĺôćât́îón̂: {locations}. Áûd́ît́ t̂h́îś p̂áĝé îń âń îńĉóĝńît́ô ẃîńd̂óŵ t́ô ṕr̂év̂én̂t́ t̂h́ê ŕêśôúr̂ćêś f̂ŕôḿ âf́f̂éĉt́îńĝ ýôúr̂ śĉór̂éŝ.}\n other {T́ĥér̂é m̂áŷ b́ê ím̂ṕôŕt̂án̂t́ d̂át̂á îń t̂h́êśê ĺôćât́îón̂ś: {locations}. Âúd̂ít̂ t́ĥíŝ ṕâǵê ín̂ án̂ ín̂ćôǵn̂ít̂ó ŵín̂d́ôẃ t̂ó p̂ŕêv́êńt̂ t́ĥé r̂éŝóûŕĉéŝ f́r̂óm̂ áf̂f́êćt̂ín̂ǵ ŷóûŕ ŝćôŕêś.}\n }" + "message": "{locationCount, plural,\n =1 {T̂h́êŕê ḿâý b̂é ŝt́ôŕêd́ d̂át̂á âf́f̂éĉt́îńĝ ĺôád̂ín̂ǵ p̂ér̂f́ôŕm̂án̂ćê ín̂ t́ĥíŝ ĺôćât́îón̂: {locations}. Áûd́ît́ t̂h́îś p̂áĝé îń âń îńĉóĝńît́ô ẃîńd̂óŵ t́ô ṕr̂év̂én̂t́ t̂h́ôśê ŕêśôúr̂ćêś f̂ŕôḿ âf́f̂éĉt́îńĝ ýôúr̂ śĉór̂éŝ.}\n other {T́ĥér̂é m̂áŷ b́ê śt̂ór̂éd̂ d́ât́â áf̂f́êćt̂ín̂ǵ l̂óâd́îńĝ ṕêŕf̂ór̂ḿâńĉé îń t̂h́êśê ĺôćât́îón̂ś: {locations}. Âúd̂ít̂ t́ĥíŝ ṕâǵê ín̂ án̂ ín̂ćôǵn̂ít̂ó ŵín̂d́ôẃ t̂ó p̂ŕêv́êńt̂ t́ĥóŝé r̂éŝóûŕĉéŝ f́r̂óm̂ áf̂f́êćt̂ín̂ǵ ŷóûŕ ŝćôŕêś.}\n }" }, "lighthouse-core/gather/gather-runner.js | warningRedirected": { "message": "T̂h́ê ṕâǵê ḿâý n̂ót̂ b́ê ĺôád̂ín̂ǵ âś êx́p̂éĉt́êd́ b̂éĉáûśê ýôúr̂ t́êśt̂ ÚR̂Ĺ ({requested}) ŵáŝ ŕêd́îŕêćt̂éd̂ t́ô {final}. T́r̂ý t̂éŝt́îńĝ t́ĥé ŝéĉón̂d́ ÛŔL̂ d́îŕêćt̂ĺŷ." diff --git a/lighthouse-core/test/gather/driver-test.js b/lighthouse-core/test/gather/driver-test.js index a55d0111a50a..4dbe76b1f78b 100644 --- a/lighthouse-core/test/gather/driver-test.js +++ b/lighthouse-core/test/gather/driver-test.js @@ -944,13 +944,12 @@ describe('.getImportantDataWarning', () => { {storageType: 'service_workers', usage: 5}, {storageType: 'cache_storage', usage: 0}, ]}); - /** @type {(LH.IcuMessage | string)[]} */ - const LighthouseRunWarnings = []; - await driver.getImportantStorageWarning('https://example.com', LighthouseRunWarnings); - expect(LighthouseRunWarnings).toHaveLength(1); - expect(LighthouseRunWarnings[0]).toBeDisplayString( - 'There may be important data in these locations: Local Storage, IndexedDB. ' + - 'Audit this page in an incognito window to prevent the resources from affecting your scores.' + const warning = await driver.getImportantStorageWarning('https://example.com'); + expect(warning).toBeDisplayString( + 'There may be stored data affecting loading performance in ' + + 'these locations: Local Storage, IndexedDB. ' + + 'Audit this page in an incognito window to prevent those resources ' + + 'from affecting your scores.' ); }); @@ -967,10 +966,8 @@ describe('.getImportantDataWarning', () => { {storageType: 'service_workers', usage: 5}, {storageType: 'cache_storage', usage: 5}, ]}); - /** @type {(LH.IcuMessage | string)[]} */ - const LighthouseRunWarnings = []; - await driver.getImportantStorageWarning('https://example.com', LighthouseRunWarnings); - expect(LighthouseRunWarnings).toHaveLength(0); + const warning = await driver.getImportantStorageWarning('https://example.com'); + expect(warning).toBeUndefined(); }); }); From 7e6b688ad7beb647b505cffec33ffc5067ba16b9 Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Tue, 29 Sep 2020 19:17:42 -0400 Subject: [PATCH 15/16] link intl issue --- lighthouse-core/audits/multi-check-audit.js | 2 +- lighthouse-core/gather/driver.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lighthouse-core/audits/multi-check-audit.js b/lighthouse-core/audits/multi-check-audit.js index 5973e152358b..a617f4c1e253 100644 --- a/lighthouse-core/audits/multi-check-audit.js +++ b/lighthouse-core/audits/multi-check-audit.js @@ -53,7 +53,7 @@ class MultiCheckAudit extends Audit { if (result.failures.length > 0) { return { score: 0, - // TODO(#7238): make this i18n-able. + // TODO(#11495): make this i18n-able. explanation: `Failures: ${result.failures.join(',\n')}.`, details, }; diff --git a/lighthouse-core/gather/driver.js b/lighthouse-core/gather/driver.js index 3cdd8f4ab6c7..44a39dfe2000 100644 --- a/lighthouse-core/gather/driver.js +++ b/lighthouse-core/gather/driver.js @@ -1514,7 +1514,7 @@ class Driver { .map(usage => storageTypeNames[usage.storageType] || '') .filter(Boolean); if (locations.length) { - // TODO: Use Intl.ListFormat with Node 12 + // TODO(#11495): Use Intl.ListFormat with Node 12 return str_( UIStrings.warningData, {locations: locations.join(', '), locationCount: locations.length} From fabeb3908c9bd93940c66c823133634c3c898023 Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Tue, 29 Sep 2020 19:24:24 -0400 Subject: [PATCH 16/16] fix type thing --- lighthouse-core/test/gather/fake-driver.js | 2 +- lighthouse-core/test/gather/gather-runner-test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lighthouse-core/test/gather/fake-driver.js b/lighthouse-core/test/gather/fake-driver.js index 6e5141aff845..db166317525b 100644 --- a/lighthouse-core/test/gather/fake-driver.js +++ b/lighthouse-core/test/gather/fake-driver.js @@ -63,7 +63,7 @@ function makeFakeDriver({protocolGetVersionResponse}) { cleanBrowserCaches() {}, clearDataForOrigin() {}, getImportantStorageWarning() { - return Promise.resolve(); + return Promise.resolve(undefined); }, cacheNatives() { return Promise.resolve(); diff --git a/lighthouse-core/test/gather/gather-runner-test.js b/lighthouse-core/test/gather/gather-runner-test.js index f5f8c8f0f3e6..977047718c6d 100644 --- a/lighthouse-core/test/gather/gather-runner-test.js +++ b/lighthouse-core/test/gather/gather-runner-test.js @@ -112,7 +112,7 @@ class EmulationDriver extends Driver { return Promise.resolve(); } getImportantStorageWarning() { - return Promise.resolve(); + return Promise.resolve(undefined); } }