try safer http cleanup on page deinit

This commit is contained in:
Karl Seguin
2025-12-02 16:05:57 +08:00
parent a61e87c5dd
commit b5eceb52fb
3 changed files with 24 additions and 1 deletions

View File

@@ -77,6 +77,13 @@ pub fn init(input: Input, options: ?RequestInit, page: *Page) !js.Promise {
return fetch._resolver.promise();
}
pub fn deinit(self: *Fetch) void {
if (self.transfer) |transfer| {
transfer.abort();
self.transfer = null;
}
}
fn httpHeaderDoneCallback(transfer: *Http.Transfer) !void {
const self: *Fetch = @ptrCast(@alignCast(transfer.ctx));