mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-03 22:13:46 +00:00
fix slice alias crash after same document navigation
The WPT tests navigation-api/navigation-methods/navigate-history-push-same-url.html crashed with a @memcpy arguments alias error. It seems to be due to the reuse of the previous page.url string. Forcing to duplicate it fixes the crash.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user