From ef98190e2537a36d85aa11ce5cf4c71fdfbfd326 Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Tue, 20 Nov 2018 18:00:54 -0500 Subject: [PATCH] for #769 --- client/modules/IDE/components/Editor.jsx | 4 ++-- client/utils/consoleUtils.js | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/client/modules/IDE/components/Editor.jsx b/client/modules/IDE/components/Editor.jsx index c87ddc8a..43fc150d 100644 --- a/client/modules/IDE/components/Editor.jsx +++ b/client/modules/IDE/components/Editor.jsx @@ -194,8 +194,8 @@ class Editor extends React.Component { if (this.props.runtimeErrorWarningVisible && this._cm.getDoc().modeOption === 'javascript') { this.props.consoleEvents.forEach((consoleEvent) => { if (consoleEvent.method === 'error') { - if (consoleEvent.arguments.indexOf(')') > -1) { - const n = consoleEvent.arguments.replace(')', '').split(' '); + if (consoleEvent.data[0].indexOf(')') > -1) { + const n = consoleEvent.data[0].replace(')', '').split(' '); const lineNumber = parseInt(n[n.length - 1], 10) - 1; this._cm.addLineClass(lineNumber, 'background', 'line-runtime-error'); } diff --git a/client/utils/consoleUtils.js b/client/utils/consoleUtils.js index 7a41da8a..ac00d6cf 100644 --- a/client/utils/consoleUtils.js +++ b/client/utils/consoleUtils.js @@ -31,8 +31,11 @@ export const hijackConsoleErrorsScript = (offs) => { data = msg + ' (' + fileInfo[1] + ': line ' + fileInfo[0] + ')'; } window.parent.postMessage([{ - method: 'error', - arguments: data, + log: [{ + method: 'error', + data: [data], + id: Date.now().toString() + }], source: fileInfo[1] }], '*'); return false; @@ -58,8 +61,8 @@ export const getAllScriptOffsets = (htmlFile) => { } else { endFilenameInd = htmlFile.indexOf('.js', ind + startTag.length + 3); filename = htmlFile.substring(ind + startTag.length, endFilenameInd); - // the length of hijackConsoleErrorsScript is 33 lines - lineOffset = htmlFile.substring(0, ind).split('\n').length + 33; + // the length of hijackConsoleErrorsScript is 37 lines + lineOffset = htmlFile.substring(0, ind).split('\n').length + 37; offs.push([lineOffset, filename]); lastInd = ind + 1; }