Merge pull request #1361 from lightpanda-io/mutation-observer-trycall
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
e2e-test / browser fetch (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-linux-aarch64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled
nightly build / build-macos-x86_64 (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
e2e-integration-test / zig build release (push) Has been cancelled
e2e-integration-test / demo-integration-scripts (push) Has been cancelled

use tryCall for MutationObserver records callback
This commit is contained in:
Karl Seguin
2026-01-12 22:42:33 +00:00
committed by GitHub
2 changed files with 7 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ const js = @import("../js/js.zig");
const Page = @import("../Page.zig");
const Node = @import("Node.zig");
const Element = @import("Element.zig");
const log = @import("../../log.zig");
pub fn registerTypes() []const type {
return &.{
@@ -247,7 +248,11 @@ pub fn deliverRecords(self: *MutationObserver, page: *Page) !void {
// Take a copy of the records and clear the list before calling callback
// This ensures mutations triggered during the callback go into a fresh list
const records = try self.takeRecords(page);
try self._callback.call(void, .{ records, self });
var result: js.Function.Result = undefined;
self._callback.tryCall(void, .{ records, self }, &result) catch |err| {
log.err(.page, "MutObserver.deliverRecords", .{ .err = result.exception, .stack = result.stack });
return err;
};
}
pub const MutationRecord = struct {

View File

@@ -18,7 +18,7 @@
const std = @import("std");
const log = @import("../../..//log.zig");
const log = @import("../../../log.zig");
const js = @import("../../js/js.zig");
const Page = @import("../../Page.zig");
const Node = @import("../Node.zig");