Repository navigation
Conversation
…page
The inline script read localStorage.getItem('leonida_lang') at top level.
With site data blocked the localStorage getter throws SecurityError, and
with storage disabled it is null; either way the script stopped before
window.onload was set and nothing in the Studio worked. The language is now
read and saved through try/catch helpers that fall back to 'ru'.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 0b981e3cb0c1552eb4e6220ac18bbe8fbe50314c)
|
Independent real-browser check of
|
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.
Claimed in the coordination issue as: #8344 (comment)
Depends on: none. Several open Studio PRs (#7287, #6786, #5780, #6704, #6731, #5017, #6821) touch the
localStoragestub intests/test_viewer_studio.cjs. None changes the page's own read atviewer/studio.html:458; a textual conflict in the test's context object is possible and trivial.What and why
The Studio's inline script read
localStorage.getItem('leonida_lang')at top level, andsetLanguagewrote it unguarded. When the browser blocks site data, thelocalStoragegetter throwsSecurityError(Chrome with the site not allowed to save data). When storage is disabled,localStorageisnull(Firefoxdom.storage.enabled=false). In both cases the script stopped at line 458, beforewindow.onloadwas set, so the page stayed empty: no model, no texture, no button. The language preference is a convenience; it shouldn't take the whole page down.The language is now read and saved through two small
try/catchhelpers,loadLanguage()(falls back to'ru') andsaveLanguage()(ignores a failure). Nothing else changes.New test "blocked or disabled site storage still starts the Studio in Russian" in
tests/test_viewer_studio.cjscovers a getter that throwsSecurityErrorandlocalStorage: null. In both,window.onloadis a function, the language is'ru', andsetLanguage('eu')doesn't throw.node:vmdoesn't call a getter set on the context object, so the test defines it onglobalThisfrom inside the context, and a counter checks that the throwing getter is really reached. With the oldstudio.htmlboth cases fail (SecurityError: storage is blocked,TypeError: Cannot read properties of null (reading 'getItem')).Tested
Windows 11, Node 24.19.0, CPU only (no GPU or driver involved), on
main867d922f0:node --test tests/test_viewer_studio.cjs: 11 pass, 0 fail.node --test tests/test_viewer_streaming.cjs: 56 pass, 1 fail. That failure is the camera-speed test withoutAbortController, red onmaintoo and covered by tests: the camera-speed viewer test passes the globals loadWorld needs #7085 / test_viewer_streaming: fix the false failure in the Shift-camera sandbox (missing AbortController) #7063 / test(viewer): pass AbortController and timers into camera-speed vm context #5692.python -I scripts/check_no_game_data.py,git diff --check: pass.AI-assisted: yes
Checklist
docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code