Skip to content

Commit c6a8480

Browse files
committed
coding
1 parent 3dfd745 commit c6a8480

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

lib/chrome.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class Chrome extends EventEmitter {
5656
this.useHostName = !!(options.useHostName);
5757
this.alterPath = options.alterPath || ((path) => path);
5858
this.protocol = options.protocol;
59-
this.local = !!(options.local || options.process);
59+
this.local = !!(options.local);
6060
this.target = options.target || defaultTarget;
6161
this.connectOptions = options.connectOptions;
6262
this.process = options.process;
@@ -121,11 +121,10 @@ class Chrome extends EventEmitter {
121121
try {
122122
if (this.process)
123123
{
124-
const options = {local: this.local, cdp: this};
125124
// we first "connect" to stdio pipes, so that we can
126125
// first the protocol remotely via the pipe.
127126
await this._connect();
128-
const protocol = await this._fetchProtocol(options);
127+
const protocol = await this._fetchProtocol({});
129128
api.prepare(this, protocol);
130129
}
131130
else
@@ -139,7 +138,7 @@ class Chrome extends EventEmitter {
139138
...this.connectOptions,
140139
};
141140
// fetch the WebSocket debugger URL
142-
const url = await this._fetchDebuggerURL(options);
141+
const url = await this._fetchWsDebuggerURL(options);
143142
// allow the user to alter the URL
144143
const urlObject = parseUrl(url);
145144
urlObject.pathname = options.alterPath(urlObject.pathname);
@@ -166,7 +165,7 @@ class Chrome extends EventEmitter {
166165
}
167166

168167
// fetch the WebSocket URL according to 'target'
169-
async _fetchDebuggerURL(options) {
168+
async _fetchWsDebuggerURL(options) {
170169
const userTarget = this.target;
171170
switch (typeof userTarget) {
172171
case 'string': {
@@ -211,6 +210,8 @@ class Chrome extends EventEmitter {
211210
// otherwise user either the local or the remote version
212211
else {
213212
options.local = this.local;
213+
if (this.process)
214+
options.cdp = this;
214215
return await devtools.Protocol(options);
215216
}
216217
}

lib/devtools.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function Protocol(options, callback) {
5353
{
5454
return options.cdp.send('Browser.getProtocolJson')
5555
.then(data=>callback(null, JSON.parse(data.result)))
56-
.catch(callback)
56+
.catch(callback);
5757
}
5858
// if the local protocol is requested
5959
if (options.local) {

0 commit comments

Comments
 (0)