@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.cjs
CHANGED
|
@@ -1006,6 +1006,20 @@ var normalizeCookieSameSite = (value) => {
|
|
|
1006
1006
|
return "";
|
|
1007
1007
|
}
|
|
1008
1008
|
};
|
|
1009
|
+
var normalizeCookieExpires = (raw = {}) => {
|
|
1010
|
+
const source = raw && typeof raw === "object" ? raw : {};
|
|
1011
|
+
const session = Boolean(source.session);
|
|
1012
|
+
if (session) return null;
|
|
1013
|
+
const expiresCandidate = Number(source.expires);
|
|
1014
|
+
if (Number.isFinite(expiresCandidate) && expiresCandidate > 0) {
|
|
1015
|
+
return expiresCandidate;
|
|
1016
|
+
}
|
|
1017
|
+
const expirationDateCandidate = Number(source.expirationDate);
|
|
1018
|
+
if (Number.isFinite(expirationDateCandidate) && expirationDateCandidate > 0) {
|
|
1019
|
+
return expirationDateCandidate;
|
|
1020
|
+
}
|
|
1021
|
+
return null;
|
|
1022
|
+
};
|
|
1009
1023
|
var normalizeCookies = (value) => {
|
|
1010
1024
|
if (!Array.isArray(value)) return [];
|
|
1011
1025
|
return value.map((item) => {
|
|
@@ -1014,15 +1028,30 @@ var normalizeCookies = (value) => {
|
|
|
1014
1028
|
const cookieValue = String(raw.value ?? "").trim();
|
|
1015
1029
|
if (!name || !cookieValue || cookieValue === "<nil>") return null;
|
|
1016
1030
|
const domain = String(raw.domain || "").trim();
|
|
1031
|
+
const url = normalizeHttpUrl(raw.url);
|
|
1017
1032
|
const path2 = String(raw.path || "").trim() || "/";
|
|
1018
1033
|
const sameSite = normalizeCookieSameSite(raw.sameSite);
|
|
1019
|
-
|
|
1020
|
-
|
|
1034
|
+
const expires = normalizeCookieExpires(raw);
|
|
1035
|
+
const secure = Boolean(raw.secure);
|
|
1036
|
+
const httpOnly = Boolean(raw.httpOnly);
|
|
1037
|
+
const partitionKey = typeof raw.partitionKey === "string" ? String(raw.partitionKey).trim() : "";
|
|
1038
|
+
const normalized = {
|
|
1021
1039
|
name,
|
|
1022
1040
|
value: cookieValue,
|
|
1023
|
-
domain,
|
|
1024
1041
|
path: path2,
|
|
1025
|
-
...
|
|
1042
|
+
...domain ? { domain } : {},
|
|
1043
|
+
...!domain && url ? { url } : {},
|
|
1044
|
+
...sameSite ? { sameSite } : {},
|
|
1045
|
+
...secure ? { secure: true } : {},
|
|
1046
|
+
...httpOnly ? { httpOnly: true } : {},
|
|
1047
|
+
...expires !== null ? { expires } : {},
|
|
1048
|
+
...partitionKey ? { partitionKey } : {}
|
|
1049
|
+
};
|
|
1050
|
+
if (!normalized.domain && !normalized.url) {
|
|
1051
|
+
return null;
|
|
1052
|
+
}
|
|
1053
|
+
return {
|
|
1054
|
+
...normalized
|
|
1026
1055
|
};
|
|
1027
1056
|
}).filter(Boolean);
|
|
1028
1057
|
};
|
|
@@ -1515,7 +1544,7 @@ var RuntimeEnv = {
|
|
|
1515
1544
|
if (!normalized.path) {
|
|
1516
1545
|
normalized.path = "/";
|
|
1517
1546
|
}
|
|
1518
|
-
if (!normalized.domain) {
|
|
1547
|
+
if (!normalized.domain && !normalized.url) {
|
|
1519
1548
|
return null;
|
|
1520
1549
|
}
|
|
1521
1550
|
return normalized;
|