mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-28 22:53:28 +00:00
Merge pull request #981 from lightpanda-io/page-navigate-event
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / browser fetch (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-linux-aarch64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled
nightly build / build-macos-x86_64 (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / browser fetch (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-linux-aarch64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled
nightly build / build-macos-x86_64 (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
page: ensure page navigate events order
This commit is contained in:
@@ -520,6 +520,14 @@ pub const Page = struct {
|
|||||||
if (opts.header) |hdr| try headers.add(hdr);
|
if (opts.header) |hdr| try headers.add(hdr);
|
||||||
try self.requestCookie(.{ .is_navigation = true }).headersForRequest(self.arena, owned_url, &headers);
|
try self.requestCookie(.{ .is_navigation = true }).headersForRequest(self.arena, owned_url, &headers);
|
||||||
|
|
||||||
|
// We dispatch page_navigate event before sending the request.
|
||||||
|
// It ensures the event page_navigated is not dispatched before this one.
|
||||||
|
self.session.browser.notification.dispatch(.page_navigate, &.{
|
||||||
|
.opts = opts,
|
||||||
|
.url = owned_url,
|
||||||
|
.timestamp = timestamp(),
|
||||||
|
});
|
||||||
|
|
||||||
self.http_client.request(.{
|
self.http_client.request(.{
|
||||||
.ctx = self,
|
.ctx = self,
|
||||||
.url = owned_url,
|
.url = owned_url,
|
||||||
@@ -536,12 +544,6 @@ pub const Page = struct {
|
|||||||
log.err(.http, "navigate request", .{ .url = owned_url, .err = err });
|
log.err(.http, "navigate request", .{ .url = owned_url, .err = err });
|
||||||
return err;
|
return err;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.session.browser.notification.dispatch(.page_navigate, &.{
|
|
||||||
.opts = opts,
|
|
||||||
.url = owned_url,
|
|
||||||
.timestamp = timestamp(),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setCurrentScript(self: *Page, script: ?*parser.Script) !void {
|
pub fn setCurrentScript(self: *Page, script: ?*parser.Script) !void {
|
||||||
|
|||||||
Reference in New Issue
Block a user