mirror of
https://github.com/daijro/camoufox.git
synced 2026-08-24 16:00:08 +00:00
Remove init_script system timezone fallback that poisons storage (#560)
The else branch in _build_init_script() reads the system timezone via Intl.DateTimeFormat().resolvedOptions().timeZone and stores it via setTimezone(). When geoip resolves a different timezone (set later via CAMOU_CONFIG/launch_options), the storage value from the init_script takes precedence — workers read the wrong timezone and the C++ MaskConfig fallback (PR #546) is never reached. Fix: only call setTimezone() when an explicit timezone value is provided. When omitted, timezone propagation is handled entirely by the C++ side (SetNewDocument + TimezoneManager::GetTimezone MaskConfig fallback). Companion to #546 (Fix worker timezone leak when using geoip/proxy). Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -373,16 +373,17 @@ def _build_init_script(values: Dict[str, Any]) -> str:
|
||||
f' if (typeof w.setScreenColorDepth === "function") w.setScreenColorDepth({scd});'
|
||||
)
|
||||
|
||||
# Timezone (always call to trigger self-destruct)
|
||||
# Timezone — only call setTimezone() when we have an explicit value.
|
||||
# Without this, the C++ MaskConfig fallback (from CAMOU_CONFIG set by geoip
|
||||
# in launch_options) handles timezone for both main thread and workers via
|
||||
# SetNewDocument() and TimezoneManager::GetTimezone().
|
||||
# The old fallback read system TZ and poisoned RoverfoxStorageManager,
|
||||
# preventing MaskConfig from ever being consulted.
|
||||
tz = values.get('timezone')
|
||||
if tz:
|
||||
lines.append(
|
||||
f' if (typeof w.setTimezone === "function") w.setTimezone({_json.dumps(tz)});'
|
||||
)
|
||||
else:
|
||||
lines.append(
|
||||
' if (typeof w.setTimezone === "function") w.setTimezone(Intl.DateTimeFormat().resolvedOptions().timeZone);'
|
||||
)
|
||||
|
||||
# WebRTC IP
|
||||
ip = values.get('webrtcIP')
|
||||
|
||||
Reference in New Issue
Block a user