appium-remote-debugger 14.0.4 → 15.0.0
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/CHANGELOG.md +21 -0
- package/build/lib/rpc/remote-messages.d.ts +0 -11
- package/build/lib/rpc/remote-messages.d.ts.map +1 -1
- package/build/lib/rpc/remote-messages.js +25 -58
- package/build/lib/rpc/remote-messages.js.map +1 -1
- package/build/lib/rpc/rpc-client.d.ts +3 -15
- package/build/lib/rpc/rpc-client.d.ts.map +1 -1
- package/build/lib/rpc/rpc-client.js +56 -101
- package/build/lib/rpc/rpc-client.js.map +1 -1
- package/build/lib/rpc/rpc-message-handler.d.ts +1 -14
- package/build/lib/rpc/rpc-message-handler.d.ts.map +1 -1
- package/build/lib/rpc/rpc-message-handler.js +2 -19
- package/build/lib/rpc/rpc-message-handler.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/lib/rpc/remote-messages.js +25 -60
- package/lib/rpc/rpc-client.js +58 -110
- package/lib/rpc/rpc-message-handler.js +2 -21
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [15.0.0](https://github.com/appium/appium-remote-debugger/compare/v14.0.5...v15.0.0) (2025-09-06)
|
|
2
|
+
|
|
3
|
+
### ⚠ BREAKING CHANGES
|
|
4
|
+
|
|
5
|
+
* Changed constructor signature of RemoteMessages class. It does not accept any arguments now
|
|
6
|
+
* Removed the obsolete isTargetBased getter and setter from RemoteMessages class instances
|
|
7
|
+
* Removed the obsolete needsTarget getter and isTargetBased property from RpcClient class instances
|
|
8
|
+
* Removed the obsolete isTargetBased getter and setter from RpcClient class instances
|
|
9
|
+
* Changed constructor signature of RpcMessageHandler class. It does not accept any arguments now
|
|
10
|
+
* Removed the obsolete isTargetBased getter and setter from RpcMessageHandler class instances
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* Drop the obsolete non-target based communication protocol support ([#440](https://github.com/appium/appium-remote-debugger/issues/440)) ([e70e7fe](https://github.com/appium/appium-remote-debugger/commit/e70e7fe20b73b8a9ff293d54a55708a5984437e3))
|
|
15
|
+
|
|
16
|
+
## [14.0.5](https://github.com/appium/appium-remote-debugger/compare/v14.0.4...v14.0.5) (2025-08-29)
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* Update page initialization logic to avoid conflicts ([#438](https://github.com/appium/appium-remote-debugger/issues/438)) ([cb03aa3](https://github.com/appium/appium-remote-debugger/commit/cb03aa394b3df07db70e5cdbd0efd00f96430a78))
|
|
21
|
+
|
|
1
22
|
## [14.0.4](https://github.com/appium/appium-remote-debugger/compare/v14.0.3...v14.0.4) (2025-08-28)
|
|
2
23
|
|
|
3
24
|
### Bug Fixes
|
|
@@ -5,17 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export function isDirectCommand(command: string): boolean;
|
|
7
7
|
export class RemoteMessages {
|
|
8
|
-
constructor(isTargetBased?: boolean);
|
|
9
|
-
_isTargetBased: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* @param {boolean} isTargetBased
|
|
12
|
-
* @returns {boolean}
|
|
13
|
-
*/
|
|
14
|
-
set isTargetBased(isTargetBased: boolean);
|
|
15
|
-
/**
|
|
16
|
-
* @returns {boolean}
|
|
17
|
-
*/
|
|
18
|
-
get isTargetBased(): boolean;
|
|
19
8
|
/**
|
|
20
9
|
*
|
|
21
10
|
* @param {string} connId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-messages.d.ts","sourceRoot":"","sources":["../../../lib/rpc/remote-messages.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remote-messages.d.ts","sourceRoot":"","sources":["../../../lib/rpc/remote-messages.js"],"names":[],"mappings":"AA8SA;;;;GAIG;AACH,yCAHW,MAAM,GACJ,OAAO,CAInB;AAzRD;IAGE;;;;OAIG;IACH,yBAHW,MAAM,GACJ,OAAO,UAAU,EAAE,gBAAgB,CAS/C;IAED;;;;;OAKG;IACH,qBAJW,MAAM,YACN,OAAO,UAAU,EAAE,QAAQ,GACzB,OAAO,UAAU,EAAE,gBAAgB,CAU/C;IAED;;;;;;;OAOG;IACH,qBANW,MAAM,YACN,MAAM,YACN,OAAO,UAAU,EAAE,QAAQ,cAC3B,OAAO,UAAU,EAAE,SAAS,GAC1B,OAAO,UAAU,EAAE,gBAAgB,CAa/C;IAED;;;;;;;OAOG;IACH,wBANW,MAAM,YACN,OAAO,UAAU,EAAE,QAAQ,cAC3B,OAAO,UAAU,EAAE,SAAS,YAC5B,OAAO,GACL,OAAO,UAAU,EAAE,gBAAgB,CAY/C;IAED;;;;OAIG;IACH,4BAHW,MAAM,GACJ,OAAO,UAAU,EAAE,gBAAgB,CAS/C;IAED;;;;OAIG;IACH,qBAHW,OAAO,UAAU,EAAE,iBAAiB,GAAG,OAAO,UAAU,EAAE,mBAAmB,GAC3E,OAAO,UAAU,EAAE,gBAAgB,CAsD/C;IAED;;;;OAIG;IACH,wBAHW,OAAO,UAAU,EAAE,iBAAiB,GAAG,OAAO,UAAU,EAAE,mBAAmB,GAC3E,OAAO,UAAU,EAAE,gBAAgB,CA8B/C;IAED;;;;OAIG;IACH,uBAHW,OAAO,UAAU,EAAE,iBAAiB,GAAG,OAAO,UAAU,EAAE,mBAAmB,GAC3E,OAAO,UAAU,EAAE,gBAAgB,CAqB/C;IAED;;;;;OAKG;IACH,0BAJW,MAAM,QACN,OAAO,UAAU,EAAE,iBAAiB,GAClC,OAAO,UAAU,EAAE,gBAAgB,CAyD/C;CAGF"}
|
|
@@ -26,22 +26,6 @@ const COMMANDS = /** @type {const} */ ({
|
|
|
26
26
|
'Timeline.stop': FULL_COMMAND,
|
|
27
27
|
});
|
|
28
28
|
class RemoteMessages {
|
|
29
|
-
constructor(isTargetBased = true) {
|
|
30
|
-
this._isTargetBased = isTargetBased;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* @param {boolean} isTargetBased
|
|
34
|
-
* @returns {boolean}
|
|
35
|
-
*/
|
|
36
|
-
set isTargetBased(isTargetBased) {
|
|
37
|
-
this._isTargetBased = isTargetBased;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* @returns {boolean}
|
|
41
|
-
*/
|
|
42
|
-
get isTargetBased() {
|
|
43
|
-
return this._isTargetBased;
|
|
44
|
-
}
|
|
45
29
|
// #region Connection functions
|
|
46
30
|
/**
|
|
47
31
|
*
|
|
@@ -137,35 +121,22 @@ class RemoteMessages {
|
|
|
137
121
|
* blocking setting on, new windows are openable both from links and from
|
|
138
122
|
* JavaScript).
|
|
139
123
|
*/
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}, params)
|
|
157
|
-
}),
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
realMethod = method;
|
|
162
|
-
realParams = Object.assign({
|
|
163
|
-
objectGroup: OBJECT_GROUP,
|
|
164
|
-
includeCommandLineAPI: true,
|
|
165
|
-
doNotPauseOnExceptionsAndMuteConsole: false,
|
|
166
|
-
emulateUserGesture: false,
|
|
167
|
-
}, params);
|
|
168
|
-
}
|
|
124
|
+
const realMethod = 'Target.sendMessageToTarget';
|
|
125
|
+
const realParams = {
|
|
126
|
+
targetId,
|
|
127
|
+
message: JSON.stringify({
|
|
128
|
+
id,
|
|
129
|
+
method,
|
|
130
|
+
params: Object.assign({
|
|
131
|
+
objectGroup: OBJECT_GROUP,
|
|
132
|
+
includeCommandLineAPI: true,
|
|
133
|
+
doNotPauseOnExceptionsAndMuteConsole: false,
|
|
134
|
+
emulateUserGesture: false,
|
|
135
|
+
generatePreview: false,
|
|
136
|
+
saveResult: false,
|
|
137
|
+
}, params)
|
|
138
|
+
}),
|
|
139
|
+
};
|
|
169
140
|
const plist = {
|
|
170
141
|
__argument: {
|
|
171
142
|
WIRSocketDataKey: {
|
|
@@ -189,19 +160,15 @@ class RemoteMessages {
|
|
|
189
160
|
*/
|
|
190
161
|
getMinimalCommand(opts) {
|
|
191
162
|
const { method, params, connId, senderId, appIdKey, pageIdKey, targetId, id } = opts;
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
params,
|
|
202
|
-
}),
|
|
203
|
-
};
|
|
204
|
-
}
|
|
163
|
+
const realMethod = 'Target.sendMessageToTarget';
|
|
164
|
+
const realParams = {
|
|
165
|
+
targetId,
|
|
166
|
+
message: JSON.stringify({
|
|
167
|
+
id,
|
|
168
|
+
method,
|
|
169
|
+
params,
|
|
170
|
+
}),
|
|
171
|
+
};
|
|
205
172
|
const plist = {
|
|
206
173
|
__argument: {
|
|
207
174
|
WIRSocketDataKey: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-messages.js","sourceRoot":"","sources":["../../../lib/rpc/remote-messages.js"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"remote-messages.js","sourceRoot":"","sources":["../../../lib/rpc/remote-messages.js"],"names":[],"mappings":";;;;;;AAmTA,0CAEC;AArTD,oDAAuB;AACvB,0CAAiD;AAGjD,MAAM,YAAY,GAAG,SAAS,CAAC;AAE/B,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAC5C,MAAM,YAAY,GAAG,gBAAgB,CAAC;AACtC,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAE1C,8DAA8D;AAC9D,wEAAwE;AACxE,MAAM,QAAQ,GAAG,oBAAoB,CAAC,CAAC;IACrC,iBAAiB,EAAE,YAAY;IAC/B,eAAe,EAAE,YAAY;IAE7B,sBAAsB,EAAE,YAAY;IACp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BAA4B;QAC5B,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,eAAe,CAAC;QAC7D,MAAM,UAAU,GAAG,IAAA,6BAAkB;QACnC,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAC1B,OAAO,EACP,IAAI,EACJ,eAAe,CAAC,OAAO,CAAC,CACzB,CAAC;QACF,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC;YAC3B,GAAG,UAAU;YACb,MAAM;YACN,QAAQ;YACR,QAAQ;YACR,SAAS;YACT,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;CAGF;AAhRD,wCAgRC;AAED;;;;GAIG;AACH,SAAgB,eAAe,CAAE,OAAO;IACtC,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,cAAc,CAAC;AAC9C,CAAC;AAED,kBAAe,cAAc,CAAC"}
|
|
@@ -54,22 +54,11 @@ export class RpcClient {
|
|
|
54
54
|
* @returns {boolean}
|
|
55
55
|
*/
|
|
56
56
|
get isConnected(): boolean;
|
|
57
|
-
|
|
58
|
-
* @param {boolean} isTargetBased
|
|
59
|
-
*/
|
|
60
|
-
set isTargetBased(isTargetBased: boolean);
|
|
61
|
-
/**
|
|
62
|
-
* @returns {boolean}
|
|
63
|
-
*/
|
|
64
|
-
get isTargetBased(): boolean;
|
|
57
|
+
_provisionedPages: Set<any>;
|
|
65
58
|
/**
|
|
66
59
|
* @returns {string[]}
|
|
67
60
|
*/
|
|
68
61
|
get contexts(): string[];
|
|
69
|
-
/**
|
|
70
|
-
* @returns {boolean}
|
|
71
|
-
*/
|
|
72
|
-
get needsTarget(): boolean;
|
|
73
62
|
/**
|
|
74
63
|
* @returns {AppToTargetsMap}
|
|
75
64
|
*/
|
|
@@ -98,7 +87,6 @@ export class RpcClient {
|
|
|
98
87
|
* @returns {this}
|
|
99
88
|
*/
|
|
100
89
|
off(event: string, listener: Function): this;
|
|
101
|
-
_isTargetBased: boolean | undefined;
|
|
102
90
|
/**
|
|
103
91
|
*
|
|
104
92
|
* @param {import('../types').AppIdKey} appIdKey
|
|
@@ -178,9 +166,9 @@ export class RpcClient {
|
|
|
178
166
|
* @param {import('../types').AppIdKey} appIdKey
|
|
179
167
|
* @param {import('../types').PageIdKey} pageIdKey
|
|
180
168
|
* @param {import('../types').TargetId} [targetId]
|
|
181
|
-
* @returns {Promise<
|
|
169
|
+
* @returns {Promise<boolean>}
|
|
182
170
|
*/
|
|
183
|
-
_initializePage(appIdKey: import("../types").AppIdKey, pageIdKey: import("../types").PageIdKey, targetId?: import("../types").TargetId): Promise<
|
|
171
|
+
_initializePage(appIdKey: import("../types").AppIdKey, pageIdKey: import("../types").PageIdKey, targetId?: import("../types").TargetId): Promise<boolean>;
|
|
184
172
|
/**
|
|
185
173
|
*
|
|
186
174
|
* @param {import('../types').AppIdKey} appIdKey
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../../lib/rpc/rpc-client.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../../lib/rpc/rpc-client.js"],"names":[],"mappings":"AAuBA,sCAAuC,+BAA+B,CAAC;AACvE,0CAA2C,gCAAgC,CAAC;AAG5E;IA6DE;;;OAGG;IACH,mBAFW,gBAAgB,EAkD1B;IAhHD,0CAA0C;IAC1C,gBADW,iBAAiB,GAAC,SAAS,CACvB;IAEf,uCAAuC;IACvC,gBADW,cAAc,GAAC,SAAS,CACpB;IAEf,sBAAsB;IACtB,WADW,OAAO,CACR;IAEV,sBAAsB;IACtB,UADW,OAAO,CACT;IAET,qBAAqB;IACrB,QADW,MAAM,CACV;IAEP,qBAAqB;IACrB,UADW,MAAM,CACR;IAET,qBAAqB;IACrB,OADW,MAAM,CACX;IAEN,+BAA+B;IAC/B,MADW,MAAM,GAAC,SAAS,CACtB;IAEL,gCAAgC;IAChC,qBADW,OAAO,GAAC,SAAS,CACR;IAEpB,gCAAgC;IAChC,4BADW,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AQ,GACzB,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CA6ClD;IAED;;;;OAIG;IACH,+BAHW,KAAK,OAAC,WACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAO7B;IAED;;OAEG;IACH,sBAFa,IAAI,CAKhB;IAED;;;;OAIG;IACH,oBAHW,KAAK,OAAC,cACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAK7B;IAED;;;;;;OAMG;IACH,wBALW,OAAO,UAAU,EAAE,QAAQ,aAC3B,OAAO,UAAU,EAAE,SAAS,YAC5B,OAAO,UAAU,EAAE,QAAQ,GACzB,OAAO,CAAC,IAAI,CAAC,CAazB;IAED;;;;OAIG;IACH,oCAHW,OAAO,UAAU,EAAE,QAAQ,aAC3B,OAAO,UAAU,EAAE,SAAS,iBActC;CACF;;;;;;;;;;;;;;uBAmBY;IAAC,CAAC,GAAG,EAAE,OAAO,UAAU,EAAE,SAAS,GAAG,OAAO,UAAU,EAAE,QAAQ,CAAA;CAAC;6BAIlE,QAAQ,GAAG;IAAC,WAAW,CAAC,EAAE,OAAO,UAAU,EAAE,qBAAqB,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAC;8BACpF;IAAC,CAAC,GAAG,EAAE,OAAO,UAAU,EAAE,QAAQ,GAAG,cAAc,CAAA;CAAC;8BA36BnC,uBAAuB;+BALtB,mBAAmB;6BAOrB,aAAa"}
|
|
@@ -19,10 +19,8 @@ const MIN_WAIT_FOR_TARGET_TIMEOUT_MS = 30000;
|
|
|
19
19
|
// although we still should not allow it to take forever
|
|
20
20
|
const PAGE_INIT_TIMEOUT_MS = 10 * 60 * 1000; // 10 minutes
|
|
21
21
|
const WAIT_FOR_TARGET_INTERVAL_MS = 100;
|
|
22
|
-
const MIN_PLATFORM_FOR_TARGET_BASED = '12.2';
|
|
23
|
-
// `Target.exists` protocol method was removed from WebKit in 13.4
|
|
24
|
-
const MIN_PLATFORM_NO_TARGET_EXISTS = '13.4';
|
|
25
22
|
const NO_TARGET_SUPPORTED_ERROR = `'target' domain was not found`;
|
|
23
|
+
const MISSING_TARGET_ERROR_PATTERN = /Missing target/i;
|
|
26
24
|
const NO_TARGET_PRESENT_YET_ERRORS = [
|
|
27
25
|
`domain was not found`,
|
|
28
26
|
`some arguments of method`,
|
|
@@ -30,20 +28,6 @@ const NO_TARGET_PRESENT_YET_ERRORS = [
|
|
|
30
28
|
];
|
|
31
29
|
exports.NEW_APP_CONNECTED_ERROR = 'New application has connected';
|
|
32
30
|
exports.EMPTY_PAGE_DICTIONARY_ERROR = 'Empty page dictionary received';
|
|
33
|
-
/**
|
|
34
|
-
* @param {boolean} isSafari
|
|
35
|
-
* @param {string} platformVersion
|
|
36
|
-
* @returns {boolean}
|
|
37
|
-
*/
|
|
38
|
-
function isTargetBased(isSafari, platformVersion) {
|
|
39
|
-
// On iOS 12.2 the messages get sent through the Target domain
|
|
40
|
-
// On iOS 13.0+, WKWebView also needs to follow the Target domain,
|
|
41
|
-
// so here only check the target OS version as the default behaviour.
|
|
42
|
-
const isHighVersion = support_1.util.compareVersions(platformVersion, '>=', MIN_PLATFORM_FOR_TARGET_BASED);
|
|
43
|
-
logger_1.default.debug(`Checking which communication style to use (${isSafari ? '' : 'non-'}Safari on platform version '${platformVersion}')`);
|
|
44
|
-
logger_1.default.debug(`Platform version equal or higher than '${MIN_PLATFORM_FOR_TARGET_BASED}': ${isHighVersion}`);
|
|
45
|
-
return isHighVersion;
|
|
46
|
-
}
|
|
47
31
|
class RpcClient {
|
|
48
32
|
/**
|
|
49
33
|
*
|
|
@@ -68,8 +52,15 @@ class RpcClient {
|
|
|
68
52
|
this._contexts = [];
|
|
69
53
|
this._targets = {};
|
|
70
54
|
this._targetSubscriptions = new node_events_1.EventEmitter();
|
|
71
|
-
|
|
72
|
-
this.
|
|
55
|
+
this._provisionedPages = new Set();
|
|
56
|
+
this.remoteMessages = new remote_messages_1.RemoteMessages();
|
|
57
|
+
this.messageHandler = new rpc_message_handler_1.default();
|
|
58
|
+
// add handlers for internal events
|
|
59
|
+
this.messageHandler.on('Target.targetCreated', this.addTarget.bind(this));
|
|
60
|
+
this.messageHandler.on('Target.didCommitProvisionalTarget', this.updateTarget.bind(this));
|
|
61
|
+
this.messageHandler.on('Target.targetDestroyed', this.removeTarget.bind(this));
|
|
62
|
+
this.messageHandler.on('Runtime.executionContextCreated', this.onExecutionContextCreated.bind(this));
|
|
63
|
+
this.messageHandler.on('Heap.garbageCollected', this.onGarbageCollected.bind(this));
|
|
73
64
|
}
|
|
74
65
|
/**
|
|
75
66
|
* @returns {string[]}
|
|
@@ -77,12 +68,6 @@ class RpcClient {
|
|
|
77
68
|
get contexts() {
|
|
78
69
|
return this._contexts;
|
|
79
70
|
}
|
|
80
|
-
/**
|
|
81
|
-
* @returns {boolean}
|
|
82
|
-
*/
|
|
83
|
-
get needsTarget() {
|
|
84
|
-
return this.isTargetBased;
|
|
85
|
-
}
|
|
86
71
|
/**
|
|
87
72
|
* @returns {AppToTargetsMap}
|
|
88
73
|
*/
|
|
@@ -139,37 +124,6 @@ class RpcClient {
|
|
|
139
124
|
this.messageHandler.off(event, listener);
|
|
140
125
|
return this;
|
|
141
126
|
}
|
|
142
|
-
/**
|
|
143
|
-
* @param {boolean} isTargetBased
|
|
144
|
-
*/
|
|
145
|
-
set isTargetBased(isTargetBased) {
|
|
146
|
-
logger_1.default.warn(`Setting communication protocol: using ${isTargetBased ? 'Target-based' : 'full Web Inspector protocol'} communication`);
|
|
147
|
-
this._isTargetBased = isTargetBased;
|
|
148
|
-
if (!this.remoteMessages) {
|
|
149
|
-
this.remoteMessages = new remote_messages_1.RemoteMessages(isTargetBased);
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
this.remoteMessages.isTargetBased = isTargetBased;
|
|
153
|
-
}
|
|
154
|
-
if (!this.messageHandler) {
|
|
155
|
-
this.messageHandler = new rpc_message_handler_1.default(isTargetBased);
|
|
156
|
-
// add handlers for internal events
|
|
157
|
-
this.messageHandler.on('Target.targetCreated', this.addTarget.bind(this));
|
|
158
|
-
this.messageHandler.on('Target.didCommitProvisionalTarget', this.updateTarget.bind(this));
|
|
159
|
-
this.messageHandler.on('Target.targetDestroyed', this.removeTarget.bind(this));
|
|
160
|
-
this.messageHandler.on('Runtime.executionContextCreated', this.onExecutionContextCreated.bind(this));
|
|
161
|
-
this.messageHandler.on('Heap.garbageCollected', this.onGarbageCollected.bind(this));
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
this.messageHandler.isTargetBased = isTargetBased;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* @returns {boolean}
|
|
169
|
-
*/
|
|
170
|
-
get isTargetBased() {
|
|
171
|
-
return !!this._isTargetBased;
|
|
172
|
-
}
|
|
173
127
|
/**
|
|
174
128
|
*
|
|
175
129
|
* @param {import('../types').AppIdKey} appIdKey
|
|
@@ -177,10 +131,6 @@ class RpcClient {
|
|
|
177
131
|
* @returns {Promise<import('../types').TargetId | undefined>}
|
|
178
132
|
*/
|
|
179
133
|
async waitForTarget(appIdKey, pageIdKey) {
|
|
180
|
-
if (!this.needsTarget) {
|
|
181
|
-
logger_1.default.debug(`Target-based communication is not needed, skipping wait for target`);
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
134
|
let target = this.getTarget(appIdKey, pageIdKey);
|
|
185
135
|
if (target) {
|
|
186
136
|
logger_1.default.debug(`The target '${target}' for app '${appIdKey}' and page '${pageIdKey}' already exists, no need to wait`);
|
|
@@ -223,13 +173,9 @@ class RpcClient {
|
|
|
223
173
|
const { appIdKey, pageIdKey } = opts;
|
|
224
174
|
const messageLc = (err.message || '').toLowerCase();
|
|
225
175
|
if (messageLc.includes(NO_TARGET_SUPPORTED_ERROR)) {
|
|
226
|
-
logger_1.default.info('The target device does not support Target based communication. ' +
|
|
227
|
-
'Will follow non-target based communication.');
|
|
228
|
-
this.isTargetBased = false;
|
|
229
176
|
return await this.sendToDevice(command, opts, waitForResponse);
|
|
230
177
|
}
|
|
231
178
|
else if (appIdKey && NO_TARGET_PRESENT_YET_ERRORS.some((error) => messageLc.includes(error))) {
|
|
232
|
-
this.isTargetBased = true;
|
|
233
179
|
await this.waitForTarget(appIdKey, /** @type {import('../types').PageIdKey} */ (pageIdKey));
|
|
234
180
|
return await this.sendToDevice(command, opts, waitForResponse);
|
|
235
181
|
}
|
|
@@ -254,18 +200,15 @@ class RpcClient {
|
|
|
254
200
|
// replies to our request
|
|
255
201
|
// keep track of the messages coming and going using a simple sequential id
|
|
256
202
|
const msgId = this.msgId++;
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
}
|
|
203
|
+
// for target-base communication, everything is wrapped up
|
|
204
|
+
const wrapperMsgId = this.msgId++;
|
|
205
|
+
// acknowledge wrapper message
|
|
206
|
+
// @ts-ignore messageHandler must be defined
|
|
207
|
+
this.messageHandler.on(wrapperMsgId.toString(), function (err) {
|
|
208
|
+
if (err) {
|
|
209
|
+
reject(err);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
269
212
|
const appIdKey = opts.appIdKey;
|
|
270
213
|
const pageIdKey = opts.pageIdKey;
|
|
271
214
|
const targetId = opts.targetId ?? this.getTarget(appIdKey, pageIdKey);
|
|
@@ -350,7 +293,7 @@ class RpcClient {
|
|
|
350
293
|
const msg = `Sending '${cmd.__selector}' message` +
|
|
351
294
|
(appIdKey ? ` to app '${appIdKey}'` : '') +
|
|
352
295
|
(pageIdKey ? `, page '${pageIdKey}'` : '') +
|
|
353
|
-
(
|
|
296
|
+
(targetId ? `, target '${targetId}'` : '') +
|
|
354
297
|
` (id: ${msgId}): '${command}'`;
|
|
355
298
|
logger_1.default.debug(msg);
|
|
356
299
|
try {
|
|
@@ -419,8 +362,9 @@ class RpcClient {
|
|
|
419
362
|
const timer = new support_1.timing.Timer().start();
|
|
420
363
|
if (targetInfo.isProvisional) {
|
|
421
364
|
logger_1.default.debug(`Provisional target created for app '${appIdKey}' and page '${pageIdKey}': '${JSON.stringify(targetInfo)}'`);
|
|
365
|
+
this._provisionedPages.add(pageIdKey);
|
|
422
366
|
try {
|
|
423
|
-
await this.targets[appIdKey].lock.acquire(
|
|
367
|
+
await this.targets[appIdKey].lock.acquire(pageIdKey, async () => {
|
|
424
368
|
try {
|
|
425
369
|
await this._initializePage(appIdKey, pageIdKey, targetInfo.targetId);
|
|
426
370
|
}
|
|
@@ -429,7 +373,7 @@ class RpcClient {
|
|
|
429
373
|
await this._resumeTarget(appIdKey, pageIdKey, targetInfo.targetId);
|
|
430
374
|
}
|
|
431
375
|
else {
|
|
432
|
-
logger_1.default.debug(`Provisional target ${targetInfo.targetId}@${appIdKey} is not paused
|
|
376
|
+
logger_1.default.debug(`Provisional target ${targetInfo.targetId}@${appIdKey} is not paused, so not resuming`);
|
|
433
377
|
}
|
|
434
378
|
}
|
|
435
379
|
});
|
|
@@ -447,17 +391,25 @@ class RpcClient {
|
|
|
447
391
|
}
|
|
448
392
|
this.targets[appIdKey][pageIdKey] = targetInfo.targetId;
|
|
449
393
|
try {
|
|
450
|
-
await this.
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
394
|
+
await this.send('Target.setPauseOnStart', {
|
|
395
|
+
pauseOnStart: true,
|
|
396
|
+
appIdKey,
|
|
397
|
+
pageIdKey,
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
catch (e) {
|
|
401
|
+
logger_1.default.debug(`Cannot setup pause on start for app '${appIdKey}' and page '${pageIdKey}': ${e.message}`);
|
|
402
|
+
}
|
|
403
|
+
try {
|
|
404
|
+
await this.targets[appIdKey].lock.acquire(pageIdKey, async () => {
|
|
459
405
|
try {
|
|
460
|
-
|
|
406
|
+
if (this._provisionedPages.has(pageIdKey)) {
|
|
407
|
+
logger_1.default.debug(`Page '${pageIdKey}' has been already provisioned`);
|
|
408
|
+
this._provisionedPages.delete(pageIdKey);
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
await this._initializePage(appIdKey, pageIdKey);
|
|
412
|
+
}
|
|
461
413
|
}
|
|
462
414
|
finally {
|
|
463
415
|
if (targetInfo.isPaused) {
|
|
@@ -467,8 +419,7 @@ class RpcClient {
|
|
|
467
419
|
});
|
|
468
420
|
}
|
|
469
421
|
catch (e) {
|
|
470
|
-
logger_1.default.warn(
|
|
471
|
-
`after ${timer.getDuration().asMilliSeconds}ms: ${e.message}`);
|
|
422
|
+
logger_1.default.warn(e.message);
|
|
472
423
|
}
|
|
473
424
|
}
|
|
474
425
|
/**
|
|
@@ -550,6 +501,7 @@ class RpcClient {
|
|
|
550
501
|
*/
|
|
551
502
|
async selectPage(appIdKey, pageIdKey) {
|
|
552
503
|
this._pendingTargetNotification = [appIdKey, pageIdKey];
|
|
504
|
+
this._provisionedPages.clear();
|
|
553
505
|
// go through the steps that the Desktop Safari system
|
|
554
506
|
// goes through to initialize the Web Inspector session
|
|
555
507
|
const sendOpts = {
|
|
@@ -564,13 +516,6 @@ class RpcClient {
|
|
|
564
516
|
}
|
|
565
517
|
await this.send('setSenderKey', sendOpts);
|
|
566
518
|
logger_1.default.debug('Sender key set');
|
|
567
|
-
if (!this.isTargetBased) {
|
|
568
|
-
await this._initializePage(appIdKey, pageIdKey);
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
if (this.isTargetBased && support_1.util.compareVersions(this.platformVersion, '<', MIN_PLATFORM_NO_TARGET_EXISTS)) {
|
|
572
|
-
await this.send('Target.exists', sendOpts, false);
|
|
573
|
-
}
|
|
574
519
|
await this.waitForTarget(appIdKey, pageIdKey);
|
|
575
520
|
await this.waitForPageInitialization(appIdKey, pageIdKey);
|
|
576
521
|
}
|
|
@@ -581,7 +526,7 @@ class RpcClient {
|
|
|
581
526
|
* @param {import('../types').AppIdKey} appIdKey
|
|
582
527
|
* @param {import('../types').PageIdKey} pageIdKey
|
|
583
528
|
* @param {import('../types').TargetId} [targetId]
|
|
584
|
-
* @returns {Promise<
|
|
529
|
+
* @returns {Promise<boolean>}
|
|
585
530
|
*/
|
|
586
531
|
async _initializePage(appIdKey, pageIdKey, targetId) {
|
|
587
532
|
const sendOpts = {
|
|
@@ -608,11 +553,14 @@ class RpcClient {
|
|
|
608
553
|
}
|
|
609
554
|
catch (err) {
|
|
610
555
|
logger_1.default.info(`Cannot enable domain '${domain}' during initialization: ${err.message}`);
|
|
556
|
+
if (MISSING_TARGET_ERROR_PATTERN.test(err.message)) {
|
|
557
|
+
return false;
|
|
558
|
+
}
|
|
611
559
|
}
|
|
612
560
|
}
|
|
613
561
|
logger_1.default.debug(`Simple initialization of page '${pageIdKey}' for app '${appIdKey}' completed ` +
|
|
614
562
|
`in ${timer.getDuration().asMilliSeconds}ms`);
|
|
615
|
-
return;
|
|
563
|
+
return true;
|
|
616
564
|
}
|
|
617
565
|
// The sequence of commands here is important
|
|
618
566
|
const domainsToOptsMap = {
|
|
@@ -683,16 +631,23 @@ class RpcClient {
|
|
|
683
631
|
}
|
|
684
632
|
catch (err) {
|
|
685
633
|
logger_1.default.info(`Cannot set logging channel level for '${source}': ${err.message}`);
|
|
634
|
+
if (MISSING_TARGET_ERROR_PATTERN.test(err.message)) {
|
|
635
|
+
return false;
|
|
636
|
+
}
|
|
686
637
|
}
|
|
687
638
|
}
|
|
688
639
|
}
|
|
689
640
|
}
|
|
690
641
|
catch (err) {
|
|
691
642
|
logger_1.default.info(`Cannot enable domain '${domain}' during full initialization: ${err.message}`);
|
|
643
|
+
if (MISSING_TARGET_ERROR_PATTERN.test(err.message)) {
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
692
646
|
}
|
|
693
647
|
}
|
|
694
648
|
logger_1.default.debug(`Full initialization of page '${pageIdKey}' for app '${appIdKey}' completed ` +
|
|
695
649
|
`in ${timer.getDuration().asMilliSeconds}ms`);
|
|
650
|
+
return true;
|
|
696
651
|
}
|
|
697
652
|
/**
|
|
698
653
|
*
|
|
@@ -802,7 +757,7 @@ class RpcClient {
|
|
|
802
757
|
}
|
|
803
758
|
const lock = appTargetsMap.lock;
|
|
804
759
|
const timer = new support_1.timing.Timer().start();
|
|
805
|
-
await lock.acquire(
|
|
760
|
+
await lock.acquire(pageIdKey, async () => await bluebird_1.default.delay(0));
|
|
806
761
|
const durationMs = timer.getDuration().asMilliSeconds;
|
|
807
762
|
if (durationMs > 10) {
|
|
808
763
|
logger_1.default.debug(`Waited ${durationMs}ms until the page ${pageIdKey}@${appIdKey} is initialized`);
|