Windows: add run_tests.ps1 + fix SxS mozglue launch failure on clean systems - #624
Windows: add run_tests.ps1 + fix SxS mozglue launch failure on clean systems#624koopatroopa787 wants to merge 3 commits into
Conversation
|
thx u very much <3 |
Progress update — Windows testing runPushed the initial implementation and ran it through all three What's been added / fixed
Scenario results
Blocker: Windows binary won't launch on clean installsThe binary fails before execution with: Event log confirms: Root cause: This is different from the headless crash in #614 — that issue hits systems where the binary does launch (because What Firefox's installer does: it places <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="mozglue" type="win32"/>
<file name="mozglue.dll"/>
</assembly>Suggested packaging fix — add package-windows:
python3 scripts/package.py windows \
--includes \
settings/chrome.css \
settings/camoucfg.jvv \
settings/properties.json \
~/.mozbuild/vs/VC/Redist/MSVC/14.38.33135/$(vcredist_arch)/Microsoft.VC143.CRT/*.dll \
$(cf_source_dir)/obj-$(moz_target)/dist/bin/mozglue.manifestWe did test placing the manifest manually — the binary still failed on this specific system (Windows 11 24H2, build 26200), which may be due to stricter SxS resolution in that build or a Windows activation context cache. Happy to retest once a new Windows binary is available. References |
…ster - Add service-tester/run_tests.ps1: PowerShell equivalent of run_tests.sh, mirrors all three binary modes (local | fetched | both), auto-detects Windows build at obj-*-windows-msvc/dist/bin/camoufox.exe, handles Windows venv paths (.venv\Scripts\python.exe), and sets UTF-8 console encoding so Unicode box-drawing characters render correctly - Fix service-tester/_bundle.py: use esbuild.cmd on Windows instead of the Unix shell script esbuild (WinError 193 otherwise) - Fix service-tester/run_tests.py: reconfigure stdout/stderr to UTF-8 on win32 to prevent UnicodeEncodeError from box-drawing characters in console output (CP1252 default does not support U+2500) Tested on Windows 11 (build 26200) — all three -Binary scenarios (local/fetched/both) behave correctly at the script level. Browser launch is currently blocked by a missing mozglue.manifest in the Windows zip package (SxS resolution fails on clean installs); documented in PR.
10550e6 to
2dc1abc
Compare
|
pls fix for us Window Community waiting for this. never give up Bro!!! |
…launch failure
camoufox.exe embeds a manifest (resource ID 1) that declares mozglue as a
Win32 side-by-side (SxS) assembly dependency. The Firefox installer registers
mozglue in the global WinSxS store; the portable zip does not. On a clean
Windows machine (no prior Firefox or Visual Studio install) this causes every
camoufox.exe launch to fail immediately with:
The application has failed to start because its side-by-side configuration
is incorrect.
Root cause (confirmed via PE resource inspection and SxS activation-context
tracing):
- camoufox.exe resource ID 1 contains a manifest that lists mozglue as a
dependent assembly with processorArchitecture="x86" (or "amd64").
- Windows SxS searches for the private assembly in this order:
1. <appdir>\mozglue\mozglue.manifest (subdirectory form)
2. <appdir>\mozglue.manifest (flat-file form)
- Neither file exists in the extracted zip, so the search fails and the
process terminates before any user code runs.
Fix: after extracting the zip in install_versioned(), write a minimal
mozglue.manifest next to camoufox.exe. The manifest content is identical
to the one shipped in Firefox source (mozglue/build/mozglue.dll.manifest).
This satisfies the SxS private-assembly lookup without touching the system
WinSxS store.
Important: only the flat-file form (mozglue.manifest directly in the install
dir) must be used. If a mozglue\ *subdirectory* is also present Windows
finds it first, fails because the DLL is absent from it, and does NOT fall
back to the flat file -- causing the same error.
|
@icepaq how it work bro we will wating for this |
|
@daijro this window 🙏🙏🙏🙏🙏🙏 |
|
@daijro @icepaq |
@KittisakPh Hi, I'd be happy to merge this in once a fix for the current crashing/limitations is implemented and tests are passing. Atm I'm not active in the development of this project, and I don't use Windows enough to help out |
|
Okay, thank you for the explanation. Thank you. I have a little more hope now. Thinking of you, my god |
|
Adding a data point on the SxS part, since I ran into this independently and the external-manifest route didn't work here. Environment: Windows 11 Pro 10.0.26200, camoufox 135.0.1-beta.24, python lib, clean system (no prior Firefox / VS install). The external Comparing what the exe asks for against what the DLL offers, two things appear to be at play:
That would explain why this passes on your box but users keep reporting the launch failure is still there. What worked here: patching the embedded manifest inside Stable here for a couple of days of real use — stealth checks pass ( To be clear on scope: the proper upstream fix is the manifest at build time ( Happy to push it as a commit here if useful: ~20 lines, idempotent, and it slots in at the same point in Diagnosis and patch worked out with Claude Opus 4.8. |
Closes #622.
What this PR does
Two separate problems blocked Camoufox from working on Windows. Both are fixed here.
1.
run_tests.ps1— PowerShell equivalent ofrun_tests.shservice-tester/run_tests.shis a Bash script and cannot run on Windows.This PR adds
service-tester/run_tests.ps1, a full PowerShell port that:-BrowserVersion,-ProfileCount,-Proxies,-Headful,-NoCert,-SaveCert,-Binarylocal | fetched | both(default:both)../camoufox-*/obj-*-windows-msvc/dist/bin/camoufox.exe.venvPython virtual environment insideservice-tester/pythonlib/and installs it into the venv[Console]::OutputEncoding = UTF8and$env:PYTHONIOENCODING=utf-8so Unicode output renders correctly[IO.Path]::Combine()throughout for PowerShell 5.x / Windows PowerShell compatibilityUsage:
2. SxS
mozgluelaunch failure — investigation and fixSymptom:
camoufox.exeexits immediately with:Root cause (confirmed via PE resource inspection and SxS tracing):
camoufox.exeembeds a manifest (PE resource ID 1) declaringmozglueas a Win32 SxS dependency. When nomozglueentry exists in the globalC:\Windows\WinSxSstore (i.e. no prior Firefox install) and no privatemozglue.manifestfile sits alongside the exe, the Windows SxS loader fails.Discovery during testing — AppContainer capability SID interaction:
Thorough end-to-end testing uncovered a second, deeper failure mode specific to Windows machines with Microsoft Edge (or Chrome) installed. Edge adds an AppContainer Capability SID (
S-1-15-3-*) toAppData\Localwith(OI)(CI)inheritance flags, which propagates to every file extracted underAppData\Local(the default camoufox install location).When the entire ancestor directory chain contains this SID, Windows switches the SxS loader into strict mode: any failed SxS dependency lookup becomes a hard fatal error, and the
mozglue.manifestprivate-assembly file is not consulted.Testing matrix (this machine — Edge installed):
C:\cf_testDocuments\cf_testAppData\Local\Temp\cf_testAppData\Local\cf_testAppData\Roaming\cf_testAdding
mozglue.manifestfixes the failure on machines WITHOUT the SID issue (i.e. no Edge/Chrome installed, or Windows versions that don't propagate the SID). On machines WITH Edge installed, the manifest alone is insufficient — the underlying cause is the install path sitting within the capability-SID-propagatingAppData\Localsubtree.This PR's fix (partial):
install_versioned()now writesmozglue.manifestalongsidecamoufox.exeafter extraction on Windows. This resolves the issue on machines without the AppContainer SID propagation (clean Windows, no prior Edge run, or machines whereAppData\Localdoes not carry the SID).Known limitation: On machines where Edge has added its capability SID to
AppData\Local(most Windows 10/11 installations where Edge has been opened at least once), the proper fix requires either:AppData\Local/AppData\Roaming(e.g.~/.camoufoxor a user-chosen path)mozglueSxS dependency from the binary at build timeBoth of these are out of scope for this PR and should be tracked separately.
3. Additional Windows fixes in
service-tester/_bundle.pyesbuild.cmdon Windows instead ofesbuild(the Unix shell script) — preventsWinError 193 [not a valid Win32 application]run_tests.pysys.stdout.reconfigure(encoding="utf-8", errors="replace")on Windows — preventsUnicodeEncodeErroron box-drawing characters (U+2500─) used in progress outputKnown limitation (not in scope)
Running in headless mode on the current Windows binary triggers a
STATUS_BREAKPOINT(0x80000003) crash — a debugger breakpoint left in the build. This is tracked separately in #614 and requires an upstream binary fix. Therun_tests.ps1script works correctly in headful mode (-Headful) with the current binary.