mirror of
				https://github.com/lightpanda-io/browser.git
				synced 2025-10-30 15:41:48 +00:00 
			
		
		
		
	retain value, avoid str alloc
This commit is contained in:
		 sjorsdonkers
					sjorsdonkers
				
			
				
					committed by
					
						 Muki Kiboigo
						Muki Kiboigo
					
				
			
			
				
	
			
			
			 Muki Kiboigo
						Muki Kiboigo
					
				
			
						parent
						
							dc60fac90d
						
					
				
				
					commit
					a3c2daf306
				
			| @@ -1429,7 +1429,7 @@ pub fn Env(comptime State: type, comptime WebApis: type) type { | ||||
|                         switch (try self.probeJsValueToZig(named_function, slice_type, js_value)) { | ||||
|                             .value => |slice_value| { | ||||
|                                 if (slice_value.len == arr.len) { | ||||
|                                     return .{ .ok = {} }; | ||||
|                                     return .{ .value = @as(*T, @ptrCast(slice_value.ptr)).* }; | ||||
|                                 } | ||||
|                                 return .{ .invalid = {} }; | ||||
|                             }, | ||||
| @@ -1441,8 +1441,8 @@ pub fn Env(comptime State: type, comptime WebApis: type) type { | ||||
|                                         return .{ .ok = {} }; | ||||
|                                     } | ||||
|                                 } else if (js_value.isString() and arr.child == u8) { | ||||
|                                     const str = try valueToString(self.call_arena, js_value, self.isolate, self.v8_context); | ||||
|                                     if (str.len == arr.len) { | ||||
|                                     const str = try js_value.toString(self.v8_context); | ||||
|                                     if (str.lenUtf8(self.isolate) == arr.len) { | ||||
|                                         return .{ .ok = {} }; | ||||
|                                     } | ||||
|                                 } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user