diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/jsifier.js | 2 | ||||
-rw-r--r-- | src/postamble.js | 4 | ||||
-rw-r--r-- | src/shell.html | 5 |
3 files changed, 8 insertions, 3 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index d4d57fc6..b54aace3 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -229,7 +229,7 @@ function JSify(data, functionsOnly, givenFunctions) { return makeEmptyStruct(type); } else if (value.intertype === 'string') { return JSON.stringify(parseLLVMString(value.text)) + - ' /* ' + value.text.substr(0, 20).replace(/\*/g, '_') + ' */'; // make string safe for inclusion in comment + ' /* ' + value.text.substr(0, 20).replace(/[*<>]/g, '_') + ' */'; // make string safe for inclusion in comment } else { return alignStruct(handleSegments(value.contents), type); } diff --git a/src/postamble.js b/src/postamble.js index 390f9f27..56f0aee1 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -37,7 +37,9 @@ function run(args) { var ret = null; if (Module['_main']) { ret = Module.callMain(args); - exitRuntime(); + if (!Module['noExitRuntime']) { + exitRuntime(); + } } return ret; } diff --git a/src/shell.html b/src/shell.html index 69217b18..a41086b9 100644 --- a/src/shell.html +++ b/src/shell.html @@ -19,7 +19,10 @@ print: (function() { var element = document.getElementById('output'); return function(text) { - element.innerHTML += text.replace('\n', '<br>', 'g') + '<br>'; + text = text.replace(/</g, "<"); + text = text.replace(/>/g, ">"); + text = text.replace('\n', '<br>', 'g'); + element.innerHTML += text + '<br>'; }; })(), canvas: document.getElementById('canvas') |