Lightpanda: the headless browser designed for AI and automation
use hasDirectListeners for fireDispose
Muki Kiboigo35f128d2641d
diff --git a/src/browser/webapi/navigation/NavigationHistoryEntry.zig b/src/browser/webapi/navigation/NavigationHistoryEntry.zigindex 35cc1a26f..c8c1010b2 100644--- a/src/browser/webapi/navigation/NavigationHistoryEntry.zig+++ b/src/browser/webapi/navigation/NavigationHistoryEntry.zig@@ -81,10 +81,11 @@ pub fn getState(self: *const NavigationHistoryEntry, frame: *Frame) !StateReturn}pub fn fireDispose(self: *NavigationHistoryEntry, frame: *Frame) !void {- const cec = self._on_dispose orelse return;+ if (!frame.hasDirectListeners(self.asEventTarget(), "dispose", self._on_dispose)) return;+ if (self._on_dispose == null) return;const event = try Event.initTrusted(comptime .wrap("dispose"), .{}, frame._page);- try frame.dispatch(self.asEventTarget(), event, cec, .{ .context = "NavigationHistoryEntry" });+ try frame.dispatch(self.asEventTarget(), event, self._on_dispose.?, .{ .context = "NavigationHistoryEntry" });}fn getOnDispose(self: *const NavigationHistoryEntry) ?js.Function.Global {