mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 15:13:28 +00:00
Fix call to Runtime.executionContextCreated in Page.navigate
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
@@ -94,6 +94,7 @@ pub fn do(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub const State = struct {
|
pub const State = struct {
|
||||||
|
executionContextId: u8 = 0,
|
||||||
contextID: ?[]const u8 = null,
|
contextID: ?[]const u8 = null,
|
||||||
frameID: []const u8 = FrameID,
|
frameID: []const u8 = FrameID,
|
||||||
url: []const u8 = URLBase,
|
url: []const u8 = URLBase,
|
||||||
|
|||||||
@@ -225,13 +225,26 @@ fn navigate(
|
|||||||
std.log.debug("res {s}", .{res});
|
std.log.debug("res {s}", .{res});
|
||||||
try server.sendSync(ctx, res);
|
try server.sendSync(ctx, res);
|
||||||
|
|
||||||
// Runtime.executionContextsCleared event
|
// Send clear runtime contexts event (noop)
|
||||||
try sendEvent(alloc, ctx, "Runtime.executionContextsCleared", void, {}, msg.sessionID);
|
try sendEvent(alloc, ctx, "Runtime.executionContextsCleared", void, {}, msg.sessionID);
|
||||||
|
|
||||||
// launch navigate
|
// Launch navigate
|
||||||
var p = try ctx.browser.currentSession().createPage();
|
var p = try ctx.browser.currentSession().createPage();
|
||||||
_ = try p.navigate(params.url);
|
_ = try p.navigate(params.url);
|
||||||
|
|
||||||
|
// Send create runtime context event
|
||||||
|
ctx.state.executionContextId += 1;
|
||||||
|
try Runtime.executionContextCreated(
|
||||||
|
alloc,
|
||||||
|
ctx,
|
||||||
|
ctx.state.executionContextId,
|
||||||
|
"http://127.0.0.1:1234", // TODO: real domain
|
||||||
|
"",
|
||||||
|
"7102379147004877974.3265385113993241162",
|
||||||
|
.{ .frameId = ctx.state.frameID },
|
||||||
|
msg.sessionID,
|
||||||
|
);
|
||||||
|
|
||||||
// frameNavigated event
|
// frameNavigated event
|
||||||
const FrameNavigated = struct {
|
const FrameNavigated = struct {
|
||||||
frame: Frame,
|
frame: Frame,
|
||||||
@@ -267,28 +280,6 @@ fn navigate(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
try Runtime.executionContextCreated(
|
|
||||||
alloc,
|
|
||||||
ctx,
|
|
||||||
3,
|
|
||||||
"http://127.0.0.1:1234",
|
|
||||||
"",
|
|
||||||
"7102379147004877974.3265385113993241162",
|
|
||||||
.{ .frameId = ctx.state.frameID },
|
|
||||||
msg.sessionID,
|
|
||||||
);
|
|
||||||
|
|
||||||
try Runtime.executionContextCreated(
|
|
||||||
alloc,
|
|
||||||
ctx,
|
|
||||||
4,
|
|
||||||
"://",
|
|
||||||
"__playwright_utility_world__",
|
|
||||||
"-4572718120346458707.6016875269626438350",
|
|
||||||
.{ .isDefault = false, .type = "isolated", .frameId = ctx.state.frameID },
|
|
||||||
msg.sessionID,
|
|
||||||
);
|
|
||||||
|
|
||||||
// domContentEventFired event
|
// domContentEventFired event
|
||||||
ts_event = .{ .timestamp = 343721.803338 };
|
ts_event = .{ .timestamp = 343721.803338 };
|
||||||
try sendEvent(
|
try sendEvent(
|
||||||
|
|||||||
Reference in New Issue
Block a user