@@ -58,6 +58,10 @@ _parse_mode: enum { document, fragment },
5858// even thoug we'll create very few (if any) actual *Attributes.
5959_attribute_lookup : std .AutoHashMapUnmanaged (usize , * Element .Attribute ),
6060
61+ // Same as _atlribute_lookup, but instead of individual attributes, this is for
62+ // the return of elements.attributes.
63+ _attribute_named_node_map_lookup : std .AutoHashMapUnmanaged (usize , * Element .Attribute .NamedNodeMap ),
64+
6165_script_manager : ScriptManager ,
6266
6367_polyfill_loader : polyfill.Loader = .{},
@@ -119,6 +123,7 @@ pub fn deinit(self: *Page) void {
119123 log .debug (.page , "page.deinit" , .{ .url = self .url });
120124 }
121125 self .js .deinit ();
126+ self ._script_manager .deinit ();
122127}
123128
124129fn reset (self : * Page , comptime initializing : bool ) ! void {
@@ -144,6 +149,7 @@ fn reset(self: *Page, comptime initializing: bool) !void {
144149 self ._parse_state = .pre ;
145150 self ._load_state = .parsing ;
146151 self ._attribute_lookup = .empty ;
152+ self ._attribute_named_node_map_lookup = .empty ;
147153 self ._event_manager = EventManager .init (self );
148154
149155 self ._script_manager = ScriptManager .init (self );
@@ -165,15 +171,15 @@ fn registerBackgroundTasks(self: *Page) !void {
165171 const Browser = @import ("Browser.zig" );
166172
167173 try self .scheduler .add (self ._session .browser , struct {
168- fn runMicrotasks (ctx : * anyopaque ) ? u32 {
174+ fn runMicrotasks (ctx : * anyopaque ) ! ? u32 {
169175 const b : * Browser = @ptrCast (@alignCast (ctx ));
170176 b .runMicrotasks ();
171177 return 5 ;
172178 }
173179 }.runMicrotasks , 5 , .{ .name = "page.microtasks" });
174180
175181 try self .scheduler .add (self ._session .browser , struct {
176- fn runMessageLoop (ctx : * anyopaque ) ? u32 {
182+ fn runMessageLoop (ctx : * anyopaque ) ! ? u32 {
177183 const b : * Browser = @ptrCast (@alignCast (ctx ));
178184 b .runMessageLoop ();
179185 return 100 ;
@@ -992,7 +998,7 @@ fn populateElementAttributes(self: *Page, element: *Element, list: anytype) !voi
992998 if (@TypeOf (list ) == ? * Element .Attribute .List ) {
993999 // from cloneNode
9941000
995- var existing = list orelse return ;
1001+ var existing = list orelse return ;
9961002
9971003 var attributes = try self .arena .create (Element .Attribute .List );
9981004 attributes .* = .{};
0 commit comments