playwright-core 1.54.0-alpha-2025-06-10 → 1.54.0-alpha-2025-06-11

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.
@@ -34,7 +34,7 @@ class Cookie {
34
34
  }
35
35
  // https://datatracker.ietf.org/doc/html/rfc6265#section-5.4
36
36
  matches(url) {
37
- if (this._raw.secure && (url.protocol !== "https:" && url.hostname !== "localhost"))
37
+ if (this._raw.secure && (url.protocol !== "https:" && !(0, import_network.isLocalHostname)(url.hostname)))
38
38
  return false;
39
39
  if (!domainMatches(url.hostname, this._raw.domain))
40
40
  return false;
@@ -23,6 +23,7 @@ __export(network_exports, {
23
23
  Route: () => Route,
24
24
  WebSocket: () => WebSocket,
25
25
  filterCookies: () => filterCookies,
26
+ isLocalHostname: () => isLocalHostname,
26
27
  kMaxCookieExpiresDateInSeconds: () => kMaxCookieExpiresDateInSeconds,
27
28
  mergeHeaders: () => mergeHeaders,
28
29
  parseURL: () => parseURL,
@@ -50,13 +51,16 @@ function filterCookies(cookies, urls) {
50
51
  continue;
51
52
  if (!parsedURL.pathname.startsWith(c.path))
52
53
  continue;
53
- if (parsedURL.protocol !== "https:" && parsedURL.hostname !== "localhost" && c.secure)
54
+ if (parsedURL.protocol !== "https:" && !isLocalHostname(parsedURL.hostname) && c.secure)
54
55
  continue;
55
56
  return true;
56
57
  }
57
58
  return false;
58
59
  });
59
60
  }
61
+ function isLocalHostname(hostname) {
62
+ return hostname === "localhost" || hostname.endsWith(".localhost");
63
+ }
60
64
  const kMaxCookieExpiresDateInSeconds = 253402300799;
61
65
  function rewriteCookies(cookies) {
62
66
  return cookies.map((c) => {
@@ -598,6 +602,7 @@ function mergeHeaders(headers) {
598
602
  Route,
599
603
  WebSocket,
600
604
  filterCookies,
605
+ isLocalHostname,
601
606
  kMaxCookieExpiresDateInSeconds,
602
607
  mergeHeaders,
603
608
  parseURL,