@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/index.js
CHANGED
|
@@ -978,6 +978,20 @@ var normalizeCookieSameSite = (value) => {
|
|
|
978
978
|
return "";
|
|
979
979
|
}
|
|
980
980
|
};
|
|
981
|
+
var normalizeCookieExpires = (raw = {}) => {
|
|
982
|
+
const source = raw && typeof raw === "object" ? raw : {};
|
|
983
|
+
const session = Boolean(source.session);
|
|
984
|
+
if (session) return null;
|
|
985
|
+
const expiresCandidate = Number(source.expires);
|
|
986
|
+
if (Number.isFinite(expiresCandidate) && expiresCandidate > 0) {
|
|
987
|
+
return expiresCandidate;
|
|
988
|
+
}
|
|
989
|
+
const expirationDateCandidate = Number(source.expirationDate);
|
|
990
|
+
if (Number.isFinite(expirationDateCandidate) && expirationDateCandidate > 0) {
|
|
991
|
+
return expirationDateCandidate;
|
|
992
|
+
}
|
|
993
|
+
return null;
|
|
994
|
+
};
|
|
981
995
|
var normalizeCookies = (value) => {
|
|
982
996
|
if (!Array.isArray(value)) return [];
|
|
983
997
|
return value.map((item) => {
|
|
@@ -986,15 +1000,30 @@ var normalizeCookies = (value) => {
|
|
|
986
1000
|
const cookieValue = String(raw.value ?? "").trim();
|
|
987
1001
|
if (!name || !cookieValue || cookieValue === "<nil>") return null;
|
|
988
1002
|
const domain = String(raw.domain || "").trim();
|
|
1003
|
+
const url = normalizeHttpUrl(raw.url);
|
|
989
1004
|
const path2 = String(raw.path || "").trim() || "/";
|
|
990
1005
|
const sameSite = normalizeCookieSameSite(raw.sameSite);
|
|
991
|
-
|
|
992
|
-
|
|
1006
|
+
const expires = normalizeCookieExpires(raw);
|
|
1007
|
+
const secure = Boolean(raw.secure);
|
|
1008
|
+
const httpOnly = Boolean(raw.httpOnly);
|
|
1009
|
+
const partitionKey = typeof raw.partitionKey === "string" ? String(raw.partitionKey).trim() : "";
|
|
1010
|
+
const normalized = {
|
|
993
1011
|
name,
|
|
994
1012
|
value: cookieValue,
|
|
995
|
-
domain,
|
|
996
1013
|
path: path2,
|
|
997
|
-
...
|
|
1014
|
+
...domain ? { domain } : {},
|
|
1015
|
+
...!domain && url ? { url } : {},
|
|
1016
|
+
...sameSite ? { sameSite } : {},
|
|
1017
|
+
...secure ? { secure: true } : {},
|
|
1018
|
+
...httpOnly ? { httpOnly: true } : {},
|
|
1019
|
+
...expires !== null ? { expires } : {},
|
|
1020
|
+
...partitionKey ? { partitionKey } : {}
|
|
1021
|
+
};
|
|
1022
|
+
if (!normalized.domain && !normalized.url) {
|
|
1023
|
+
return null;
|
|
1024
|
+
}
|
|
1025
|
+
return {
|
|
1026
|
+
...normalized
|
|
998
1027
|
};
|
|
999
1028
|
}).filter(Boolean);
|
|
1000
1029
|
};
|
|
@@ -1487,7 +1516,7 @@ var RuntimeEnv = {
|
|
|
1487
1516
|
if (!normalized.path) {
|
|
1488
1517
|
normalized.path = "/";
|
|
1489
1518
|
}
|
|
1490
|
-
if (!normalized.domain) {
|
|
1519
|
+
if (!normalized.domain && !normalized.url) {
|
|
1491
1520
|
return null;
|
|
1492
1521
|
}
|
|
1493
1522
|
return normalized;
|