Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core(driver): add driver.wsEndpoint() #3864

Merged
merged 3 commits into from
Nov 21, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lighthouse-core/gather/connections/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ class Connection {
return Promise.reject(new Error('Not implemented'));
}


/**
* @return {!Promise}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we still say !Promise<string> here just it'll always be rejected?

*/
wsEndpoint() {
return Promise.reject(new Error('Not implemented'));
}


/**
* Call protocol methods
* @param {!string} method
Expand Down
9 changes: 9 additions & 0 deletions lighthouse-core/gather/connections/cri.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ class CriConnection extends Connection {
});
}

/**
* @override
* @return {!Promise<string>}
*/
wsEndpoint() {
return this._runJsonCommand('version').then(response => response.webSocketDebuggerUrl)
}


/**
* @override
* @param {string} message
Expand Down
4 changes: 4 additions & 0 deletions lighthouse-core/gather/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ class Driver {
return this._connection.disconnect();
}

wsEndpoint() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy/paste jsdoc or hopefully tsc smart enough?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add docs for which endpoint this is? And I can't imagine who would think otherwise, but probably worth noting that it's CRI-only

return this._connection.wsEndpoint();
}

/**
* Bind listeners for protocol events
* @param {!string} eventName
Expand Down