browserclaw 0.7.0 → 0.7.1

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
@@ -1295,20 +1295,7 @@ async function fetchChromeVersion(cdpUrl, timeoutMs = 500, authToken) {
1295
1295
  async function isChromeReachable(cdpUrl, timeoutMs = 500, authToken) {
1296
1296
  if (isWebSocketUrl(cdpUrl)) return await canOpenWebSocket(cdpUrl, timeoutMs);
1297
1297
  const version = await fetchChromeVersion(cdpUrl, timeoutMs, authToken);
1298
- if (version !== null) return true;
1299
- let isLoopback = false;
1300
- try {
1301
- const u = new URL(cdpUrl.startsWith("http") ? cdpUrl : `http://${cdpUrl}`);
1302
- isLoopback = isLoopbackHost(u.hostname);
1303
- } catch {
1304
- }
1305
- if (!isLoopback) return false;
1306
- for (let i = 0; i < 2; i++) {
1307
- await new Promise((r) => setTimeout(r, 150));
1308
- const retry = await fetchChromeVersion(cdpUrl, timeoutMs, authToken);
1309
- if (retry !== null) return true;
1310
- }
1311
- return false;
1298
+ return version !== null;
1312
1299
  }
1313
1300
  async function getChromeWebSocketUrl(cdpUrl, timeoutMs = 500, authToken) {
1314
1301
  if (isWebSocketUrl(cdpUrl)) return cdpUrl;
@@ -2053,6 +2040,8 @@ async function disconnectBrowser() {
2053
2040
  }
2054
2041
  }
2055
2042
  for (const cur of cachedByCdpUrl.values()) {
2043
+ if (cur.onDisconnected && typeof cur.browser.off === "function")
2044
+ cur.browser.off("disconnected", cur.onDisconnected);
2056
2045
  await cur.browser.close().catch(() => {
2057
2046
  });
2058
2047
  }