From 615381c70e809d9a9dd1e6b0d8ec2441233e136d Mon Sep 17 00:00:00 2001 From: JoelEinbinder Date: Tue, 25 Jul 2017 00:44:13 -0700 Subject: [PATCH] Remove browser.closePage. (#124) Remove browser.closePage. Closes #116 --- docs/api.md | 7 ------- lib/Browser.js | 17 ++++------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/docs/api.md b/docs/api.md index 04ba9d02291..9b40658bbfd 100644 --- a/docs/api.md +++ b/docs/api.md @@ -9,7 +9,6 @@ * [class: Browser](#class-browser) + [new Browser([options])](#new-browseroptions) + [browser.close()](#browserclose) - + [browser.closePage(page)](#browserclosepagepage) + [browser.newPage()](#browsernewpage) + [browser.stderr](#browserstderr) + [browser.stdout](#browserstdout) @@ -197,12 +196,6 @@ browser.newPage().then(async page => { Closes browser with all the pages (if any were opened). The browser object itself is considered to be disposed and could not be used anymore. -#### browser.closePage(page) -- `page` <[Page]> A page to be closed. -- returns: <[Promise]> Promise which resolves when the page is closed. - -This is an alias for the `page.close()` method. - #### browser.newPage() - returns: <[Promise]<[Page]>> Promise which resolves to a new [Page] object. diff --git a/lib/Browser.js b/lib/Browser.js index 69704c0f2c0..4a136ed5ea2 100644 --- a/lib/Browser.js +++ b/lib/Browser.js @@ -84,8 +84,8 @@ class Browser { } /** - * @return {!Promise} - */ + * @return {!Promise} + */ async newPage() { await this._ensureChromeIsRunning(); if (!this._chromeProcess || this._terminated) @@ -96,17 +96,8 @@ class Browser { } /** - * @param {!Page} page - */ - async closePage(page) { - if (!this._chromeProcess || this._terminated) - throw new Error('ERROR: this chrome instance is not running'); - await page.close(); - } - - /** - * @return {string} - */ + * @return {string} + */ async version() { await this._ensureChromeIsRunning(); let version = await Connection.version(this._remoteDebuggingPort);