Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/browser/browser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ pub const Session = struct {
pub fn createPage(self: *Session) !*Page {
std.debug.assert(self.page == null);

// Start netsurf memory arena.
// We need to init this early as JS event handlers may be registered through Runtime.evaluate before the first html doc is loaded
try parser.init();

const page_arena = &self.browser.page_arena;
_ = page_arena.reset(.{ .retain_with_limit = 1 * 1024 * 1024 });

Expand Down Expand Up @@ -393,9 +397,6 @@ pub const Page = struct {
fn loadHTMLDoc(self: *Page, reader: anytype, charset: []const u8) !void {
const arena = self.arena;

// start netsurf memory arena.
try parser.init();

log.debug("parse html with charset {s}", .{charset});

const ccharset = try arena.dupeZ(u8, charset);
Expand Down
1 change: 0 additions & 1 deletion src/cdp/testing.zig
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ const TestContext = struct {
if (opts.html) |html| {
if (bc.session_id == null) bc.session_id = "SID-X";
parser.deinit();
try parser.init();
const page = try bc.session.createPage();
page.doc = (try Document.init(html)).doc;
}
Expand Down