Skip to content

Commit

Permalink
core(driver): recover from rejection on handleJavaScriptDialog (#6327)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish authored Oct 17, 2018
1 parent 1e3ef60 commit 03f8d02
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lighthouse-core/gather/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -1196,17 +1196,16 @@ class Driver {
* @return {Promise<void>}
*/
async dismissJavaScriptDialogs() {
await this.sendCommand('Page.enable');

this.on('Page.javascriptDialogOpening', data => {
log.warn('Driver', `${data.type} dialog opened by the page automatically suppressed.`);

// rejection intentionally unhandled
this.sendCommand('Page.handleJavaScriptDialog', {
accept: true,
promptText: 'Lighthouse prompt response',
});
}).catch(err => log.warn('Driver', err));
});

await this.sendCommand('Page.enable');
}
}

Expand Down

0 comments on commit 03f8d02

Please sign in to comment.