Bug 1506323 - Add JS::PrintError to public API. r=tcampbell

Depends on D11568

Differential Revision: https://phabricator.services.mozilla.com/D11569

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Philip Chimento 2018-11-15 16:28:03 +00:00
parent dd1c4d38c5
commit 700abccb03
5 changed files with 16 additions and 16 deletions

View File

@ -4286,6 +4286,16 @@ CreateError(JSContext* cx, JSExnType type, HandleObject stack,
HandleString fileName, uint32_t lineNumber, uint32_t columnNumber,
JSErrorReport* report, HandleString message, MutableHandleValue rval);
/*
* Prints a full report and returns true if the given report is non-nullptr
* and the report doesn't have the JSREPORT_WARNING flag set or reportWarnings
* is true.
* Returns false otherwise.
*/
extern JS_PUBLIC_API(bool)
PrintError(JSContext* cx, FILE* file, ConstUTF8CharsZ toStringResult,
JSErrorReport* report, bool reportWarnings);
/************************************************************************/
/*

View File

@ -9475,7 +9475,7 @@ js::shell::AutoReportException::~AutoReportException()
MOZ_ASSERT(!JSREPORT_IS_WARNING(report.report()->flags));
FILE* fp = ErrorFilePointer();
PrintError(cx, fp, report.toStringResult(), report.report(), reportWarnings);
JS::PrintError(cx, fp, report.toStringResult(), report.report(), reportWarnings);
{
JS::AutoSaveExceptionState savedExc(cx);
@ -9521,7 +9521,7 @@ js::shell::WarningReporter(JSContext* cx, JSErrorReport* report)
}
// Print the warning.
PrintError(cx, fp, JS::ConstUTF8CharsZ(), report, reportWarnings);
JS::PrintError(cx, fp, JS::ConstUTF8CharsZ(), report, reportWarnings);
}
static bool

View File

@ -578,8 +578,8 @@ PrintSingleError(JSContext* cx, FILE* file, JS::ConstUTF8CharsZ toStringResult,
return true;
}
bool
js::PrintError(JSContext* cx, FILE* file, JS::ConstUTF8CharsZ toStringResult,
JS_PUBLIC_API(bool)
JS::PrintError(JSContext* cx, FILE* file, JS::ConstUTF8CharsZ toStringResult,
JSErrorReport* report, bool reportWarnings)
{
MOZ_ASSERT(report);

View File

@ -1071,16 +1071,6 @@ ExpandErrorArgumentsVA(JSContext* cx, JSErrorCallback callback,
extern void
ReportUsageErrorASCII(JSContext* cx, HandleObject callee, const char* msg);
/*
* Prints a full report and returns true if the given report is non-nullptr
* and the report doesn't have the JSREPORT_WARNING flag set or reportWarnings
* is true.
* Returns false otherwise.
*/
extern bool
PrintError(JSContext* cx, FILE* file, JS::ConstUTF8CharsZ toStringResult,
JSErrorReport* report, bool reportWarnings);
extern void
ReportIsNotDefined(JSContext* cx, HandlePropertyName name);

View File

@ -80,7 +80,7 @@ selfHosting_WarningReporter(JSContext* cx, JSErrorReport* report)
MOZ_ASSERT(report);
MOZ_ASSERT(JSREPORT_IS_WARNING(report->flags));
PrintError(cx, stderr, JS::ConstUTF8CharsZ(), report, true);
JS::PrintError(cx, stderr, JS::ConstUTF8CharsZ(), report, true);
}
static bool
@ -2894,7 +2894,7 @@ MaybePrintAndClearPendingException(JSContext* cx, FILE* file)
}
MOZ_ASSERT(!JSREPORT_IS_WARNING(report.report()->flags));
PrintError(cx, file, report.toStringResult(), report.report(), true);
JS::PrintError(cx, file, report.toStringResult(), report.report(), true);
}
class MOZ_STACK_CLASS AutoSelfHostingErrorReporter