mirror of
				https://github.com/lightpanda-io/browser.git
				synced 2025-10-29 15:13:28 +00:00 
			
		
		
		
	expose URLSearchParams toString and URL.toString
This commit is contained in:
		| @@ -111,10 +111,12 @@ pub const URL = struct { | ||||
|     } | ||||
|  | ||||
|     // get_href returns the URL by writing all its components. | ||||
|     // The query is replaced by a dump of search params. | ||||
|     // | ||||
|     pub fn get_href(self: *URL, page: *Page) ![]const u8 { | ||||
|         return try self.toString(page.arena); | ||||
|         return self.toString(page.arena); | ||||
|     } | ||||
|  | ||||
|     pub fn _toString(self: *URL, page: *Page) ![]const u8 { | ||||
|         return self.toString(page.arena); | ||||
|     } | ||||
|  | ||||
|     // format the url with all its components. | ||||
| @@ -307,7 +309,7 @@ pub const URLSearchParams = struct { | ||||
|         return self._entries(); | ||||
|     } | ||||
|  | ||||
|     fn _toString(self: *const URLSearchParams, page: *Page) ![]const u8 { | ||||
|     pub fn _toString(self: *const URLSearchParams, page: *Page) ![]const u8 { | ||||
|         var arr: std.ArrayListUnmanaged(u8) = .empty; | ||||
|         try self.write(arr.writer(page.call_arena)); | ||||
|         return arr.items; | ||||
|   | ||||
| @@ -1806,14 +1806,8 @@ pub fn Env(comptime State: type, comptime WebApis: type) type { | ||||
|         } | ||||
|  | ||||
|         fn generateProperty(comptime Struct: type, comptime name: []const u8, isolate: v8.Isolate, template_proto: v8.ObjectTemplate) void { | ||||
|             const getter = @field(Struct, "get_" ++ name); | ||||
|             const param_count = @typeInfo(@TypeOf(getter)).@"fn".params.len; | ||||
|  | ||||
|             var js_name: v8.Name = undefined; | ||||
|             if (comptime std.mem.eql(u8, name, "symbol_toStringTag")) { | ||||
|                 if (param_count != 0) { | ||||
|                     @compileError(@typeName(Struct) ++ ".get_symbol_toStringTag() cannot take any parameters"); | ||||
|                 } | ||||
|                 js_name = v8.Symbol.getToStringTag(isolate).toName(); | ||||
|             } else { | ||||
|                 js_name = v8.String.initUtf8(isolate, name).toName(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Karl Seguin
					Karl Seguin