From cd67ed8a27241eea1c2d3709876f647a41a0ff03 Mon Sep 17 00:00:00 2001 From: Karl Seguin Date: Sun, 18 Jan 2026 08:30:50 +0800 Subject: [PATCH] Fix static accessors These are called without a self from v8, and should match that in Zig code. --- src/browser/js/bridge.zig | 15 +++++++++++---- .../performance_observer.html | 5 +++++ src/browser/webapi/PerformanceObserver.zig | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/browser/js/bridge.zig b/src/browser/js/bridge.zig index 53ca21b0..2f7e9f0d 100644 --- a/src/browser/js/bridge.zig +++ b/src/browser/js/bridge.zig @@ -720,10 +720,17 @@ pub const Accessor = struct { defer caller.deinit(); const info = FunctionCallbackInfo{ .handle = handle.? }; - caller.method(T, getter, info, .{ - .as_typed_array = opts.as_typed_array, - .null_as_undefined = opts.null_as_undefined, - }); + if (comptime opts.static) { + caller.function(T, getter, info, .{ + .as_typed_array = opts.as_typed_array, + .null_as_undefined = opts.null_as_undefined, + }); + } else { + caller.method(T, getter, info, .{ + .as_typed_array = opts.as_typed_array, + .null_as_undefined = opts.null_as_undefined, + }); + } } }.wrap; } diff --git a/src/browser/tests/performance_observer/performance_observer.html b/src/browser/tests/performance_observer/performance_observer.html index f0d48ea9..7b5b6c9e 100644 --- a/src/browser/tests/performance_observer/performance_observer.html +++ b/src/browser/tests/performance_observer/performance_observer.html @@ -37,6 +37,7 @@ } +<<<<<<< HEAD + + diff --git a/src/browser/webapi/PerformanceObserver.zig b/src/browser/webapi/PerformanceObserver.zig index 2da5ab3e..a15c7f0d 100644 --- a/src/browser/webapi/PerformanceObserver.zig +++ b/src/browser/webapi/PerformanceObserver.zig @@ -133,7 +133,7 @@ pub fn takeRecords(self: *PerformanceObserver, page: *Page) ![]*Performance.Entr return records; } -pub fn getSupportedEntryTypes(_: *const PerformanceObserver) []const []const u8 { +pub fn getSupportedEntryTypes() []const []const u8 { return &.{ "mark", "measure" }; }