@@ -8,15 +8,21 @@ type SetCookie = {
88 Value : string ;
99 Path ?: string ;
1010 Url : string ;
11+ Creation ?: number ;
12+ Expires ?: number ;
13+ HasExpires ?: 0 | 1 ;
14+ Httponly ?: 0 | 1 ;
15+ LastAccess ?: number ;
16+ Secure ?: 0 | 1 ;
1117 [ "max-age" ] ?: number ;
12- samsite ?: "strict" ;
18+ samesite ?: "strict" ;
1319} ;
1420
1521type FullCookie = {
1622 Creation : number ;
1723 Domain : string ;
1824 Expires : number ;
19- HasExpires : number ;
25+ HasExpires : 0 | 1 ;
2026 Httponly : number ;
2127 LastAccess : number ;
2228 Name : string ;
@@ -31,12 +37,12 @@ registerCallHandler<[string], [FullCookie[]]>(
3137 // TODO: We might need to know when the cookie was actually created/last accessed and what's the original URL.
3238 return [
3339 ( await getFullCookies ( url ) ) . map ( ( cookie ) => ( {
34- Creation : Date . now ( ) ,
40+ Creation : Date . now ( ) / 1000 ,
3541 Domain : cookie . domain || "" ,
36- Expires : cookie . expirationDate ?. valueOf ( ) || Date . now ( ) ,
42+ Expires : ( cookie . expirationDate ?. valueOf ( ) || Date . now ( ) ) / 1000 ,
3743 HasExpires : cookie . expirationDate !== undefined ? 1 : 0 ,
3844 Httponly : cookie . httpOnly ? 1 : 0 ,
39- LastAccess : Date . now ( ) ,
45+ LastAccess : Date . now ( ) / 1000 ,
4046 Name : cookie . name ,
4147 Path : cookie . path || "/" ,
4248 Secure : cookie . secure ? 1 : 0 ,
@@ -72,8 +78,15 @@ registerCallHandler<[SetCookie], [boolean]>(
7278 value : cookie . Value ,
7379 domain : cookie . Domain ,
7480 path : cookie . Path ,
81+ httpOnly :
82+ cookie . Httponly !== undefined ? cookie . Httponly === 1 : undefined ,
83+ expires :
84+ cookie . HasExpires && cookie . Expires
85+ ? new Date ( cookie . Expires * 1000 )
86+ : undefined ,
87+ secure : cookie . Secure !== undefined ? cookie . Secure === 1 : undefined ,
7588 maxAge : cookie [ "max-age" ] ,
76- sameSite : cookie . samsite ,
89+ sameSite : cookie . samesite ,
7790 } ) ;
7891 } catch ( error ) {
7992 console . error ( `Error setting cookie: ${ stringifyError ( error ) } ` ) ;
0 commit comments