@skrillex1224/playwright-toolkit 2.1.185 → 2.1.186

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.js CHANGED
@@ -1386,6 +1386,20 @@ var normalizeCookieSameSite = (value) => {
1386
1386
  return "";
1387
1387
  }
1388
1388
  };
1389
+ var normalizeCookieExpires = (raw = {}) => {
1390
+ const source = raw && typeof raw === "object" ? raw : {};
1391
+ const session = Boolean(source.session);
1392
+ if (session) return null;
1393
+ const expiresCandidate = Number(source.expires);
1394
+ if (Number.isFinite(expiresCandidate) && expiresCandidate > 0) {
1395
+ return expiresCandidate;
1396
+ }
1397
+ const expirationDateCandidate = Number(source.expirationDate);
1398
+ if (Number.isFinite(expirationDateCandidate) && expirationDateCandidate > 0) {
1399
+ return expirationDateCandidate;
1400
+ }
1401
+ return null;
1402
+ };
1389
1403
  var normalizeCookies = (value) => {
1390
1404
  if (!Array.isArray(value)) return [];
1391
1405
  return value.map((item) => {
@@ -1395,15 +1409,28 @@ var normalizeCookies = (value) => {
1395
1409
  const cookieValue = String((_a = raw.value) != null ? _a : "").trim();
1396
1410
  if (!name || !cookieValue || cookieValue === "<nil>") return null;
1397
1411
  const domain = String(raw.domain || "").trim();
1412
+ const url = normalizeHttpUrl(raw.url);
1398
1413
  const path = String(raw.path || "").trim() || "/";
1399
1414
  const sameSite = normalizeCookieSameSite(raw.sameSite);
1400
- return {
1401
- ...raw,
1415
+ const expires = normalizeCookieExpires(raw);
1416
+ const secure = Boolean(raw.secure);
1417
+ const httpOnly = Boolean(raw.httpOnly);
1418
+ const normalized = {
1402
1419
  name,
1403
1420
  value: cookieValue,
1404
- domain,
1405
1421
  path,
1406
- ...sameSite ? { sameSite } : {}
1422
+ ...domain ? { domain } : {},
1423
+ ...!domain && url ? { url } : {},
1424
+ ...sameSite ? { sameSite } : {},
1425
+ ...secure ? { secure: true } : {},
1426
+ ...httpOnly ? { httpOnly: true } : {},
1427
+ ...expires !== null ? { expires } : {}
1428
+ };
1429
+ if (!normalized.domain && !normalized.url) {
1430
+ return null;
1431
+ }
1432
+ return {
1433
+ ...normalized
1407
1434
  };
1408
1435
  }).filter(Boolean);
1409
1436
  };