Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 31 additions & 17 deletions client/utils/consoleUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
}
]
}
]
}, '*');
}
};
`;
Expand All @@ -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;
Expand Down