mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-06-11 01:25:53 -04:00
Frame: change Location reference release order
This commit is contained in:
@@ -566,13 +566,11 @@ pub fn navigate(self: *Frame, request_url: [:0]const u8, opts: NavigateOpts) !vo
|
||||
// have to do this to make sure window.location is at a unique _address_.
|
||||
// If we don't do this, multiple window._location will have the same
|
||||
// address and thus be mapped to the same v8::Object in the identity map.
|
||||
//
|
||||
// We don't hold a reference to old location anymore.
|
||||
self.window._location.releaseRef(self._page);
|
||||
// Create new location.
|
||||
const location = try Location.init(self.url, self);
|
||||
location.acquireRef();
|
||||
errdefer location.releaseRef(self._page);
|
||||
// We're not holding a ref to old location anymore.
|
||||
self.window._location.releaseRef(self._page);
|
||||
self.window._location = location;
|
||||
|
||||
if (is_blob) {
|
||||
@@ -810,11 +808,10 @@ fn scheduleNavigationWithArena(originator: *Frame, arena: Allocator, request_url
|
||||
if (!opts.force and is_fragment_navigation) {
|
||||
target.url = try target.arena.dupeZ(u8, resolved_url);
|
||||
|
||||
// Release our reference to the previous location before replacing it.
|
||||
target.window._location.releaseRef(target._page);
|
||||
const location = try Location.init(target.url, target);
|
||||
location.acquireRef();
|
||||
errdefer location.releaseRef(target._page);
|
||||
target.window._location.releaseRef(target._page);
|
||||
target.window._location = location;
|
||||
|
||||
if (target.parent == null) {
|
||||
@@ -1094,12 +1091,11 @@ fn frameHeaderDoneCallback(response: HttpClient.Response) !bool {
|
||||
}
|
||||
}
|
||||
|
||||
// Release our reference to location before.
|
||||
self.window._location.releaseRef(self._page);
|
||||
// Init new location.
|
||||
const location = try Location.init(self.url, self);
|
||||
location.acquireRef();
|
||||
errdefer location.releaseRef(self._page);
|
||||
self.window._location.releaseRef(self._page);
|
||||
self.window._location = location;
|
||||
|
||||
if (comptime IS_DEBUG) {
|
||||
|
||||
Reference in New Issue
Block a user