Use textContent instead of innerHTML for extracting logs from headless browser tests

Easier to maintain fidelity and less likely to be sabotaged by XSS and
`<script>` tags.

Fixes #1232
This commit is contained in:
Nick Fitzgerald
2019-02-08 10:35:19 +01:00
parent 9d27bc2e8b
commit 11eeeb8fc8
4 changed files with 21 additions and 18 deletions

View File

@ -13,7 +13,7 @@
const orig = id => (...args) => {
const logs = document.getElementById(id);
for (let msg of args) {
logs.innerHTML += `${msg}\n`;
logs.textContent += `${msg}\n`;
}
};

View File

@ -30,7 +30,7 @@ pub fn spawn(
// Now that we've gotten to the point where JS is executing, update our
// status text as at this point we should be asynchronously fetching the
// wasm module.
document.getElementById('output').innerHTML = "Loading wasm module...";
document.getElementById('output').textContent = "Loading wasm module...";
async function main(test) {{
// this is a facet of using wasm2es6js, a hack until browsers have