fix(topbar-strip): escape pageName() output before innerHTML insertion
This commit is contained in:
parent
76b0a5e05e
commit
36f165807a
1 changed files with 5 additions and 1 deletions
|
|
@ -1,5 +1,9 @@
|
|||
// Operator status strip mounted at the top of every .main pane.
|
||||
(function () {
|
||||
function esc(s) {
|
||||
if (!s) return '';
|
||||
return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');
|
||||
}
|
||||
function mount() {
|
||||
const main = document.querySelector('.main');
|
||||
if (!main || main.querySelector('.topbar-strip')) return;
|
||||
|
|
@ -11,7 +15,7 @@
|
|||
'<span class="ts-now" id="tsNow">00:00:00</span>' +
|
||||
'<span class="ts-sep"></span>' +
|
||||
'<span class="ts-label">Page</span>' +
|
||||
'<span class="ts-value" id="tsPage">' + pageName() + '</span>' +
|
||||
'<span class="ts-value" id="tsPage">' + esc(pageName()) + '</span>' +
|
||||
'<span class="ts-sep"></span>' +
|
||||
'<span class="ts-label">API</span>' +
|
||||
'<span class="ts-value" id="tsApi">--</span>';
|
||||
|
|
|
|||
Loading…
Reference in a new issue