Repository navigation
fix: release served markup a revision removes, which four retainers kept alive - #5660
Merged
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_removescases, which fail on mainec2799b1d, 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.floating-response.jscached its observation modes the first timewatchFabPosition(target, …)ran. Those closures were built inside that call, so they kept itstargetalive. A helper now builds them outside that scope, which is howarrivals.jsalready builds its owner watch.stop()infloating.jsdidn't resetstand, which was still the last anchored writer, and that writer closes over its anchor element.stop()now resetsstandtoplacedAt.formatclosure was built insidereceiveState, whose scope also holds the activation and the outgoing authored document.newsFormatnow builds it outside that scope. It reads the samepresentedNewsobject as before.preview.jskept the last preview's source (anchored) and its placement (placed) after the preview hid.anchoredis now aWeakRef, because the Firefox re-show workaround compares against it after a hide.hide()setsplacedto null, since it's only read while a preview stands for the same target.Bisect evidence: at
b0aaf9038the test passes withrestFabremoved from the repaint and fails with it, and the two placement fixes alone make it pass there. WithrestFabdisabled,git bisect runoverb0aaf9038..ec2799b1dlands 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. Atb0aaf9038, the two placement fixes alone make them pass.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.pnpm run test:runtime(896 pass),pnpm run check, andpre-commit run --fileson the four files: pass.Refs #5641 — automated triage