Skip to content

Commit 72c9763

Browse files
committed
changeLocation on nav
1 parent a52877f commit 72c9763

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/browser/html/location.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub const Location = struct {
5252
current_url;
5353

5454
const normalized_hash = std.mem.trimStart(u8, hash, "#");
55-
const new_url = try std.fmt.allocPrint(page.session.transfer_arena, "{s}#{s}", .{ base_without_hash, normalized_hash });
55+
const new_url = try std.fmt.allocPrint(page.arena, "{s}#{s}", .{ base_without_hash, normalized_hash });
5656

5757
return page.navigateFromWebAPI(new_url, .{ .reason = .script }, .replace);
5858
}

src/browser/page.zig

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,15 @@ pub const Page = struct {
10651065
// specifically for this type of lifetime.
10661066
pub fn navigateFromWebAPI(self: *Page, url: []const u8, opts: NavigateOpts, kind: NavigationKind) !void {
10671067
const session = self.session;
1068-
const stitched_url = try URL.stitch(session.transfer_arena, url, self.url.raw, .{ .alloc = .always });
1068+
const stitched_url = try URL.stitch(
1069+
session.transfer_arena,
1070+
url,
1071+
self.url.raw,
1072+
.{
1073+
.alloc = .always,
1074+
.null_terminated = true,
1075+
},
1076+
);
10691077

10701078
// Force will force a page load.
10711079
// Otherwise, we need to check if this is a true navigation.
@@ -1075,6 +1083,8 @@ pub const Page = struct {
10751083

10761084
if (try self.url.eqlDocument(&new_url, session.transfer_arena)) {
10771085
self.url = new_url;
1086+
try self.window.changeLocation(self.url.raw, self);
1087+
10781088
try session.navigation.updateEntries(stitched_url, kind, self, true);
10791089
return;
10801090
}

0 commit comments

Comments
 (0)