mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-06-11 01:25:53 -04:00
Fix same-url navigate
Same-URL navigate should always cause a reload. The code that currently prevents
a navigate on fragment change is too loose and treats identical URLs as being
a fragment change..but for it to be considered a fragment change, the fragment
actually has to change.
This improves some WPT compat where tests do:
<iframe></iframe> <--- loads "about:blank"
<script>
document.querySelector('iframe').src = "about:blank"; <--- should load it again
</script>
This commit is contained in:
@@ -720,7 +720,10 @@ fn scheduleNavigationWithArena(originator: *Frame, arena: Allocator, request_url
|
||||
};
|
||||
|
||||
const session = target._session;
|
||||
if (!opts.force and URL.eqlDocument(target.url, resolved_url)) {
|
||||
// Short-circuit only true fragment-only navigations (same path/query, different
|
||||
// fragment). Identical URLs fall through and trigger a real reload.
|
||||
const is_fragment_navigation = !std.mem.eql(u8, target.url, resolved_url) and URL.eqlDocument(target.url, resolved_url);
|
||||
if (!opts.force and is_fragment_navigation) {
|
||||
target.url = try target.arena.dupeZ(u8, resolved_url);
|
||||
target.window._location = try Location.init(target.url, target);
|
||||
if (target.parent == null) {
|
||||
|
||||
@@ -151,8 +151,20 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<iframe id=f7></iframe>
|
||||
<script id=onloadorder type=module>
|
||||
{
|
||||
const state = await testing.async();
|
||||
$('#f7').onload = state.resolve;
|
||||
$('#f7').src = "about:blank";
|
||||
await state.done(() => {
|
||||
testing.expectEqual(true, true);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<script id=count>
|
||||
testing.onload(() => {
|
||||
testing.expectEqual(9, window.length);
|
||||
testing.expectEqual(10, window.length);
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user