From 4567bcfbde030b35a0e7bfe699a9c58913323e27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 22 Nov 2018 16:48:28 +0100 Subject: [PATCH] Platform: properly escape output on windowless Emscripten app. --- doc/changelog.dox | 1 + src/Magnum/Platform/WindowlessEmscriptenApplication.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index 8a076a063..082ed61b0 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -116,6 +116,7 @@ r>>) - Don't assert in DPI scaling detection in @ref Platform::Sdl2Application and @ref Platform::GlfwApplication on X11 DEs that don't create any `RESOURCE_MANAGER` (see [mosra/magnum#290](https://github.com/mosra/magnum/issues/290)) +- Properly escaping log output on Emscripten @ref Platform::WindowlessEglApplication - The @ref GL::Context::States enum set was missing value combining operators - Fixed @ref Text::DistanceFieldGlyphCache internal formats on ES2 devices that support @gl_extension{EXT,texture_storage} (see diff --git a/src/Magnum/Platform/WindowlessEmscriptenApplication.js b/src/Magnum/Platform/WindowlessEmscriptenApplication.js index 1484b5673..3184ebdc9 100644 --- a/src/Magnum/Platform/WindowlessEmscriptenApplication.js +++ b/src/Magnum/Platform/WindowlessEmscriptenApplication.js @@ -33,12 +33,18 @@ var Module = { printErr: function(message) { var log = document.getElementById('log'); - log.innerHTML += Array.prototype.slice.call(arguments).join(' ') + '\n'; + log.innerHTML += Array.prototype.slice.call(arguments).join(' ') + .replace(/[\"&<>]/g, function (a) { + return { '"': '"', '&': '&', '<': '<', '>': '>' }[a]; + }) + '\n'; }, print: function(message) { var log = document.getElementById('log'); - log.innerHTML += Array.prototype.slice.call(arguments).join(' ') + '\n'; + log.innerHTML += Array.prototype.slice.call(arguments).join(' ') + .replace(/[\"&<>]/g, function (a) { + return { '"': '"', '&': '&', '<': '<', '>': '>' }[a]; + }) + '\n'; }, /* onAbort not handled here, as the output is printed directly on the page */