diff --git a/client/utils/consoleUtils.js b/client/utils/consoleUtils.js index 0f10eb9841..0794b2da90 100644 --- a/client/utils/consoleUtils.js +++ b/client/utils/consoleUtils.js @@ -28,14 +28,21 @@ export const hijackConsoleErrorsScript = (offs) => { var fileInfo = getScriptOff(lineNumber); data = msg + ' (' + fileInfo[1] + ': line ' + fileInfo[0] + ')'; } - window.parent.postMessage([{ - log: [{ - method: 'error', - data: [data], - id: Date.now().toString() - }], - source: fileInfo[1] - }], '*'); + window.parent.postMessage( + { + source: fileInfo[1], + messages: [ + { + log: [ + { + method: 'error', + data: [data], + id: Date.now().toString() + } + ] + } + ] + }, '*'); return false; }; // catch rejected promises @@ -44,14 +51,21 @@ export const hijackConsoleErrorsScript = (offs) => { var errorNum = event.reason.stack.split('about:srcdoc:')[1].split(':')[0]; var fileInfo = getScriptOff(errorNum); var data = event.reason.message + ' (' + fileInfo[1] + ': line ' + fileInfo[0] + ')'; - window.parent.postMessage([{ - log: [{ - method: 'error', - data: [data], - id: Date.now().toString() - }], - source: fileInfo[1] - }], '*'); + window.parent.postMessage( + { + source: fileInfo[1], + messages: [ + { + log: [ + { + method: 'error', + data: [data], + id: Date.now().toString() + } + ] + } + ] + }, '*'); } }; `; @@ -62,7 +76,7 @@ export const startTag = '@fs-'; export const getAllScriptOffsets = (htmlFile) => { const offs = []; - const hijackConsoleErrorsScriptLength = 52; + const hijackConsoleErrorsScriptLength = 66; const embeddedJSStart = 'script crossorigin=""'; let foundJSScript = true; let foundEmbeddedJS = true;