File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -192,7 +192,7 @@ pub const Session = struct {
192192 // can't use the page arena, because we're about to reset it
193193 // and don't want to use the session's arena, because that'll start to
194194 // look like a leak if we navigate from page to page a lot.
195- var buf : [4096 ]u8 = undefined ;
195+ var buf : [2048 ]u8 = undefined ;
196196 var fba = std .heap .FixedBufferAllocator .init (& buf );
197197 const url = try self .page .? .url .resolve (fba .allocator (), url_string );
198198
@@ -731,7 +731,7 @@ pub const Page = struct {
731731 _ = repeat_delay ;
732732 const self : * DelayedNavigation = @fieldParentPtr ("navigate_node" , node );
733733 self .session .pageNavigate (self .href ) catch | err | {
734- log .err ("Delayed navigation error {}" , .{err });
734+ log .err ("Delayed navigation error {}" , .{err }); // TODO: should we trigger a specific event here?
735735 };
736736 }
737737 };
Original file line number Diff line number Diff line change @@ -82,3 +82,19 @@ pub const URL = struct {
8282 return WebApiURL .init (allocator , self .uri );
8383 }
8484};
85+
86+ test "Url resolve size" {
87+ const base = "https://www.lightpande.io" ;
88+ const url = try URL .parse (base , null );
89+
90+ var url_string : [511 ]u8 = undefined ; // Currently this is the largest url we support, it is however recommmended to at least support 2000 characters
91+ @memset (& url_string , 'a' );
92+
93+ var buf : [2048 ]u8 = undefined ; // This is approximately the required size to support the current largest supported URL
94+ var fba = std .heap .FixedBufferAllocator .init (& buf );
95+ const out_url = try url .resolve (fba .allocator (), & url_string );
96+
97+ try std .testing .expectEqualStrings (out_url .raw [0.. 25], base );
98+ try std .testing .expectEqual (out_url .raw [25 ], '/' );
99+ try std .testing .expectEqualStrings (out_url .raw [26.. ], & url_string );
100+ }
You can’t perform that action at this time.
0 commit comments