feat(worker): implement pageerror event from a worker (#2795)

Fixes #2761
This commit is contained in:
Yaniv Efraim
2018-06-26 01:10:36 +03:00
committed by Andrey Lushnikov
parent 811415bc8c
commit aae73f5fd7
3 changed files with 10 additions and 2 deletions

View File

@@ -22,8 +22,9 @@ class Worker extends EventEmitter {
* @param {Puppeteer.CDPSession} client
* @param {string} url
* @param {function(!string, !Array<!JSHandle>)} consoleAPICalled
* @param {function(!Protocol.Runtime.ExceptionDetails)} exceptionThrown
*/
constructor(client, url, consoleAPICalled) {
constructor(client, url, consoleAPICalled, exceptionThrown) {
super();
this._client = client;
this._url = url;
@@ -39,6 +40,7 @@ class Worker extends EventEmitter {
this._client.send('Runtime.enable', {}).catch(debugError);
this._client.on('Runtime.consoleAPICalled', event => consoleAPICalled(event.type, event.args.map(jsHandleFactory)));
this._client.on('Runtime.exceptionThrown', exception => exceptionThrown(exception.exceptionDetails));
}
/**