Display infinite loops to user

Also exits early if infinite loop
This commit is contained in:
Berkeley Martinez
2015-12-01 17:38:48 -08:00
parent f904f91f97
commit 636824aba3
2 changed files with 7 additions and 0 deletions

View File

@ -11,6 +11,7 @@ window.common = (function(global) {
<script> <script>
window.$ = parent.$.proxy(parent.$.fn.find, parent.$(document)); window.$ = parent.$.proxy(parent.$.fn.find, parent.$(document));
window.loopProtect = parent.loopProtect; window.loopProtect = parent.loopProtect;
window.__err = null;
</script> </script>
<link <link
rel='stylesheet' rel='stylesheet'

View File

@ -10,6 +10,12 @@ window.$(document).ready(function() {
var tests = parent.tests; var tests = parent.tests;
var common = parent.common; var common = parent.common;
window.loopProtect.hit = function(line) {
window.__err = new Error(
'Potential infinite loop at line ' + line
);
};
common.getJsOutput = function evalJs(code = '') { common.getJsOutput = function evalJs(code = '') {
let output; let output;
try { try {