Files
camoufox/fix_navigator.py
T
Nirupam BhowmickandClaude 55088770aa wip: update Navigator.cpp function line numbers for Firefox 146
Updated 13 Navigator.cpp hunks to match Firefox 146 function locations:
- Invalidate: 267 → 173
- GetUserAgent: 293 → 262
- GetAppCodeName: 314 → 291
- GetAppVersion: 325 → 313
- GetPlatform: 449 → 443
- GetVendor: 488 → 511
- CookieEnabled: 589 → 578
- GetBuildID: 659 → 642
- GlobalPrivacyControl: 684 → 710
- Vibrate: 882 → 868

Some hunks still fail due to code structure changes in Firefox 146
(new fingerprint resistance checks). Still 24 failing hunks to fix.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-25 20:16:58 +00:00

25 lines
815 B
Python

#!/usr/bin/env python3
"""Fix all Navigator.cpp hunks by finding actual line numbers"""
import re
import subprocess
# Read the clean Firefox 146 Navigator.cpp
with open('camoufox-146.0.1-beta.25/dom/base/Navigator.cpp', 'r') as f:
firefox_lines = f.readlines()
# Find line numbers for each function/marker in Firefox 146
def find_line(pattern):
for i, line in enumerate(firefox_lines, 1):
if pattern in line:
return i
return None
# Read the patch
with open('patches/fingerprint-injection.patch', 'r') as f:
patch_content = f.read()
# Find and print all Navigator.cpp hunks with their context
hunks = re.findall(r'(@@ -(\d+),\d+ \+\d+,\d+ @@[^\n]*\n(?:[^\n]*\n){0,3})', patch_content)
for hunk_header, old_line in hunks[:10]:
print(f"Line {old_line}: {hunk_header[:80]}")