fix(firefox): enable domains in a proper order (#4077)

Otherwise we might get console messages from Page domain before
we get execution contexts reported.
This commit is contained in:
Andrey Lushnikov 2019-02-26 16:52:50 -08:00 committed by GitHub
parent 9ef23b1754
commit dae998ec06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,9 +27,9 @@ class Page extends EventEmitter {
static async create(session, target, defaultViewport) {
const page = new Page(session, target);
await Promise.all([
session.send('Page.enable'),
session.send('Network.enable'),
session.send('Runtime.enable'),
session.send('Network.enable'),
session.send('Page.enable'),
]);
if (defaultViewport)
@ -729,9 +729,6 @@ class Page extends EventEmitter {
return await this._frameManager.mainFrame().setContent(html);
}
_onClosed() {
}
_onConsole({type, args, executionContextId, location}) {
const context = this._frameManager.executionContextById(executionContextId);
this.emit(Events.Page.Console, new ConsoleMessage(type, args.map(arg => createHandle(context, arg)), location));