mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-21 20:24:42 +00:00
Merge pull request #1853 from lightpanda-io/fix-ignore-partition-key
Fix ignore partition key
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
const std = @import("std");
|
||||
const lp = @import("lightpanda");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const log = @import("../../log.zig");
|
||||
|
||||
const CdpStorage = @import("storage.zig");
|
||||
|
||||
@@ -117,7 +118,12 @@ fn deleteCookies(cmd: anytype) !void {
|
||||
path: ?[]const u8 = null,
|
||||
partitionKey: ?CdpStorage.CookiePartitionKey = null,
|
||||
})) orelse return error.InvalidParams;
|
||||
if (params.partitionKey != null) return error.NotImplemented;
|
||||
// Silently ignore partitionKey since we don't support partitioned cookies (CHIPS).
|
||||
// This allows Puppeteer's page.setCookie() to work, which sends deleteCookies
|
||||
// with partitionKey as part of its cookie-setting workflow.
|
||||
if (params.partitionKey != null) {
|
||||
log.warn(.not_implemented, "partition key", .{ .src = "deleteCookies" });
|
||||
}
|
||||
|
||||
const bc = cmd.browser_context orelse return error.BrowserContextNotLoaded;
|
||||
const cookies = &bc.session.cookie_jar.cookies;
|
||||
|
||||
@@ -128,7 +128,14 @@ pub const CdpCookie = struct {
|
||||
};
|
||||
|
||||
pub fn setCdpCookie(cookie_jar: *CookieJar, param: CdpCookie) !void {
|
||||
if (param.priority != .Medium or param.sameParty != null or param.sourceScheme != null or param.partitionKey != null) {
|
||||
// Silently ignore partitionKey since we don't support partitioned cookies (CHIPS).
|
||||
// This allows Puppeteer's page.setCookie() to work, which may send cookies with
|
||||
// partitionKey as part of its cookie-setting workflow.
|
||||
if (param.partitionKey != null) {
|
||||
log.warn(.not_implemented, "partition key", .{ .src = "setCdpCookie" });
|
||||
}
|
||||
// Still reject unsupported features
|
||||
if (param.priority != .Medium or param.sameParty != null or param.sourceScheme != null) {
|
||||
return error.NotImplemented;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user