presidium 3.3.2 → 3.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/GoogleChromeDevTools.js
CHANGED
|
@@ -12,7 +12,7 @@ function getId() {
|
|
|
12
12
|
*
|
|
13
13
|
* @docs
|
|
14
14
|
* ```coffeescript [specscript]
|
|
15
|
-
* sendRequestJSON(payload
|
|
15
|
+
* sendRequestJSON(payload object) -> data Promise<Object>
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
18
|
async function sendRequestJSON(payload) {
|
|
@@ -23,13 +23,13 @@ async function sendRequestJSON(payload) {
|
|
|
23
23
|
|
|
24
24
|
const handler = function (message) {
|
|
25
25
|
const data = JSON.parse(message.toString('utf8'))
|
|
26
|
-
if (data.id == id) {
|
|
26
|
+
if (data.id == payload.id) {
|
|
27
27
|
resolve(data)
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
this.websocket.on('message', handler)
|
|
32
|
-
this.websocket.send(payload)
|
|
32
|
+
this.websocket.send(JSON.stringify(payload))
|
|
33
33
|
|
|
34
34
|
const data = await promise
|
|
35
35
|
this.websocket.removeListener('message', handler)
|
|
@@ -51,12 +51,12 @@ async function sendRequestJSON(payload) {
|
|
|
51
51
|
async function _Method(method, { sessionId, ...params }) {
|
|
52
52
|
const id = getId()
|
|
53
53
|
|
|
54
|
-
const payload =
|
|
54
|
+
const payload = {
|
|
55
55
|
sessionId: sessionId ?? this.sessionId,
|
|
56
56
|
id,
|
|
57
57
|
method,
|
|
58
58
|
params,
|
|
59
|
-
}
|
|
59
|
+
}
|
|
60
60
|
|
|
61
61
|
const data = await sendRequestJSON.call(this, payload)
|
|
62
62
|
|
|
@@ -371,6 +371,7 @@ class GoogleChromeDevToolsDOM {
|
|
|
371
371
|
* DOM.describeNode(options {
|
|
372
372
|
* sessionId: string,
|
|
373
373
|
* nodeId: string,
|
|
374
|
+
* depth: number,
|
|
374
375
|
* }) -> data Promise<{
|
|
375
376
|
* node: CDPDOM.Node,
|
|
376
377
|
* }>
|
|
@@ -382,6 +383,7 @@ class GoogleChromeDevToolsDOM {
|
|
|
382
383
|
* * `options`
|
|
383
384
|
* * `sessionId` - the session ID.
|
|
384
385
|
* * `nodeId` - the ID of the node to describe.
|
|
386
|
+
* * `depth` - the maximum depth of the subtree. Defaults to `1`. Use `-1` for the entire subtree.
|
|
385
387
|
*
|
|
386
388
|
* Return:
|
|
387
389
|
* * `data`
|
|
@@ -1052,6 +1054,7 @@ class GoogleChromeDevTools extends EventEmitter {
|
|
|
1052
1054
|
})
|
|
1053
1055
|
await this.googleChromeForTesting.init()
|
|
1054
1056
|
|
|
1057
|
+
console.log('initializing websocket with devtoolsUrl:', this.googleChromeForTesting.devtoolsUrl)
|
|
1055
1058
|
this.websocket = new WebSocket(this.googleChromeForTesting.devtoolsUrl, {
|
|
1056
1059
|
offerPerMessageDeflate: false,
|
|
1057
1060
|
})
|
|
@@ -267,8 +267,12 @@ class GoogleChromeForTesting {
|
|
|
267
267
|
const devtoolsUrlPromise = new Promise(_resolve => {
|
|
268
268
|
devtoolsUrlResolve = _resolve
|
|
269
269
|
})
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
|
|
271
|
+
const rl = readline.createInterface({
|
|
272
|
+
input: cmd.stderr,
|
|
273
|
+
})
|
|
274
|
+
|
|
275
|
+
rl.on('line', line => {
|
|
272
276
|
if (line.includes('DevTools listening on')) {
|
|
273
277
|
const devtoolsUrl = line.replace('DevTools listening on ', '')
|
|
274
278
|
devtoolsUrlResolve(devtoolsUrl)
|