Merge pull request #1460 from lightpanda-io/dupe-url-nav

fix slice alias crash after same document navigation
This commit is contained in:
Pierre Tachoire
2026-02-04 08:25:32 +01:00
committed by GitHub

View File

@@ -271,9 +271,16 @@ pub fn navigateInner(
const committed = local.createPromiseResolver();
const finished = local.createPromiseResolver();
const new_url = try URL.resolve(arena, page.url, url, .{});
var new_url = try URL.resolve(arena, page.url, url, .{});
const is_same_document = URL.eqlDocument(new_url, page.url);
// In case of navigation to the same document, we force an url duplication.
// Keeping the same url generates a crash during WPT test navigate-history-push-same-url.html.
// When building a script's src, script's base and page url overlap.
if (is_same_document) {
new_url = try arena.dupeZ(u8, new_url);
}
const previous = self.getCurrentEntry();
switch (kind) {