docs: wrapper-02, -03 and -07 say what the code does
This commit is contained in:
1 parent
4af52c8056
commit
c06b79cc99
3 files changed
+3
-3
No files matched your search
@@ -6,7 +6,7 @@
|
||||
- The client reads the browser payload with the key `initializer["firefox"]`. The schema changes only after the protocol is captured again with `scripts/capture_protocol.py`.
|
||||
- The range of clients the engine was tested with travels in the seal, as `playwright.min` and `playwright.max`, from `stealth_playwright_range.txt` in the series repo. `assert_playwright_range()` compares the version of the vendored client with that range. It never reads an installed Playwright. Outside the range it raises, unless `INVISIBLE_PLAYWRIGHT_SKEW=allow` is set, which only warns. The pinned client version is in `scripts/playwright_pin.txt`.
|
||||
- `__init__.py` runs the core pin check, then the range check, before any other import of the package. `_pin.py` records which core modules were already imported before it loads the core. The message of the import filter carries the remedy (a forced reinstall) and no version number: the version is resolved from the requirement the package declares.
|
||||
- The package drives Firefox only. Every browser type other than Firefox (`playwright[...]`) raises `ValueError`. The vendored client has no module for another browser engine and no object for another platform. The remote server answers every other browser type with a refusal that gives the reason.
|
||||
- The package drives Firefox only. Asking `playwright[...]` for any browser type other than Firefox raises `ValueError`, and the attributes of the other browser types raise `NotImplementedError`, in the sync and in the async client. The vendored client has no module for another browser engine and no object for another platform. The remote server answers every other browser type with a refusal that gives the reason.
|
||||
|
||||
**Enforced by.** `tests/test_fork.py::test_no_one_imports_the_installed_playwright` and `::test_the_vendored_client_is_the_one_imported` fail when code imports `playwright`, or the imported client is not the one inside the package. `::test_the_apache_licence_the_fork_still_owes_is_shipped` fails when the licence is not shipped. `tests/test_seal_playwright_range.py::test_client_above_the_range_is_refused`, `::test_client_below_the_range_is_refused` and `::test_skew_can_be_allowed_explicitly_and_still_warns` fail when the range check stops refusing outside the range or the skew switch stops warning. `::test_the_installed_client_satisfies_the_packaged_seal` fails when the vendored client is outside the range of the packaged seal. `tests/test_core_pin.py::test_the_prelude_is_the_first_thing_the_package_does` fails when another import runs before the pin check. `::test_that_refusal_carries_no_version_literal_and_no_git_install` and `::test_no_source_file_hardcodes_a_core_version_requirement` fail when a version number is written into a message or a source file. `tests/test_the_remote_server_serves_the_protocol.py` fails when the other browser types stop refusing with a reason.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# wrapper-03: every engine goes through the seal check, before and after the launch
|
||||
|
||||
**Rule.** No binary starts without being checked against the seal, and a running engine is checked again from outside the process.
|
||||
- Every engine of the wrapper is resolved by `_engine.resolve_executable()`. It is called by `launcher.py` (sync), `async_api.py` (async), `CommonLaunch` in `_session.py` and `_juggler/remote.py`.
|
||||
- Every launch of the wrapper resolves its engine with `_engine.resolve_executable()`. It is called by `launcher.py` (sync), `async_api.py` (async), `CommonLaunch` in `_session.py` and `_juggler/remote.py`. `invisible-playwright fetch` launches nothing: it calls `ensure_binary`, which verifies what it downloads.
|
||||
- Without `binary_path=` it calls `ensure_binary(seal=)`. With `binary_path=` it skips the download but still calls `verify_engine`. The caller then needs an `INVISIBLE_SEAL_FILE` made for that binary; without it the wrapper refuses.
|
||||
- After the launch `assert_wire_version(browser)` compares the version the engine reports over the protocol with the seal. It reads `browser.version`, cached from the initializer, so it costs no round trip. A different version raises `EngineMismatch` and names `python -m invisible_playwright fetch`. A missing or empty version is no evidence and is never read as a match.
|
||||
- The check runs on the `launch()` path and in the remote server. It does not run on the persistent context, which has no `Browser`.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
- The server writes `user.js` with `write_user_js` before it starts the browser, and launches with `-profile`. `Browser.enable` takes no pref. All prefs of the browser go through the profile.
|
||||
- The session keys that are not prefs (the typing seed and the keyboard layout) are taken out of the prefs before `write_user_js` (`op_launch` in `server.py`). Nothing of them is written to the profile.
|
||||
- `build_prefs` in `_session.py` composes the prefs of a session. The proxy does not go through it.
|
||||
- The `Browser.set*Override` commands run when the context is created, in `_apply_context_options`, before the first page, so the first page already sees them.
|
||||
- The `Browser.set*Override` commands run when the context is created, in `_apply_context_options`, before the first page, so the first page already sees them. The timezone is one of them: `timezoneId` goes out as `Browser.setTimezoneOverride` with the other entries of `ENGINE_OPTIONS` in `server.py`.
|
||||
- The persistent context has the same parameters as the default context, locale and timezone included. An empty timezone is left out.
|
||||
- `Browser.setDefaultViewport` carries `viewportSize` and `screenSize`. The screen comes from the `screen` option, which the wrapper takes from the profile with `context_geometry`. `deviceScaleFactor` is sent when present and `isMobile` when true.
|
||||
- `colorScheme`, `reducedMotion` and `forcedColors` of a context go to the engine with `Browser.setColorScheme`, `Browser.setReducedMotion` and `Browser.setForcedColors`. The value `no-override` is not sent, and the context keeps what the identity declares. `emulate_media` forwards only the fields that were asked for, `contrast` included.
|
||||
|
||||
Reference in new issue
Block a user