diff --git a/lib/Browser.js b/lib/Browser.js index 46ae2874..3acff7f9 100644 --- a/lib/Browser.js +++ b/lib/Browser.js @@ -73,7 +73,7 @@ class Browser { if (!this._chromeProcess || this._terminated) throw new Error('ERROR: this chrome instance is not alive any more!'); var client = await Connection.create(this._remoteDebuggingPort); - var page = await Page.create(this, client); + var page = await Page.create(client); return page; } diff --git a/lib/Page.js b/lib/Page.js index 4e1871b1..46307f90 100644 --- a/lib/Page.js +++ b/lib/Page.js @@ -23,11 +23,10 @@ var Dialog = require('./Dialog'); class Page extends EventEmitter { /** - * @param {!Browser} browser * @param {!Connection} client * @return {!Promise} */ - static async create(browser, client) { + static async create(client) { await Promise.all([ client.send('Network.enable', {}), client.send('Page.enable', {}), @@ -35,20 +34,18 @@ class Page extends EventEmitter { client.send('Security.enable', {}), ]); var screenDPI = await helpers.evaluate(client, () => window.devicePixelRatio, []); - var page = new Page(browser, client, screenDPI.result.value); + var page = new Page(client, screenDPI.result.value); // Initialize default page size. await page.setViewportSize({width: 400, height: 300}); return page; } /** - * @param {!Browser} browser * @param {!Connection} client * @param {number} screenDPI */ - constructor(browser, client, screenDPI) { + constructor(client, screenDPI) { super(); - this._browser = browser; this._client = client; this._screenDPI = screenDPI; this._extraHeaders = {};