Files
camoufox/fix_navigator_patch.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

67 lines
2.4 KiB
Python

#!/usr/bin/env python3
"""Fix Navigator.cpp patch hunks for Firefox 146."""
import re
# Read the current source file to understand the actual structure
with open('/Users/jish/Documents/GitHub/camoufox/camoufox-146.0.1-beta.25/dom/base/Navigator.cpp', 'r') as f:
source_lines = f.readlines()
# Find actual line numbers for key functions
patterns = {
'Navigator.h include': r'^#include "Navigator\.h"',
'GetUserAgent': r'^void Navigator::GetUserAgent\(',
'GetAppCodeName': r'^void Navigator::GetAppCodeName\(',
'GetAppVersion': r'^void Navigator::GetAppVersion\(',
'GetAppName': r'^void Navigator::GetAppName\(',
'GetAcceptLanguages': r'^void Navigator::GetAcceptLanguages\(',
'GetLanguage': r'^void Navigator::GetLanguage\(',
'GetPlatform': r'^void Navigator::GetPlatform\(',
'GetOscpu': r'^void Navigator::GetOscpu\(',
'GetProduct': r'^void Navigator::GetProduct\(',
'GetProductSub': r'^void Navigator::GetProductSub\(',
'PdfViewerEnabled': r'^bool Navigator::PdfViewerEnabled\(',
'CookieEnabled': r'^bool Navigator::CookieEnabled\(',
'OnLine': r'^bool Navigator::OnLine\(',
'GetBuildID': r'^void Navigator::GetBuildID\(',
'GetDoNotTrack': r'^void Navigator::GetDoNotTrack\(',
'GlobalPrivacyControl': r'^bool Navigator::GlobalPrivacyControl\(',
'HardwareConcurrency': r'^uint64_t Navigator::HardwareConcurrency\(',
'MaxTouchPoints': r'^uint32_t Navigator::MaxTouchPoints\(',
}
line_numbers = {}
for i, line in enumerate(source_lines, 1):
for name, pattern in patterns.items():
if re.match(pattern, line):
line_numbers[name] = i
print(f"{name}: line {i}")
print("\nExpected vs Actual:")
expected = {
'Navigator.h include': 10,
'GetUserAgent': 267,
'GetAppCodeName': 293,
'GetAppVersion': 314,
'GetAppName': 325,
'GetAcceptLanguages': 350,
'GetLanguage': 400,
'GetPlatform': 423,
'GetOscpu': 449,
'GetProduct': 488,
'GetProductSub': 493,
'PdfViewerEnabled': 517,
'CookieEnabled': 543,
'OnLine': 589,
'GetBuildID': 603,
'GetDoNotTrack': 659,
'GlobalPrivacyControl': 673,
'HardwareConcurrency': 684,
'MaxTouchPoints': 882,
}
for name, exp_line in expected.items():
act_line = line_numbers.get(name, '?')
diff = act_line - exp_line if isinstance(act_line, int) else '?'
print(f"{name}: expected {exp_line}, actual {act_line}, diff {diff}")