From a014f3dc02c041b5c5a7c418f2cbc748b0a6bcc2 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sat, 10 Apr 2021 18:23:07 -0400 Subject: =?UTF-8?q?=E2=80=A2JS=20for=20Javascript=20evaluation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/repl.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'docs/repl.js') diff --git a/docs/repl.js b/docs/repl.js index 4bdb653f..ec79324f 100644 --- a/docs/repl.js +++ b/docs/repl.js @@ -33,6 +33,7 @@ let repl = ()=>{ doc.rslt.classList.add('err'); doc.rslt.textContent=fmtErr(src,e); } + sysvals.js=dojs; // In case it was disabled by fragment loading }, 0); } if (doc.run) doc.run.onclick = repl; @@ -158,7 +159,8 @@ if (location.hash) { b=new Uint8Array([...b].map(c=>c.charCodeAt(0))); setcount(doc.code.value = (new TextDecoder()).decode(b)); if (ee && doc.doexplain) doc.doexplain.onclick(); - if (run) repl(); + nojs = () => { throw Error("Possible script injection; press Run to confirm"); } + if (run) { sysvals.js=nojs; repl(); } doc.code.focus(); } } -- cgit v1.2.3