Skip to content

fix: release served markup a revision removes, which four retainers kept alive - #5660

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-5641-served-markup
Nov 7, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-5641-served-markup

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

After a revision removes the markup a page was served with, four references kept it in memory for the rest of the session. Each now lets go, and the three test_a_revision_releases_the_served_markup_it_removes cases, which fail on main ec2799b1d, pass. Nothing a user sees changes.

I found each one by taking a heap snapshot after the test's forced GC and following the retainer path to #served-link. Fixing one exposed the next.

  • The box at rest, Show where c goes before the press, and stop it following focus out of sight #5428. Show where c goes before the press, and stop it following focus out of sight #5428 stands the comment box beside a focused control, so its placement now watches that control. Two holds in the placement were already there, and they kept the control after the watch stopped:
    • floating-response.js cached its observation modes the first time watchFabPosition(target, …) ran. Those closures were built inside that call, so they kept its target alive. A helper now builds them outside that scope, which is how arrivals.js already builds its owner watch.
    • stop() in floating.js didn't reset stand, which was still the last anchored writer, and that writer closes over its anchor element. stop() now resets stand to placedAt.
  • The "Nothing waiting on me" notice, Say so when a page walk has nothing to step through, and when On me empties #5597. In the test, the revision empties On me. A background notice then waits behind the user's focus. Its format closure was built inside receiveState, whose scope also holds the activation and the outgoing authored document. newsFormat now builds it outside that scope. It reads the same presentedNews object as before.
  • Previews. preview.js kept the last preview's source (anchored) and its placement (placed) after the preview hid. anchored is now a WeakRef, because the Firefox re-show workaround compares against it after a hide. hide() sets placed to null, since it's only read while a preview stands for the same target.

Bisect evidence: at b0aaf9038 the test passes with restFab removed from the repaint and fails with it, and the two placement fixes alone make it pass there. With restFab disabled, git bisect run over b0aaf9038..ec2799b1d lands on #5597 (7d6565b14).

This settles the served-markup group of #5641. The other groups there (the bar visible where tests expect it hidden, the resting box moving without input, clicks the resting box intercepts, and the other consumers) are untouched.

Checks run
  • tests/browser/projection/test_revision_patches.py::test_a_revision_releases_the_served_markup_it_removes (all three cases, --run-main): fail on main, pass on this branch. At b0aaf9038, the two placement fixes alone make them pass.
  • Preview tests about standing, placement, side, growth, links into the page, put-away, resize and new aims (controls/test_previews.py -k …), test_a_press_on_the_box_at_rest_opens_it_beside_its_target, test_a_walk_with_nothing_to_step_through_says_so: 48 passed.
  • Commenting, On me and semantic-news selections: pass.
  • pnpm run test:runtime (896 pass), pnpm run check, and pre-commit run --files on the four files: pass.

Refs #5641 — automated triage

…ept alive

Since #5428 stood the comment box at rest beside a focused control, the
box's placement watches that control, and two latent holds in the
placement kept it after the watch stopped:

- `floating-response.js` built its cached observation modes inside
  `watchFabPosition(target, ...)`, so their closures kept the first
  target alive for the session. They are now built in a helper outside
  that scope, as `arrivals.js` already does for its owner watch.
- `floatingPlacement`'s `stop()` left `stand` as the last anchored
  writer, which closes over the element it anchored to. Stopping now
  resets it to the unanchored writer.

Two more holds came later and fail the same test on main once those are
fixed:

- #5597 made a revision that empties On me show a "Nothing waiting on
  me" notice. Its `format` closure was made inside `receiveState`, whose
  scope holds the activation and so the document the revision replaced,
  for as long as the notice waits. It is now made outside that scope.
- `preview.js` kept the last preview's source and placement after the
  preview hid. The source is now a WeakRef (Firefox's re-show still
  compares against it), and `hide()` drops the placement, which is only
  read while the preview stands for the same target.

No behavior a user sees changes. The three
`test_a_revision_releases_the_served_markup_it_removes` cases fail on
main before this and pass after it.

Refs #5641
@leaf-agent
leaf-agent merged commit f521783 into main Nov 7, 2026
6 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-5641-served-markup branch November 7, 2026 12:22
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