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.js CHANGED
@@ -1284,20 +1284,7 @@ async function fetchChromeVersion(cdpUrl, timeoutMs = 500, authToken) {
1284
1284
  async function isChromeReachable(cdpUrl, timeoutMs = 500, authToken) {
1285
1285
  if (isWebSocketUrl(cdpUrl)) return await canOpenWebSocket(cdpUrl, timeoutMs);
1286
1286
  const version = await fetchChromeVersion(cdpUrl, timeoutMs, authToken);
1287
- if (version !== null) return true;
1288
- let isLoopback = false;
1289
- try {
1290
- const u = new URL(cdpUrl.startsWith("http") ? cdpUrl : `http://${cdpUrl}`);
1291
- isLoopback = isLoopbackHost(u.hostname);
1292
- } catch {
1293
- }
1294
- if (!isLoopback) return false;
1295
- for (let i = 0; i < 2; i++) {
1296
- await new Promise((r) => setTimeout(r, 150));
1297
- const retry = await fetchChromeVersion(cdpUrl, timeoutMs, authToken);
1298
- if (retry !== null) return true;
1299
- }
1300
- return false;
1287
+ return version !== null;
1301
1288
  }
1302
1289
  async function getChromeWebSocketUrl(cdpUrl, timeoutMs = 500, authToken) {
1303
1290
  if (isWebSocketUrl(cdpUrl)) return cdpUrl;
@@ -2042,6 +2029,8 @@ async function disconnectBrowser() {
2042
2029
  }
2043
2030
  }
2044
2031
  for (const cur of cachedByCdpUrl.values()) {
2032
+ if (cur.onDisconnected && typeof cur.browser.off === "function")
2033
+ cur.browser.off("disconnected", cur.onDisconnected);
2045
2034
  await cur.browser.close().catch(() => {
2046
2035
  });
2047
2036
  }