mirror of
				https://github.com/lightpanda-io/browser.git
				synced 2025-10-28 14:43:28 +00:00 
			
		
		
		
	Increase event timeStamp resolution
Depends on https://github.com/lightpanda-io/libdom/pull/36 The spec says this should be a High Definition timestamp. But browsers avoid that in order to avoid fingerprinting. By default, FireFox rounds to 2ms (which is what this PR does). Previously, the timestamp was seconds, so you'd think: isn't that better? Well, it's pretty far off the spec and what browsers do, but more importantly, it crashes our WPT test. If you look at `Event-timestamp-safe-resolution.html` you'll see that it's trying to find the delta between two timestamps, in an endless loop (without a loop of many iterations). With second-resolution, it just takes too long (and crashes..memory).
This commit is contained in:
		| @@ -113,7 +113,7 @@ pub const Event = struct { | ||||
|     // Even though this is supposed to to provide microsecond resolution, browser | ||||
|     // return coarser values to protect against fingerprinting. libdom returns | ||||
|     // seconds, which is good enough. | ||||
|     pub fn get_timeStamp(self: *parser.Event) !u32 { | ||||
|     pub fn get_timeStamp(self: *parser.Event) !u64 { | ||||
|         return parser.eventTimestamp(self); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -505,11 +505,11 @@ pub fn eventIsTrusted(evt: *Event) !bool { | ||||
|     return res; | ||||
| } | ||||
|  | ||||
| pub fn eventTimestamp(evt: *Event) !u32 { | ||||
|     var ts: c_uint = undefined; | ||||
| pub fn eventTimestamp(evt: *Event) !u64 { | ||||
|     var ts: u64 = 0; | ||||
|     const err = c._dom_event_get_timestamp(evt, &ts); | ||||
|     try DOMErr(err); | ||||
|     return @as(u32, @intCast(ts)); | ||||
|     return ts; | ||||
| } | ||||
|  | ||||
| pub fn eventStopPropagation(evt: *Event) !void { | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/netsurf/libdom
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/netsurf/libdom
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/netsurf/libdom updated: 120717bad4...269ce05169
									
								
							
		Reference in New Issue
	
	Block a user
	 Karl Seguin
					Karl Seguin