@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 +31 -4
- package/dist/browser.js.map +2 -2
- package/dist/index.cjs +31 -4
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +31 -4
- 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,28 @@ 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 normalized = {
|
|
993
1010
|
name,
|
|
994
1011
|
value: cookieValue,
|
|
995
|
-
domain,
|
|
996
1012
|
path: path2,
|
|
997
|
-
...
|
|
1013
|
+
...domain ? { domain } : {},
|
|
1014
|
+
...!domain && url ? { url } : {},
|
|
1015
|
+
...sameSite ? { sameSite } : {},
|
|
1016
|
+
...secure ? { secure: true } : {},
|
|
1017
|
+
...httpOnly ? { httpOnly: true } : {},
|
|
1018
|
+
...expires !== null ? { expires } : {}
|
|
1019
|
+
};
|
|
1020
|
+
if (!normalized.domain && !normalized.url) {
|
|
1021
|
+
return null;
|
|
1022
|
+
}
|
|
1023
|
+
return {
|
|
1024
|
+
...normalized
|
|
998
1025
|
};
|
|
999
1026
|
}).filter(Boolean);
|
|
1000
1027
|
};
|