mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 06:23:45 +00:00
on XHR shutdown, use terminate to prevent any client callbacks into the XHR
This commit is contained in:
@@ -93,7 +93,7 @@ pub fn init(page: *Page) !*XMLHttpRequest {
|
|||||||
|
|
||||||
pub fn deinit(self: *XMLHttpRequest) void {
|
pub fn deinit(self: *XMLHttpRequest) void {
|
||||||
if (self._transfer) |transfer| {
|
if (self._transfer) |transfer| {
|
||||||
transfer.abort(error.Abort);
|
transfer.terminate();
|
||||||
self._transfer = null;
|
self._transfer = null;
|
||||||
}
|
}
|
||||||
self._page.releaseArena(self._arena);
|
self._page.releaseArena(self._arena);
|
||||||
|
|||||||
@@ -979,6 +979,13 @@ pub const Transfer = struct {
|
|||||||
self.deinit();
|
self.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn terminate(self: *Transfer) void {
|
||||||
|
if (self._handle != null) {
|
||||||
|
self.client.endTransfer(self);
|
||||||
|
}
|
||||||
|
self.deinit();
|
||||||
|
}
|
||||||
|
|
||||||
// internal, when the page is shutting down. Doesn't have the same ceremony
|
// internal, when the page is shutting down. Doesn't have the same ceremony
|
||||||
// as abort (doesn't send a notification, doesn't invoke an error callback)
|
// as abort (doesn't send a notification, doesn't invoke an error callback)
|
||||||
fn kill(self: *Transfer) void {
|
fn kill(self: *Transfer) void {
|
||||||
|
|||||||
Reference in New Issue
Block a user