fix: use CSS custom property for timing bar width to bypass CSP blocking
Inline style= attributes containing property:value pairs are blocked by strict style-src-attr CSP. CSS custom properties (--foo:value) set via style= are treated as data not styles and are not subject to this restriction. The width is now resolved in the stylesheet via var(--bar-w, 100%) so CSP cannot interfere.
This commit is contained in:
+1
-1
@@ -710,7 +710,7 @@ function renderStatusPanel(data, panel) {
|
|||||||
html += `
|
html += `
|
||||||
<div class="timing-row">
|
<div class="timing-row">
|
||||||
<span class="timing-label">${escapeHtml(t.label)}</span>
|
<span class="timing-label">${escapeHtml(t.label)}</span>
|
||||||
<div class="timing-bar-bg"><div class="timing-bar" style="width:${barWidth.toFixed(1)}%"></div></div>
|
<div class="timing-bar-bg"><div class="timing-bar" style="--bar-w:${barWidth.toFixed(1)}%"></div></div>
|
||||||
<span class="timing-value">${t.ms}ms</span>
|
<span class="timing-value">${t.ms}ms</span>
|
||||||
</div>`;
|
</div>`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -952,6 +952,7 @@ body {
|
|||||||
|
|
||||||
.timing-bar {
|
.timing-bar {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
width: var(--bar-w, 100%);
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
min-width: 2px;
|
min-width: 2px;
|
||||||
|
|||||||
Reference in New Issue
Block a user