Skip to content

gh-16315: Preserve existing Boost CSS when opening the editor - #16318

Merged
mr-cheffy merged 1 commit into
zen-browser:devfrom
jasseeeem:fix/boost-css-editor
Nov 3, 2026
Merged

mr-cheffy merged 1 commit into
zen-browser:devfrom
jasseeeem:fix/boost-css-editor

Conversation

@jasseeeem

@jasseeeem jasseeeem commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

A Boost with missing color-picker coordinates opens the Code editor empty because updateAllVisuals() throws before loading the stored CSS. Editing that empty buffer then replaces the existing CSS on disk.

Load the saved CSS while the editor is read-only, before connecting its change handler. Fill missing Boost settings and partial color-picker coordinates from defaults, update the CSS before the other visual controls, and avoid replacing an unchanged editor buffer.

Fixes #16315.

Before and after

boost-css-editor-before-after.mp4

Both recordings use the same synthetic Boost with secondaryDotPos removed. They show opening Code, typing a new rule, then closing and reopening. The before case loses the original CSS on disk; the after case preserves both the original and new CSS. Captures include only the temporary profile's Boost editor.

Validation

  • Added browser_boosts_code_editor.js to the Boost browser-test manifest. It covers complete, missing, null, partial and minimal records; edit/save/reopen; import/reset; and opening an untouched Boost.
  • All 35 assertions passed locally through a Marionette adapter on macOS using Zen 1.24b / Firefox 159.0, with the branch's editor module loaded into a temporary browser profile. The adapter also checks the saved CSS files.
  • The same tests against unpatched dev detect the blank editor, lost original CSS and incomplete-import failure.
  • Mozilla ESLint rules, Prettier and git diff --check pass.
  • The full mach test harness was not run because this checkout has no initialized Zen engine.

Reproduction scope

The failure is reproduced with synthetic Boost records missing dotPos or secondaryDotPos. The reporter's exported Boost and console output are not available, so their exact input has not been confirmed.

@jasseeeem
jasseeeem marked this pull request as ready for review November 1, 2026 18:54
@jasseeeem
jasseeeem requested a review from mr-cheffy as a code owner November 1, 2026 18:54

@mr-cheffy mr-cheffy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@mr-cheffy
mr-cheffy merged commit 59561e3 into zen-browser:dev Nov 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Boost CSS editor appears empty despite existing code, overwrites code on save

2 participants