mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1283712 - Part 11.1: Show notes in devtools console. r=nchevobbe
This commit is contained in:
parent
f4e61b592f
commit
917ac773a0
@ -36,6 +36,7 @@ function EvaluationResult(props) {
|
||||
frame,
|
||||
timeStamp,
|
||||
parameters,
|
||||
notes,
|
||||
} = message;
|
||||
|
||||
let messageBody;
|
||||
@ -61,6 +62,7 @@ function EvaluationResult(props) {
|
||||
frame,
|
||||
timeStamp,
|
||||
parameters,
|
||||
notes,
|
||||
};
|
||||
return Message(childProps);
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ function PageError(props) {
|
||||
frame,
|
||||
exceptionDocURL,
|
||||
timeStamp,
|
||||
notes,
|
||||
} = message;
|
||||
|
||||
const childProps = {
|
||||
@ -64,6 +65,7 @@ function PageError(props) {
|
||||
serviceContainer,
|
||||
exceptionDocURL,
|
||||
timeStamp,
|
||||
notes,
|
||||
};
|
||||
return Message(childProps);
|
||||
}
|
||||
|
@ -56,6 +56,10 @@ const Message = createClass({
|
||||
openLink: PropTypes.func.isRequired,
|
||||
sourceMapService: PropTypes.any,
|
||||
}),
|
||||
notes: PropTypes.arrayOf(PropTypes.shape({
|
||||
messageBody: PropTypes.string.isRequired,
|
||||
frame: PropTypes.any,
|
||||
})),
|
||||
},
|
||||
|
||||
getDefaultProps: function () {
|
||||
@ -112,6 +116,7 @@ const Message = createClass({
|
||||
dispatch,
|
||||
exceptionDocURL,
|
||||
timeStamp = Date.now(),
|
||||
notes,
|
||||
} = this.props;
|
||||
|
||||
topLevelClasses.push("message", source, type, level);
|
||||
@ -154,6 +159,29 @@ const Message = createClass({
|
||||
});
|
||||
}
|
||||
|
||||
let notesNodes;
|
||||
if (notes) {
|
||||
notes.map(note => dom.span(
|
||||
{ className: "message-flex-body error-note" },
|
||||
dom.span({ className: "message-body devtools-monospace" },
|
||||
"note: " + note.messageBody
|
||||
),
|
||||
dom.span({ className: "message-location devtools-monospace" },
|
||||
note.frame ? FrameView({
|
||||
frame: note.frame,
|
||||
onClick: serviceContainer
|
||||
? serviceContainer.onViewSourceInDebugger
|
||||
: undefined,
|
||||
showEmptyPathAsHost: true,
|
||||
sourceMapService: serviceContainer
|
||||
? serviceContainer.sourceMapService
|
||||
: undefined
|
||||
}) : null
|
||||
)));
|
||||
} else {
|
||||
notesNodes = [];
|
||||
}
|
||||
|
||||
const repeat = this.props.repeat ? MessageRepeat({repeat: this.props.repeat}) : null;
|
||||
|
||||
let onFrameClick;
|
||||
@ -212,7 +240,8 @@ const Message = createClass({
|
||||
// Add a newline for formatting when copying to the clipboard.
|
||||
"\n",
|
||||
// If an attachment is displayed, the final newline is handled by the attachment.
|
||||
attachment
|
||||
attachment,
|
||||
...notesNodes
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -134,6 +134,15 @@ function matchSearchFilters(message, filters) {
|
||||
|| (message.parameters !== null
|
||||
&& message.parameters.join("").toLocaleLowerCase()
|
||||
.includes(text.toLocaleLowerCase()))
|
||||
// Look for a match in notes.
|
||||
|| (Array.isArray(message.notes) && message.notes.some(note =>
|
||||
// Look for a match in location.
|
||||
isTextInFrame(text, note.frame)
|
||||
// Look for a match in messageBody.
|
||||
|| (note.messageBody !== null
|
||||
&& note.messageBody.toLocaleLowerCase()
|
||||
.includes(text.toLocaleLowerCase()))
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ exports.ConsoleMessage = Immutable.Record({
|
||||
groupId: null,
|
||||
exceptionDocURL: null,
|
||||
userProvidedStyles: null,
|
||||
notes: null,
|
||||
});
|
||||
|
||||
exports.NetworkEventMessage = Immutable.Record({
|
||||
|
@ -170,7 +170,8 @@ function transformPacket(packet) {
|
||||
stacktrace: pageError.stacktrace ? pageError.stacktrace : null,
|
||||
frame,
|
||||
exceptionDocURL: pageError.exceptionDocURL,
|
||||
timeStamp: pageError.timeStamp
|
||||
timeStamp: pageError.timeStamp,
|
||||
notes: pageError.notes,
|
||||
});
|
||||
}
|
||||
|
||||
@ -195,6 +196,7 @@ function transformPacket(packet) {
|
||||
frame,
|
||||
result: parameters,
|
||||
timestamp: timeStamp,
|
||||
notes,
|
||||
} = packet;
|
||||
|
||||
const level = messageText ? MESSAGE_LEVEL.ERROR : MESSAGE_LEVEL.LOG;
|
||||
@ -207,6 +209,7 @@ function transformPacket(packet) {
|
||||
exceptionDocURL,
|
||||
frame,
|
||||
timeStamp,
|
||||
notes,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -899,7 +899,8 @@ WebConsoleActor.prototype =
|
||||
let evalResult = evalInfo.result;
|
||||
let helperResult = evalInfo.helperResult;
|
||||
|
||||
let result, errorDocURL, errorMessage, errorGrip = null, frame = null;
|
||||
let result, errorDocURL, errorMessage, errorNotes = null, errorGrip = null,
|
||||
frame = null;
|
||||
if (evalResult) {
|
||||
if ("return" in evalResult) {
|
||||
result = evalResult.return;
|
||||
@ -954,6 +955,23 @@ WebConsoleActor.prototype =
|
||||
};
|
||||
}
|
||||
} catch (ex) {}
|
||||
|
||||
try {
|
||||
let notes = error.errorNotes;
|
||||
if (notes && notes.length) {
|
||||
errorNotes = [];
|
||||
for (let note of notes) {
|
||||
errorNotes.push({
|
||||
messageBody: this._createStringGrip(note.message),
|
||||
frame: {
|
||||
source: note.fileName,
|
||||
line: note.lineNumber,
|
||||
column: note.columnNumber,
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (ex) {}
|
||||
}
|
||||
}
|
||||
|
||||
@ -978,6 +996,7 @@ WebConsoleActor.prototype =
|
||||
exceptionDocURL: errorDocURL,
|
||||
frame,
|
||||
helperResult: helperResult,
|
||||
notes: errorNotes,
|
||||
};
|
||||
},
|
||||
|
||||
@ -1511,6 +1530,23 @@ WebConsoleActor.prototype =
|
||||
lineText = lineText.substr(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH);
|
||||
}
|
||||
|
||||
let notesArray = null;
|
||||
let notes = aPageError.notes;
|
||||
if (notes && notes.length) {
|
||||
notesArray = [];
|
||||
for (let i = 0, len = notes.length; i < len; i++) {
|
||||
let note = notes.queryElementAt(i, Ci.nsIScriptErrorNote);
|
||||
notesArray.push({
|
||||
messageBody: this._createStringGrip(note.errorMessage),
|
||||
frame: {
|
||||
source: note.sourceName,
|
||||
line: note.lineNumber,
|
||||
column: note.columnNumber,
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
errorMessage: this._createStringGrip(aPageError.errorMessage),
|
||||
errorMessageName: aPageError.errorMessageName,
|
||||
@ -1527,7 +1563,8 @@ WebConsoleActor.prototype =
|
||||
strict: !!(aPageError.flags & aPageError.strictFlag),
|
||||
info: !!(aPageError.flags & aPageError.infoFlag),
|
||||
private: aPageError.isFromPrivateWindow,
|
||||
stacktrace: stack
|
||||
stacktrace: stack,
|
||||
notes: notesArray,
|
||||
};
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user