Repository navigation
fix: skip generated config properties the installed Camoufox dropped - #339
Open
goodchang77 wants to merge 1 commit into
Open
goodchang77 wants to merge 1 commit into
goodchang77 wants to merge 1 commit into
Conversation
Camoufox v156 removed several config properties that the library still generates: BrowserForge-mapped navigator.product/appCodeName/appName, battery:*, screen.pageXOffset/pageYOffset, plus the hardcoded window.history.length and canvas:aaOffset/aaCapOffset. launch() then fails with 'Unknown property <key> in config' from validateConfig. Load the installed build's properties.json before assembling the config and filter the fingerprint-derived keys against it; guard the hardcoded window.history.length and canvas anti-fingerprinting additions the same way. Caller-supplied config keys are untouched, so validateConfig still catches user typos (covered by a new test). On Camoufox v156.0.1-beta.34: test/basics.test.ts goes from 12/15 failing (browser cannot launch) to 11/15 passing; the remaining locale test failure is a separate v156 behavioral issue. The three 'seeding' tests in test/utils.test.ts pin against the installed browser's schema and fail on v156 with or without this change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Against the current Camoufox release (v156.0.1-beta.34),
launch()fails withUnknown property <key> in configbecause the library generates config keys the browser no longer declares in its bundledproperties.json:navigator.product,navigator.appCodeName,navigator.appName,battery:charging/chargingTime/dischargingTime,screen.pageXOffset/pageYOffsetlaunchOptions():window.history.length,canvas:aaOffset,canvas:aaCapOffsetSame failure class as #307 (
audio:seed), which was fixed by guarding againstknownProperties— but the browserforge-derived config and the two hardcoded spots were left unguarded, so any newer browser that drops a mapped property breaks launch entirely.Reproduction (macOS arm64, Camoufox v156.0.1-beta.34):
Fix
Load the installed build's
properties.jsonbefore assembling the config (it was already loaded later for the seed guards — just moved earlier) and:fromBrowserforge()output against the schema before merging — forward-compatible with any future property removal, not just the v156 set.window.history.lengthbehindknownProperties, same pattern as the seeds.canvas:aaOffset/aaCapOffsetthe same way.Caller-supplied
configkeys are intentionally not filtered —validateConfig()still throws on user typos/mistakes (pinned by a new test), so the filter only ever touches keys the library generated itself.Tests
test/utils.test.ts > launchOptions dropped-property filtering(2 tests): a simulated newer browser whoseproperties.jsonlacks the v156-dropped keys — generated config omits them; an explicitly passed dropped key still throws.test/basics.test.ts: 12/15 failing → 11/15 passing (on master the browser cannot launch at all). The one remaining failure (locale option overrides Intl locale) is a separate v156 behavioral issue, untouched by this change.test/utils.test.ts: all new tests pass. The three pre-existingseedingtests pin against the installed browser's schema and fail on v156 with or without this change (v156 also droppedfonts:spacing_seed/audio:seed/canvas:seed) — flagging as a separate issue rather than expanding scope here.pnpm build(tsc) clean.