mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-14 15:28:57 +00:00
new NavigationEventTarget on new page
This commit is contained in:
@@ -47,6 +47,12 @@ index: usize = 0,
|
||||
entries: std.ArrayListUnmanaged(*NavigationHistoryEntry) = .empty,
|
||||
next_entry_id: usize = 0,
|
||||
|
||||
pub fn resetForNewPage(self: *Navigation) void {
|
||||
// libdom will automatically clean this up when a new page is made.
|
||||
// We must create a new target whenever we create a new page.
|
||||
self.proto = NavigationEventTarget{};
|
||||
}
|
||||
|
||||
pub fn get_canGoBack(self: *const Navigation) bool {
|
||||
return self.index > 0;
|
||||
}
|
||||
|
||||
@@ -104,6 +104,9 @@ pub const Session = struct {
|
||||
// We need to init this early as JS event handlers may be registered through Runtime.evaluate before the first html doc is loaded
|
||||
parser.init();
|
||||
|
||||
// creates a new event target for Navigation
|
||||
self.navigation.resetForNewPage();
|
||||
|
||||
const page_arena = &self.browser.page_arena;
|
||||
_ = page_arena.reset(.{ .retain_with_limit = 1 * 1024 * 1024 });
|
||||
_ = self.browser.state_pool.reset(.{ .retain_with_limit = 4 * 1024 });
|
||||
|
||||
Reference in New Issue
Block a user