browserclaw 0.9.4 → 0.9.5

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/index.cjs CHANGED
@@ -1727,7 +1727,13 @@ function appendCdpPath2(cdpUrl, cdpPath) {
1727
1727
  }
1728
1728
  }
1729
1729
  async function withPlaywrightPageCdpSession(page, fn) {
1730
- const session = await page.context().newCDPSession(page);
1730
+ const CDP_SESSION_TIMEOUT_MS = 1e4;
1731
+ const session = await Promise.race([
1732
+ page.context().newCDPSession(page),
1733
+ new Promise(
1734
+ (_, reject) => setTimeout(() => reject(new Error("newCDPSession timed out after 10s")), CDP_SESSION_TIMEOUT_MS)
1735
+ )
1736
+ ]);
1731
1737
  try {
1732
1738
  return await fn(session);
1733
1739
  } finally {