The tray panel is hidden nearly all the time, yet renderPanel put up a
new head, stage and row list for every trace update (about 200 a minute
under 1 request a second), whichever tab was picked. A hidden page draws
no frames, so the infinite CSS animations on what each draw replaced
(.rt-livedot in the head, .pr-req.wait .pr-to > i on a waiting row,
.ps-dst.wait > i on the stage) were never dropped from the document's
timeline, and each held its detached tab, rows and all.
On the Windows box (WebView2, where a hidden panel reports
visibilityState "hidden"), magpie-gm sandbox, base build 9fd80b212,
main window on Routing, panel hidden on its Agents tab, a fake vendor
at 1 request a second:
- panel page after GC: 265,012 DOM nodes and 13,731 listeners after 11
minutes of traffic (1,071 elements at start); Runtime.queryObjects:
68,015 of 69,591 elements detached, 760 div.pr-list roots (58,733
elements) and 1,110 div.pr-head (8,874); the heap snapshot's retainer
path Window > HTMLDocument > DocumentTimeline > CSSAnimation > <i> >
span.pr-to > span.pr-line > button.pr-req.wait > div.pr-list
(detached), 6,505 ElementAnimations
- WebView2 renderers' private bytes 131 MB at minute 6, 443 MB at 17,
555 MB at 25 (about 20 MB a minute); the reporter's 5.2 GB after 28 h
is this rate.
Now renderPanel, while document.hidden, draws again only when the tab's
shape changes (rows shown, the off message, loaded, the group picks,
today's totals there or not), as the panel's height is fitted to every
tab measured; otherwise it marks the tab stale and draws it in full on
visibilitychange. pDraw waits the same way, and no request's dot flies
in a hidden panel. A panel shown draws exactly as before.
After, the same soak with this build (magpie-fix.exe), main window
also on Routing:
- panel page after GC at minutes 17, 47 and 60: 4,698, 4,654 and 4,654
DOM nodes, 317 listeners, JS heap 5.0-5.2 MB, 5 animations
- WebView2 renderers 274 MB at minute 5, 318 at 25, 423 at 60 (2.7 MB a
minute, against about 20); 3,690 requests answered by minute 60.
The panel's own renderer (told apart by a 200 MB allocation made in
it) still grows about 0.75 MB a minute natively with its JS heap and
DOM flat; that is not explained by this commit.
panel-routing-hidden.test.cjs fakes a hidden page (headless pages are
never hidden: a minimised window still says "visible" and runs rAF),
sends a request every 80 ms and checks the hidden tab is drawn 0 times
over 20 of them, flies no dot, and is drawn once, newest request first,
on visibilitychange. On 9fd80b212's client.js it is red in all four
(chromium, webkit x en, zh): "the hidden tab was drawn 20 times over 20
requests" (expected 0, actual 20). With the visibilitychange redraw
taken out by hand it is red: "drawn once as the panel shows" expected
1, actual 0. With the fix, 4/4 ok.
Every GUI file that opens the tray panel (70 files, chromium and
webkit, their languages and narrow widths; node --test
--test-concurrency=4, machine load ~275): 960 of 962 pass. The two:
usage-chart-axis chromium was browserType.launch timing out at 180 s
(passes alone), and usage-fold "the view didn't scroll" 184 !== 180,
which fails the same way twice with 9fd80b212's client.js put back
(#2163, #2399). No Go code changed.