mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
clearRetainingCapacity
This commit is contained in:
@@ -32,7 +32,7 @@ pub const Jar = struct {
|
|||||||
self.cookies.deinit(self.allocator);
|
self.cookies.deinit(self.allocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear(self: *Jar) void {
|
pub fn clearRetainingCapacity(self: *Jar) void {
|
||||||
for (self.cookies.items) |c| {
|
for (self.cookies.items) |c| {
|
||||||
c.deinit();
|
c.deinit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ pub fn processMessage(cmd: anytype) !void {
|
|||||||
setCacheDisabled,
|
setCacheDisabled,
|
||||||
setExtraHTTPHeaders,
|
setExtraHTTPHeaders,
|
||||||
deleteCookies,
|
deleteCookies,
|
||||||
|
clearBrowserCookies,
|
||||||
setCookie,
|
setCookie,
|
||||||
setCookies,
|
setCookies,
|
||||||
}, cmd.input.action) orelse return error.UnknownMethod;
|
}, cmd.input.action) orelse return error.UnknownMethod;
|
||||||
@@ -39,6 +40,7 @@ pub fn processMessage(cmd: anytype) !void {
|
|||||||
.setCacheDisabled => return cmd.sendResult(null, .{}),
|
.setCacheDisabled => return cmd.sendResult(null, .{}),
|
||||||
.setExtraHTTPHeaders => return setExtraHTTPHeaders(cmd),
|
.setExtraHTTPHeaders => return setExtraHTTPHeaders(cmd),
|
||||||
.deleteCookies => return deleteCookies(cmd),
|
.deleteCookies => return deleteCookies(cmd),
|
||||||
|
.clearBrowserCookies => return clearBrowserCookies(cmd),
|
||||||
.setCookie => return setCookie(cmd),
|
.setCookie => return setCookie(cmd),
|
||||||
.setCookies => return setCookies(cmd),
|
.setCookies => return setCookies(cmd),
|
||||||
}
|
}
|
||||||
@@ -123,6 +125,15 @@ fn deleteCookies(cmd: anytype) !void {
|
|||||||
return cmd.sendResult(null, .{});
|
return cmd.sendResult(null, .{});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn clearBrowserCookies(cmd: anytype) !void {
|
||||||
|
_ = (try cmd.params(struct {})) orelse return error.InvalidParams;
|
||||||
|
|
||||||
|
const bc = cmd.browser_context orelse return error.BrowserContextNotLoaded;
|
||||||
|
bc.session.cookie_jar.clearRetainingCapacity();
|
||||||
|
|
||||||
|
return cmd.sendResult(null, .{});
|
||||||
|
}
|
||||||
|
|
||||||
const SameSite = enum {
|
const SameSite = enum {
|
||||||
Strict,
|
Strict,
|
||||||
Lax,
|
Lax,
|
||||||
|
|||||||
Reference in New Issue
Block a user