Skip to content

Fix initialization order for menu controls#9

Open
DaKongOlta wants to merge 7 commits into
mainfrom
codex/continue-development-on-spacer_x-game-dh7kht
Open

Fix initialization order for menu controls#9
DaKongOlta wants to merge 7 commits into
mainfrom
codex/continue-development-on-spacer_x-game-dh7kht

Conversation

@DaKongOlta

Copy link
Copy Markdown
Owner

Summary

  • declare start light timers alongside the HUD elements that use them to prevent reset helpers from touching undefined state
  • reorder the race initialization block so leaderboard history, caution presets, and race settings are set up before UI refreshes, avoiding TDZ errors on first load
  • move the race settings event wiring after the track catalog so rebuilding the minimap no longer crashes the menu

Testing

  • node --check script.js

https://chatgpt.com/codex/tasks/task_e_68c9d8830d808324adea8afa75f49e4d

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @DaKongOlta, your pull request is larger than the review limit of 150000 diff characters

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New security issues found

Comment thread script.js
const startMode = startProc?.value || raceSettings.startProc || 'standing';
tags.push(getStartProcedureLabel(startMode));
tags.push(aiLabels[aiLevel] || `KI: ${aiLevel}`);
eventTraitSummary.innerHTML = tags.map(tag => `<span>${tag}</span>`).join('');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-document-method): User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
const startMode = startProc?.value || raceSettings.startProc || 'standing';
tags.push(getStartProcedureLabel(startMode));
tags.push(aiLabels[aiLevel] || `KI: ${aiLevel}`);
eventTraitSummary.innerHTML = tags.map(tag => `<span>${tag}</span>`).join('');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-innerhtml): User controlled data in a eventTraitSummary.innerHTML is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
`<span>PaceIdx ${paceIndex} • Form ${formText} • Morale ${moralePct}%</span>` +
`<span>Driver Stats P${paceStat} | I${intelStat} | C${consistStat} | R${riskStat}</span></li>`;
});
gridIntroList.innerHTML = listItems.join('');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-document-method): User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
`<span>PaceIdx ${paceIndex} • Form ${formText} • Morale ${moralePct}%</span>` +
`<span>Driver Stats P${paceStat} | I${intelStat} | C${consistStat} | R${riskStat}</span></li>`;
});
gridIntroList.innerHTML = listItems.join('');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-innerhtml): User controlled data in a gridIntroList.innerHTML is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
sectorFeed.forEach(item => {
const li = document.createElement('li');
if (item.className) li.classList.add(item.className);
li.innerHTML = `<span class=\"tag\">S${item.sector}</span><span class=\"driver\">#${item.number} ${item.driver}</span><span class=\"value\">${formatSplit(item.time)}${item.label ? ' ' + item.label : ''}</span>`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-document-method): User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
const container = document.createElement('div');
container.className = 'archiveEntry';
const header = document.createElement('header');
header.innerHTML = `<span>${formatDateTime(entry.timestamp)}</span><span>${entry.trackLabel}</span>`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-innerhtml): User controlled data in a header.innerHTML is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
Comment on lines +6193 to +6243
container.appendChild(podium);
if (entry.fastestLap) {
const fl = document.createElement('div');
fl.className = 'meta';
fl.textContent

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-document-method): User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
Comment on lines +6193 to +6243
container.appendChild(podium);
if (entry.fastestLap) {
const fl = document.createElement('div');
fl.className = 'meta';
fl.textContent

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-innerhtml): User controlled data in a div.innerHTML is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
if (entry.fastestLap) {
const fl = document.createElement('div');
fl.className = 'meta';
fl.textContent

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-document-method): User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
if (entry.fastestLap) {
const fl = document.createElement('div');
fl.className = 'meta';
fl.textContent

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-innerhtml): User controlled data in a row.innerHTML is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New security issues found

Comment thread script.js
const startMode = startProc?.value || raceSettings.startProc || 'standing';
tags.push(getStartProcedureLabel(startMode));
tags.push(aiLabels[aiLevel] || `KI: ${aiLevel}`);
eventTraitSummary.innerHTML = tags.map(tag => `<span>${tag}</span>`).join('');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-document-method): User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
const startMode = startProc?.value || raceSettings.startProc || 'standing';
tags.push(getStartProcedureLabel(startMode));
tags.push(aiLabels[aiLevel] || `KI: ${aiLevel}`);
eventTraitSummary.innerHTML = tags.map(tag => `<span>${tag}</span>`).join('');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-innerhtml): User controlled data in a eventTraitSummary.innerHTML is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
`<span>PaceIdx ${paceIndex} • Form ${formText} • Morale ${moralePct}%</span>` +
`<span>Driver Stats P${paceStat} | I${intelStat} | C${consistStat} | R${riskStat}</span></li>`;
});
gridIntroList.innerHTML = listItems.join('');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-document-method): User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
`<span>PaceIdx ${paceIndex} • Form ${formText} • Morale ${moralePct}%</span>` +
`<span>Driver Stats P${paceStat} | I${intelStat} | C${consistStat} | R${riskStat}</span></li>`;
});
gridIntroList.innerHTML = listItems.join('');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-innerhtml): User controlled data in a gridIntroList.innerHTML is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
sectorFeed.forEach(item => {
const li = document.createElement('li');
if (item.className) li.classList.add(item.className);
li.innerHTML = `<span class=\"tag\">S${item.sector}</span><span class=\"driver\">#${item.number} ${item.driver}</span><span class=\"value\">${formatSplit(item.time)}${item.label ? ' ' + item.label : ''}</span>`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-document-method): User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
card.style.border = '1px solid #1e293b';
card.style.borderRadius = '10px';
card.style.padding = '8px';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-innerhtml): User controlled data in a header.innerHTML is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
Comment on lines +6251 to +6716
const card = document.createElement('div');
card.style.border = '1px solid #1e293b';
card.style.borderRadius = '10px';
card.style.padding = '8px';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-document-method): User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
Comment on lines +6251 to +6716
const card = document.createElement('div');
card.style.border = '1px solid #1e293b';
card.style.borderRadius = '10px';
card.style.padding = '8px';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-innerhtml): User controlled data in a div.innerHTML is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
card.style.border = '1px solid #1e293b';
card.style.borderRadius = '10px';
card.style.padding = '8px';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-document-method): User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
card.style.border = '1px solid #1e293b';
card.style.borderRadius = '10px';
card.style.padding = '8px';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-innerhtml): User controlled data in a row.innerHTML is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New security issues found

Comment thread script.js
Comment on lines +6251 to +6564
}

function renderTeams() {
if (!teamsList) return;
teamsList.innerHTML = '';
Object.entries(managerState.teams).forEach(([team, da

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-document-method): User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
Comment on lines +6251 to +6564
}

function renderTeams() {
if (!teamsList) return;
teamsList.innerHTML = '';
Object.entries(managerState.teams).forEach(([team, da

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-innerhtml): User controlled data in a card.innerHTML is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
function renderTeams() {
if (!teamsList) return;
teamsList.innerHTML = '';
Object.entries(managerState.teams).forEach(([team, da

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-document-method): User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
function renderTeams() {
if (!teamsList) return;
teamsList.innerHTML = '';
Object.entries(managerState.teams).forEach(([team, da

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-innerhtml): User controlled data in a header.innerHTML is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
Comment on lines +6252 to +6722

function renderTeams() {
if (!teamsList) return;
teamsList.innerHTML = '';
Object.entries(managerState.teams).forEach(([team, da

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-document-method): User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
Comment on lines +6252 to +6722

function renderTeams() {
if (!teamsList) return;
teamsList.innerHTML = '';
Object.entries(managerState.teams).forEach(([team, da

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-innerhtml): User controlled data in a div.innerHTML is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
function renderTeams() {
if (!teamsList) return;
teamsList.innerHTML = '';
Object.entries(managerState.teams).forEach(([team, da

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-document-method): User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Comment thread script.js
function renderTeams() {
if (!teamsList) return;
teamsList.innerHTML = '';
Object.entries(managerState.teams).forEach(([team, da

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-innerhtml): User controlled data in a row.innerHTML is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant