1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-13 18:16:19 +02:00

script: prevent JS breaking when logging circular obj. fixes #224

This commit is contained in:
Kushagra Gour
2017-11-09 00:28:44 +05:30
parent d4424bd95b
commit 0aa8f2a5b9

View File

@ -1840,13 +1840,17 @@ globalConsoleContainerEl
'script $1:$2' 'script $1:$2'
); );
} }
scope.consoleCm.replaceRange( try {
arg + scope.consoleCm.replaceRange(
' ' + arg +
((arg + '').match(/\[object \w+]/) ? JSON.stringify(arg) : '') + ' ' +
'\n', ((arg + '').match(/\[object \w+]/) ? JSON.stringify(arg) : '') +
{ line: Infinity } '\n',
); { line: Infinity }
);
} catch (e) {
scope.consoleCm.replaceRange('🌀\n', { line: Infinity });
}
scope.consoleCm.scrollTo(0, Infinity); scope.consoleCm.scrollTo(0, Infinity);
logCount++; logCount++;
}); });