mirror of
https://github.com/daijro/camoufox.git
synced 2026-09-09 08:01:15 +00:00
`forceScopeAccess` was declared in settings/properties.json and settings/camoucfg.jvv, validated on the way in, and then read by nothing -- grep found no consumer anywhere in additions/juggler/. So `element.shadowRootUnl`, which patches/shadow-root-bypass.patch adds to Element.webidl gated on Func="Document::IsCallerChromeOrAddon", was `undefined` from page.evaluate() no matter what the flag was set to. Reproduced on 152.0.4-beta.28. The gate tests the caller, not the world the property is defined in. So export a getter whose body stays in FrameTree.js's system-principal scope and install it on the page's own Element.prototype. The default execution context is left alone: page.evaluate() still runs against the real page window. Deliberately NOT taking PR #685's shape. It unlocks the same binding by swapping the default main world for a Cu.Sandbox over the page window, and with Xray vision that hides page expandos -- its own tests assert `page.evaluate('window.pageSecret') is None` and `element.pageMarker is None`. Enabling a shadow-DOM flag should not silently stop page.evaluate() from seeing page state; that is a much worse failure than the two caveats below, and it is undocumented in the PR. The trade-offs of keeping evaluation in the main world, both documented at the call site: the property is visible to the page while the flag is on (so it can be fingerprinted -- hence opt-in and off by default), and a page that defines its own `shadowRootUnl` on an element shadows the accessor. A page can only do either if it already knows the property exists. Credit to @Cloudymap1e (#685) for the Cu.exportFunction technique this reuses. Adds tests/patches/force-scope-access.py, which pins both halves: the binding works with the flag on, is absent with it off, and main-world evaluation sees page globals, page expandos and element handles identically in both modes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Camoufox Tests
Ensures that Playwright functionality is not broken.
This directory is based on the original Playwright-Python tests.
It has been modified to skip tests that use the following features:
- Injecting JavaScript into the page or writing to DOM. Camoufox's
page.evaluateonly supports reading values, not executing within the page context. - Overriding the User-Agent.
- Any tests specific to Chromium or Webkit.
Usage
Setting up the environment
Cd to this directory and run the following command to setup the venv and install the dependencies:
bash setup-venv.sh
Running the tests
Run via the shell script:
bash run-tests.sh --headful --executable-path /path/to/camoufox-bin
Or through the Makefile:
make tests headful=true