@orkestrel/browser 0.0.6 → 0.0.7
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/src/core/index.cjs +308 -262
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.js +308 -262
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +120 -47
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +10 -5
- package/dist/src/server/index.d.ts +10 -5
- package/dist/src/server/index.js +120 -47
- package/dist/src/server/index.js.map +1 -1
- package/package.json +16 -16
package/dist/src/core/index.cjs
CHANGED
|
@@ -559,10 +559,10 @@ function createBrowserHAREntry(pending, duration, body, error) {
|
|
|
559
559
|
cookies: [],
|
|
560
560
|
headers: requestHeaders,
|
|
561
561
|
queryString: query,
|
|
562
|
-
|
|
562
|
+
...post !== void 0 ? { postData: {
|
|
563
563
|
mimeType: requestMime,
|
|
564
564
|
text: post
|
|
565
|
-
},
|
|
565
|
+
} } : {},
|
|
566
566
|
headersSize: -1,
|
|
567
567
|
bodySize: post === void 0 ? 0 : textToBytes(post).byteLength
|
|
568
568
|
},
|
|
@@ -575,8 +575,10 @@ function createBrowserHAREntry(pending, duration, body, error) {
|
|
|
575
575
|
content: {
|
|
576
576
|
size,
|
|
577
577
|
mimeType: response?.mime ?? "application/octet-stream",
|
|
578
|
-
text
|
|
579
|
-
|
|
578
|
+
...text !== void 0 ? {
|
|
579
|
+
text,
|
|
580
|
+
encoding: "base64"
|
|
581
|
+
} : {}
|
|
580
582
|
},
|
|
581
583
|
redirectURL: redirect,
|
|
582
584
|
headersSize: -1,
|
|
@@ -1388,7 +1390,7 @@ function readBrowserCookiePartition(value) {
|
|
|
1388
1390
|
if (!(0, _orkestrel_contract.isRecord)(value) || !(0, _orkestrel_contract.isString)(value["topLevelSite"])) return void 0;
|
|
1389
1391
|
return {
|
|
1390
1392
|
site: value["topLevelSite"],
|
|
1391
|
-
|
|
1393
|
+
...(0, _orkestrel_contract.isBoolean)(value["hasCrossSiteAncestor"]) ? { ancestor: value["hasCrossSiteAncestor"] } : {}
|
|
1392
1394
|
};
|
|
1393
1395
|
}
|
|
1394
1396
|
/**
|
|
@@ -1610,7 +1612,7 @@ function readBrowserDownloadProgress(value) {
|
|
|
1610
1612
|
status,
|
|
1611
1613
|
received: value["receivedBytes"],
|
|
1612
1614
|
total: value["totalBytes"],
|
|
1613
|
-
|
|
1615
|
+
...(0, _orkestrel_contract.isString)(value["filePath"]) ? { path: value["filePath"] } : {}
|
|
1614
1616
|
}];
|
|
1615
1617
|
}
|
|
1616
1618
|
/**
|
|
@@ -3510,7 +3512,7 @@ var BrowserClock = class {
|
|
|
3510
3512
|
#installed = false;
|
|
3511
3513
|
#advancing = false;
|
|
3512
3514
|
#budgetResolve;
|
|
3513
|
-
#budgetHandler =
|
|
3515
|
+
#budgetHandler = this.#handleBudget.bind(this);
|
|
3514
3516
|
constructor(frame) {
|
|
3515
3517
|
this.#frame = frame;
|
|
3516
3518
|
}
|
|
@@ -3610,6 +3612,9 @@ var BrowserClock = class {
|
|
|
3610
3612
|
#idle() {
|
|
3611
3613
|
if (this.#advancing) throw new BrowserError("Browser clock advance is already active");
|
|
3612
3614
|
}
|
|
3615
|
+
#handleBudget() {
|
|
3616
|
+
this.#budgetResolve?.();
|
|
3617
|
+
}
|
|
3613
3618
|
};
|
|
3614
3619
|
//#endregion
|
|
3615
3620
|
//#region src/core/BrowserCoverage.ts
|
|
@@ -3807,8 +3812,8 @@ var BrowserCookieManager = class {
|
|
|
3807
3812
|
expires: cookie.expires,
|
|
3808
3813
|
http: cookie.http,
|
|
3809
3814
|
secure: cookie.secure,
|
|
3810
|
-
site: cookie.site,
|
|
3811
|
-
partition: cookie.partition
|
|
3815
|
+
...cookie.site !== void 0 ? { site: cookie.site } : {},
|
|
3816
|
+
...cookie.partition !== void 0 ? { partition: cookie.partition } : {}
|
|
3812
3817
|
})) };
|
|
3813
3818
|
if (this.#context !== void 0) restore["browserContextId"] = this.#context;
|
|
3814
3819
|
const result = await this.#client.send("Storage.setCookies", restore);
|
|
@@ -3952,12 +3957,14 @@ var BrowserCodegen = class {
|
|
|
3952
3957
|
#stopping;
|
|
3953
3958
|
#shutdown;
|
|
3954
3959
|
#emitter;
|
|
3960
|
+
#onBindingCalled = this.#handleBindingCalled.bind(this);
|
|
3961
|
+
#onFrameNavigated = this.#handleFrameNavigated.bind(this);
|
|
3955
3962
|
constructor(client, sessionId, options) {
|
|
3956
3963
|
this.#client = client;
|
|
3957
3964
|
this.#sessionId = sessionId;
|
|
3958
3965
|
this.#emitter = new _orkestrel_emitter.Emitter({
|
|
3959
|
-
on: options
|
|
3960
|
-
error: options
|
|
3966
|
+
...options?.on !== void 0 ? { on: options.on } : {},
|
|
3967
|
+
...options?.error !== void 0 ? { error: options.error } : {}
|
|
3961
3968
|
});
|
|
3962
3969
|
}
|
|
3963
3970
|
get emitter() {
|
|
@@ -4052,19 +4059,19 @@ var BrowserCodegen = class {
|
|
|
4052
4059
|
this.#actions = [];
|
|
4053
4060
|
this.#emitter.destroy();
|
|
4054
4061
|
}
|
|
4055
|
-
#
|
|
4062
|
+
#handleBindingCalled(params) {
|
|
4056
4063
|
if (params["name"] !== "__orkestrelBrowserCodegen") return;
|
|
4057
4064
|
const action = parseCodegenActionPayload(params["payload"]);
|
|
4058
4065
|
if (action === void 0) return;
|
|
4059
4066
|
this.#actions.push(action);
|
|
4060
4067
|
this.#emitter.emit("action", action);
|
|
4061
|
-
}
|
|
4062
|
-
#
|
|
4068
|
+
}
|
|
4069
|
+
#handleFrameNavigated(params) {
|
|
4063
4070
|
const action = readCodegenNavigateAction(params);
|
|
4064
4071
|
if (action === void 0) return;
|
|
4065
4072
|
this.#actions.push(action);
|
|
4066
4073
|
this.#emitter.emit("action", action);
|
|
4067
|
-
}
|
|
4074
|
+
}
|
|
4068
4075
|
#unsubscribe() {
|
|
4069
4076
|
this.#client.unsubscribe("Runtime.bindingCalled", this.#onBindingCalled, this.#sessionId);
|
|
4070
4077
|
this.#client.unsubscribe("Page.frameNavigated", this.#onFrameNavigated, this.#sessionId);
|
|
@@ -4134,12 +4141,7 @@ var BrowserTracing = class {
|
|
|
4134
4141
|
#active = false;
|
|
4135
4142
|
#options;
|
|
4136
4143
|
#completion;
|
|
4137
|
-
#completeHandler = (
|
|
4138
|
-
const completion = this.#completion;
|
|
4139
|
-
if (completion === void 0) return;
|
|
4140
|
-
if ((0, _orkestrel_contract.isString)(params["stream"])) completion.resolve(params["stream"]);
|
|
4141
|
-
else completion.reject(new BrowserError("Browser trace did not return an IO stream"));
|
|
4142
|
-
};
|
|
4144
|
+
#completeHandler = this.#handleComplete.bind(this);
|
|
4143
4145
|
constructor(frame, writer) {
|
|
4144
4146
|
this.#frame = frame;
|
|
4145
4147
|
this.#writer = writer;
|
|
@@ -4215,6 +4217,12 @@ var BrowserTracing = class {
|
|
|
4215
4217
|
clearTimeout(timer);
|
|
4216
4218
|
}
|
|
4217
4219
|
}
|
|
4220
|
+
#handleComplete(params) {
|
|
4221
|
+
const completion = this.#completion;
|
|
4222
|
+
if (completion === void 0) return;
|
|
4223
|
+
if ((0, _orkestrel_contract.isString)(params["stream"])) completion.resolve(params["stream"]);
|
|
4224
|
+
else completion.reject(new BrowserError("Browser trace did not return an IO stream"));
|
|
4225
|
+
}
|
|
4218
4226
|
};
|
|
4219
4227
|
//#endregion
|
|
4220
4228
|
//#region src/core/BrowserDiagnostics.ts
|
|
@@ -4932,8 +4940,8 @@ var BrowserLocator = class BrowserLocator {
|
|
|
4932
4940
|
let targetHandle;
|
|
4933
4941
|
try {
|
|
4934
4942
|
await target.wait({
|
|
4935
|
-
timeout: options
|
|
4936
|
-
strict: options
|
|
4943
|
+
...options?.timeout !== void 0 ? { timeout: options.timeout } : {},
|
|
4944
|
+
...options?.strict !== void 0 ? { strict: options.strict } : {},
|
|
4937
4945
|
state: "visible"
|
|
4938
4946
|
});
|
|
4939
4947
|
targetHandle = await target.frame.handle(compileLocatorExpression(target.query));
|
|
@@ -4956,8 +4964,8 @@ var BrowserLocator = class BrowserLocator {
|
|
|
4956
4964
|
async #resolve(options, state) {
|
|
4957
4965
|
validateBrowserActionOptions(options);
|
|
4958
4966
|
await this.wait({
|
|
4959
|
-
timeout: options
|
|
4960
|
-
strict: options
|
|
4967
|
+
...options?.timeout !== void 0 ? { timeout: options.timeout } : {},
|
|
4968
|
+
...options?.strict !== void 0 ? { strict: options.strict } : {},
|
|
4961
4969
|
state
|
|
4962
4970
|
});
|
|
4963
4971
|
return await this.#frame.handle(compileLocatorExpression(this.#query));
|
|
@@ -4965,7 +4973,7 @@ var BrowserLocator = class BrowserLocator {
|
|
|
4965
4973
|
async #point(handle, options, actionability) {
|
|
4966
4974
|
if (options?.force !== true) await handle.call(compileActionabilityFunction({
|
|
4967
4975
|
...actionability,
|
|
4968
|
-
position: options
|
|
4976
|
+
...options?.position !== void 0 ? { position: options.position } : {}
|
|
4969
4977
|
}));
|
|
4970
4978
|
const quad = await this.#quad(handle);
|
|
4971
4979
|
if (options?.position === void 0) return quad.center;
|
|
@@ -5039,29 +5047,29 @@ var BrowserSelectorManager = class {
|
|
|
5039
5047
|
return new BrowserLocator(this.#frame, {
|
|
5040
5048
|
selector: "role",
|
|
5041
5049
|
value,
|
|
5042
|
-
name: options
|
|
5043
|
-
exact: options
|
|
5050
|
+
...options?.name !== void 0 ? { name: options.name } : {},
|
|
5051
|
+
...options?.exact !== void 0 ? { exact: options.exact } : {}
|
|
5044
5052
|
});
|
|
5045
5053
|
}
|
|
5046
5054
|
text(value, options) {
|
|
5047
5055
|
return new BrowserLocator(this.#frame, {
|
|
5048
5056
|
selector: "text",
|
|
5049
5057
|
value,
|
|
5050
|
-
exact: options
|
|
5058
|
+
...options?.exact !== void 0 ? { exact: options.exact } : {}
|
|
5051
5059
|
});
|
|
5052
5060
|
}
|
|
5053
5061
|
label(value, options) {
|
|
5054
5062
|
return new BrowserLocator(this.#frame, {
|
|
5055
5063
|
selector: "label",
|
|
5056
5064
|
value,
|
|
5057
|
-
exact: options
|
|
5065
|
+
...options?.exact !== void 0 ? { exact: options.exact } : {}
|
|
5058
5066
|
});
|
|
5059
5067
|
}
|
|
5060
5068
|
placeholder(value, options) {
|
|
5061
5069
|
return new BrowserLocator(this.#frame, {
|
|
5062
5070
|
selector: "placeholder",
|
|
5063
5071
|
value,
|
|
5064
|
-
exact: options
|
|
5072
|
+
...options?.exact !== void 0 ? { exact: options.exact } : {}
|
|
5065
5073
|
});
|
|
5066
5074
|
}
|
|
5067
5075
|
test(value) {
|
|
@@ -5331,45 +5339,11 @@ var BrowserHARManager = class {
|
|
|
5331
5339
|
#failure;
|
|
5332
5340
|
#archive;
|
|
5333
5341
|
#fallback = false;
|
|
5334
|
-
#requestHandler = (
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
response: void 0
|
|
5340
|
-
});
|
|
5341
|
-
};
|
|
5342
|
-
#responseHandler = (response) => {
|
|
5343
|
-
const pending = this.#pending.get(response.id);
|
|
5344
|
-
if (pending === void 0) return;
|
|
5345
|
-
this.#pending.set(response.id, {
|
|
5346
|
-
request: pending.request,
|
|
5347
|
-
started: pending.started,
|
|
5348
|
-
response
|
|
5349
|
-
});
|
|
5350
|
-
};
|
|
5351
|
-
#failureHandler = (failure) => {
|
|
5352
|
-
const pending = this.#pending.get(failure.id);
|
|
5353
|
-
if (pending === void 0) return;
|
|
5354
|
-
this.#pending.delete(failure.id);
|
|
5355
|
-
this.#entries.push(createBrowserHAREntry(pending, Math.max(0, Date.now() - pending.started), void 0, failure.error));
|
|
5356
|
-
};
|
|
5357
|
-
#finishHandler = (id) => this.#track(this.#complete(id));
|
|
5358
|
-
#replayHandler = async (route) => {
|
|
5359
|
-
const entry = this.#archive?.log.entries.find((candidate) => candidate.request.url === route.request.url && candidate.request.method === route.request.method);
|
|
5360
|
-
if (entry === void 0 || entry.response.status === 0) {
|
|
5361
|
-
if (this.#fallback) await route.continue();
|
|
5362
|
-
else await route.abort("Failed");
|
|
5363
|
-
return;
|
|
5364
|
-
}
|
|
5365
|
-
const body = entry.response.content.text === void 0 ? void 0 : entry.response.content.encoding === "base64" ? decodeBase64(entry.response.content.text) : entry.response.content.text;
|
|
5366
|
-
await route.fulfill({
|
|
5367
|
-
status: entry.response.status,
|
|
5368
|
-
phrase: entry.response.statusText,
|
|
5369
|
-
headers: browserHARHeadersToRecord(entry.response.headers),
|
|
5370
|
-
body
|
|
5371
|
-
});
|
|
5372
|
-
};
|
|
5342
|
+
#requestHandler = this.#handleRequest.bind(this);
|
|
5343
|
+
#responseHandler = this.#handleResponse.bind(this);
|
|
5344
|
+
#failureHandler = this.#handleFailure.bind(this);
|
|
5345
|
+
#finishHandler = this.#handleFinish.bind(this);
|
|
5346
|
+
#replayHandler = this.#handleReplay.bind(this);
|
|
5373
5347
|
constructor(network, writer) {
|
|
5374
5348
|
this.#network = network;
|
|
5375
5349
|
this.#writer = writer;
|
|
@@ -5448,6 +5422,47 @@ var BrowserHARManager = class {
|
|
|
5448
5422
|
this.#entries.length = 0;
|
|
5449
5423
|
this.#pending.clear();
|
|
5450
5424
|
}
|
|
5425
|
+
#handleRequest(request) {
|
|
5426
|
+
if (!this.#recording) return;
|
|
5427
|
+
this.#pending.set(request.id, {
|
|
5428
|
+
request,
|
|
5429
|
+
started: request.walltime === void 0 ? Date.now() : request.walltime * 1e3,
|
|
5430
|
+
response: void 0
|
|
5431
|
+
});
|
|
5432
|
+
}
|
|
5433
|
+
#handleResponse(response) {
|
|
5434
|
+
const pending = this.#pending.get(response.id);
|
|
5435
|
+
if (pending === void 0) return;
|
|
5436
|
+
this.#pending.set(response.id, {
|
|
5437
|
+
request: pending.request,
|
|
5438
|
+
started: pending.started,
|
|
5439
|
+
response
|
|
5440
|
+
});
|
|
5441
|
+
}
|
|
5442
|
+
#handleFailure(failure) {
|
|
5443
|
+
const pending = this.#pending.get(failure.id);
|
|
5444
|
+
if (pending === void 0) return;
|
|
5445
|
+
this.#pending.delete(failure.id);
|
|
5446
|
+
this.#entries.push(createBrowserHAREntry(pending, Math.max(0, Date.now() - pending.started), void 0, failure.error));
|
|
5447
|
+
}
|
|
5448
|
+
#handleFinish(id) {
|
|
5449
|
+
this.#track(this.#complete(id));
|
|
5450
|
+
}
|
|
5451
|
+
async #handleReplay(route) {
|
|
5452
|
+
const entry = this.#archive?.log.entries.find((candidate) => candidate.request.url === route.request.url && candidate.request.method === route.request.method);
|
|
5453
|
+
if (entry === void 0 || entry.response.status === 0) {
|
|
5454
|
+
if (this.#fallback) await route.continue();
|
|
5455
|
+
else await route.abort("Failed");
|
|
5456
|
+
return;
|
|
5457
|
+
}
|
|
5458
|
+
const body = entry.response.content.text === void 0 ? void 0 : entry.response.content.encoding === "base64" ? decodeBase64(entry.response.content.text) : entry.response.content.text;
|
|
5459
|
+
await route.fulfill({
|
|
5460
|
+
status: entry.response.status,
|
|
5461
|
+
phrase: entry.response.statusText,
|
|
5462
|
+
headers: browserHARHeadersToRecord(entry.response.headers),
|
|
5463
|
+
...body !== void 0 ? { body } : {}
|
|
5464
|
+
});
|
|
5465
|
+
}
|
|
5451
5466
|
async #complete(id) {
|
|
5452
5467
|
const pending = this.#pending.get(id);
|
|
5453
5468
|
if (pending === void 0) return;
|
|
@@ -5597,54 +5612,17 @@ var BrowserNetworkManager = class {
|
|
|
5597
5612
|
#fetch = false;
|
|
5598
5613
|
#destroyed = false;
|
|
5599
5614
|
#starting;
|
|
5600
|
-
#requestHandler = (
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
#
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
#
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
};
|
|
5612
|
-
#finishHandler = (params) => {
|
|
5613
|
-
if ((0, _orkestrel_contract.isString)(params["requestId"])) this.#emitter.emit("finish", params["requestId"]);
|
|
5614
|
-
};
|
|
5615
|
-
#pausedHandler = (params) => {
|
|
5616
|
-
this.#route(params).catch(() => void 0);
|
|
5617
|
-
};
|
|
5618
|
-
#authHandler = (params) => {
|
|
5619
|
-
this.#authenticate(params).catch(() => void 0);
|
|
5620
|
-
};
|
|
5621
|
-
#socketHandler = (params) => {
|
|
5622
|
-
if (!(0, _orkestrel_contract.isString)(params["requestId"]) || !(0, _orkestrel_contract.isString)(params["url"])) return;
|
|
5623
|
-
const socket = new BrowserWebSocket(params["requestId"], params["url"]);
|
|
5624
|
-
this.#sockets.set(socket.id, socket);
|
|
5625
|
-
this.#emitter.emit("socket", socket);
|
|
5626
|
-
};
|
|
5627
|
-
#socketReceiveHandler = (params) => {
|
|
5628
|
-
const socket = (0, _orkestrel_contract.isString)(params["requestId"]) ? this.#sockets.get(params["requestId"]) : void 0;
|
|
5629
|
-
const frame = readBrowserWebSocketFrame(params);
|
|
5630
|
-
if (socket !== void 0 && frame !== void 0) socket.receive(frame);
|
|
5631
|
-
};
|
|
5632
|
-
#socketTransmitHandler = (params) => {
|
|
5633
|
-
const socket = (0, _orkestrel_contract.isString)(params["requestId"]) ? this.#sockets.get(params["requestId"]) : void 0;
|
|
5634
|
-
const frame = readBrowserWebSocketFrame(params);
|
|
5635
|
-
if (socket !== void 0 && frame !== void 0) socket.transmit(frame);
|
|
5636
|
-
};
|
|
5637
|
-
#socketErrorHandler = (params) => {
|
|
5638
|
-
const socket = (0, _orkestrel_contract.isString)(params["requestId"]) ? this.#sockets.get(params["requestId"]) : void 0;
|
|
5639
|
-
if (socket !== void 0 && (0, _orkestrel_contract.isString)(params["errorMessage"])) socket.fail(params["errorMessage"]);
|
|
5640
|
-
};
|
|
5641
|
-
#socketCloseHandler = (params) => {
|
|
5642
|
-
if (!(0, _orkestrel_contract.isString)(params["requestId"])) return;
|
|
5643
|
-
const socket = this.#sockets.get(params["requestId"]);
|
|
5644
|
-
if (socket === void 0) return;
|
|
5645
|
-
this.#sockets.delete(params["requestId"]);
|
|
5646
|
-
socket.close((0, _orkestrel_contract.isFiniteNumber)(params["timestamp"]) ? params["timestamp"] : Date.now() / 1e3);
|
|
5647
|
-
};
|
|
5615
|
+
#requestHandler = this.#handleRequest.bind(this);
|
|
5616
|
+
#responseHandler = this.#handleResponse.bind(this);
|
|
5617
|
+
#failureHandler = this.#handleFailure.bind(this);
|
|
5618
|
+
#finishHandler = this.#handleFinish.bind(this);
|
|
5619
|
+
#pausedHandler = this.#handlePause.bind(this);
|
|
5620
|
+
#authHandler = this.#handleAuth.bind(this);
|
|
5621
|
+
#socketHandler = this.#handleSocket.bind(this);
|
|
5622
|
+
#socketReceiveHandler = this.#handleSocketReceive.bind(this);
|
|
5623
|
+
#socketTransmitHandler = this.#handleSocketTransmit.bind(this);
|
|
5624
|
+
#socketErrorHandler = this.#handleSocketError.bind(this);
|
|
5625
|
+
#socketCloseHandler = this.#handleSocketClose.bind(this);
|
|
5648
5626
|
constructor(frame, writer) {
|
|
5649
5627
|
this.#frame = frame;
|
|
5650
5628
|
this.#emitter = new _orkestrel_emitter.Emitter();
|
|
@@ -5774,6 +5752,54 @@ var BrowserNetworkManager = class {
|
|
|
5774
5752
|
this.#emitter.destroy();
|
|
5775
5753
|
if (failed) throw failure;
|
|
5776
5754
|
}
|
|
5755
|
+
#handleRequest(params) {
|
|
5756
|
+
const request = readBrowserRequest(params);
|
|
5757
|
+
if (request !== void 0) this.#emitter.emit("request", request);
|
|
5758
|
+
}
|
|
5759
|
+
#handleResponse(params) {
|
|
5760
|
+
const response = readBrowserResponse(params);
|
|
5761
|
+
if (response !== void 0) this.#emitter.emit("response", response);
|
|
5762
|
+
}
|
|
5763
|
+
#handleFailure(params) {
|
|
5764
|
+
const failure = readBrowserRequestFailure(params);
|
|
5765
|
+
if (failure !== void 0) this.#emitter.emit("failure", failure);
|
|
5766
|
+
}
|
|
5767
|
+
#handleFinish(params) {
|
|
5768
|
+
if ((0, _orkestrel_contract.isString)(params["requestId"])) this.#emitter.emit("finish", params["requestId"]);
|
|
5769
|
+
}
|
|
5770
|
+
#handlePause(params) {
|
|
5771
|
+
this.#route(params).catch(() => void 0);
|
|
5772
|
+
}
|
|
5773
|
+
#handleAuth(params) {
|
|
5774
|
+
this.#authenticate(params).catch(() => void 0);
|
|
5775
|
+
}
|
|
5776
|
+
#handleSocket(params) {
|
|
5777
|
+
if (!(0, _orkestrel_contract.isString)(params["requestId"]) || !(0, _orkestrel_contract.isString)(params["url"])) return;
|
|
5778
|
+
const socket = new BrowserWebSocket(params["requestId"], params["url"]);
|
|
5779
|
+
this.#sockets.set(socket.id, socket);
|
|
5780
|
+
this.#emitter.emit("socket", socket);
|
|
5781
|
+
}
|
|
5782
|
+
#handleSocketReceive(params) {
|
|
5783
|
+
const socket = (0, _orkestrel_contract.isString)(params["requestId"]) ? this.#sockets.get(params["requestId"]) : void 0;
|
|
5784
|
+
const frame = readBrowserWebSocketFrame(params);
|
|
5785
|
+
if (socket !== void 0 && frame !== void 0) socket.receive(frame);
|
|
5786
|
+
}
|
|
5787
|
+
#handleSocketTransmit(params) {
|
|
5788
|
+
const socket = (0, _orkestrel_contract.isString)(params["requestId"]) ? this.#sockets.get(params["requestId"]) : void 0;
|
|
5789
|
+
const frame = readBrowserWebSocketFrame(params);
|
|
5790
|
+
if (socket !== void 0 && frame !== void 0) socket.transmit(frame);
|
|
5791
|
+
}
|
|
5792
|
+
#handleSocketError(params) {
|
|
5793
|
+
const socket = (0, _orkestrel_contract.isString)(params["requestId"]) ? this.#sockets.get(params["requestId"]) : void 0;
|
|
5794
|
+
if (socket !== void 0 && (0, _orkestrel_contract.isString)(params["errorMessage"])) socket.fail(params["errorMessage"]);
|
|
5795
|
+
}
|
|
5796
|
+
#handleSocketClose(params) {
|
|
5797
|
+
if (!(0, _orkestrel_contract.isString)(params["requestId"])) return;
|
|
5798
|
+
const socket = this.#sockets.get(params["requestId"]);
|
|
5799
|
+
if (socket === void 0) return;
|
|
5800
|
+
this.#sockets.delete(params["requestId"]);
|
|
5801
|
+
socket.close((0, _orkestrel_contract.isFiniteNumber)(params["timestamp"]) ? params["timestamp"] : Date.now() / 1e3);
|
|
5802
|
+
}
|
|
5777
5803
|
async #begin() {
|
|
5778
5804
|
try {
|
|
5779
5805
|
await this.#subscribe();
|
|
@@ -5877,21 +5903,8 @@ var BrowserNetworkManager = class {
|
|
|
5877
5903
|
var BrowserNavigationManager = class {
|
|
5878
5904
|
#page;
|
|
5879
5905
|
#waits = /* @__PURE__ */ new Map();
|
|
5880
|
-
#navigateHandler = (
|
|
5881
|
-
|
|
5882
|
-
if (!matchesBrowserURL(url, wait.pattern)) continue;
|
|
5883
|
-
clearTimeout(wait.timer);
|
|
5884
|
-
this.#waits.delete(id);
|
|
5885
|
-
wait.resolve(url);
|
|
5886
|
-
}
|
|
5887
|
-
};
|
|
5888
|
-
#closeHandler = () => {
|
|
5889
|
-
for (const [id, wait] of this.#waits) {
|
|
5890
|
-
clearTimeout(wait.timer);
|
|
5891
|
-
this.#waits.delete(id);
|
|
5892
|
-
wait.reject(new BrowserError("Browser URL wait ended because the page closed"));
|
|
5893
|
-
}
|
|
5894
|
-
};
|
|
5906
|
+
#navigateHandler = this.#handleNavigate.bind(this);
|
|
5907
|
+
#closeHandler = this.#handleClose.bind(this);
|
|
5895
5908
|
constructor(page) {
|
|
5896
5909
|
this.#page = page;
|
|
5897
5910
|
this.#page.emitter.on("navigate", this.#navigateHandler);
|
|
@@ -5926,6 +5939,21 @@ var BrowserNavigationManager = class {
|
|
|
5926
5939
|
timeout
|
|
5927
5940
|
});
|
|
5928
5941
|
}
|
|
5942
|
+
#handleNavigate(url) {
|
|
5943
|
+
for (const [id, wait] of this.#waits) {
|
|
5944
|
+
if (!matchesBrowserURL(url, wait.pattern)) continue;
|
|
5945
|
+
clearTimeout(wait.timer);
|
|
5946
|
+
this.#waits.delete(id);
|
|
5947
|
+
wait.resolve(url);
|
|
5948
|
+
}
|
|
5949
|
+
}
|
|
5950
|
+
#handleClose() {
|
|
5951
|
+
for (const [id, wait] of this.#waits) {
|
|
5952
|
+
clearTimeout(wait.timer);
|
|
5953
|
+
this.#waits.delete(id);
|
|
5954
|
+
wait.reject(new BrowserError("Browser URL wait ended because the page closed"));
|
|
5955
|
+
}
|
|
5956
|
+
}
|
|
5929
5957
|
#timeout(options) {
|
|
5930
5958
|
const timeout = options?.timeout ?? 3e4;
|
|
5931
5959
|
validateBrowserTimeout(timeout);
|
|
@@ -5943,9 +5971,7 @@ var BrowserScriptManager = class {
|
|
|
5943
5971
|
#scripts = /* @__PURE__ */ new Map();
|
|
5944
5972
|
#subscribed = false;
|
|
5945
5973
|
#destroyed = false;
|
|
5946
|
-
#bindingHandler = (
|
|
5947
|
-
this.#call(params).catch(() => void 0);
|
|
5948
|
-
};
|
|
5974
|
+
#bindingHandler = this.#handleBinding.bind(this);
|
|
5949
5975
|
constructor(frame) {
|
|
5950
5976
|
this.#frame = frame;
|
|
5951
5977
|
}
|
|
@@ -6041,6 +6067,9 @@ var BrowserScriptManager = class {
|
|
|
6041
6067
|
});
|
|
6042
6068
|
}
|
|
6043
6069
|
}
|
|
6070
|
+
#handleBinding(params) {
|
|
6071
|
+
this.#call(params).catch(() => void 0);
|
|
6072
|
+
}
|
|
6044
6073
|
#assert() {
|
|
6045
6074
|
if (this.#destroyed) throw new BrowserError("Browser script manager is destroyed");
|
|
6046
6075
|
}
|
|
@@ -6136,129 +6165,21 @@ var BrowserPage = class BrowserPage extends BrowserFrame {
|
|
|
6136
6165
|
#loadResolve;
|
|
6137
6166
|
#loadReject;
|
|
6138
6167
|
#responses;
|
|
6139
|
-
#navigationResponseHandler = (
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
#
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
#
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
}
|
|
6155
|
-
}
|
|
6156
|
-
if (this.#loadEvents.includes("Page.frameNavigated")) {
|
|
6157
|
-
const frame = params["frame"];
|
|
6158
|
-
if ((0, _orkestrel_contract.isRecord)(frame) && frame["id"] === this.id) this.#resolveLoad();
|
|
6159
|
-
return;
|
|
6160
|
-
}
|
|
6161
|
-
if (this.#loadEvents.includes("Page.loadEventFired") || this.#loadEvents.includes("Page.domContentEventFired")) this.#resolveLoad();
|
|
6162
|
-
};
|
|
6163
|
-
#frameAttachedHandler = (params) => {
|
|
6164
|
-
const frame = params["frameId"];
|
|
6165
|
-
const parent = params["parentFrameId"];
|
|
6166
|
-
if (!(0, _orkestrel_contract.isString)(frame)) return;
|
|
6167
|
-
this.#emitter.emit("attach", new BrowserFrame(this.#client, (id) => this.#resolveFrameSession(id), frame, "about:blank", (0, _orkestrel_contract.isString)(parent) ? parent : void 0));
|
|
6168
|
-
};
|
|
6169
|
-
#frameNavigatedHandler = (params) => {
|
|
6170
|
-
const frame = params["frame"];
|
|
6171
|
-
if (!(0, _orkestrel_contract.isRecord)(frame) || !(0, _orkestrel_contract.isString)(frame["id"]) || !(0, _orkestrel_contract.isString)(frame["url"])) return;
|
|
6172
|
-
if (frame["id"] === this.id) {
|
|
6173
|
-
this.update(frame["url"]);
|
|
6174
|
-
this.#emitter.emit("navigate", frame["url"]);
|
|
6175
|
-
}
|
|
6176
|
-
};
|
|
6177
|
-
#frameDetachedHandler = (params) => {
|
|
6178
|
-
const frame = params["frameId"];
|
|
6179
|
-
if (!(0, _orkestrel_contract.isString)(frame)) return;
|
|
6180
|
-
this.#frameSessions.delete(frame);
|
|
6181
|
-
this.#emitter.emit("detach", frame);
|
|
6182
|
-
};
|
|
6183
|
-
#dialogHandler = (params) => {
|
|
6184
|
-
const category = params["type"];
|
|
6185
|
-
if (category !== "alert" && category !== "confirm" && category !== "prompt" && category !== "beforeunload" || !(0, _orkestrel_contract.isString)(params["message"])) return;
|
|
6186
|
-
this.#emitter.emit("dialog", new BrowserDialog(this, category, params["message"], (0, _orkestrel_contract.isString)(params["defaultPrompt"]) ? params["defaultPrompt"] : ""));
|
|
6187
|
-
};
|
|
6188
|
-
#chooserHandler = (params) => {
|
|
6189
|
-
const backend = params["backendNodeId"];
|
|
6190
|
-
const mode = params["mode"];
|
|
6191
|
-
if (!(0, _orkestrel_contract.isInteger)(backend)) return;
|
|
6192
|
-
this.#emitter.emit("chooser", new BrowserFileChooser(this, backend, mode === "selectMultiple"));
|
|
6193
|
-
};
|
|
6194
|
-
#consoleHandler = (params) => {
|
|
6195
|
-
const message = readBrowserConsoleMessage(params);
|
|
6196
|
-
if (message !== void 0) this.#emitter.emit("console", message);
|
|
6197
|
-
};
|
|
6198
|
-
#errorHandler = (params) => {
|
|
6199
|
-
const error = readBrowserPageError(params);
|
|
6200
|
-
if (error !== void 0) this.#emitter.emit("error", error);
|
|
6201
|
-
};
|
|
6202
|
-
#crashHandler = () => this.#emitter.emit("crash");
|
|
6203
|
-
#downloadHandler = (params) => {
|
|
6204
|
-
const start = readBrowserDownloadStart(params);
|
|
6205
|
-
if (start === void 0 || start.frame !== this.id && !this.#frameSessions.has(start.frame)) return;
|
|
6206
|
-
const download = new BrowserDownload(this.#client, start.id, start.url, start.name, this.#contextId);
|
|
6207
|
-
this.#downloads.set(start.id, download);
|
|
6208
|
-
this.#emitter.emit("download", download);
|
|
6209
|
-
};
|
|
6210
|
-
#downloadProgressHandler = (params) => {
|
|
6211
|
-
const decoded = readBrowserDownloadProgress(params);
|
|
6212
|
-
if (decoded === void 0) return;
|
|
6213
|
-
const [id, progress] = decoded;
|
|
6214
|
-
const download = this.#downloads.get(id);
|
|
6215
|
-
if (download === void 0) return;
|
|
6216
|
-
download.update(progress);
|
|
6217
|
-
if (progress.status !== "pending") this.#downloads.delete(id);
|
|
6218
|
-
};
|
|
6219
|
-
#attachedHandler = (params) => {
|
|
6220
|
-
const target = params["targetInfo"];
|
|
6221
|
-
const session = params["sessionId"];
|
|
6222
|
-
if (!(0, _orkestrel_contract.isRecord)(target) || !(0, _orkestrel_contract.isString)(target["targetId"]) || !(0, _orkestrel_contract.isString)(session)) return;
|
|
6223
|
-
const category = target["type"];
|
|
6224
|
-
if (category === "worker" || category === "service_worker" || category === "shared_worker") {
|
|
6225
|
-
this.#attachWorker(session, target["targetId"], (0, _orkestrel_contract.isString)(target["url"]) ? target["url"] : "", category);
|
|
6226
|
-
return;
|
|
6227
|
-
}
|
|
6228
|
-
if (category === "page") {
|
|
6229
|
-
this.#attachPopup(session, target["targetId"], (0, _orkestrel_contract.isString)(target["url"]) ? target["url"] : "about:blank");
|
|
6230
|
-
return;
|
|
6231
|
-
}
|
|
6232
|
-
if (category !== "iframe") return;
|
|
6233
|
-
const frame = target["targetId"];
|
|
6234
|
-
const attempt = this.#enableFrameSession(session);
|
|
6235
|
-
this.#frameSessions.set(frame, attempt);
|
|
6236
|
-
this.#frameIds.set(session, frame);
|
|
6237
|
-
attempt.catch(() => {
|
|
6238
|
-
if (this.#frameSessions.get(frame) === attempt) this.#frameSessions.delete(frame);
|
|
6239
|
-
if (this.#frameIds.get(session) === frame) this.#frameIds.delete(session);
|
|
6240
|
-
this.#detachChild(session);
|
|
6241
|
-
});
|
|
6242
|
-
};
|
|
6243
|
-
#detachedHandler = (params) => {
|
|
6244
|
-
const session = params["sessionId"];
|
|
6245
|
-
const target = params["targetId"];
|
|
6246
|
-
if ((0, _orkestrel_contract.isString)(target)) {
|
|
6247
|
-
const worker = this.#workers.get(target);
|
|
6248
|
-
if (worker !== void 0) {
|
|
6249
|
-
worker.detach();
|
|
6250
|
-
this.#workers.delete(target);
|
|
6251
|
-
}
|
|
6252
|
-
const popup = this.#popups.get(target);
|
|
6253
|
-
if (popup !== void 0) {
|
|
6254
|
-
this.#popups.delete(target);
|
|
6255
|
-
popup.destroy().catch(() => void 0);
|
|
6256
|
-
}
|
|
6257
|
-
}
|
|
6258
|
-
const frame = (0, _orkestrel_contract.isString)(target) ? target : (0, _orkestrel_contract.isString)(session) ? this.#frameIds.get(session) : void 0;
|
|
6259
|
-
if (frame !== void 0) this.#frameSessions.delete(frame);
|
|
6260
|
-
if ((0, _orkestrel_contract.isString)(session)) this.#frameIds.delete(session);
|
|
6261
|
-
};
|
|
6168
|
+
#navigationResponseHandler = this.#handleNavigationResponse.bind(this);
|
|
6169
|
+
#destroyHandler = this.#handleDestroy.bind(this);
|
|
6170
|
+
#loadHandler = this.#handleLoad.bind(this);
|
|
6171
|
+
#frameAttachedHandler = this.#handleFrameAttached.bind(this);
|
|
6172
|
+
#frameNavigatedHandler = this.#handleFrameNavigated.bind(this);
|
|
6173
|
+
#frameDetachedHandler = this.#handleFrameDetached.bind(this);
|
|
6174
|
+
#dialogHandler = this.#handleDialog.bind(this);
|
|
6175
|
+
#chooserHandler = this.#handleChooser.bind(this);
|
|
6176
|
+
#consoleHandler = this.#handleConsole.bind(this);
|
|
6177
|
+
#errorHandler = this.#handleError.bind(this);
|
|
6178
|
+
#crashHandler = this.#handleCrash.bind(this);
|
|
6179
|
+
#downloadHandler = this.#handleDownload.bind(this);
|
|
6180
|
+
#downloadProgressHandler = this.#handleDownloadProgress.bind(this);
|
|
6181
|
+
#attachedHandler = this.#handleAttached.bind(this);
|
|
6182
|
+
#detachedHandler = this.#handleDetached.bind(this);
|
|
6262
6183
|
constructor(client, targetId, sessionId, writer, url, frameId, contextId, opener) {
|
|
6263
6184
|
super(client, sessionId, frameId ?? targetId, url ?? "about:blank", void 0, void 0, false);
|
|
6264
6185
|
this.#client = client;
|
|
@@ -6718,6 +6639,131 @@ var BrowserPage = class BrowserPage extends BrowserFrame {
|
|
|
6718
6639
|
await this.request("Page.stopLoading", void 0, timeout);
|
|
6719
6640
|
} catch {}
|
|
6720
6641
|
}
|
|
6642
|
+
#handleNavigationResponse(response) {
|
|
6643
|
+
if (response.frame === this.id) this.#responses?.push(response);
|
|
6644
|
+
}
|
|
6645
|
+
#handleDestroy(params) {
|
|
6646
|
+
if (!(0, _orkestrel_contract.isString)(params["targetId"]) || params["targetId"] !== this.#targetId) return;
|
|
6647
|
+
this.#closed = true;
|
|
6648
|
+
this.#release().catch(() => void 0);
|
|
6649
|
+
}
|
|
6650
|
+
#handleLoad(params) {
|
|
6651
|
+
if (this.#loadEvents.includes("Page.navigatedWithinDocument")) {
|
|
6652
|
+
const frame = params["frameId"];
|
|
6653
|
+
if ((0, _orkestrel_contract.isString)(frame) && frame === this.id) {
|
|
6654
|
+
this.#sameDocument = true;
|
|
6655
|
+
this.#resolveLoad();
|
|
6656
|
+
return;
|
|
6657
|
+
}
|
|
6658
|
+
}
|
|
6659
|
+
if (this.#loadEvents.includes("Page.frameNavigated")) {
|
|
6660
|
+
const frame = params["frame"];
|
|
6661
|
+
if ((0, _orkestrel_contract.isRecord)(frame) && frame["id"] === this.id) this.#resolveLoad();
|
|
6662
|
+
return;
|
|
6663
|
+
}
|
|
6664
|
+
if (this.#loadEvents.includes("Page.loadEventFired") || this.#loadEvents.includes("Page.domContentEventFired")) this.#resolveLoad();
|
|
6665
|
+
}
|
|
6666
|
+
#handleFrameAttached(params) {
|
|
6667
|
+
const frame = params["frameId"];
|
|
6668
|
+
const parent = params["parentFrameId"];
|
|
6669
|
+
if (!(0, _orkestrel_contract.isString)(frame)) return;
|
|
6670
|
+
this.#emitter.emit("attach", new BrowserFrame(this.#client, (id) => this.#resolveFrameSession(id), frame, "about:blank", (0, _orkestrel_contract.isString)(parent) ? parent : void 0));
|
|
6671
|
+
}
|
|
6672
|
+
#handleFrameNavigated(params) {
|
|
6673
|
+
const frame = params["frame"];
|
|
6674
|
+
if (!(0, _orkestrel_contract.isRecord)(frame) || !(0, _orkestrel_contract.isString)(frame["id"]) || !(0, _orkestrel_contract.isString)(frame["url"])) return;
|
|
6675
|
+
if (frame["id"] === this.id) {
|
|
6676
|
+
this.update(frame["url"]);
|
|
6677
|
+
this.#emitter.emit("navigate", frame["url"]);
|
|
6678
|
+
}
|
|
6679
|
+
}
|
|
6680
|
+
#handleFrameDetached(params) {
|
|
6681
|
+
const frame = params["frameId"];
|
|
6682
|
+
if (!(0, _orkestrel_contract.isString)(frame)) return;
|
|
6683
|
+
this.#frameSessions.delete(frame);
|
|
6684
|
+
this.#emitter.emit("detach", frame);
|
|
6685
|
+
}
|
|
6686
|
+
#handleDialog(params) {
|
|
6687
|
+
const category = params["type"];
|
|
6688
|
+
if (category !== "alert" && category !== "confirm" && category !== "prompt" && category !== "beforeunload" || !(0, _orkestrel_contract.isString)(params["message"])) return;
|
|
6689
|
+
this.#emitter.emit("dialog", new BrowserDialog(this, category, params["message"], (0, _orkestrel_contract.isString)(params["defaultPrompt"]) ? params["defaultPrompt"] : ""));
|
|
6690
|
+
}
|
|
6691
|
+
#handleChooser(params) {
|
|
6692
|
+
const backend = params["backendNodeId"];
|
|
6693
|
+
const mode = params["mode"];
|
|
6694
|
+
if (!(0, _orkestrel_contract.isInteger)(backend)) return;
|
|
6695
|
+
this.#emitter.emit("chooser", new BrowserFileChooser(this, backend, mode === "selectMultiple"));
|
|
6696
|
+
}
|
|
6697
|
+
#handleConsole(params) {
|
|
6698
|
+
const message = readBrowserConsoleMessage(params);
|
|
6699
|
+
if (message !== void 0) this.#emitter.emit("console", message);
|
|
6700
|
+
}
|
|
6701
|
+
#handleError(params) {
|
|
6702
|
+
const error = readBrowserPageError(params);
|
|
6703
|
+
if (error !== void 0) this.#emitter.emit("error", error);
|
|
6704
|
+
}
|
|
6705
|
+
#handleCrash() {
|
|
6706
|
+
this.#emitter.emit("crash");
|
|
6707
|
+
}
|
|
6708
|
+
#handleDownload(params) {
|
|
6709
|
+
const start = readBrowserDownloadStart(params);
|
|
6710
|
+
if (start === void 0 || start.frame !== this.id && !this.#frameSessions.has(start.frame)) return;
|
|
6711
|
+
const download = new BrowserDownload(this.#client, start.id, start.url, start.name, this.#contextId);
|
|
6712
|
+
this.#downloads.set(start.id, download);
|
|
6713
|
+
this.#emitter.emit("download", download);
|
|
6714
|
+
}
|
|
6715
|
+
#handleDownloadProgress(params) {
|
|
6716
|
+
const decoded = readBrowserDownloadProgress(params);
|
|
6717
|
+
if (decoded === void 0) return;
|
|
6718
|
+
const [id, progress] = decoded;
|
|
6719
|
+
const download = this.#downloads.get(id);
|
|
6720
|
+
if (download === void 0) return;
|
|
6721
|
+
download.update(progress);
|
|
6722
|
+
if (progress.status !== "pending") this.#downloads.delete(id);
|
|
6723
|
+
}
|
|
6724
|
+
#handleAttached(params) {
|
|
6725
|
+
const target = params["targetInfo"];
|
|
6726
|
+
const session = params["sessionId"];
|
|
6727
|
+
if (!(0, _orkestrel_contract.isRecord)(target) || !(0, _orkestrel_contract.isString)(target["targetId"]) || !(0, _orkestrel_contract.isString)(session)) return;
|
|
6728
|
+
const category = target["type"];
|
|
6729
|
+
if (category === "worker" || category === "service_worker" || category === "shared_worker") {
|
|
6730
|
+
this.#attachWorker(session, target["targetId"], (0, _orkestrel_contract.isString)(target["url"]) ? target["url"] : "", category);
|
|
6731
|
+
return;
|
|
6732
|
+
}
|
|
6733
|
+
if (category === "page") {
|
|
6734
|
+
this.#attachPopup(session, target["targetId"], (0, _orkestrel_contract.isString)(target["url"]) ? target["url"] : "about:blank");
|
|
6735
|
+
return;
|
|
6736
|
+
}
|
|
6737
|
+
if (category !== "iframe") return;
|
|
6738
|
+
const frame = target["targetId"];
|
|
6739
|
+
const attempt = this.#enableFrameSession(session);
|
|
6740
|
+
this.#frameSessions.set(frame, attempt);
|
|
6741
|
+
this.#frameIds.set(session, frame);
|
|
6742
|
+
attempt.catch(() => {
|
|
6743
|
+
if (this.#frameSessions.get(frame) === attempt) this.#frameSessions.delete(frame);
|
|
6744
|
+
if (this.#frameIds.get(session) === frame) this.#frameIds.delete(session);
|
|
6745
|
+
this.#detachChild(session);
|
|
6746
|
+
});
|
|
6747
|
+
}
|
|
6748
|
+
#handleDetached(params) {
|
|
6749
|
+
const session = params["sessionId"];
|
|
6750
|
+
const target = params["targetId"];
|
|
6751
|
+
if ((0, _orkestrel_contract.isString)(target)) {
|
|
6752
|
+
const worker = this.#workers.get(target);
|
|
6753
|
+
if (worker !== void 0) {
|
|
6754
|
+
worker.detach();
|
|
6755
|
+
this.#workers.delete(target);
|
|
6756
|
+
}
|
|
6757
|
+
const popup = this.#popups.get(target);
|
|
6758
|
+
if (popup !== void 0) {
|
|
6759
|
+
this.#popups.delete(target);
|
|
6760
|
+
popup.destroy().catch(() => void 0);
|
|
6761
|
+
}
|
|
6762
|
+
}
|
|
6763
|
+
const frame = (0, _orkestrel_contract.isString)(target) ? target : (0, _orkestrel_contract.isString)(session) ? this.#frameIds.get(session) : void 0;
|
|
6764
|
+
if (frame !== void 0) this.#frameSessions.delete(frame);
|
|
6765
|
+
if ((0, _orkestrel_contract.isString)(session)) this.#frameIds.delete(session);
|
|
6766
|
+
}
|
|
6721
6767
|
#waitForLoadEvent(condition, timeout) {
|
|
6722
6768
|
const eventName = condition === "commit" ? "Page.frameNavigated" : condition === "domcontentloaded" ? "Page.domContentEventFired" : "Page.loadEventFired";
|
|
6723
6769
|
const deferred = Promise.withResolvers();
|
|
@@ -6819,8 +6865,8 @@ var BrowserStorageManager = class {
|
|
|
6819
6865
|
expires: cookie.expires,
|
|
6820
6866
|
http: cookie.http,
|
|
6821
6867
|
secure: cookie.secure,
|
|
6822
|
-
site: cookie.site,
|
|
6823
|
-
partition: cookie.partition
|
|
6868
|
+
...cookie.site !== void 0 ? { site: cookie.site } : {},
|
|
6869
|
+
...cookie.partition !== void 0 ? { partition: cookie.partition } : {}
|
|
6824
6870
|
})),
|
|
6825
6871
|
origins: storage
|
|
6826
6872
|
};
|
|
@@ -6968,7 +7014,7 @@ var BrowserContext = class {
|
|
|
6968
7014
|
try {
|
|
6969
7015
|
const viewport = options?.viewport ?? this.#viewport;
|
|
6970
7016
|
page = await this.#attach(targetId, options?.url ?? "about:blank", viewport);
|
|
6971
|
-
if (options?.url !== void 0 && options.url !== "about:blank") await page.navigate(options.url, { timeout: options.timeout });
|
|
7017
|
+
if (options?.url !== void 0 && options.url !== "about:blank") await page.navigate(options.url, { ...options.timeout !== void 0 ? { timeout: options.timeout } : {} });
|
|
6972
7018
|
if (this.#closed) throw new BrowserError("Browser context closed during page creation");
|
|
6973
7019
|
this.#pages.set(targetId, page);
|
|
6974
7020
|
this.#emitter.emit("page", page);
|