Skip to content

Frontend: various small fixes to Typescript code#1329

Merged
gusthoff merged 7 commits intoAdaCore:mainfrom
gusthoff:topic/infrastructure/yarn/refactoring/20260322/small_fixes
Mar 22, 2026
Merged

Frontend: various small fixes to Typescript code#1329
gusthoff merged 7 commits intoAdaCore:mainfrom
gusthoff:topic/infrastructure/yarn/refactoring/20260322/small_fixes

Conversation

@gusthoff
Copy link
Collaborator

No description provided.

gusthoff and others added 7 commits March 22, 2026 18:53
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bare except clauses catch KeyboardInterrupt and SystemExit, making
the script impossible to interrupt cleanly via Ctrl+C.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The getElemsByTag describe block had a copy-paste description
saying 'have the class' instead of 'have the tag'.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace all loose == and != comparisons with === and !==. None of
these caused behavioral bugs (all were same-type comparisons), but
they were inconsistent with TypeScript best practices.

Affected files: widget.ts, download.ts, areas.ts, sandbox-redirect.ts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All three JSON.parse calls on widget/download switch data were
unprotected. A malformed data-switches attribute would throw an
uncaught exception silently breaking functionality.

- download.ts getUnparsedSwitches(): rethrow with descriptive message
- widget.ts download button handler: show error and return early
- widget.ts buttonCB(): show error, hide spinner, and return early

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t.ts

Two locations built HTML by concatenating untrusted strings into
innerHTML, creating an XSS vector if switch names, titles, or error
messages ever contain HTML special characters.

- initCompilerSwitches(): build tooltip via createElement/textContent/appendChild
- widgetFactory() catch block: build error paragraph via createElement/textContent

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gusthoff gusthoff merged commit 54e6c5f into AdaCore:main Mar 22, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant