Skip to content

Commit 11c7f57

Browse files
committed
cdp: dispatch Page.frameNavigated before DOM.documentUpdated
chromedp client expects to receive Page.frameNavigated before DOM.documentUpdated.
1 parent 332508f commit 11c7f57

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/cdp/domains/page.zig

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,6 @@ pub fn pageNavigated(bc: anytype, event: *const Notification.PageNavigated) !voi
243243
const target_id = bc.target_id orelse unreachable;
244244
const session_id = bc.session_id orelse unreachable;
245245

246-
try cdp.sendEvent("DOM.documentUpdated", null, .{ .session_id = session_id });
247-
248246
// frameNavigated event
249247
try cdp.sendEvent("Page.frameNavigated", .{
250248
.type = "Navigation",
@@ -257,6 +255,11 @@ pub fn pageNavigated(bc: anytype, event: *const Notification.PageNavigated) !voi
257255
},
258256
}, .{ .session_id = session_id });
259257

258+
// The DOM.documentUpdated event must be send after the frameNavigated one.
259+
// chromedp client expects to receive the events is this order.
260+
// see https://github.com/chromedp/chromedp/issues/1558
261+
try cdp.sendEvent("DOM.documentUpdated", null, .{ .session_id = session_id });
262+
260263
// domContentEventFired event
261264
// TODO: partially hard coded
262265
try cdp.sendEvent(

0 commit comments

Comments
 (0)