fix: bound proxy GeoIP setup

This commit is contained in:
Pradeep Elankumaran
2026-09-08 22:36:29 -07:00
parent fe5fc221f4
commit c85e9bd438
2 changed files with 6 additions and 2 deletions
+4 -2
View File
@@ -1077,13 +1077,15 @@ function _countActiveHandles() {
try { return process._getActiveHandles().length; } catch { return null; }
}
const GEOIP_SETUP_TIMEOUT_MS = 10000;
function isCamoufoxGeoipError(err) {
return /Invalid locale:|GeoLite|MaxMind|geolocation|public proxy IP address/i.test(err?.message || String(err || ''));
return /Invalid locale:|GeoLite|MaxMind|geolocation|public proxy IP address|GeoIP setup timed out/i.test(err?.message || String(err || ''));
}
async function buildLaunchOptionsWithGeoipFallback(baseOptions, attemptMeta) {
try {
return await launchOptions(baseOptions);
return await withTimeout(launchOptions(baseOptions), GEOIP_SETUP_TIMEOUT_MS, 'GeoIP setup');
} catch (err) {
if (!baseOptions.geoip || !isCamoufoxGeoipError(err)) {
throw err;
+2
View File
@@ -72,6 +72,8 @@ describe('launch compatibility source contract', () => {
expect(geoipFallback).toMatch(/GeoLite\|MaxMind\|geolocation/);
expect(geoipFallback).toContain('public proxy IP address');
expect(serverSource).toContain('GEOIP_SETUP_TIMEOUT_MS = 10000');
expect(geoipFallback).toContain("withTimeout(launchOptions(baseOptions), GEOIP_SETUP_TIMEOUT_MS, 'GeoIP setup')");
expect(geoipFallback).toContain('geoip: false');
expect(launchBrowser).toContain('buildLaunchOptionsWithGeoipFallback');
});