extension 4.1.31 → 4.1.33
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/dist/597.cjs +27 -15
- package/dist/browsers.cjs +692 -183
- package/dist/cli.cjs +1075 -263
- package/dist/extension/__spec__/exec/gecko-system-profile.d.ts +3 -0
- package/dist/extension/browsers/__spec__/safari-fake-tools.d.ts +11 -1
- package/dist/extension/browsers/browsers-lib/instance-registry.d.ts +1 -0
- package/dist/extension/browsers/browsers-lib/messages.d.ts +12 -0
- package/dist/extension/browsers/browsers-lib/ready-stamp.d.ts +6 -0
- package/dist/extension/browsers/browsers-lib/resolve-profile.d.ts +1 -0
- package/dist/extension/browsers/browsers-types.d.ts +1 -0
- package/dist/extension/browsers/index.d.ts +1 -0
- package/dist/extension/browsers/run-chromium/cdp/cdp-client.d.ts +1 -0
- package/dist/extension/browsers/run-chromium/cdp/coded-error.d.ts +6 -0
- package/dist/extension/browsers/run-chromium/cdp/pipe-guard.d.ts +8 -0
- package/dist/extension/browsers/run-chromium/chromium-launch/index.d.ts +1 -0
- package/dist/extension/browsers/run-firefox/firefox-types.d.ts +1 -1
- package/dist/extension/browsers/run-firefox/rdp/evaluate-extension-document.d.ts +31 -1
- package/dist/extension/browsers/run-firefox/rdp/remote-firefox/evaluate.d.ts +4 -1
- package/dist/extension/browsers/run-firefox/rdp/remote-firefox/messaging-client.d.ts +1 -1
- package/dist/extension/browsers/run-only.d.ts +1 -0
- package/dist/extension/browsers/run-safari/safari-launch/container-app.d.ts +3 -0
- package/dist/extension/browsers/run-safari/safari-launch/index.d.ts +3 -1
- package/dist/extension/browsers/run-safari/safari-launch/tools.d.ts +14 -0
- package/dist/extension/browsers/run-safari/safari-launch/webdriver.d.ts +15 -0
- package/dist/extension/commands/act.d.ts +10 -0
- package/dist/extension/config-types.d.ts +15 -3
- package/dist/extension/helpers/messaging.d.ts +12 -4
- package/dist/extension/helpers/node-version-guard.d.ts +2 -1
- package/dist/extension/helpers/ready-contract-codes.d.ts +4 -0
- package/dist/extension/helpers/telemetry-cli.d.ts +1 -0
- package/dist/extension/helpers/template-catalog.d.ts +1 -1
- package/dist/extension/helpers/template-corpus.generated.d.ts +1 -1
- package/dist/extension/index.d.ts +1 -1
- package/package.json +4 -4
package/dist/597.cjs
CHANGED
|
@@ -203,12 +203,14 @@ exports.modules = {
|
|
|
203
203
|
var external_ws_ = __webpack_require__("ws");
|
|
204
204
|
var external_ws_default = /*#__PURE__*/ __webpack_require__.n(external_ws_);
|
|
205
205
|
var constants = __webpack_require__("./browsers/browsers-lib/constants.ts");
|
|
206
|
+
var coded_error = __webpack_require__("./browsers/run-chromium/cdp/coded-error.ts");
|
|
206
207
|
var discovery = __webpack_require__("./browsers/run-chromium/cdp/discovery.ts");
|
|
207
208
|
async function getExtensionInfo(cdp, extensionId) {
|
|
208
209
|
return await cdp.sendCommand('Extensions.getExtensionInfo', {
|
|
209
210
|
extensionId
|
|
210
211
|
});
|
|
211
212
|
}
|
|
213
|
+
var pipe_guard = __webpack_require__("./browsers/run-chromium/cdp/pipe-guard.ts");
|
|
212
214
|
function establishBrowserConnection(url, isDev, onMessage, onRejectPending) {
|
|
213
215
|
return new Promise((resolve, reject)=>{
|
|
214
216
|
const ws = new (external_ws_default())(url);
|
|
@@ -227,7 +229,7 @@ exports.modules = {
|
|
|
227
229
|
ws.on('close', ()=>{
|
|
228
230
|
if (isDev) (0, messaging._w)(messages.hE());
|
|
229
231
|
onRejectPending('CDP connection closed');
|
|
230
|
-
reject(
|
|
232
|
+
reject((0, coded_error.A)(messaging.Lp.E_CDP_NOT_CONNECTED, 'CDP WebSocket closed before the connection opened'));
|
|
231
233
|
});
|
|
232
234
|
});
|
|
233
235
|
}
|
|
@@ -265,7 +267,7 @@ exports.modules = {
|
|
|
265
267
|
pendingRejected = true;
|
|
266
268
|
this.pendingRequests.forEach(({ reject, timeout }, id)=>{
|
|
267
269
|
try {
|
|
268
|
-
reject(
|
|
270
|
+
reject((0, coded_error.A)(messaging.Lp.E_BROWSER_CONNECTION_CLOSED, reason));
|
|
269
271
|
} catch {}
|
|
270
272
|
if (timeout) clearTimeout(timeout);
|
|
271
273
|
this.pendingRequests.delete(id);
|
|
@@ -277,7 +279,7 @@ exports.modules = {
|
|
|
277
279
|
if (this.isDev()) (0, messaging._w)(messages.M3(this.host, this.port));
|
|
278
280
|
} catch (error) {
|
|
279
281
|
const err = error;
|
|
280
|
-
throw
|
|
282
|
+
throw (0, coded_error.A)((0, coded_error.K)(err) ?? messaging.Lp.E_CDP_NOT_CONNECTED, `Failed to connect to CDP: ${err.message || err}`);
|
|
281
283
|
}
|
|
282
284
|
}
|
|
283
285
|
async connectViaPipe(input, output) {
|
|
@@ -299,7 +301,8 @@ exports.modules = {
|
|
|
299
301
|
};
|
|
300
302
|
const onReadError = (error)=>{
|
|
301
303
|
if (this.isDev()) (0, messaging.Gg)(`[CDP] Pipe read error: ${error.message}`);
|
|
302
|
-
this.rejectAllPending(
|
|
304
|
+
this.rejectAllPending(`CDP pipe read error: ${error.message}`);
|
|
305
|
+
this.markTransportGone(error.message);
|
|
303
306
|
};
|
|
304
307
|
const onClose = ()=>{
|
|
305
308
|
if (this.isDev()) (0, messaging._w)('[CDP] Pipe closed');
|
|
@@ -313,6 +316,10 @@ exports.modules = {
|
|
|
313
316
|
this.pipeOut = null;
|
|
314
317
|
this.markTransportGone(error.message);
|
|
315
318
|
};
|
|
319
|
+
(0, pipe_guard.b)(input);
|
|
320
|
+
(0, pipe_guard.b)(output);
|
|
321
|
+
(0, pipe_guard.S)(input, this);
|
|
322
|
+
(0, pipe_guard.S)(output, this);
|
|
316
323
|
input.on('data', onData);
|
|
317
324
|
input.on('error', onReadError);
|
|
318
325
|
input.on('close', onClose);
|
|
@@ -334,13 +341,16 @@ exports.modules = {
|
|
|
334
341
|
notify(reason);
|
|
335
342
|
} catch {}
|
|
336
343
|
}
|
|
344
|
+
reportPipeGone(error) {
|
|
345
|
+
this.markTransportGone(error?.message || 'the CDP pipe failed');
|
|
346
|
+
}
|
|
337
347
|
isTransportGone() {
|
|
338
348
|
return Boolean(this.transportGoneReason);
|
|
339
349
|
}
|
|
340
350
|
rejectAllPending(reason) {
|
|
341
351
|
this.pendingRequests.forEach(({ reject, timeout }, id)=>{
|
|
342
352
|
try {
|
|
343
|
-
reject(
|
|
353
|
+
reject((0, coded_error.A)(messaging.Lp.E_BROWSER_CONNECTION_CLOSED, reason));
|
|
344
354
|
} catch {}
|
|
345
355
|
if (timeout) clearTimeout(timeout);
|
|
346
356
|
this.pendingRequests.delete(id);
|
|
@@ -409,7 +419,7 @@ exports.modules = {
|
|
|
409
419
|
if (pending) {
|
|
410
420
|
if (pending.timeout) clearTimeout(pending.timeout);
|
|
411
421
|
this.pendingRequests.delete(message.id);
|
|
412
|
-
if (message.error) pending.reject(
|
|
422
|
+
if (message.error) pending.reject((0, coded_error.A)(messaging.Lp.E_CDP_OP_FAILED, JSON.stringify(message.error)));
|
|
413
423
|
else pending.resolve(message.result);
|
|
414
424
|
}
|
|
415
425
|
return;
|
|
@@ -423,7 +433,7 @@ exports.modules = {
|
|
|
423
433
|
}
|
|
424
434
|
async sendCommand(method, params = {}, sessionId, timeoutMs = constants.Ns) {
|
|
425
435
|
return new Promise((resolve, reject)=>{
|
|
426
|
-
if (!this.isConnected()) return reject(
|
|
436
|
+
if (!this.isConnected()) return reject((0, coded_error.A)(messaging.Lp.E_CDP_NOT_CONNECTED, 'CDP transport is not open'));
|
|
427
437
|
const id = ++this.messageId;
|
|
428
438
|
const message = {
|
|
429
439
|
id,
|
|
@@ -436,7 +446,7 @@ exports.modules = {
|
|
|
436
446
|
const pending = this.pendingRequests.get(id);
|
|
437
447
|
if (!pending) return;
|
|
438
448
|
this.pendingRequests.delete(id);
|
|
439
|
-
pending.reject(
|
|
449
|
+
pending.reject((0, coded_error.A)(messaging.Lp.E_CDP_TIMEOUT, `CDP command timed out (${timeoutMs}ms): ${String(pending.method || method)}`));
|
|
440
450
|
}, timeoutMs);
|
|
441
451
|
this.pendingRequests.set(id, {
|
|
442
452
|
resolve,
|
|
@@ -500,7 +510,7 @@ exports.modules = {
|
|
|
500
510
|
try {
|
|
501
511
|
return await getExtensionInfo(this, extensionId);
|
|
502
512
|
} catch (error) {
|
|
503
|
-
throw
|
|
513
|
+
throw (0, coded_error.A)((0, coded_error.K)(error) ?? messaging.Lp.E_CDP_OP_FAILED, messages.Z5(extensionId, error.message));
|
|
504
514
|
}
|
|
505
515
|
}
|
|
506
516
|
constructor(port = 9222, host = '127.0.0.1'){
|
|
@@ -655,7 +665,7 @@ exports.modules = {
|
|
|
655
665
|
await new Promise((r)=>setTimeout(r, delayMs));
|
|
656
666
|
}
|
|
657
667
|
}
|
|
658
|
-
throw lastError instanceof Error ? lastError :
|
|
668
|
+
throw lastError instanceof Error ? lastError : (0, coded_error.A)(messaging.Lp.E_CDP_NOT_CONNECTED, 'Failed to bootstrap CDP connection');
|
|
659
669
|
}
|
|
660
670
|
async function deriveExtensionIdFromTargetsHelper(cdp, outPath, maxRetries = 6, backoffMs = 150, profilePath, extensionPaths) {
|
|
661
671
|
let expectedName;
|
|
@@ -1043,7 +1053,7 @@ exports.modules = {
|
|
|
1043
1053
|
return false;
|
|
1044
1054
|
}
|
|
1045
1055
|
async ensureLoaded() {
|
|
1046
|
-
if (!this.cdp) throw
|
|
1056
|
+
if (!this.cdp) throw (0, coded_error.A)(messaging.Lp.E_CDP_NOT_CONNECTED, 'CDP not connected');
|
|
1047
1057
|
const exists = external_node_fs_.existsSync(this.outPath);
|
|
1048
1058
|
if (!exists) throw new Error(`Output path not found: ${this.outPath}`);
|
|
1049
1059
|
if (this.profilePath) try {
|
|
@@ -1101,7 +1111,7 @@ exports.modules = {
|
|
|
1101
1111
|
}
|
|
1102
1112
|
try {
|
|
1103
1113
|
if (!this.extensionId) this.extensionId = await this.deriveExtensionIdFromTargets(20, 200);
|
|
1104
|
-
if (!this.extensionId) throw
|
|
1114
|
+
if (!this.extensionId) throw (0, coded_error.A)(messaging.Lp.E_EXTENSION_ID_UNKNOWN, 'Failed to determine extension ID via CDP');
|
|
1105
1115
|
(0, ready_stamp.hg)(this.outPath, this.extensionId);
|
|
1106
1116
|
await this.enableLogging();
|
|
1107
1117
|
let name;
|
|
@@ -1125,7 +1135,7 @@ exports.modules = {
|
|
|
1125
1135
|
version
|
|
1126
1136
|
};
|
|
1127
1137
|
} catch (error) {
|
|
1128
|
-
throw
|
|
1138
|
+
throw (0, coded_error.A)((0, coded_error.K)(error) ?? messaging.Lp.E_CDP_OP_FAILED, `Failed to load extension from ${external_node_path_.resolve(this.outPath)}: ${String(error.message || error)}`);
|
|
1129
1139
|
}
|
|
1130
1140
|
}
|
|
1131
1141
|
async deriveExtensionIdFromTargets(maxRetries = 20, backoffMs = 200) {
|
|
@@ -1155,7 +1165,7 @@ exports.modules = {
|
|
|
1155
1165
|
registerAutoEnableLogging(this.cdp, ()=>this.extensionId, this.logSink);
|
|
1156
1166
|
}
|
|
1157
1167
|
onProtocolEvent(cb) {
|
|
1158
|
-
if (!this.cdp) throw
|
|
1168
|
+
if (!this.cdp) throw (0, coded_error.A)(messaging.Lp.E_CDP_NOT_CONNECTED, 'CDP not connected');
|
|
1159
1169
|
this.cdp.onProtocolEvent((message)=>{
|
|
1160
1170
|
cb(message);
|
|
1161
1171
|
});
|
|
@@ -1398,10 +1408,12 @@ exports.modules = {
|
|
|
1398
1408
|
extensionControllerInfo = await Promise.race([
|
|
1399
1409
|
cdpExtensionController.ensureLoaded(),
|
|
1400
1410
|
new Promise((_, reject)=>{
|
|
1401
|
-
setTimeout(()=>reject(
|
|
1411
|
+
setTimeout(()=>reject((0, coded_error.A)(messaging.Lp.E_CDP_TIMEOUT, `ensureLoaded timeout (${ensureLoadedTimeoutMs}ms)`)), ensureLoadedTimeoutMs);
|
|
1402
1412
|
})
|
|
1403
1413
|
]);
|
|
1404
1414
|
} catch (error) {
|
|
1415
|
+
const code = (0, coded_error.K)(error);
|
|
1416
|
+
if (code) (0, ready_stamp.QP)(extensionOutputPath, code, (0, ready_stamp.dT)(error), plugin.launchRunId);
|
|
1405
1417
|
if ((0, messaging._o)()) (0, messaging.mR)(`[CDP] ensureLoaded failed: ${String(error?.message || error)}`);
|
|
1406
1418
|
}
|
|
1407
1419
|
try {
|