Skip to content

Commit 421bc5a

Browse files
committed
new NavigationEventTarget on new page
1 parent 72c9763 commit 421bc5a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/browser/navigation/Navigation.zig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ index: usize = 0,
4747
entries: std.ArrayListUnmanaged(*NavigationHistoryEntry) = .empty,
4848
next_entry_id: usize = 0,
4949

50+
pub fn resetForNewPage(self: *Navigation) void {
51+
// libdom will automatically clean this up when a new page is made.
52+
// We must create a new target whenever we create a new page.
53+
self.proto = NavigationEventTarget{};
54+
}
55+
5056
pub fn get_canGoBack(self: *const Navigation) bool {
5157
return self.index > 0;
5258
}

src/browser/session.zig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ pub const Session = struct {
104104
// We need to init this early as JS event handlers may be registered through Runtime.evaluate before the first html doc is loaded
105105
parser.init();
106106

107+
// creates a new event target for Navigation
108+
self.navigation.resetForNewPage();
109+
107110
const page_arena = &self.browser.page_arena;
108111
_ = page_arena.reset(.{ .retain_with_limit = 1 * 1024 * 1024 });
109112
_ = self.browser.state_pool.reset(.{ .retain_with_limit = 4 * 1024 });

0 commit comments

Comments
 (0)