mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 06:23:45 +00:00
Merge pull request #1364 from lightpanda-io/observer_try_catch
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
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
add trycatch to Intersection and Performance Observers
This commit is contained in:
@@ -17,6 +17,8 @@
|
|||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const js = @import("../js/js.zig");
|
const js = @import("../js/js.zig");
|
||||||
|
const log = @import("../../log.zig");
|
||||||
|
|
||||||
const Page = @import("../Page.zig");
|
const Page = @import("../Page.zig");
|
||||||
const Element = @import("Element.zig");
|
const Element = @import("Element.zig");
|
||||||
const DOMRect = @import("DOMRect.zig");
|
const DOMRect = @import("DOMRect.zig");
|
||||||
@@ -238,7 +240,11 @@ pub fn deliverEntries(self: *IntersectionObserver, page: *Page) !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const entries = try self.takeRecords(page);
|
const entries = try self.takeRecords(page);
|
||||||
try self._callback.call(void, .{ entries, self });
|
var result: js.Function.Result = undefined;
|
||||||
|
self._callback.tryCall(void, .{ entries, self }, &result) catch |err| {
|
||||||
|
log.err(.page, "IntsctObserver.deliverEntries", .{ .err = result.exception, .stack = result.stack });
|
||||||
|
return err;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const IntersectionObserverEntry = struct {
|
pub const IntersectionObserverEntry = struct {
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
const js = @import("../js/js.zig");
|
const js = @import("../js/js.zig");
|
||||||
|
const log = @import("../../log.zig");
|
||||||
|
|
||||||
const Page = @import("../Page.zig");
|
const Page = @import("../Page.zig");
|
||||||
const Performance = @import("Performance.zig");
|
const Performance = @import("Performance.zig");
|
||||||
|
|
||||||
@@ -149,7 +151,11 @@ pub inline fn hasRecords(self: *const PerformanceObserver) bool {
|
|||||||
/// Runs the PerformanceObserver's callback with records; emptying it out.
|
/// Runs the PerformanceObserver's callback with records; emptying it out.
|
||||||
pub fn dispatch(self: *PerformanceObserver, page: *Page) !void {
|
pub fn dispatch(self: *PerformanceObserver, page: *Page) !void {
|
||||||
const records = try self.takeRecords(page);
|
const records = try self.takeRecords(page);
|
||||||
_ = try self._callback.call(void, .{ EntryList{ ._entries = records }, self });
|
var result: js.Function.Result = undefined;
|
||||||
|
self._callback.tryCall(void, .{ EntryList{ ._entries = records }, self }, &result) catch |err| {
|
||||||
|
log.err(.page, "PerfObserver.dispatch", .{ .err = result.exception, .stack = result.stack });
|
||||||
|
return err;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const JsApi = struct {
|
pub const JsApi = struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user