Skip to content

Commit

Permalink
Remove promise jsdoc (puppeteer#641)
Browse files Browse the repository at this point in the history
This patch removes unnecessary "promise" return types in jsdoc for async functions.
  • Loading branch information
JoelEinbinder authored and aslushnikov committed Sep 1, 2017
1 parent 62ececb commit 42fa3af
Show file tree
Hide file tree
Showing 12 changed files with 1 addition and 59 deletions.
6 changes: 0 additions & 6 deletions lib/Connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ class Connection extends EventEmitter {
this._sessions.clear();
}

/**
* @return {!Promise}
*/
dispose() {
this._onClose();
this._ws.close();
Expand Down Expand Up @@ -203,9 +200,6 @@ class Session extends EventEmitter {
}
}

/**
* @return {!Promise}
*/
async dispose() {
await this._connection.send('Target.closeTarget', {targetId: this._targetId});
}
Expand Down
4 changes: 0 additions & 4 deletions lib/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class Dialog {

/**
* @param {string=} promptText
* @return {!Promise}
*/
async accept(promptText) {
console.assert(!this._handled, 'Cannot accept dialog which is already handled!');
Expand All @@ -58,9 +57,6 @@ class Dialog {
});
}

/**
* @return {!Promise}
*/
async dismiss() {
console.assert(!this._handled, 'Cannot dismiss dialog which is already handled!');
this._handled = true;
Expand Down
7 changes: 0 additions & 7 deletions lib/ElementHandle.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ class ElementHandle {
this._disposed = false;
}

/**
* @return {!Promise}
*/
async dispose() {
if (this._disposed)
return;
Expand Down Expand Up @@ -77,17 +74,13 @@ class ElementHandle {
return center;
}

/**
* @return {!Promise}
*/
async hover() {
const {x, y} = await this._visibleCenter();
await this._mouse.move(x, y);
}

/**
* @param {!Object=} options
* @return {!Promise}
*/
async click(options) {
const {x, y} = await this._visibleCenter();
Expand Down
3 changes: 1 addition & 2 deletions lib/FrameManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class Frame {

/**
* @param {string} filePath
* @return {!Promise}
* @return {!Promise<*>}
*/
async injectFile(filePath) {
let contents = await new Promise((resolve, reject) => {
Expand All @@ -299,7 +299,6 @@ class Frame {

/**
* @param {string} url
* @return {!Promise}
*/
async addScriptTag(url) {
return this.evaluate(addScriptTag, url);
Expand Down
3 changes: 0 additions & 3 deletions lib/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class Keyboard {
/**
* @param {string} key
* @param {{text: (string|undefined)}} options
* @return {!Promise}
*/
async down(key, options = {}) {
const text = options.text;
Expand Down Expand Up @@ -65,7 +64,6 @@ class Keyboard {

/**
* @param {string} key
* @return {!Promise}
*/
async up(key) {
this._modifiers &= ~this._modifierBit(key);
Expand All @@ -80,7 +78,6 @@ class Keyboard {

/**
* @param {string} char
* @return {!Promise}
*/
async sendCharacter(char) {
await this._client.send('Input.dispatchKeyEvent', {
Expand Down
3 changes: 0 additions & 3 deletions lib/NetworkManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class NetworkManager extends EventEmitter {

/**
* @param {!Object<string, string>} extraHTTPHeaders
* @return {!Promise}
*/
async setExtraHTTPHeaders(extraHTTPHeaders) {
this._extraHTTPHeaders = {};
Expand All @@ -65,15 +64,13 @@ class NetworkManager extends EventEmitter {

/**
* @param {string} userAgent
* @return {!Promise}
*/
async setUserAgent(userAgent) {
return this._client.send('Network.setUserAgentOverride', { userAgent });
}

/**
* @param {boolean} value
* @return {!Promise}
*/
async setRequestInterceptionEnabled(value) {
await this._client.send('Network.setRequestInterceptionEnabled', {enabled: !!value});
Expand Down
17 changes: 0 additions & 17 deletions lib/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,13 @@ class Page extends EventEmitter {

/**
* @param {string} url
* @return {!Promise}
*/
async addScriptTag(url) {
return this.mainFrame().addScriptTag(url);
}

/**
* @param {string} filePath
* @return {!Promise}
*/
async injectFile(filePath) {
return this.mainFrame().injectFile(filePath);
Expand Down Expand Up @@ -252,15 +250,13 @@ class Page extends EventEmitter {

/**
* @param {!Object<string, string>} headers
* @return {!Promise}
*/
async setExtraHTTPHeaders(headers) {
return this._networkManager.setExtraHTTPHeaders(headers);
}

/**
* @param {string} userAgent
* @return {!Promise}
*/
async setUserAgent(userAgent) {
return this._networkManager.setUserAgent(userAgent);
Expand Down Expand Up @@ -333,7 +329,6 @@ class Page extends EventEmitter {

/**
* @param {string} html
* @return {!Promise}
*/
async setContent(html) {
await this.evaluate(html => {
Expand Down Expand Up @@ -425,7 +420,6 @@ class Page extends EventEmitter {

/**
* @param {!Object} options
* @return {!Promise}
*/
async emulate(options) {
return Promise.all([
Expand All @@ -443,7 +437,6 @@ class Page extends EventEmitter {

/**
* @param {?string} mediaType
* @return {!Promise}
*/
async emulateMedia(mediaType) {
console.assert(mediaType === 'screen' || mediaType === 'print' || mediaType === null, 'Unsupported media type: ' + mediaType);
Expand All @@ -452,7 +445,6 @@ class Page extends EventEmitter {

/**
* @param {!Page.Viewport} viewport
* @return {!Promise}
*/
async setViewport(viewport) {
const needsReload = await this._emulationManager.emulateViewport(this._client, viewport);
Expand Down Expand Up @@ -480,7 +472,6 @@ class Page extends EventEmitter {
/**
* @param {function()|string} pageFunction
* @param {!Array<*>} args
* @return {!Promise}
*/
async evaluateOnNewDocument(pageFunction, ...args) {
const source = helper.evaluationString(pageFunction, ...args);
Expand Down Expand Up @@ -627,9 +618,6 @@ class Page extends EventEmitter {
return this.mainFrame().title();
}

/**
* @return {!Promise}
*/
async close() {
await this._client.dispose();
}
Expand All @@ -644,7 +632,6 @@ class Page extends EventEmitter {
/**
* @param {string} selector
* @param {!Object} options
* @return {!Promise}
*/
async click(selector, options) {
const handle = await this.$(selector);
Expand All @@ -655,7 +642,6 @@ class Page extends EventEmitter {

/**
* @param {string} selector
* @param {!Promise}
*/
async hover(selector) {
const handle = await this.$(selector);
Expand All @@ -666,7 +652,6 @@ class Page extends EventEmitter {

/**
* @param {string} selector
* @return {!Promise}
*/
async focus(selector) {
const handle = await this.$(selector);
Expand All @@ -678,7 +663,6 @@ class Page extends EventEmitter {
/**
* @param {string} text
* @param {{delay: (number|undefined)}=} options
* @return {!Promise}
*/
async type(text, options) {
let delay = 0;
Expand All @@ -696,7 +680,6 @@ class Page extends EventEmitter {
/**
* @param {string} text
* @param {!Object=} options
* @return {!Promise}
*/
async press(key, options) {
this._keyboard.down(key, options);
Expand Down
5 changes: 0 additions & 5 deletions lib/Tracing.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class Tracing {

/**
* @param {!Object} options
* @return {!Promise}
*/
async start(options) {
console.assert(!this._recording, 'Cannot start recording trace while already recording trace.');
Expand All @@ -52,9 +51,6 @@ class Tracing {
});
}

/**
* @return {!Promise}
*/
async stop() {
let fulfill;
const contentPromise = new Promise(x => fulfill = x);
Expand All @@ -69,7 +65,6 @@ class Tracing {
/**
* @param {string} handle
* @param {string} path
* @return {!Promise}
*/
async _readStream(handle, path) {
let eof = false;
Expand Down
1 change: 0 additions & 1 deletion lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ class Helper {
/**
* @param {!Session} client
* @param {!Object} remoteObject
* @return {!Promise}
*/
static async releaseObject(client, remoteObject) {
if (!remoteObject.objectId)
Expand Down
3 changes: 0 additions & 3 deletions test/frame-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const utils = module.exports = {
* @param {!Page} page
* @param {string} frameId
* @param {string} url
* @return {!Promise}
*/
attachFrame: async function(page, frameId, url) {
await page.evaluate(attachFrame, frameId, url);
Expand All @@ -36,7 +35,6 @@ const utils = module.exports = {
/**
* @param {!Page} page
* @param {string} frameId
* @return {!Promise}
*/
detachFrame: async function(page, frameId) {
await page.evaluate(detachFrame, frameId);
Expand All @@ -51,7 +49,6 @@ const utils = module.exports = {
* @param {!Page} page
* @param {string} frameId
* @param {string} url
* @return {!Promise}
*/
navigateFrame: async function(page, frameId, url) {
await page.evaluate(navigateFrame, frameId, url);
Expand Down
3 changes: 0 additions & 3 deletions test/server/SimpleServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ class SimpleServer {
socket.once('close', () => this._sockets.delete(socket));
}

/**
* @return {!Promise}
*/
async stop() {
this.reset();
for (const socket of this._sockets)
Expand Down
5 changes: 0 additions & 5 deletions utils/check_availability.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ const fromRevision = parseInt(process.argv[2], 10);
const toRevision = parseInt(process.argv[3], 10);
checkRangeAvailability(fromRevision, toRevision);

/**
* @return {!Promise}
*/
async function checkOmahaProxyAvailability() {
console.log('Fetching revisions from ' + OMAHA_PROXY);
const platforms = await loadJSON(OMAHA_PROXY);
Expand Down Expand Up @@ -93,7 +90,6 @@ async function checkOmahaProxyAvailability() {
/**
* @param {number} fromRevision
* @param {number} toRevision
* @return {!Promise}
*/
async function checkRangeAvailability(fromRevision, toRevision) {
const table = new Table([10, 7, 7, 7, 7]);
Expand All @@ -107,7 +103,6 @@ async function checkRangeAvailability(fromRevision, toRevision) {
* @param {!Table} table
* @param {string} name
* @param {number} revision
* @return {!Promise}
*/
async function checkAndDrawRevisionAvailability(table, name, revision) {
const promises = [];
Expand Down

0 comments on commit 42fa3af

Please sign in to comment.