fxcss 0.26.0__tar.gz → 0.27.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. {fxcss-0.26.0 → fxcss-0.27.0}/PKG-INFO +84 -14
  2. {fxcss-0.26.0 → fxcss-0.27.0}/README.md +83 -13
  3. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/__init__.py +1 -1
  4. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/capture.py +20 -2
  5. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/check.py +5 -0
  6. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/checklist.py +68 -29
  7. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/cli.py +154 -44
  8. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/core.py +555 -131
  9. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/fetch.py +22 -5
  10. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/install.py +48 -15
  11. fxcss-0.27.0/fxcss/lint.py +82 -0
  12. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/tweaks.py +2 -7
  13. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss.egg-info/PKG-INFO +84 -14
  14. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss.egg-info/SOURCES.txt +4 -0
  15. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_capture_coverage.py +20 -0
  16. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_capture_state_checks.py +9 -1
  17. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_checks.py +32 -0
  18. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_data_safety.py +2 -2
  19. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_install_fidelity.py +8 -0
  20. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_maintenance_cli.py +270 -1
  21. fxcss-0.27.0/tests/test_pref_lint.py +73 -0
  22. fxcss-0.27.0/tests/test_private_window.py +428 -0
  23. fxcss-0.27.0/tests/test_sidebar_history.py +224 -0
  24. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_units.py +574 -0
  25. {fxcss-0.26.0 → fxcss-0.27.0}/LICENSE +0 -0
  26. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/__main__.py +0 -0
  27. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/adopt.py +0 -0
  28. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/audit.py +0 -0
  29. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/catalogue.py +0 -0
  30. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/compare.py +0 -0
  31. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/complete.py +0 -0
  32. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/inventory.py +0 -0
  33. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/layout.py +0 -0
  34. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/omni.py +0 -0
  35. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/probe.py +0 -0
  36. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/prompt.py +0 -0
  37. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/scaffold.py +0 -0
  38. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/sheets.py +0 -0
  39. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/style.py +0 -0
  40. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/support.py +0 -0
  41. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/templates/firefox-watch.yml +0 -0
  42. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/templates/pr-preview-cleanup.yml +0 -0
  43. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/templates/pr-preview-publish.yml +0 -0
  44. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/templates/pr-preview.yml +0 -0
  45. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/templates/readme-previews.yml +0 -0
  46. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/templates/showcase.yml +0 -0
  47. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/templates/starter/chrome/userChrome.css +0 -0
  48. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss/templates/starter/custom/accent-red.css +0 -0
  49. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss.egg-info/dependency_links.txt +0 -0
  50. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss.egg-info/entry_points.txt +0 -0
  51. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss.egg-info/requires.txt +0 -0
  52. {fxcss-0.26.0 → fxcss-0.27.0}/fxcss.egg-info/top_level.txt +0 -0
  53. {fxcss-0.26.0 → fxcss-0.27.0}/pyproject.toml +0 -0
  54. {fxcss-0.26.0 → fxcss-0.27.0}/setup.cfg +0 -0
  55. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_audit_sheets_regressions.py +0 -0
  56. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_capture_names.py +0 -0
  57. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_compare_resolution.py +0 -0
  58. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_connection_lifecycle.py +0 -0
  59. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_dialog_capture.py +0 -0
  60. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_discovery_tweaks_catalogue_regressions.py +0 -0
  61. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_flag_columns.py +0 -0
  62. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_inventory.py +0 -0
  63. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_layout.py +0 -0
  64. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_maintenance_preservation.py +0 -0
  65. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_patch_duplicates.py +0 -0
  66. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_profile_safety.py +0 -0
  67. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_prompt.py +0 -0
  68. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_release_orchestration.py +0 -0
  69. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_review_maintenance.py +0 -0
  70. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_sheet_groups.py +0 -0
  71. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_smoke_regressions.py +0 -0
  72. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_support.py +0 -0
  73. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_support_scaffold_regressions.py +0 -0
  74. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_terminal_style.py +0 -0
  75. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_threshold_and_variant_migration.py +0 -0
  76. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_welcome_context.py +0 -0
  77. {fxcss-0.26.0 → fxcss-0.27.0}/tests/test_workflows.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fxcss
3
- Version: 0.26.0
3
+ Version: 0.27.0
4
4
  Summary: Live-reload, inspect and screenshot-test Firefox userChrome.css themes
5
5
  Author: AdamXweb
6
6
  License: MIT
@@ -96,6 +96,7 @@ repository to `fxcss try`.
96
96
  ```bash
97
97
  fxcss try adamXweb/WhiteSurFirefoxThemeMacOS
98
98
  fxcss try github.com/owner/theme --with compact-tabs
99
+ fxcss try owner/theme --prefs user.js # also set a preference file it ships
99
100
  fxcss try owner/theme --info # report what's there, launch nothing
100
101
  fxcss try ~/src/my-theme # a theme folder on this computer
101
102
  ```
@@ -132,7 +133,7 @@ It reports what it found before doing anything:
132
133
  …
133
134
 
134
135
  Setup beyond the files 1 automatic · 3 to check
135
- ✓ automatic 3 prefs in configuration/user.js in fxcss's own block
136
+ ✓ automatic 3 prefs in configuration/user.js in the throwaway profile
136
137
  ! check Firefox's native vertical tabs
137
138
  a setting in Firefox's own sidebar options
138
139
  …
@@ -149,9 +150,15 @@ SHA. A browser URL for a branch or folder
149
150
  (`https://github.com/owner/theme/tree/photon-style/themes/one`) is read as
150
151
  meaning that branch and that folder, and the branch is then *tracked* rather
151
152
  than pinned. `--with name,name` layers on the theme's optional stylesheets so
152
- you can see a variant without hunting through install flags. `--shot dir`
153
- captures the standard screenshots instead of opening a window, and `--keep dir`
154
- leaves the download behind so you can start editing it with `watch`.
153
+ you can see a variant without hunting through install flags. `--prefs user.js`
154
+ loads the file's `user_pref(...)` declarations into the throwaway profile.
155
+ You can name a shipped preference file by its repository-relative path, even
156
+ when the checklist did not discover its name. Quote paths that contain spaces,
157
+ for example `--prefs "Dark Mode/user.js"`. Some themes switch their rules on
158
+ from these files. When a theme ships a user.js that you have left unset, `try`
159
+ says so once Firefox is up. `--shot dir` captures the standard screenshots
160
+ with the selected preferences and stylesheets. After a successful run,
161
+ `--keep dir` saves the download in a new directory for editing with `watch`.
155
162
 
156
163
  #### How the theme is found
157
164
 
@@ -181,7 +188,8 @@ files, read from the files it ships and its README — preference files outside
181
188
  `configuration/user.js` (with their pref names), `.uc.js` scripts that need a
182
189
  userChrome.js loader, extension settings to import, fonts, forks and platform
183
190
  effects. Each item is *required*, *optional* or *unknown*, with the evidence.
184
- Nothing on it is applied automatically; see `install --prefs` below.
191
+ Nothing on it is applied automatically: `try --prefs` sets a listed preference
192
+ file in the throwaway profile, and `install --prefs` (below) writes it to yours.
185
193
 
186
194
  #### Private repositories, other hosts and local folders
187
195
 
@@ -421,6 +429,9 @@ The install is what a theme's install script does, done carefully:
421
429
  plus the layout selected, the preference files applied and each optional
422
430
  sheet's path in the repository.
423
431
 
432
+ If Firefox skips a setting in a shipped preference file, [`fxcss lint`](#fxcss-lint)
433
+ can show you where a missing semicolon belongs.
434
+
424
435
  When several options have the same name, select their repository paths, for
425
436
  example `--with custom/tabs.css,optional/tabs.css`. Each retains its identity
426
437
  through upgrades. Options loaded after the base get separate dependency trees
@@ -812,6 +823,33 @@ That last section is the useful part: not just what the element is, but which of
812
823
  your files already style it, with line numbers. Keep clicking to pick more; Esc
813
824
  in the browser or Ctrl-C in the terminal stops.
814
825
 
826
+ ### fxcss lint
827
+
828
+ Run `fxcss lint` in a theme repository to find missing semicolons in its
829
+ Firefox preference files. You can also name a file directly, including one
830
+ with a custom name or a path containing spaces.
831
+
832
+ ```sh
833
+ fxcss lint
834
+ fxcss lint "Dark Mode/user.js"
835
+ ```
836
+
837
+ Each finding includes a local file link and a source preview. The caret
838
+ marks where to insert the semicolon, even if a comment follows the setting.
839
+
840
+ ```text
841
+ Dark Mode/user.js:7:30: missing semicolon after user_pref
842
+ file:///themes/Dark%20Mode/user.js
843
+ 7 | user_pref("theme.nord", true) // use Nord colors
844
+ | ^ add ; here
845
+ ```
846
+
847
+ Firefox can skip both an unterminated setting and the setting that follows
848
+ it. The lint command reads the files offline and leaves edits to you. It
849
+ exits with `0` for a clean scan, `1` for findings and `2` for a read error.
850
+ The checklist and lint both skip settings inside actual `/* … */`, `//`
851
+ and `#` comments. A `/*` inside a `#` comment is text on that line.
852
+
815
853
  ### fxcss inspect
816
854
 
817
855
  ```bash
@@ -1016,7 +1054,9 @@ mode — and three that a theme is most likely to have never been tested in:
1016
1054
 
1017
1055
  - **Sidebar — bookmarks and history.** Both panels, with their trees expanded,
1018
1056
  because a fresh profile shows them collapsed and a collapsed panel has almost
1019
- nothing in it to style.
1057
+ nothing in it to style. History is grouped by site rather than by day: a day
1058
+ heading prints the date, so the view would differ from its baseline on every
1059
+ later day.
1020
1060
  - **Vertical tabs.** Firefox 133+ does not restyle the tab strip here, it
1021
1061
  *moves* it: `#tabbrowser-tabs` leaves `#TabsToolbar` for `#vertical-tabs`, so
1022
1062
  every `#TabsToolbar > …` rule a theme owns silently stops matching while its
@@ -1060,11 +1100,16 @@ restyled tab strip, say — leaves it alone:
1060
1100
  Panels are separate OS windows that Marionette cannot see, so these four are
1061
1101
  taken with a screen capture of the panel's area. That briefly brings the
1062
1102
  capture Firefox to the front. The capture is first checked against Marionette's
1063
- own image of the window; when it cannot see Firefox (no screen-recording
1064
- permission on macOS, a Wayland session,
1065
- another window on top) the panel views are reported as unsupported with that
1066
- reason rather than captured wrong. A Firefox without the search engine button
1067
- skips its two views the same way.
1103
+ own image of the window. A check that shows something else, such as a window
1104
+ that came to the front at that moment, is made again with Firefox brought to
1105
+ the front first, three times in all. When the screen cannot be captured at all
1106
+ (no screen-recording permission on macOS, a Wayland session), or still does not
1107
+ show Firefox after the third check, the panel views are reported as unsupported
1108
+ with that reason rather than captured wrong. The command still succeeds, so
1109
+ look for `unsupported` in its output. The line printed just before the panel
1110
+ views says what the check found, and it is a `warning:` when the cause may only
1111
+ have been a window that stayed in front. A Firefox without the search engine
1112
+ button skips its two views the same way.
1068
1113
 
1069
1114
  These views run in a browser session of their own, so the pointer and hover
1070
1115
  locks they use never reach the window views. Its window is up to 1280×900 and
@@ -1073,6 +1118,16 @@ translucent edges and rounded corners show the browser, not your desktop.
1073
1118
  Anything the system draws on top during the capture is photographed too, so a
1074
1119
  notification that pops up over a panel appears in that view; rerun if one did.
1075
1120
 
1121
+ Firefox closes a panel when another application comes to the front, and a
1122
+ window that comes in front of Firefox hides one that stays open, so leave the
1123
+ machine alone while these views are taken. Each panel capture checks that the
1124
+ panel is still open and that the screen still shows Firefox's navigation bar.
1125
+ When either is not so the panel is opened again, three times in all. If that
1126
+ does not work the view is recorded as failed, the rest of the run carries on,
1127
+ and the command ends with one line naming the view and a non-zero exit status,
1128
+ so `fxcss check` cannot pass without it. Run the capture again. Something that
1129
+ covers a panel and leaves the navigation bar clear is not noticed.
1130
+
1076
1131
  ### fxcss compare
1077
1132
 
1078
1133
  ```bash
@@ -1670,7 +1725,7 @@ text.
1670
1725
  For a custom workflow, the core capture-and-compare steps are:
1671
1726
 
1672
1727
  ```yaml
1673
- - run: pip install "fxcss[images]==0.25.0"
1728
+ - run: pip install "fxcss[images]==0.26.0"
1674
1729
  - run: fxcss shot --theme base --out shots/base
1675
1730
  - run: fxcss shot --theme head --out shots/head
1676
1731
  - run: fxcss compare --base shots/base --head shots/head --out out/ --platform ${{ runner.os }}
@@ -1843,13 +1898,28 @@ the [releases page](https://github.com/AdamXweb/fxcss/releases) has the latest.
1843
1898
  CI runners' Pythons are not externally managed, so plain pip is fine there:
1844
1899
 
1845
1900
  ```bash
1846
- pip install "fxcss[images]==0.25.0"
1901
+ pip install "fxcss[images]==0.26.0"
1847
1902
  ```
1848
1903
 
1849
1904
  Pinned installs keep the `[images]` extra so the same line also brings in Pillow
1850
1905
  on older releases. Upgrade an existing pipx installation with
1851
1906
  `pipx upgrade fxcss`.
1852
1907
 
1908
+ ### Reviewing a baseline after upgrading to 0.27
1909
+
1910
+ Run `fxcss check` with your existing baseline, using the same operating system
1911
+ and Firefox build you used to create it. The first comparison can show an
1912
+ address bar without the automation stripes, a scrollbar that has finished
1913
+ fading, a History sidebar grouped by site, or a disabled Back button in a
1914
+ fresh private window. Selected stylesheets and preferences now also apply to
1915
+ screenshots taken in a separate Firefox session.
1916
+
1917
+ Review the changed images and `capture-coverage.json` before running
1918
+ `fxcss check --update-baseline`. In particular, check the light and dark panel
1919
+ views. On some wide-gamut displays, a strongly coloured toolbar can make the
1920
+ screen check report those views as `unsupported`, even when Firefox is in
1921
+ front. Keep your existing baseline if it contains panel views you still need.
1922
+
1853
1923
  ### Upgrading to 0.22
1854
1924
 
1855
1925
  The new `check` command requires baselines with a complete capture coverage
@@ -73,6 +73,7 @@ repository to `fxcss try`.
73
73
  ```bash
74
74
  fxcss try adamXweb/WhiteSurFirefoxThemeMacOS
75
75
  fxcss try github.com/owner/theme --with compact-tabs
76
+ fxcss try owner/theme --prefs user.js # also set a preference file it ships
76
77
  fxcss try owner/theme --info # report what's there, launch nothing
77
78
  fxcss try ~/src/my-theme # a theme folder on this computer
78
79
  ```
@@ -109,7 +110,7 @@ It reports what it found before doing anything:
109
110
  …
110
111
 
111
112
  Setup beyond the files 1 automatic · 3 to check
112
- ✓ automatic 3 prefs in configuration/user.js in fxcss's own block
113
+ ✓ automatic 3 prefs in configuration/user.js in the throwaway profile
113
114
  ! check Firefox's native vertical tabs
114
115
  a setting in Firefox's own sidebar options
115
116
  …
@@ -126,9 +127,15 @@ SHA. A browser URL for a branch or folder
126
127
  (`https://github.com/owner/theme/tree/photon-style/themes/one`) is read as
127
128
  meaning that branch and that folder, and the branch is then *tracked* rather
128
129
  than pinned. `--with name,name` layers on the theme's optional stylesheets so
129
- you can see a variant without hunting through install flags. `--shot dir`
130
- captures the standard screenshots instead of opening a window, and `--keep dir`
131
- leaves the download behind so you can start editing it with `watch`.
130
+ you can see a variant without hunting through install flags. `--prefs user.js`
131
+ loads the file's `user_pref(...)` declarations into the throwaway profile.
132
+ You can name a shipped preference file by its repository-relative path, even
133
+ when the checklist did not discover its name. Quote paths that contain spaces,
134
+ for example `--prefs "Dark Mode/user.js"`. Some themes switch their rules on
135
+ from these files. When a theme ships a user.js that you have left unset, `try`
136
+ says so once Firefox is up. `--shot dir` captures the standard screenshots
137
+ with the selected preferences and stylesheets. After a successful run,
138
+ `--keep dir` saves the download in a new directory for editing with `watch`.
132
139
 
133
140
  #### How the theme is found
134
141
 
@@ -158,7 +165,8 @@ files, read from the files it ships and its README — preference files outside
158
165
  `configuration/user.js` (with their pref names), `.uc.js` scripts that need a
159
166
  userChrome.js loader, extension settings to import, fonts, forks and platform
160
167
  effects. Each item is *required*, *optional* or *unknown*, with the evidence.
161
- Nothing on it is applied automatically; see `install --prefs` below.
168
+ Nothing on it is applied automatically: `try --prefs` sets a listed preference
169
+ file in the throwaway profile, and `install --prefs` (below) writes it to yours.
162
170
 
163
171
  #### Private repositories, other hosts and local folders
164
172
 
@@ -398,6 +406,9 @@ The install is what a theme's install script does, done carefully:
398
406
  plus the layout selected, the preference files applied and each optional
399
407
  sheet's path in the repository.
400
408
 
409
+ If Firefox skips a setting in a shipped preference file, [`fxcss lint`](#fxcss-lint)
410
+ can show you where a missing semicolon belongs.
411
+
401
412
  When several options have the same name, select their repository paths, for
402
413
  example `--with custom/tabs.css,optional/tabs.css`. Each retains its identity
403
414
  through upgrades. Options loaded after the base get separate dependency trees
@@ -789,6 +800,33 @@ That last section is the useful part: not just what the element is, but which of
789
800
  your files already style it, with line numbers. Keep clicking to pick more; Esc
790
801
  in the browser or Ctrl-C in the terminal stops.
791
802
 
803
+ ### fxcss lint
804
+
805
+ Run `fxcss lint` in a theme repository to find missing semicolons in its
806
+ Firefox preference files. You can also name a file directly, including one
807
+ with a custom name or a path containing spaces.
808
+
809
+ ```sh
810
+ fxcss lint
811
+ fxcss lint "Dark Mode/user.js"
812
+ ```
813
+
814
+ Each finding includes a local file link and a source preview. The caret
815
+ marks where to insert the semicolon, even if a comment follows the setting.
816
+
817
+ ```text
818
+ Dark Mode/user.js:7:30: missing semicolon after user_pref
819
+ file:///themes/Dark%20Mode/user.js
820
+ 7 | user_pref("theme.nord", true) // use Nord colors
821
+ | ^ add ; here
822
+ ```
823
+
824
+ Firefox can skip both an unterminated setting and the setting that follows
825
+ it. The lint command reads the files offline and leaves edits to you. It
826
+ exits with `0` for a clean scan, `1` for findings and `2` for a read error.
827
+ The checklist and lint both skip settings inside actual `/* … */`, `//`
828
+ and `#` comments. A `/*` inside a `#` comment is text on that line.
829
+
792
830
  ### fxcss inspect
793
831
 
794
832
  ```bash
@@ -993,7 +1031,9 @@ mode — and three that a theme is most likely to have never been tested in:
993
1031
 
994
1032
  - **Sidebar — bookmarks and history.** Both panels, with their trees expanded,
995
1033
  because a fresh profile shows them collapsed and a collapsed panel has almost
996
- nothing in it to style.
1034
+ nothing in it to style. History is grouped by site rather than by day: a day
1035
+ heading prints the date, so the view would differ from its baseline on every
1036
+ later day.
997
1037
  - **Vertical tabs.** Firefox 133+ does not restyle the tab strip here, it
998
1038
  *moves* it: `#tabbrowser-tabs` leaves `#TabsToolbar` for `#vertical-tabs`, so
999
1039
  every `#TabsToolbar > …` rule a theme owns silently stops matching while its
@@ -1037,11 +1077,16 @@ restyled tab strip, say — leaves it alone:
1037
1077
  Panels are separate OS windows that Marionette cannot see, so these four are
1038
1078
  taken with a screen capture of the panel's area. That briefly brings the
1039
1079
  capture Firefox to the front. The capture is first checked against Marionette's
1040
- own image of the window; when it cannot see Firefox (no screen-recording
1041
- permission on macOS, a Wayland session,
1042
- another window on top) the panel views are reported as unsupported with that
1043
- reason rather than captured wrong. A Firefox without the search engine button
1044
- skips its two views the same way.
1080
+ own image of the window. A check that shows something else, such as a window
1081
+ that came to the front at that moment, is made again with Firefox brought to
1082
+ the front first, three times in all. When the screen cannot be captured at all
1083
+ (no screen-recording permission on macOS, a Wayland session), or still does not
1084
+ show Firefox after the third check, the panel views are reported as unsupported
1085
+ with that reason rather than captured wrong. The command still succeeds, so
1086
+ look for `unsupported` in its output. The line printed just before the panel
1087
+ views says what the check found, and it is a `warning:` when the cause may only
1088
+ have been a window that stayed in front. A Firefox without the search engine
1089
+ button skips its two views the same way.
1045
1090
 
1046
1091
  These views run in a browser session of their own, so the pointer and hover
1047
1092
  locks they use never reach the window views. Its window is up to 1280×900 and
@@ -1050,6 +1095,16 @@ translucent edges and rounded corners show the browser, not your desktop.
1050
1095
  Anything the system draws on top during the capture is photographed too, so a
1051
1096
  notification that pops up over a panel appears in that view; rerun if one did.
1052
1097
 
1098
+ Firefox closes a panel when another application comes to the front, and a
1099
+ window that comes in front of Firefox hides one that stays open, so leave the
1100
+ machine alone while these views are taken. Each panel capture checks that the
1101
+ panel is still open and that the screen still shows Firefox's navigation bar.
1102
+ When either is not so the panel is opened again, three times in all. If that
1103
+ does not work the view is recorded as failed, the rest of the run carries on,
1104
+ and the command ends with one line naming the view and a non-zero exit status,
1105
+ so `fxcss check` cannot pass without it. Run the capture again. Something that
1106
+ covers a panel and leaves the navigation bar clear is not noticed.
1107
+
1053
1108
  ### fxcss compare
1054
1109
 
1055
1110
  ```bash
@@ -1647,7 +1702,7 @@ text.
1647
1702
  For a custom workflow, the core capture-and-compare steps are:
1648
1703
 
1649
1704
  ```yaml
1650
- - run: pip install "fxcss[images]==0.25.0"
1705
+ - run: pip install "fxcss[images]==0.26.0"
1651
1706
  - run: fxcss shot --theme base --out shots/base
1652
1707
  - run: fxcss shot --theme head --out shots/head
1653
1708
  - run: fxcss compare --base shots/base --head shots/head --out out/ --platform ${{ runner.os }}
@@ -1820,13 +1875,28 @@ the [releases page](https://github.com/AdamXweb/fxcss/releases) has the latest.
1820
1875
  CI runners' Pythons are not externally managed, so plain pip is fine there:
1821
1876
 
1822
1877
  ```bash
1823
- pip install "fxcss[images]==0.25.0"
1878
+ pip install "fxcss[images]==0.26.0"
1824
1879
  ```
1825
1880
 
1826
1881
  Pinned installs keep the `[images]` extra so the same line also brings in Pillow
1827
1882
  on older releases. Upgrade an existing pipx installation with
1828
1883
  `pipx upgrade fxcss`.
1829
1884
 
1885
+ ### Reviewing a baseline after upgrading to 0.27
1886
+
1887
+ Run `fxcss check` with your existing baseline, using the same operating system
1888
+ and Firefox build you used to create it. The first comparison can show an
1889
+ address bar without the automation stripes, a scrollbar that has finished
1890
+ fading, a History sidebar grouped by site, or a disabled Back button in a
1891
+ fresh private window. Selected stylesheets and preferences now also apply to
1892
+ screenshots taken in a separate Firefox session.
1893
+
1894
+ Review the changed images and `capture-coverage.json` before running
1895
+ `fxcss check --update-baseline`. In particular, check the light and dark panel
1896
+ views. On some wide-gamut displays, a strongly coloured toolbar can make the
1897
+ screen check report those views as `unsupported`, even when Firefox is in
1898
+ front. Keep your existing baseline if it contains panel views you still need.
1899
+
1830
1900
  ### Upgrading to 0.22
1831
1901
 
1832
1902
  The new `check` command requires baselines with a complete capture coverage
@@ -1,3 +1,3 @@
1
1
  """fxcss — a testing toolkit for Firefox userChrome.css themes."""
2
2
 
3
- __version__ = "0.26.0"
3
+ __version__ = "0.27.0"
@@ -27,9 +27,18 @@ CATEGORIES = ("Window", "Tabs", "Toolbars", "Address bar", "Find bar", "Sidebar"
27
27
  # a run may skip it, each an explicitly detected capability.
28
28
  View = namedtuple("View", "key title category schemes since unsupported")
29
29
 
30
- SCREEN_CAPTURE_REASONS = ("screen capture needs Pillow",
31
- "screen capture cannot see the Firefox window")
30
+ # The panel views are photographed from the screen. SCREEN_NOT_SEEN covers a
31
+ # capture that cannot be made at all (no screen-recording permission, a Wayland
32
+ # session) and one that still shows something other than Firefox after Firefox
33
+ # has been brought to the front several times.
34
+ NO_PILLOW = "screen capture needs Pillow"
35
+ SCREEN_NOT_SEEN = "screen capture cannot see the Firefox window"
36
+ SCREEN_CAPTURE_REASONS = (NO_PILLOW, SCREEN_NOT_SEEN)
32
37
  NO_SEARCH_BUTTON = "no search engine button on this Firefox"
38
+ # Why a panel view failed: its panel is photographed from the screen, and was
39
+ # closed or behind another window every time. Never an accepted reason to skip.
40
+ PANEL_LOST = ("the panel was closed or covered each time it was opened; Firefox "
41
+ "probably lost focus, so run the capture again without using the machine")
33
42
 
34
43
  VIEWS = (
35
44
  View("01-window", "Browser window", "Window", True, None, ()),
@@ -191,6 +200,15 @@ def select_views(names, patterns):
191
200
  return [n for n in names if any(fnmatch.fnmatchcase(n, p) for p in patterns)]
192
201
 
193
202
 
203
+ def failure_summary(failed):
204
+ """One line naming the views that failed, grouped by why."""
205
+ by_reason = {}
206
+ for name, reason in failed.items():
207
+ by_reason.setdefault(reason, []).append(name)
208
+ return "; ".join(f"could not capture {', '.join(sorted(names))}: {reason}"
209
+ for reason, names in by_reason.items())
210
+
211
+
194
212
  def write_coverage(directory, info, expected, unsupported=None, failed=None,
195
213
  interrupted=False):
196
214
  unsupported, failed = unsupported or {}, failed or {}
@@ -162,6 +162,11 @@ class CaptureProgress:
162
162
  name, _, reason = line.removeprefix(" unsupported ").partition(": ")
163
163
  print(f" view {self.count}/{self.total}: {name} unsupported ({reason})",
164
164
  file=self.terminal, flush=True)
165
+ elif line.startswith(" failed "):
166
+ self.count += 1
167
+ name, _, reason = line.removeprefix(" failed ").partition(": ")
168
+ print(f" view {self.count}/{self.total}: {name} failed ({reason})",
169
+ file=self.terminal, flush=True)
165
170
  elif line.startswith((" note:", " warning:")):
166
171
  print(line, file=self.terminal, flush=True)
167
172
  return written
@@ -17,16 +17,18 @@ three states, each with its evidence:
17
17
 
18
18
  Nothing here is applied. Preference files outside ``configuration/user.js``
19
19
  are listed with their pref names so a person can choose them with
20
- ``--prefs``; README prose and CSS ``-moz-pref`` toggles are only reported.
20
+ ``--prefs`` (on ``install``, or on ``try`` for the throwaway profile); README
21
+ prose and CSS ``-moz-pref`` toggles are only reported.
21
22
  That is deliberate: a crawler that applies every pref-like string it finds
22
23
  would set things nobody asked for, and a copy operation that calls itself
23
24
  "configured" would be a lie a person acts on.
24
25
  """
25
26
 
26
27
  import re
28
+ import shlex
27
29
  from pathlib import Path
28
30
 
29
- from .install import PREF_NAME_RE, _printable, _strip_js_comments
31
+ from .install import _printable, pref_names, safe_theme_path
30
32
  from .style import plural as _pl
31
33
 
32
34
  MAX_README_BYTES = 512 * 1024
@@ -94,11 +96,11 @@ README_PREF_RE = re.compile(
94
96
  CSS_PREF_RE = re.compile(r"""-moz-(?:bool-)?pref\(\s*["']([^"']+)["']""")
95
97
 
96
98
 
97
- def _read(path, limit):
99
+ def _read(path, limit, encoding="utf-8"):
98
100
  try:
99
101
  if path.stat().st_size > limit:
100
102
  return ""
101
- return path.read_text(encoding="utf-8", errors="replace")
103
+ return path.read_text(encoding=encoding, errors="replace")
102
104
  except OSError:
103
105
  return ""
104
106
 
@@ -109,13 +111,20 @@ def pref_names_in(path):
109
111
  The names come from a theme and are shown in a terminal, so anything
110
112
  unprintable in one is escaped rather than replayed.
111
113
  """
112
- code = _strip_js_comments(_read(path, MAX_PREF_FILE_BYTES))
113
- names = []
114
- for match in PREF_NAME_RE.finditer(code):
115
- name = _printable(match.group(2))
116
- if name not in names:
117
- names.append(name)
118
- return names
114
+ return pref_names(_read(path, MAX_PREF_FILE_BYTES, encoding="utf-8-sig"))
115
+
116
+
117
+ def prefs_option(relative):
118
+ """A copyable --prefs argument for a path shown in the terminal."""
119
+ path = _printable(relative)
120
+ # Ordinary spaced paths can use double quotes in POSIX shells,
121
+ # PowerShell and cmd.exe alike.
122
+ if " " in path and re.fullmatch(r"[\w .()/\-]+", path):
123
+ argument = f'"{path}"'
124
+ else:
125
+ argument = shlex.quote(path)
126
+ separator = "=" if path.startswith("-") else " "
127
+ return f"--prefs{separator}{argument}"
119
128
 
120
129
 
121
130
  def _walk(root, limit=20000):
@@ -132,7 +141,14 @@ def _walk(root, limit=20000):
132
141
  yield path, "/".join(parts)
133
142
 
134
143
 
135
- def pref_files(repo_root, theme_root=None):
144
+ def discovered_pref_paths(repo_root):
145
+ """Paths to preference files recognized by their name or directory."""
146
+ return {relative: path for path, relative in _walk(repo_root)
147
+ if (PREF_FILE_RE.search(relative) or PREF_DIRS_RE.search(relative))
148
+ and relative.lower().endswith((".js", ".js.example"))}
149
+
150
+
151
+ def pref_files(repo_root, theme_root=None, include=(), source_root=None):
136
152
  """Shipped preference files, each with its names and a state guess.
137
153
 
138
154
  ``configuration/user.js`` under the theme root is what fxcss applies and
@@ -142,18 +158,25 @@ def pref_files(repo_root, theme_root=None):
142
158
  """
143
159
  repo_root = Path(repo_root)
144
160
  theme_root = Path(theme_root) if theme_root else repo_root
145
- applied = (theme_root / "configuration" / "user.js")
161
+ auto_pref = Path("configuration") / "user.js"
162
+ applied = None
163
+ if (theme_root / auto_pref).is_file():
164
+ applied = ((source_root or theme_root) / auto_pref).resolve()
146
165
  found = []
147
- for path, relative in _walk(repo_root):
148
- lowered = relative.lower()
149
- if not (PREF_FILE_RE.search(relative) or PREF_DIRS_RE.search(relative)):
150
- continue
151
- if path.suffix.lower() not in (".js", ".example") and not lowered.endswith(".js.example"):
166
+ candidates = discovered_pref_paths(repo_root)
167
+ # A filename convention helps discovery. A person who names the file
168
+ # explicitly can select any shipped profile preference file.
169
+ for relative in include:
170
+ path = safe_theme_path(repo_root, relative)
171
+ if path is not None and path.is_file() and not path.is_symlink():
172
+ candidates[relative] = path
173
+ for relative, path in sorted(candidates.items()):
174
+ if path.suffix.lower() != ".js" and not relative.lower().endswith(".js.example"):
152
175
  continue
153
176
  names = pref_names_in(path)
154
177
  if not names:
155
178
  continue
156
- if applied.is_file() and path.resolve() == applied.resolve():
179
+ if path.resolve() == applied:
157
180
  state = "applied"
158
181
  elif REQUIRED_WORD_RE.search(relative):
159
182
  state = "required"
@@ -178,11 +201,15 @@ def _sentences(text):
178
201
  return re.split(r"(?<=[.!?\n])\s+", text)
179
202
 
180
203
 
181
- def build(repo_root, theme_root=None, plan=None, applied_pref_files=()):
204
+ def build(repo_root, theme_root=None, plan=None, applied_pref_files=(),
205
+ throwaway=False):
182
206
  """The checklist: [{item, state, evidence, note}], required first.
183
207
 
184
208
  `applied_pref_files` are repository-relative preference files the
185
- person chose with --prefs; those are reported as applied.
209
+ person chose with --prefs; those are reported as applied. `throwaway`
210
+ words the preference rows for a test drive, where prefs go into a
211
+ profile that is deleted afterwards rather than into a block of the
212
+ person's own user.js.
186
213
  """
187
214
  repo_root = Path(repo_root)
188
215
  theme_root = Path(theme_root) if theme_root else repo_root
@@ -191,7 +218,11 @@ def build(repo_root, theme_root=None, plan=None, applied_pref_files=()):
191
218
 
192
219
  readme = readme_text(repo_root)
193
220
  sentences = _sentences(readme) if readme else []
194
- for entry in pref_files(repo_root, theme_root):
221
+ # Materialized layouts copy configuration/ from the selected edition.
222
+ # Compare repository paths so that the source and its copy count once.
223
+ edition = (plan or {}).get("selected")
224
+ source_root = repo_root / (edition.get("subpath") or "") if edition else theme_root
225
+ for entry in pref_files(repo_root, theme_root, include=applied, source_root=source_root):
195
226
  state = entry["state"]
196
227
  if entry["path"] in applied or state == "applied":
197
228
  state = "applied"
@@ -206,16 +237,24 @@ def build(repo_root, theme_root=None, plan=None, applied_pref_files=()):
206
237
  state = "optional"
207
238
  # What fxcss is about to write into user.js is named in full: five
208
239
  # names and an ellipsis would let the sixth change a profile unseen.
209
- shown = entry["names"] if state == "applied" else entry["names"][:5]
240
+ # A throwaway profile has nothing to protect, so its list stays short.
241
+ in_full = state == "applied" and not throwaway
242
+ shown = entry["names"] if in_full else entry["names"][:5]
210
243
  preview = ", ".join(shown) + (" …" if len(shown) < entry["count"] else "")
211
244
  items.append({
212
245
  "item": f"preferences in {_printable(entry['path'])} ({_pl(entry['count'], 'pref')}: {preview})",
213
246
  "state": state,
214
247
  "evidence": entry["path"],
215
- "note": ("fxcss writes these into its own block of user.js" if state == "applied" else
216
- f"not applied; `--prefs {_printable(entry['path'])}` adds them to the managed block"),
248
+ "note": (("set in the throwaway profile" if throwaway else
249
+ "fxcss writes these into its own block of user.js")
250
+ if state == "applied" else
251
+ f"not applied; `{prefs_option(entry['path'])}` "
252
+ + ("sets them in the throwaway profile" if throwaway else
253
+ "adds them to the managed block")),
217
254
  "pref_file": entry["path"],
218
255
  "names": entry["names"],
256
+ "where": "in the throwaway profile" if throwaway else "in fxcss's own block",
257
+ "in_full": in_full,
219
258
  })
220
259
 
221
260
  loaders, ext_configs, fonts = [], [], []
@@ -330,15 +369,15 @@ def render(items, indent=" "):
330
369
  note = item.get("note")
331
370
  if names and item["state"] == "applied":
332
371
  # Said once, beside the row, rather than as a line of its own.
333
- text += " " + style.muted("in fxcss's own block")
372
+ text += " " + style.muted(item.get("where") or "in fxcss's own block")
334
373
  note = None
335
374
  wrapped = style.wrap(text, indent=text_indent) if style._visible(text) == text else [text]
336
375
  lines.append(head + wrapped[0].lstrip())
337
376
  lines.extend(wrapped[1:])
338
377
  if names:
339
- # Every pref fxcss will write is named; files it only reports
340
- # are summarised.
341
- listed = names if item["state"] == "applied" else names[:5]
378
+ # Every pref fxcss will write into a person's profile is named;
379
+ # files it only reports, or sets for a test drive, are summarised.
380
+ listed = names if item.get("in_full", item["state"] == "applied") else names[:5]
342
381
  shown = f" {style.DOT} ".join(listed)
343
382
  if len(names) > len(listed):
344
383
  shown += f" {style.DOT} {style.ELLIPSIS} and {len(names) - len(listed)} more"