Skip to content

Lightpanda: the headless browser designed for AI and automation

allow location.reload() on fragmented url to cause navigation

Karl Seguin51dbad5a6a73
diff --git a/src/browser/EventManager.zig b/src/browser/EventManager.zig
index 81e581585..f78889e3c 100644
--- a/src/browser/EventManager.zig
+++ b/src/browser/EventManager.zig
@@ -432,11 +432,6 @@ fn dispatchNode(self: *EventManager, target: *Node, event: *Event, comptime opts
}
}
-// Per the HTML "event handler processing algorithm", an event handler (on*
-// property or attribute) returning false cancels the event — unlike
-// addEventListener listeners, whose return value is ignored. The inverted
-// special case for onerror only applies to the global's onerror, which is
-// invoked via Window.reportError, not through this node dispatch path.
fn processHandlerReturnValue(event: *Event, handler_return: ?js.Value) void {
const ret = handler_return orelse return;
if (ret.isFalse() and !event._type_string.eql(comptime .wrap("error"))) {
diff --git a/src/browser/Frame.zig b/src/browser/Frame.zig
index 7f7588d81..0a78cd0e2 100644
--- a/src/browser/Frame.zig
+++ b/src/browser/Frame.zig
@@ -901,6 +901,7 @@ fn scheduleNavigationWithArena(originator: *Frame, arena: Allocator, request_url
// fragments and url's fragment is non-null): no reload, and since the
// fragment didn't change, no hashchange and no new history entry either.
if (!opts.force and
+ opts.kind != .reload and
std.mem.eql(u8, target.url, resolved_url) and
std.mem.indexOfScalar(u8, resolved_url, '#') != null)
{