Repository navigation
studio: a failed texture preview no longer re-fires its onerror forever - #6529
Conversation
…r handler forever The texture cards in viewer/studio.html (the first 80 and the "show all" ones) handled a failed preview with onerror="this.src=''; ...". Chromium fires error again for every src='' it is given, so the handler re-ran itself without end: about 424,000 error events in 3 s for one card in Chromium 156, one pinned CPU core per broken preview (for example a 404 for a DDS format dds_png can't convert). The handler now clears itself first (this.onerror=null), as the script tags in the same file already do; measured in the same browser it then runs once. tests/test_viewer_studio.cjs: a fake image that fires the handler again on every src write, as that browser does, runs each card path's handler; it fails before the change and passes after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fi5BEBqGPiXnY67f9mzu13
|
Independent source/Node check of Negative control: copied the exact new test file into an external scratch fixture with the actual parent Also exercised both source handlers with an asynchronous event-queue simulation, rather than the suite's synchronous setter re-entry. Resetting No blocking finding from the source and JavaScript checks. No independent native-browser verification here: the available browser environment could not reach the local fixture, so I cannot corroborate the Chromium timing/event-rate measurement. The event-queue check above is explicitly a simulation, not a browser run. No GPU, game files or external services used for these tests. AI-assisted review with Codex; tests and negative control executed locally. |
shayderrr
left a comment
There was a problem hiding this comment.
Summary
viewer/studio.html sets this.onerror=null before clearing src in both texture-card <img> handlers (first 80 and "show all"), so Chromium's repeat error on src='' cannot re-enter the handler. tests/test_viewer_studio.cjs adds a fake image whose src setter refires onerror and asserts both inline handlers run exactly once and leave the fallback alt text.
Why merge
Fixes a real infinite error loop observed at ~424,000 firings in 3 s on Chromium 156. Test reproduces the browser behaviour without a browser.
Verdict: Approve
Summary
Why mergeFixes a real infinite error loop observed at ~424,000 firings in 3 s on Chromium 156. Test reproduces the browser behaviour without a browser. Verdict: Approve |
Claimed in the coordination issue as: STUDIO-TEX-ONERROR-LOOP (posted in #6414)
Depends on: none. It conflicts only textually with #5780 in
tests/test_viewer_studio.cjs, where both add a test at the same place. It applies cleanly with #5017 and #5083.What and why
The texture cards in
viewer/studio.html(the first 80 and the "show all" ones) handled a preview that failed to load withonerror="this.src=''; this.alt='DDS / Pre-converted'". Chromium fireserroragain for everysrc=''it is given, so this handler re-ran itself without end. Measured in Chromium 156: about 424,000 error events in 3 s for a single image, which is one pinned CPU core per broken preview. A preview fails, for example, when the gallery answers 404 for a DDS formatdds_pngcan't convert.The handler now clears itself first (
this.onerror=null; ...), as the three<script>tags at the top of the same file already do. Measured in the same browser, it then runs once and the card still shows theDDS / Pre-convertedtext.Tested
Linux, Node 22.23.5, plus Chromium 156 for the before/after event counts. No GPU or driver involved, no game files.
node --test tests/test_viewer_studio.cjs: 4/4 on top of main 1cc6e3c.a texture preview that fails to load fires its error handler once, not in a looptest renders both card paths through the existingrenderTextureGridhelper and runs eachonerroron a fake image that fires the handler again on everysrcwrite, as Chromium does. It fails without theviewer/studio.htmlchange and passes with it.tests/test_viewer_streaming.cjs: the only failure is the Shift/Ctrl test that already fails on main (fixed by test(viewer): pass AbortController and timers into camera-speed vm context #5692).git diff --checkis clean.AI-assisted: yes (Claude)
Checklist
docs/design.md, with how it was confirmed. (Not applicable: no translator change.)