Bug 1711878 - Remove unused JSContext arguments from PrintErrorImpl and PrintSingleError. r=mgaudet

Differential Revision: https://phabricator.services.mozilla.com/D115754
This commit is contained in:
NuriAmari 2021-06-01 13:56:19 +00:00
Родитель c80e2f09d3
Коммит 307c53eb25
8 изменённых файлов: 22 добавлений и 25 удалений

Просмотреть файл

@ -355,11 +355,10 @@ struct MOZ_STACK_CLASS JS_PUBLIC_API ErrorReportBuilder {
// Writes a full report to a file descriptor. Does nothing for JSErrorReports
// which are warnings, unless reportWarnings is set.
extern JS_PUBLIC_API void PrintError(JSContext* cx, FILE* file,
JSErrorReport* report,
extern JS_PUBLIC_API void PrintError(FILE* file, JSErrorReport* report,
bool reportWarnings);
extern JS_PUBLIC_API void PrintError(JSContext* cx, FILE* file,
extern JS_PUBLIC_API void PrintError(FILE* file,
const JS::ErrorReportBuilder& builder,
bool reportWarnings);

Просмотреть файл

@ -52,7 +52,7 @@ BEGIN_TEST(testPrintError_Works) {
JS::ErrorReportBuilder builder(cx);
CHECK(builder.init(cx, exnStack, JS::ErrorReportBuilder::NoSideEffects));
JS::PrintError(cx, buf.stream(), builder, false);
JS::PrintError(buf.stream(), builder, false);
CHECK(buf.contains("testPrintError_Works.js:3:1 uncaught exception: null\n"));
@ -71,7 +71,7 @@ static bool warningSuccess;
static void warningReporter(JSContext* cx, JSErrorReport* report) {
AutoStreamBuffer buf;
JS::PrintError(cx, buf.stream(), report, false);
JS::PrintError(buf.stream(), report, false);
warningSuccess = buf.contains("");
}
END_TEST(testPrintError_SkipWarning)
@ -89,7 +89,7 @@ static bool warningSuccess;
static void warningReporter(JSContext* cx, JSErrorReport* report) {
AutoStreamBuffer buf;
JS::PrintError(cx, buf.stream(), report, true);
JS::PrintError(buf.stream(), report, true);
warningSuccess = buf.contains("warning: warning message\n");
}
END_TEST(testPrintError_PrintWarning)
@ -111,7 +111,7 @@ BEGIN_TEST(testPrintError_UTF16CodePoints) {
JS::ErrorReportBuilder builder(cx);
CHECK(builder.init(cx, exnStack, JS::ErrorReportBuilder::NoSideEffects));
JS::PrintError(cx, buf.stream(), builder, false);
JS::PrintError(buf.stream(), builder, false);
CHECK(
buf.contains("testPrintError_UTF16CodePoints.js:3:4 SyntaxError: illegal "

Просмотреть файл

@ -292,7 +292,7 @@ void js::ErrorToException(JSContext* cx, JSErrorReport* reportp,
// cannot construct the Error constructor without self-hosted code. Just
// print the error to stderr to help debugging.
if (cx->realm()->isSelfHostingRealm()) {
JS::PrintError(cx, stderr, reportp, true);
JS::PrintError(stderr, reportp, true);
return;
}

Просмотреть файл

@ -10192,7 +10192,7 @@ js::shell::AutoReportException::~AutoReportException() {
MOZ_ASSERT(!report.report()->isWarning());
FILE* fp = ErrorFilePointer();
JS::PrintError(cx, fp, report, reportWarnings);
JS::PrintError(fp, report, reportWarnings);
JS_ClearPendingException(cx);
if (!PrintStackTrace(cx, exnStack.stack())) {
@ -10232,7 +10232,7 @@ void js::shell::WarningReporter(JSContext* cx, JSErrorReport* report) {
}
// Print the warning.
JS::PrintError(cx, fp, report, reportWarnings);
JS::PrintError(fp, report, reportWarnings);
}
static bool global_enumerate(JSContext* cx, JS::HandleObject obj,

Просмотреть файл

@ -44,7 +44,7 @@ static void CrashOnPendingException() {
fprintf(stderr, "out of memory initializing JS::ErrorReportBuilder\n");
fflush(stderr);
} else {
JS::PrintError(gCx, stderr, report, js::shell::reportWarnings);
JS::PrintError(stderr, report, js::shell::reportWarnings);
if (!js::shell::PrintStackTrace(gCx, exnStack.stack())) {
fputs("(Unable to print stack trace)\n", stderr);
}

Просмотреть файл

@ -589,5 +589,5 @@ void js::MaybePrintAndClearPendingException(JSContext* cx) {
}
MOZ_ASSERT(!report.report()->isWarning());
JS::PrintError(cx, stderr, report, true);
JS::PrintError(stderr, report, true);
}

Просмотреть файл

@ -417,9 +417,8 @@ static void PrintErrorLine(FILE* file, const char* prefix,
JSErrorNotes::Note* note) {}
template <typename T>
static void PrintSingleError(JSContext* cx, FILE* file,
JS::ConstUTF8CharsZ toStringResult, T* report,
PrintErrorKind kind) {
static void PrintSingleError(FILE* file, JS::ConstUTF8CharsZ toStringResult,
T* report, PrintErrorKind kind) {
UniqueChars prefix;
if (report->filename) {
prefix = JS_smprintf("%s:", report->filename);
@ -472,8 +471,7 @@ static void PrintSingleError(JSContext* cx, FILE* file,
fflush(file);
}
static void PrintErrorImpl(JSContext* cx, FILE* file,
JS::ConstUTF8CharsZ toStringResult,
static void PrintErrorImpl(FILE* file, JS::ConstUTF8CharsZ toStringResult,
JSErrorReport* report, bool reportWarnings) {
MOZ_ASSERT(report);
@ -486,25 +484,25 @@ static void PrintErrorImpl(JSContext* cx, FILE* file,
if (report->isWarning()) {
kind = PrintErrorKind::Warning;
}
PrintSingleError(cx, file, toStringResult, report, kind);
PrintSingleError(file, toStringResult, report, kind);
if (report->notes) {
for (auto&& note : *report->notes) {
PrintSingleError(cx, file, JS::ConstUTF8CharsZ(), note.get(),
PrintSingleError(file, JS::ConstUTF8CharsZ(), note.get(),
PrintErrorKind::Note);
}
}
}
JS_PUBLIC_API void JS::PrintError(JSContext* cx, FILE* file,
JSErrorReport* report, bool reportWarnings) {
PrintErrorImpl(cx, file, JS::ConstUTF8CharsZ(), report, reportWarnings);
JS_PUBLIC_API void JS::PrintError(FILE* file, JSErrorReport* report,
bool reportWarnings) {
PrintErrorImpl(file, JS::ConstUTF8CharsZ(), report, reportWarnings);
}
JS_PUBLIC_API void JS::PrintError(JSContext* cx, FILE* file,
JS_PUBLIC_API void JS::PrintError(FILE* file,
const JS::ErrorReportBuilder& builder,
bool reportWarnings) {
PrintErrorImpl(cx, file, builder.toStringResult(), builder.report(),
PrintErrorImpl(file, builder.toStringResult(), builder.report(),
reportWarnings);
}

Просмотреть файл

@ -118,7 +118,7 @@ using mozilla::Maybe;
static void selfHosting_WarningReporter(JSContext* cx, JSErrorReport* report) {
MOZ_ASSERT(report->isWarning());
JS::PrintError(cx, stderr, report, true);
JS::PrintError(stderr, report, true);
}
static bool intrinsic_ToObject(JSContext* cx, unsigned argc, Value* vp) {