File tree 2 files changed +9
-6
lines changed
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -194,8 +194,8 @@ class Editor extends React.Component {
194
194
if ( this . props . runtimeErrorWarningVisible && this . _cm . getDoc ( ) . modeOption === 'javascript' ) {
195
195
this . props . consoleEvents . forEach ( ( consoleEvent ) => {
196
196
if ( consoleEvent . method === 'error' ) {
197
- if ( consoleEvent . arguments . indexOf ( ')' ) > - 1 ) {
198
- const n = consoleEvent . arguments . replace ( ')' , '' ) . split ( ' ' ) ;
197
+ if ( consoleEvent . data [ 0 ] . indexOf ( ')' ) > - 1 ) {
198
+ const n = consoleEvent . data [ 0 ] . replace ( ')' , '' ) . split ( ' ' ) ;
199
199
const lineNumber = parseInt ( n [ n . length - 1 ] , 10 ) - 1 ;
200
200
this . _cm . addLineClass ( lineNumber , 'background' , 'line-runtime-error' ) ;
201
201
}
Original file line number Diff line number Diff line change @@ -31,8 +31,11 @@ export const hijackConsoleErrorsScript = (offs) => {
31
31
data = msg + ' (' + fileInfo[1] + ': line ' + fileInfo[0] + ')';
32
32
}
33
33
window.parent.postMessage([{
34
- method: 'error',
35
- arguments: data,
34
+ log: [{
35
+ method: 'error',
36
+ data: [data],
37
+ id: Date.now().toString()
38
+ }],
36
39
source: fileInfo[1]
37
40
}], '*');
38
41
return false;
@@ -58,8 +61,8 @@ export const getAllScriptOffsets = (htmlFile) => {
58
61
} else {
59
62
endFilenameInd = htmlFile . indexOf ( '.js' , ind + startTag . length + 3 ) ;
60
63
filename = htmlFile . substring ( ind + startTag . length , endFilenameInd ) ;
61
- // the length of hijackConsoleErrorsScript is 33 lines
62
- lineOffset = htmlFile . substring ( 0 , ind ) . split ( '\n' ) . length + 33 ;
64
+ // the length of hijackConsoleErrorsScript is 37 lines
65
+ lineOffset = htmlFile . substring ( 0 , ind ) . split ( '\n' ) . length + 37 ;
63
66
offs . push ( [ lineOffset , filename ] ) ;
64
67
lastInd = ind + 1 ;
65
68
}
You can’t perform that action at this time.
0 commit comments