@orkestrel/browser 0.0.9 → 0.0.11
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 +83 -24
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +13 -11
- package/dist/src/core/index.d.ts +13 -11
- package/dist/src/core/index.js +83 -24
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.d.cts +12 -12
- package/dist/src/server/index.d.ts +12 -12
- package/package.json +10 -8
|
@@ -49,7 +49,7 @@ export declare const BROWSER_FRAME_WORLD_NAME = "__orkestrelBrowserFrame";
|
|
|
49
49
|
/** Tool identity embedded in HAR 1.2 documents. */
|
|
50
50
|
export declare const BROWSER_HAR_CREATOR: Readonly<{
|
|
51
51
|
name: "@orkestrel/browser";
|
|
52
|
-
version: "0.0.
|
|
52
|
+
version: "0.0.11";
|
|
53
53
|
}>;
|
|
54
54
|
|
|
55
55
|
/** CDP Input modifier bit values keyed by canonical key name. */
|
|
@@ -739,14 +739,12 @@ export declare class BrowserFrame implements BrowserFrameInterface {
|
|
|
739
739
|
evaluate(expression: string, timeout?: number): Promise<unknown>;
|
|
740
740
|
handle(expression: string): Promise<BrowserHandleInterface>;
|
|
741
741
|
wait(selector: string, options?: BrowserWaitOptions): Promise<void>;
|
|
742
|
-
send(method: string, params?: Readonly<Record<string, unknown
|
|
742
|
+
send(method: string, params?: Readonly<Record<string, unknown>>, timeout?: number): Promise<unknown>;
|
|
743
743
|
subscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
744
744
|
unsubscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
745
745
|
save(path: string, _bytes: Uint8Array): Promise<void>;
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
protected raw(expression: string, timeout?: number): Promise<unknown>;
|
|
749
|
-
protected update(url: string): void;
|
|
746
|
+
assert(): void;
|
|
747
|
+
update(url: string): void;
|
|
750
748
|
}
|
|
751
749
|
|
|
752
750
|
/**
|
|
@@ -781,7 +779,9 @@ export declare interface BrowserFrameInfo {
|
|
|
781
779
|
* - `select` — choose option(s) in a `<select>` element
|
|
782
780
|
* - `evaluate` — execute a JavaScript expression in the page context
|
|
783
781
|
* - `wait` — wait for an element state
|
|
784
|
-
* - `send` — issue a raw CDP method in the frame's current target session
|
|
782
|
+
* - `send` — issue a raw CDP method in the frame's current target session, with an optional per-call timeout
|
|
783
|
+
* - `assert` — throw when the frame can no longer accept protocol work
|
|
784
|
+
* - `update` — record an externally observed URL as the frame's current URL
|
|
785
785
|
*/
|
|
786
786
|
export declare interface BrowserFrameInterface {
|
|
787
787
|
readonly id: string;
|
|
@@ -801,10 +801,12 @@ export declare interface BrowserFrameInterface {
|
|
|
801
801
|
evaluate(expression: string, timeout?: number): Promise<unknown>;
|
|
802
802
|
handle(expression: string): Promise<BrowserHandleInterface>;
|
|
803
803
|
wait(selector: string, options?: BrowserWaitOptions): Promise<void>;
|
|
804
|
-
send(method: string, params?: Readonly<Record<string, unknown
|
|
804
|
+
send(method: string, params?: Readonly<Record<string, unknown>>, timeout?: number): Promise<unknown>;
|
|
805
805
|
subscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
806
806
|
unsubscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
807
807
|
save(path: string, bytes: Uint8Array): Promise<void>;
|
|
808
|
+
assert(): void;
|
|
809
|
+
update(url: string): void;
|
|
808
810
|
}
|
|
809
811
|
|
|
810
812
|
/** Function coverage inside one script. */
|
|
@@ -1002,7 +1004,7 @@ export declare interface BrowserHARValue {
|
|
|
1002
1004
|
* @param headers - Header record
|
|
1003
1005
|
* @returns Protocol header entries
|
|
1004
1006
|
*/
|
|
1005
|
-
export declare function browserHeadersToProtocol(headers: Readonly<Record<string, string>>):
|
|
1007
|
+
export declare function browserHeadersToProtocol(headers: Readonly<Record<string, string>>): ReadonlyArray<Readonly<Record<string, string>>>;
|
|
1006
1008
|
|
|
1007
1009
|
/** Normalized CDP keyboard key data. */
|
|
1008
1010
|
export declare interface BrowserKey {
|
|
@@ -1348,7 +1350,7 @@ export declare class BrowserPage extends BrowserFrame implements BrowserPageInte
|
|
|
1348
1350
|
codegen(options?: BrowserCodegenOptions): Promise<BrowserCodegenInterface>;
|
|
1349
1351
|
destroy(): Promise<void>;
|
|
1350
1352
|
close(): Promise<void>;
|
|
1351
|
-
|
|
1353
|
+
assert(): void;
|
|
1352
1354
|
}
|
|
1353
1355
|
|
|
1354
1356
|
/** One uncaught page exception. */
|
|
@@ -2784,7 +2786,7 @@ export declare function matchesBrowserURL(url: string, pattern: string): boolean
|
|
|
2784
2786
|
* @param media - Public media configuration
|
|
2785
2787
|
* @returns Protocol feature records
|
|
2786
2788
|
*/
|
|
2787
|
-
export declare function mediaToFeatures(media: BrowserMedia):
|
|
2789
|
+
export declare function mediaToFeatures(media: BrowserMedia): ReadonlyArray<Readonly<Record<string, string>>>;
|
|
2788
2790
|
|
|
2789
2791
|
/**
|
|
2790
2792
|
* Normalize a raw list of recorded codegen actions.
|
package/dist/src/core/index.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export declare const BROWSER_FRAME_WORLD_NAME = "__orkestrelBrowserFrame";
|
|
|
49
49
|
/** Tool identity embedded in HAR 1.2 documents. */
|
|
50
50
|
export declare const BROWSER_HAR_CREATOR: Readonly<{
|
|
51
51
|
name: "@orkestrel/browser";
|
|
52
|
-
version: "0.0.
|
|
52
|
+
version: "0.0.11";
|
|
53
53
|
}>;
|
|
54
54
|
|
|
55
55
|
/** CDP Input modifier bit values keyed by canonical key name. */
|
|
@@ -739,14 +739,12 @@ export declare class BrowserFrame implements BrowserFrameInterface {
|
|
|
739
739
|
evaluate(expression: string, timeout?: number): Promise<unknown>;
|
|
740
740
|
handle(expression: string): Promise<BrowserHandleInterface>;
|
|
741
741
|
wait(selector: string, options?: BrowserWaitOptions): Promise<void>;
|
|
742
|
-
send(method: string, params?: Readonly<Record<string, unknown
|
|
742
|
+
send(method: string, params?: Readonly<Record<string, unknown>>, timeout?: number): Promise<unknown>;
|
|
743
743
|
subscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
744
744
|
unsubscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
745
745
|
save(path: string, _bytes: Uint8Array): Promise<void>;
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
protected raw(expression: string, timeout?: number): Promise<unknown>;
|
|
749
|
-
protected update(url: string): void;
|
|
746
|
+
assert(): void;
|
|
747
|
+
update(url: string): void;
|
|
750
748
|
}
|
|
751
749
|
|
|
752
750
|
/**
|
|
@@ -781,7 +779,9 @@ export declare interface BrowserFrameInfo {
|
|
|
781
779
|
* - `select` — choose option(s) in a `<select>` element
|
|
782
780
|
* - `evaluate` — execute a JavaScript expression in the page context
|
|
783
781
|
* - `wait` — wait for an element state
|
|
784
|
-
* - `send` — issue a raw CDP method in the frame's current target session
|
|
782
|
+
* - `send` — issue a raw CDP method in the frame's current target session, with an optional per-call timeout
|
|
783
|
+
* - `assert` — throw when the frame can no longer accept protocol work
|
|
784
|
+
* - `update` — record an externally observed URL as the frame's current URL
|
|
785
785
|
*/
|
|
786
786
|
export declare interface BrowserFrameInterface {
|
|
787
787
|
readonly id: string;
|
|
@@ -801,10 +801,12 @@ export declare interface BrowserFrameInterface {
|
|
|
801
801
|
evaluate(expression: string, timeout?: number): Promise<unknown>;
|
|
802
802
|
handle(expression: string): Promise<BrowserHandleInterface>;
|
|
803
803
|
wait(selector: string, options?: BrowserWaitOptions): Promise<void>;
|
|
804
|
-
send(method: string, params?: Readonly<Record<string, unknown
|
|
804
|
+
send(method: string, params?: Readonly<Record<string, unknown>>, timeout?: number): Promise<unknown>;
|
|
805
805
|
subscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
806
806
|
unsubscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
807
807
|
save(path: string, bytes: Uint8Array): Promise<void>;
|
|
808
|
+
assert(): void;
|
|
809
|
+
update(url: string): void;
|
|
808
810
|
}
|
|
809
811
|
|
|
810
812
|
/** Function coverage inside one script. */
|
|
@@ -1002,7 +1004,7 @@ export declare interface BrowserHARValue {
|
|
|
1002
1004
|
* @param headers - Header record
|
|
1003
1005
|
* @returns Protocol header entries
|
|
1004
1006
|
*/
|
|
1005
|
-
export declare function browserHeadersToProtocol(headers: Readonly<Record<string, string>>):
|
|
1007
|
+
export declare function browserHeadersToProtocol(headers: Readonly<Record<string, string>>): ReadonlyArray<Readonly<Record<string, string>>>;
|
|
1006
1008
|
|
|
1007
1009
|
/** Normalized CDP keyboard key data. */
|
|
1008
1010
|
export declare interface BrowserKey {
|
|
@@ -1348,7 +1350,7 @@ export declare class BrowserPage extends BrowserFrame implements BrowserPageInte
|
|
|
1348
1350
|
codegen(options?: BrowserCodegenOptions): Promise<BrowserCodegenInterface>;
|
|
1349
1351
|
destroy(): Promise<void>;
|
|
1350
1352
|
close(): Promise<void>;
|
|
1351
|
-
|
|
1353
|
+
assert(): void;
|
|
1352
1354
|
}
|
|
1353
1355
|
|
|
1354
1356
|
/** One uncaught page exception. */
|
|
@@ -2784,7 +2786,7 @@ export declare function matchesBrowserURL(url: string, pattern: string): boolean
|
|
|
2784
2786
|
* @param media - Public media configuration
|
|
2785
2787
|
* @returns Protocol feature records
|
|
2786
2788
|
*/
|
|
2787
|
-
export declare function mediaToFeatures(media: BrowserMedia):
|
|
2789
|
+
export declare function mediaToFeatures(media: BrowserMedia): ReadonlyArray<Readonly<Record<string, string>>>;
|
|
2788
2790
|
|
|
2789
2791
|
/**
|
|
2790
2792
|
* Normalize a raw list of recorded codegen actions.
|
package/dist/src/core/index.js
CHANGED
|
@@ -5,7 +5,72 @@ import { createHTML, renderText } from "@orkestrel/html";
|
|
|
5
5
|
/** Base64 alphabet, index-ordered, used to build {@link BASE64_LOOKUP}. */
|
|
6
6
|
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
7
7
|
/** Base64 character to 6-bit value lookup table, derived from {@link BASE64_CHARS}. */
|
|
8
|
-
var BASE64_LOOKUP = Object.freeze(
|
|
8
|
+
var BASE64_LOOKUP = Object.freeze({
|
|
9
|
+
A: 0,
|
|
10
|
+
B: 1,
|
|
11
|
+
C: 2,
|
|
12
|
+
D: 3,
|
|
13
|
+
E: 4,
|
|
14
|
+
F: 5,
|
|
15
|
+
G: 6,
|
|
16
|
+
H: 7,
|
|
17
|
+
I: 8,
|
|
18
|
+
J: 9,
|
|
19
|
+
K: 10,
|
|
20
|
+
L: 11,
|
|
21
|
+
M: 12,
|
|
22
|
+
N: 13,
|
|
23
|
+
O: 14,
|
|
24
|
+
P: 15,
|
|
25
|
+
Q: 16,
|
|
26
|
+
R: 17,
|
|
27
|
+
S: 18,
|
|
28
|
+
T: 19,
|
|
29
|
+
U: 20,
|
|
30
|
+
V: 21,
|
|
31
|
+
W: 22,
|
|
32
|
+
X: 23,
|
|
33
|
+
Y: 24,
|
|
34
|
+
Z: 25,
|
|
35
|
+
a: 26,
|
|
36
|
+
b: 27,
|
|
37
|
+
c: 28,
|
|
38
|
+
d: 29,
|
|
39
|
+
e: 30,
|
|
40
|
+
f: 31,
|
|
41
|
+
g: 32,
|
|
42
|
+
h: 33,
|
|
43
|
+
i: 34,
|
|
44
|
+
j: 35,
|
|
45
|
+
k: 36,
|
|
46
|
+
l: 37,
|
|
47
|
+
m: 38,
|
|
48
|
+
n: 39,
|
|
49
|
+
o: 40,
|
|
50
|
+
p: 41,
|
|
51
|
+
q: 42,
|
|
52
|
+
r: 43,
|
|
53
|
+
s: 44,
|
|
54
|
+
t: 45,
|
|
55
|
+
u: 46,
|
|
56
|
+
v: 47,
|
|
57
|
+
w: 48,
|
|
58
|
+
x: 49,
|
|
59
|
+
y: 50,
|
|
60
|
+
z: 51,
|
|
61
|
+
"0": 52,
|
|
62
|
+
"1": 53,
|
|
63
|
+
"2": 54,
|
|
64
|
+
"3": 55,
|
|
65
|
+
"4": 56,
|
|
66
|
+
"5": 57,
|
|
67
|
+
"6": 58,
|
|
68
|
+
"7": 59,
|
|
69
|
+
"8": 60,
|
|
70
|
+
"9": 61,
|
|
71
|
+
"+": 62,
|
|
72
|
+
"/": 63
|
|
73
|
+
});
|
|
9
74
|
/** Default timeout in milliseconds for browser connection, requests, and navigation. */
|
|
10
75
|
var BROWSER_DEFAULT_TIMEOUT_MS = 3e4;
|
|
11
76
|
/**
|
|
@@ -75,7 +140,7 @@ var BROWSER_MOUSE_BUTTON_MASKS = Object.freeze({
|
|
|
75
140
|
/** Tool identity embedded in HAR 1.2 documents. */
|
|
76
141
|
var BROWSER_HAR_CREATOR = Object.freeze({
|
|
77
142
|
name: "@orkestrel/browser",
|
|
78
|
-
version: "0.0.
|
|
143
|
+
version: "0.0.11"
|
|
79
144
|
});
|
|
80
145
|
/** Attribute used to tag temporary screenshot styles and masks. */
|
|
81
146
|
var BROWSER_SCREENSHOT_ATTRIBUTE = "data-orkestrel-screenshot";
|
|
@@ -4892,9 +4957,9 @@ var BrowserFrame = class {
|
|
|
4892
4957
|
this.assert();
|
|
4893
4958
|
await this.#selectors.css(selector).wait(options);
|
|
4894
4959
|
}
|
|
4895
|
-
async send(method, params) {
|
|
4960
|
+
async send(method, params, timeout) {
|
|
4896
4961
|
this.assert();
|
|
4897
|
-
return await this.#client.send(method, params, await this.#sessionId());
|
|
4962
|
+
return await this.#client.send(method, params, await this.#sessionId(), timeout);
|
|
4898
4963
|
}
|
|
4899
4964
|
async subscribe(method, handler) {
|
|
4900
4965
|
this.assert();
|
|
@@ -4909,12 +4974,6 @@ var BrowserFrame = class {
|
|
|
4909
4974
|
assert() {
|
|
4910
4975
|
if (!this.#client.connected) throw new BrowserError("Browser frame is disconnected", void 0, { frame: this.#id });
|
|
4911
4976
|
}
|
|
4912
|
-
async request(method, params, timeout) {
|
|
4913
|
-
return await this.#client.send(method, params, await this.#sessionId(), timeout);
|
|
4914
|
-
}
|
|
4915
|
-
async raw(expression, timeout) {
|
|
4916
|
-
return await this.#evaluate(expression, timeout);
|
|
4917
|
-
}
|
|
4918
4977
|
update(url) {
|
|
4919
4978
|
this.#url = url;
|
|
4920
4979
|
}
|
|
@@ -6133,7 +6192,7 @@ var BrowserPage = class BrowserPage extends BrowserFrame {
|
|
|
6133
6192
|
this.assert();
|
|
6134
6193
|
const params = { ...browserScreenshotToParams(options) };
|
|
6135
6194
|
if (options?.full === true) {
|
|
6136
|
-
const metrics = await this.
|
|
6195
|
+
const metrics = await this.send("Page.getLayoutMetrics");
|
|
6137
6196
|
const size = isRecord(metrics) && isRecord(metrics["cssContentSize"]) ? metrics["cssContentSize"] : isRecord(metrics) && isRecord(metrics["contentSize"]) ? metrics["contentSize"] : void 0;
|
|
6138
6197
|
const width = size?.["width"];
|
|
6139
6198
|
const height = size?.["height"];
|
|
@@ -6151,7 +6210,7 @@ var BrowserPage = class BrowserPage extends BrowserFrame {
|
|
|
6151
6210
|
const ratio = options.scale === "css" ? 1 : await this.evaluate("devicePixelRatio");
|
|
6152
6211
|
if (!isFiniteNumber(ratio) || ratio <= 0) throw new BrowserError("Browser screenshot device scale is malformed");
|
|
6153
6212
|
if (!isRecord(params["clip"])) {
|
|
6154
|
-
const metrics = await this.
|
|
6213
|
+
const metrics = await this.send("Page.getLayoutMetrics");
|
|
6155
6214
|
const viewport = isRecord(metrics) && isRecord(metrics["cssVisualViewport"]) ? metrics["cssVisualViewport"] : void 0;
|
|
6156
6215
|
if (viewport === void 0 || !isFiniteNumber(viewport["pageX"]) || !isFiniteNumber(viewport["pageY"]) || !isFiniteNumber(viewport["clientWidth"]) || viewport["clientWidth"] <= 0 || !isFiniteNumber(viewport["clientHeight"]) || viewport["clientHeight"] <= 0) throw new BrowserError("Browser screenshot viewport metrics are malformed");
|
|
6157
6216
|
params["clip"] = {
|
|
@@ -6173,7 +6232,7 @@ var BrowserPage = class BrowserPage extends BrowserFrame {
|
|
|
6173
6232
|
token = value;
|
|
6174
6233
|
}
|
|
6175
6234
|
if (options?.transparent === true) {
|
|
6176
|
-
await this.
|
|
6235
|
+
await this.send("Emulation.setDefaultBackgroundColorOverride", { color: {
|
|
6177
6236
|
r: 0,
|
|
6178
6237
|
g: 0,
|
|
6179
6238
|
b: 0,
|
|
@@ -6181,7 +6240,7 @@ var BrowserPage = class BrowserPage extends BrowserFrame {
|
|
|
6181
6240
|
} });
|
|
6182
6241
|
transparent = true;
|
|
6183
6242
|
}
|
|
6184
|
-
const result = await this.
|
|
6243
|
+
const result = await this.send("Page.captureScreenshot", params);
|
|
6185
6244
|
if (!isRecord(result) || !isString(result["data"])) throw new BrowserError("Screenshot failed: no data returned");
|
|
6186
6245
|
const bytes = decodeBase64(result["data"]);
|
|
6187
6246
|
if (options?.path !== void 0) await this.save(options.path, bytes);
|
|
@@ -6190,13 +6249,13 @@ var BrowserPage = class BrowserPage extends BrowserFrame {
|
|
|
6190
6249
|
path: options?.path
|
|
6191
6250
|
};
|
|
6192
6251
|
} finally {
|
|
6193
|
-
if (transparent) await this.
|
|
6252
|
+
if (transparent) await this.send("Emulation.setDefaultBackgroundColorOverride").catch(() => void 0);
|
|
6194
6253
|
if (token !== void 0) await this.evaluate(compileScreenshotCleanupExpression(token)).catch(() => void 0);
|
|
6195
6254
|
}
|
|
6196
6255
|
}
|
|
6197
6256
|
async pdf(options) {
|
|
6198
6257
|
this.assert();
|
|
6199
|
-
const result = await this.
|
|
6258
|
+
const result = await this.send("Page.printToPDF", browserPDFToParams(options));
|
|
6200
6259
|
if (!isRecord(result) || !isString(result["data"])) throw new BrowserError("PDF failed: no data returned");
|
|
6201
6260
|
const bytes = decodeBase64(result["data"]);
|
|
6202
6261
|
if (options?.path !== void 0) await this.save(options.path, bytes);
|
|
@@ -6214,12 +6273,12 @@ var BrowserPage = class BrowserPage extends BrowserFrame {
|
|
|
6214
6273
|
}
|
|
6215
6274
|
async frames() {
|
|
6216
6275
|
this.assert();
|
|
6217
|
-
return readBrowserFrames(await this.
|
|
6276
|
+
return readBrowserFrames(await this.send("Page.getFrameTree")).map((frame) => this.#frame(frame));
|
|
6218
6277
|
}
|
|
6219
6278
|
async snapshot(options) {
|
|
6220
6279
|
this.assert();
|
|
6221
6280
|
const styles = options?.styles ?? [];
|
|
6222
|
-
return new BrowserSnapshot(decodeBrowserSnapshot(await this.
|
|
6281
|
+
return new BrowserSnapshot(decodeBrowserSnapshot(await this.send("DOMSnapshot.captureSnapshot", {
|
|
6223
6282
|
computedStyles: [...styles],
|
|
6224
6283
|
includePaintOrder: options?.paint ?? false,
|
|
6225
6284
|
includeDOMRects: options?.rects ?? false
|
|
@@ -6272,7 +6331,7 @@ var BrowserPage = class BrowserPage extends BrowserFrame {
|
|
|
6272
6331
|
wait.catch(() => void 0);
|
|
6273
6332
|
let loader;
|
|
6274
6333
|
try {
|
|
6275
|
-
const result = await this.
|
|
6334
|
+
const result = await this.send("Page.navigate", { url }, timeout);
|
|
6276
6335
|
if (isRecord(result) && isString(result["errorText"])) throw new BrowserError(`Navigation failed: ${result["errorText"]}`);
|
|
6277
6336
|
if (isRecord(result) && isString(result["loaderId"])) loader = result["loaderId"];
|
|
6278
6337
|
await wait;
|
|
@@ -6291,7 +6350,7 @@ var BrowserPage = class BrowserPage extends BrowserFrame {
|
|
|
6291
6350
|
const wait = this.#waitForLoadEvent(options?.condition ?? "load", timeout);
|
|
6292
6351
|
wait.catch(() => void 0);
|
|
6293
6352
|
try {
|
|
6294
|
-
await this.
|
|
6353
|
+
await this.send("Page.reload", void 0, timeout);
|
|
6295
6354
|
await wait;
|
|
6296
6355
|
} catch (error) {
|
|
6297
6356
|
this.#clearNavigationWatch(watch);
|
|
@@ -6316,7 +6375,7 @@ var BrowserPage = class BrowserPage extends BrowserFrame {
|
|
|
6316
6375
|
async #navigateHistory(offset, options) {
|
|
6317
6376
|
const timeout = options?.timeout ?? 3e4;
|
|
6318
6377
|
validateBrowserTimeout(timeout);
|
|
6319
|
-
const history = await this.
|
|
6378
|
+
const history = await this.send("Page.getNavigationHistory");
|
|
6320
6379
|
if (!isRecord(history) || !isInteger(history["currentIndex"]) || !isArray(history["entries"])) throw new BrowserError("Navigation history is malformed");
|
|
6321
6380
|
const entry = history["entries"][history["currentIndex"] + offset];
|
|
6322
6381
|
if (!isRecord(entry) || !isInteger(entry["id"])) return {
|
|
@@ -6328,7 +6387,7 @@ var BrowserPage = class BrowserPage extends BrowserFrame {
|
|
|
6328
6387
|
const wait = this.#waitForLoadEvent(options?.condition ?? "load", timeout);
|
|
6329
6388
|
wait.catch(() => void 0);
|
|
6330
6389
|
try {
|
|
6331
|
-
await this.
|
|
6390
|
+
await this.send("Page.navigateToHistoryEntry", { entryId: entry["id"] }, timeout);
|
|
6332
6391
|
await wait;
|
|
6333
6392
|
} catch (error) {
|
|
6334
6393
|
this.#clearNavigationWatch(watch);
|
|
@@ -6358,7 +6417,7 @@ var BrowserPage = class BrowserPage extends BrowserFrame {
|
|
|
6358
6417
|
}
|
|
6359
6418
|
async #completeNavigation(watch, loader) {
|
|
6360
6419
|
try {
|
|
6361
|
-
const resolved = requireBrowserString(await this.
|
|
6420
|
+
const resolved = requireBrowserString(await this.evaluate("location.href"), "Navigation URL");
|
|
6362
6421
|
this.update(resolved);
|
|
6363
6422
|
return this.#navigationResult(watch, resolved, loader);
|
|
6364
6423
|
} catch (error) {
|
|
@@ -6492,7 +6551,7 @@ var BrowserPage = class BrowserPage extends BrowserFrame {
|
|
|
6492
6551
|
}
|
|
6493
6552
|
async #stopLoading(timeout) {
|
|
6494
6553
|
try {
|
|
6495
|
-
await this.
|
|
6554
|
+
await this.send("Page.stopLoading", void 0, timeout);
|
|
6496
6555
|
} catch {}
|
|
6497
6556
|
}
|
|
6498
6557
|
#handleNavigationResponse(response) {
|