File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,7 @@ fn deleteCookies(cmd: anytype) !void {
132132}
133133
134134fn clearBrowserCookies (cmd : anytype ) ! void {
135+ if (try cmd .params (struct {}) != null ) return error .InvalidParams ;
135136 const bc = cmd .browser_context orelse return error .BrowserContextNotLoaded ;
136137 bc .session .cookie_jar .clearRetainingCapacity ();
137138 return cmd .sendResult (null , .{});
@@ -161,11 +162,10 @@ fn setCookies(cmd: anytype) !void {
161162 try cmd .sendResult (null , .{});
162163}
163164
165+ const getCookiesParam = struct { urls : ? []const []const u8 = null };
164166fn getCookies (cmd : anytype ) ! void {
165167 const bc = cmd .browser_context orelse return error .BrowserContextNotLoaded ;
166- const params = (try cmd .params (struct {
167- urls : ? []const []const u8 = null ,
168- })) orelse return error .InvalidParams ;
168+ const params = (try cmd .params (getCookiesParam )) orelse getCookiesParam {};
169169
170170 // If not specified, use the URLs of the page and all of its subframes. TODO subframes
171171 const page_url = if (bc .session .page ) | * page | page .url .raw else null ; // @speed: avoid repasing the URL
Original file line number Diff line number Diff line change @@ -38,11 +38,11 @@ pub fn processMessage(cmd: anytype) !void {
3838 }
3939}
4040
41+ const BrowserContextParam = struct { browserContextId : ? []const u8 = null };
42+
4143fn clearCookies (cmd : anytype ) ! void {
4244 const bc = cmd .browser_context orelse return error .BrowserContextNotLoaded ;
43- const params = (try cmd .params (struct {
44- browserContextId : ? []const u8 = null ,
45- })) orelse return error .InvalidParams ;
45+ const params = (try cmd .params (BrowserContextParam )) orelse BrowserContextParam {};
4646
4747 if (params .browserContextId ) | browser_context_id | {
4848 if (std .mem .eql (u8 , browser_context_id , bc .id ) == false ) {
@@ -57,9 +57,7 @@ fn clearCookies(cmd: anytype) !void {
5757
5858fn getCookies (cmd : anytype ) ! void {
5959 const bc = cmd .browser_context orelse return error .BrowserContextNotLoaded ;
60- const params = (try cmd .params (struct {
61- browserContextId : ? []const u8 = null ,
62- })) orelse return error .InvalidParams ;
60+ const params = (try cmd .params (BrowserContextParam )) orelse BrowserContextParam {};
6361
6462 if (params .browserContextId ) | browser_context_id | {
6563 if (std .mem .eql (u8 , browser_context_id , bc .id ) == false ) {
You can’t perform that action at this time.
0 commit comments