@opensteer/browser-core 0.7.5 → 0.7.6
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/index.cjs +25 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -899,6 +899,12 @@ interface BrowserInspector {
|
|
|
899
899
|
readonly args?: readonly unknown[];
|
|
900
900
|
readonly timeoutMs?: number;
|
|
901
901
|
}): Promise<StepResult<unknown>>;
|
|
902
|
+
evaluateFrame(input: {
|
|
903
|
+
readonly frameRef: FrameRef;
|
|
904
|
+
readonly script: string;
|
|
905
|
+
readonly args?: readonly unknown[];
|
|
906
|
+
readonly timeoutMs?: number;
|
|
907
|
+
}): Promise<StepResult<unknown>>;
|
|
902
908
|
}
|
|
903
909
|
interface SessionTransportExecutor {
|
|
904
910
|
readonly capabilities: Readonly<BrowserCapabilities>;
|
|
@@ -1107,6 +1113,12 @@ declare class FakeBrowserCoreEngine implements BrowserCoreEngine {
|
|
|
1107
1113
|
readonly args?: readonly unknown[];
|
|
1108
1114
|
readonly timeoutMs?: number;
|
|
1109
1115
|
}): Promise<StepResult<unknown>>;
|
|
1116
|
+
evaluateFrame(input: {
|
|
1117
|
+
readonly frameRef: FrameRef;
|
|
1118
|
+
readonly script: string;
|
|
1119
|
+
readonly args?: readonly unknown[];
|
|
1120
|
+
readonly timeoutMs?: number;
|
|
1121
|
+
}): Promise<StepResult<unknown>>;
|
|
1110
1122
|
executeRequest(input: {
|
|
1111
1123
|
readonly sessionRef: SessionRef;
|
|
1112
1124
|
readonly request: SessionTransportRequest;
|
package/dist/index.d.ts
CHANGED
|
@@ -899,6 +899,12 @@ interface BrowserInspector {
|
|
|
899
899
|
readonly args?: readonly unknown[];
|
|
900
900
|
readonly timeoutMs?: number;
|
|
901
901
|
}): Promise<StepResult<unknown>>;
|
|
902
|
+
evaluateFrame(input: {
|
|
903
|
+
readonly frameRef: FrameRef;
|
|
904
|
+
readonly script: string;
|
|
905
|
+
readonly args?: readonly unknown[];
|
|
906
|
+
readonly timeoutMs?: number;
|
|
907
|
+
}): Promise<StepResult<unknown>>;
|
|
902
908
|
}
|
|
903
909
|
interface SessionTransportExecutor {
|
|
904
910
|
readonly capabilities: Readonly<BrowserCapabilities>;
|
|
@@ -1107,6 +1113,12 @@ declare class FakeBrowserCoreEngine implements BrowserCoreEngine {
|
|
|
1107
1113
|
readonly args?: readonly unknown[];
|
|
1108
1114
|
readonly timeoutMs?: number;
|
|
1109
1115
|
}): Promise<StepResult<unknown>>;
|
|
1116
|
+
evaluateFrame(input: {
|
|
1117
|
+
readonly frameRef: FrameRef;
|
|
1118
|
+
readonly script: string;
|
|
1119
|
+
readonly args?: readonly unknown[];
|
|
1120
|
+
readonly timeoutMs?: number;
|
|
1121
|
+
}): Promise<StepResult<unknown>>;
|
|
1110
1122
|
executeRequest(input: {
|
|
1111
1123
|
readonly sessionRef: SessionRef;
|
|
1112
1124
|
readonly request: SessionTransportRequest;
|
package/dist/index.js
CHANGED
|
@@ -1225,6 +1225,24 @@ var FakeBrowserCoreEngine = class {
|
|
|
1225
1225
|
data: clone(value)
|
|
1226
1226
|
});
|
|
1227
1227
|
}
|
|
1228
|
+
async evaluateFrame(input) {
|
|
1229
|
+
const frame = this.requireFrame(input.frameRef);
|
|
1230
|
+
const page = this.requirePage(frame.frameInfo.pageRef);
|
|
1231
|
+
const value = await Promise.resolve().then(() => {
|
|
1232
|
+
const evaluated = (0, eval)(input.script);
|
|
1233
|
+
if (typeof evaluated === "function") {
|
|
1234
|
+
return evaluated(...input.args ?? []);
|
|
1235
|
+
}
|
|
1236
|
+
return evaluated;
|
|
1237
|
+
});
|
|
1238
|
+
return this.createStepResult(page.sessionRef, page.pageRef, {
|
|
1239
|
+
frameRef: frame.frameInfo.frameRef,
|
|
1240
|
+
documentRef: frame.frameInfo.documentRef,
|
|
1241
|
+
documentEpoch: frame.frameInfo.documentEpoch,
|
|
1242
|
+
events: this.drainQueuedEvents(page.pageRef),
|
|
1243
|
+
data: clone(value)
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1228
1246
|
async executeRequest(input) {
|
|
1229
1247
|
this.requireCapability("transport.sessionHttp");
|
|
1230
1248
|
input.signal?.throwIfAborted?.();
|
|
@@ -3184,6 +3202,13 @@ async function waitForActionBoundary(input) {
|
|
|
3184
3202
|
continue;
|
|
3185
3203
|
}
|
|
3186
3204
|
if (crossDocument) {
|
|
3205
|
+
if (!postLoadTrackerIsSettled(
|
|
3206
|
+
await input.readTrackerState(),
|
|
3207
|
+
DEFAULT_POST_LOAD_TRACKER_QUIET_WINDOW_MS
|
|
3208
|
+
)) {
|
|
3209
|
+
await delay(Math.min(pollIntervalMs, Math.max(0, deadline - Date.now())));
|
|
3210
|
+
continue;
|
|
3211
|
+
}
|
|
3187
3212
|
return {
|
|
3188
3213
|
trigger,
|
|
3189
3214
|
crossDocument,
|