Remove promise jsdoc (#641)

This patch removes unnecessary "promise" return types in jsdoc for async functions.
This commit is contained in:
JoelEinbinder 2017-08-31 17:58:07 -07:00 committed by Andrey Lushnikov
parent 62ececb1c7
commit 42fa3af659
12 changed files with 1 additions and 59 deletions

View File

@ -117,9 +117,6 @@ class Connection extends EventEmitter {
this._sessions.clear();
}
/**
* @return {!Promise}
*/
dispose() {
this._onClose();
this._ws.close();
@ -203,9 +200,6 @@ class Session extends EventEmitter {
}
}
/**
* @return {!Promise}
*/
async dispose() {
await this._connection.send('Target.closeTarget', {targetId: this._targetId});
}

View File

@ -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!');
@ -58,9 +57,6 @@ class Dialog {
});
}
/**
* @return {!Promise}
*/
async dismiss() {
console.assert(!this._handled, 'Cannot dismiss dialog which is already handled!');
this._handled = true;

View File

@ -29,9 +29,6 @@ class ElementHandle {
this._disposed = false;
}
/**
* @return {!Promise}
*/
async dispose() {
if (this._disposed)
return;
@ -77,9 +74,6 @@ class ElementHandle {
return center;
}
/**
* @return {!Promise}
*/
async hover() {
const {x, y} = await this._visibleCenter();
await this._mouse.move(x, y);
@ -87,7 +81,6 @@ class ElementHandle {
/**
* @param {!Object=} options
* @return {!Promise}
*/
async click(options) {
const {x, y} = await this._visibleCenter();

View File

@ -284,7 +284,7 @@ class Frame {
/**
* @param {string} filePath
* @return {!Promise}
* @return {!Promise<*>}
*/
async injectFile(filePath) {
let contents = await new Promise((resolve, reject) => {
@ -299,7 +299,6 @@ class Frame {
/**
* @param {string} url
* @return {!Promise}
*/
async addScriptTag(url) {
return this.evaluate(addScriptTag, url);

View File

@ -29,7 +29,6 @@ class Keyboard {
/**
* @param {string} key
* @param {{text: (string|undefined)}} options
* @return {!Promise}
*/
async down(key, options = {}) {
const text = options.text;
@ -65,7 +64,6 @@ class Keyboard {
/**
* @param {string} key
* @return {!Promise}
*/
async up(key) {
this._modifiers &= ~this._modifierBit(key);
@ -80,7 +78,6 @@ class Keyboard {
/**
* @param {string} char
* @return {!Promise}
*/
async sendCharacter(char) {
await this._client.send('Input.dispatchKeyEvent', {

View File

@ -47,7 +47,6 @@ class NetworkManager extends EventEmitter {
/**
* @param {!Object<string, string>} extraHTTPHeaders
* @return {!Promise}
*/
async setExtraHTTPHeaders(extraHTTPHeaders) {
this._extraHTTPHeaders = {};
@ -65,7 +64,6 @@ class NetworkManager extends EventEmitter {
/**
* @param {string} userAgent
* @return {!Promise}
*/
async setUserAgent(userAgent) {
return this._client.send('Network.setUserAgentOverride', { userAgent });
@ -73,7 +71,6 @@ class NetworkManager extends EventEmitter {
/**
* @param {boolean} value
* @return {!Promise}
*/
async setRequestInterceptionEnabled(value) {
await this._client.send('Network.setRequestInterceptionEnabled', {enabled: !!value});

View File

@ -205,7 +205,6 @@ class Page extends EventEmitter {
/**
* @param {string} url
* @return {!Promise}
*/
async addScriptTag(url) {
return this.mainFrame().addScriptTag(url);
@ -213,7 +212,6 @@ class Page extends EventEmitter {
/**
* @param {string} filePath
* @return {!Promise}
*/
async injectFile(filePath) {
return this.mainFrame().injectFile(filePath);
@ -252,7 +250,6 @@ class Page extends EventEmitter {
/**
* @param {!Object<string, string>} headers
* @return {!Promise}
*/
async setExtraHTTPHeaders(headers) {
return this._networkManager.setExtraHTTPHeaders(headers);
@ -260,7 +257,6 @@ class Page extends EventEmitter {
/**
* @param {string} userAgent
* @return {!Promise}
*/
async setUserAgent(userAgent) {
return this._networkManager.setUserAgent(userAgent);
@ -333,7 +329,6 @@ class Page extends EventEmitter {
/**
* @param {string} html
* @return {!Promise}
*/
async setContent(html) {
await this.evaluate(html => {
@ -425,7 +420,6 @@ class Page extends EventEmitter {
/**
* @param {!Object} options
* @return {!Promise}
*/
async emulate(options) {
return Promise.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);
@ -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);
@ -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);
@ -627,9 +618,6 @@ class Page extends EventEmitter {
return this.mainFrame().title();
}
/**
* @return {!Promise}
*/
async close() {
await this._client.dispose();
}
@ -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);
@ -655,7 +642,6 @@ class Page extends EventEmitter {
/**
* @param {string} selector
* @param {!Promise}
*/
async hover(selector) {
const handle = await this.$(selector);
@ -666,7 +652,6 @@ class Page extends EventEmitter {
/**
* @param {string} selector
* @return {!Promise}
*/
async focus(selector) {
const handle = await this.$(selector);
@ -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;
@ -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);

View File

@ -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.');
@ -52,9 +51,6 @@ class Tracing {
});
}
/**
* @return {!Promise}
*/
async stop() {
let fulfill;
const contentPromise = new Promise(x => fulfill = x);
@ -69,7 +65,6 @@ class Tracing {
/**
* @param {string} handle
* @param {string} path
* @return {!Promise}
*/
async _readStream(handle, path) {
let eof = false;

View File

@ -90,7 +90,6 @@ class Helper {
/**
* @param {!Session} client
* @param {!Object} remoteObject
* @return {!Promise}
*/
static async releaseObject(client, remoteObject) {
if (!remoteObject.objectId)

View File

@ -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);
@ -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);
@ -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);

View File

@ -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)

View File

@ -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);
@ -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]);
@ -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 = [];