From 43e93bc71d66f479c50d0d0eca8de6807b39057c Mon Sep 17 00:00:00 2001 From: Paul Irish Date: Tue, 26 Sep 2017 12:21:05 -0700 Subject: [PATCH] Don't wait for Page.navigate's resolution (#3413) --- lighthouse-core/gather/driver.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lighthouse-core/gather/driver.js b/lighthouse-core/gather/driver.js index f5b957b080e6..34579f994e36 100644 --- a/lighthouse-core/gather/driver.js +++ b/lighthouse-core/gather/driver.js @@ -622,9 +622,14 @@ class Driver { /* eslint-enable max-len */ return this._beginNetworkStatusMonitoring(url) - .then(_ => this.sendCommand('Page.enable')) - .then(_ => this.sendCommand('Emulation.setScriptExecutionDisabled', {value: disableJS})) - .then(_ => this.sendCommand('Page.navigate', {url})) + .then(_ => { + // These can 'race' and that's OK. + // We don't want to wait for Page.navigate's resolution, as it can now + // happen _after_ onload: https://crbug.com/768961 + this.sendCommand('Page.enable'); + this.sendCommand('Emulation.setScriptExecutionDisabled', {value: disableJS}); + this.sendCommand('Page.navigate', {url}); + }) .then(_ => waitForLoad && this._waitForFullyLoaded(pauseAfterLoadMs, networkQuietThresholdMs, cpuQuietThresholdMs, maxWaitMs)) .then(_ => this._endNetworkStatusMonitoring());