mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-08-01 02:06:17 -04:00
History: prefer setHref instead of new URL in replaceState
This is what spec recommends, `pushState` was updated in commits before.
This commit is contained in:
@@ -20,9 +20,7 @@ const std = @import("std");
|
||||
const js = @import("../js/js.zig");
|
||||
|
||||
const Frame = @import("../Frame.zig");
|
||||
const Location = @import("Location.zig");
|
||||
const PopStateEvent = @import("event/PopStateEvent.zig");
|
||||
const URL = @import("URL.zig");
|
||||
|
||||
const History = @This();
|
||||
|
||||
@@ -77,13 +75,8 @@ pub fn replaceState(_: *History, state: js.Value, _: ?[]const u8, _url: ?[]const
|
||||
_ = try frame._session.navigation.replaceEntry(url, .{ .source = .history, .value = json }, frame, true);
|
||||
|
||||
frame.url = url;
|
||||
|
||||
frame.window._location.releaseRef(frame._page);
|
||||
// Initialize new location.
|
||||
const location = try Location.init(url, frame);
|
||||
location.acquireRef();
|
||||
errdefer location.releaseRef(frame._page);
|
||||
frame.window._location = location;
|
||||
// setHref == reinitializing.
|
||||
try frame.window._location._url.setHref(url, &frame.js.execution);
|
||||
}
|
||||
|
||||
fn goInner(delta: i32, frame: *Frame) !void {
|
||||
|
||||
Reference in New Issue
Block a user