@skrillex1224/playwright-toolkit 2.1.185 → 2.1.187
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 +34 -5
- package/dist/browser.js.map +2 -2
- package/dist/index.cjs +34 -5
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +34 -5
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
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,30 @@ 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
|
-
|
|
1401
|
-
|
|
1415
|
+
const expires = normalizeCookieExpires(raw);
|
|
1416
|
+
const secure = Boolean(raw.secure);
|
|
1417
|
+
const httpOnly = Boolean(raw.httpOnly);
|
|
1418
|
+
const partitionKey = typeof raw.partitionKey === "string" ? String(raw.partitionKey).trim() : "";
|
|
1419
|
+
const normalized = {
|
|
1402
1420
|
name,
|
|
1403
1421
|
value: cookieValue,
|
|
1404
|
-
domain,
|
|
1405
1422
|
path,
|
|
1406
|
-
...
|
|
1423
|
+
...domain ? { domain } : {},
|
|
1424
|
+
...!domain && url ? { url } : {},
|
|
1425
|
+
...sameSite ? { sameSite } : {},
|
|
1426
|
+
...secure ? { secure: true } : {},
|
|
1427
|
+
...httpOnly ? { httpOnly: true } : {},
|
|
1428
|
+
...expires !== null ? { expires } : {},
|
|
1429
|
+
...partitionKey ? { partitionKey } : {}
|
|
1430
|
+
};
|
|
1431
|
+
if (!normalized.domain && !normalized.url) {
|
|
1432
|
+
return null;
|
|
1433
|
+
}
|
|
1434
|
+
return {
|
|
1435
|
+
...normalized
|
|
1407
1436
|
};
|
|
1408
1437
|
}).filter(Boolean);
|
|
1409
1438
|
};
|
|
@@ -1899,7 +1928,7 @@ var RuntimeEnv = {
|
|
|
1899
1928
|
if (!normalized.path) {
|
|
1900
1929
|
normalized.path = "/";
|
|
1901
1930
|
}
|
|
1902
|
-
if (!normalized.domain) {
|
|
1931
|
+
if (!normalized.domain && !normalized.url) {
|
|
1903
1932
|
return null;
|
|
1904
1933
|
}
|
|
1905
1934
|
return normalized;
|