Skip to content

WIP upload as JSLB - #6193

Draft
mstange wants to merge 9 commits into
firefox-devtools:mainfrom
mstange:push-rusqtwztrtmr
Draft

WIP upload as JSLB#6193
mstange wants to merge 9 commits into
firefox-devtools:mainfrom
mstange:push-rusqtwztrtmr

Conversation

@mstange

@mstange mstange commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Main | Deploy preview

This is currently blocked until we deploy firefox-devtools/profiler-server#696 on the server side.

I'm also considering waiting a bit more before landing this because the perf difference from encoding to jslb will be more pronounced once we've converted more columns to typed arrays.

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 68.03279% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.78%. Comparing base (9203f11) to head (0d4b417).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/components/app/MenuButtons/Publish.tsx 53.94% 35 Missing ⚠️
src/actions/publish.ts 78.94% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6193      +/-   ##
==========================================
- Coverage   83.79%   83.78%   -0.01%     
==========================================
  Files         350      350              
  Lines       37583    37664      +81     
  Branches    10459    10573     +114     
==========================================
+ Hits        31492    31557      +65     
- Misses       5664     5680      +16     
  Partials      427      427              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mstange
mstange force-pushed the push-rusqtwztrtmr branch from 1f8e1b6 to 17c1382 Compare July 16, 2026 14:46
The Download and Share panels have independent sharing options, so they
sanitize to different profiles. sanitizePII always allocates a new Profile
(even its no-op early return does {...profile, shared}), so the two modes
never produce an identical object.

The encoding state was a single slot keyed on that identity, which meant:

 - Each panel open missed both reuse checks and clobbered the other mode's
   entry, so an untouched profile was re-serialized and re-gzipped on every
   single open, forever. Alternating opens never settled.
 - The panel rendered whatever blob was in the shared slot, with no check
   that it had been encoded for its own mode's options. Opting into URLs in
   Share and then opening Download left a DONE blob containing those URLs
   sitting in the slot. What kept that from being offered was only that
   componentDidMount dispatches ENCODING synchronously before paint -- an
   accidental invariant, not a designed one.

Give each mode its own slot and thread the mode through the three encoding
actions. mapStateToProps now selects by ownProps.mode, so a panel is
structurally incapable of seeing the other mode's blob, and each mode's
encoding survives reopening.
… JSON.

Serialize the sanitized profile with serializeProfileToJsonSlabsFile
(preceded by optimizeProfileForStorage to convert eligible columns to
typed arrays). Downloads from the panel now offer a .jslb.gz file.

Fetches from the profile store already handle JSLB via
unserializeProfileOfArbitraryFormat, and the storage endpoint treats
the payload as opaque bytes, so no server-side change is needed.
…ion.

The main download button downloads the profile as JSLB (as before). A new
dropdown arrow next to it opens a menu with 'Download as JSON'.

The JSON encoding is kicked off lazily when the dropdown is first opened,
and re-encoded when the user toggles sharing options after that. The
upload path continues to use JSLB exclusively.

The encoding state in Redux is now keyed by format (jslb, json), and the
selector/action APIs take a PublishProfileFormat argument.
…ats.

Switch the split download button's dropdown from ButtonWithPanel/ArrowPanel
to a react-contextmenu menu (the same style used next to the marker
chart's search field). The toggle is a plain photon button with a
CSS-drawn caret; showMenu opens the menu at the button's bottom-right.
showMenu positions the menu's top-left at the given coords. Subtracting
a fixed menu width from the toggle button's right edge right-anchors the
menu so its top-right lines up with the button's bottom-right, and it
grows leftwards into the panel instead of off toward the right edge.
encodeSanitizedProfile's promise body runs its serializer synchronously
up to the first await, so kicking it off from the menu's onShow blocked
the menu's first paint on large profiles. setTimeout(0) yields to the
browser so the menu appears immediately.
@mstange
mstange force-pushed the push-rusqtwztrtmr branch from 17c1382 to 0d4b417 Compare August 19, 2026 21:37
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.

1 participant