File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -520,6 +520,14 @@ pub const Page = struct {
520520 if (opts .header ) | hdr | try headers .add (hdr );
521521 try self .requestCookie (.{ .is_navigation = true }).headersForRequest (self .arena , owned_url , & headers );
522522
523+ // We dispatch page_navigate event before sending the request.
524+ // It ensures the event page_navigated is not dispatched before this one.
525+ self .session .browser .notification .dispatch (.page_navigate , &.{
526+ .opts = opts ,
527+ .url = owned_url ,
528+ .timestamp = timestamp (),
529+ });
530+
523531 self .http_client .request (.{
524532 .ctx = self ,
525533 .url = owned_url ,
@@ -536,12 +544,6 @@ pub const Page = struct {
536544 log .err (.http , "navigate request" , .{ .url = owned_url , .err = err });
537545 return err ;
538546 };
539-
540- self .session .browser .notification .dispatch (.page_navigate , &.{
541- .opts = opts ,
542- .url = owned_url ,
543- .timestamp = timestamp (),
544- });
545547 }
546548
547549 pub fn setCurrentScript (self : * Page , script : ? * parser.Script ) ! void {
You can’t perform that action at this time.
0 commit comments