File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,10 @@ pub const Session = struct {
152152 pub fn createPage (self : * Session ) ! * Page {
153153 std .debug .assert (self .page == null );
154154
155+ // Start netsurf memory arena.
156+ // We need to init this early as JS event handlers may be registered through Runtime.evaluate before the first html doc is loaded
157+ try parser .init ();
158+
155159 const page_arena = & self .browser .page_arena ;
156160 _ = page_arena .reset (.{ .retain_with_limit = 1 * 1024 * 1024 });
157161
@@ -393,9 +397,6 @@ pub const Page = struct {
393397 fn loadHTMLDoc (self : * Page , reader : anytype , charset : []const u8 ) ! void {
394398 const arena = self .arena ;
395399
396- // start netsurf memory arena.
397- try parser .init ();
398-
399400 log .debug ("parse html with charset {s}" , .{charset });
400401
401402 const ccharset = try arena .dupeZ (u8 , charset );
You can’t perform that action at this time.
0 commit comments