mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-11-01 20:17:33 +09:00
1283712 - Part 5: Support notes in Debugger.
This commit is contained in:
parent
519f13c210
commit
f8f673d986
4 changed files with 85 additions and 0 deletions
|
|
@ -921,6 +921,52 @@ js::ReportValueErrorFlags(JSContext* cx, unsigned flags, const unsigned errorNum
|
|||
return ok;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
js::CreateErrorNotesArray(JSContext* cx, JSErrorReport* report)
|
||||
{
|
||||
RootedArrayObject notesArray(cx, NewDenseEmptyArray(cx));
|
||||
if (!notesArray)
|
||||
return nullptr;
|
||||
|
||||
if (!report->notes)
|
||||
return notesArray;
|
||||
|
||||
for (auto&& note : *report->notes) {
|
||||
RootedPlainObject noteObj(cx, NewBuiltinClassInstance<PlainObject>(cx));
|
||||
if (!noteObj)
|
||||
return nullptr;
|
||||
|
||||
RootedString messageStr(cx, note->newMessageString(cx));
|
||||
if (!messageStr)
|
||||
return nullptr;
|
||||
RootedValue messageVal(cx, StringValue(messageStr));
|
||||
if (!DefineProperty(cx, noteObj, cx->names().message, messageVal))
|
||||
return nullptr;
|
||||
|
||||
RootedValue filenameVal(cx);
|
||||
if (note->filename) {
|
||||
RootedString filenameStr(cx, NewStringCopyZ<CanGC>(cx, note->filename));
|
||||
if (!filenameStr)
|
||||
return nullptr;
|
||||
filenameVal = StringValue(filenameStr);
|
||||
}
|
||||
if (!DefineProperty(cx, noteObj, cx->names().fileName, filenameVal))
|
||||
return nullptr;
|
||||
|
||||
RootedValue linenoVal(cx, Int32Value(note->lineno));
|
||||
if (!DefineProperty(cx, noteObj, cx->names().lineNumber, linenoVal))
|
||||
return nullptr;
|
||||
RootedValue columnVal(cx, Int32Value(note->column));
|
||||
if (!DefineProperty(cx, noteObj, cx->names().columnNumber, columnVal))
|
||||
return nullptr;
|
||||
|
||||
if (!NewbornArrayPush(cx, notesArray, ObjectValue(*noteObj)))
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return notesArray;
|
||||
}
|
||||
|
||||
const JSErrorFormatString js_ErrorFormatString[JSErr_Limit] = {
|
||||
#define MSG_DEF(name, count, exception, format) \
|
||||
{ #name, format, count, exception } ,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue