зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1622562 - Remove flags from JSErrorReport. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D67143 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
77e3057b6d
Коммит
366a89593e
|
@ -203,16 +203,6 @@ class JSErrorNotes {
|
|||
JS_PUBLIC_API iterator end();
|
||||
};
|
||||
|
||||
/*
|
||||
* JSErrorReport flag values. These may be freely composed.
|
||||
*
|
||||
* To be removed.
|
||||
*/
|
||||
#define JSREPORT_ERROR 0x0 /* pseudo-flag for default case */
|
||||
#define JSREPORT_WARNING 0x1 /* reported via JS::Warn* */
|
||||
|
||||
#define JSREPORT_USER_1 0x8 /* user-defined flag */
|
||||
|
||||
/**
|
||||
* Describes a single error or warning that occurs in the execution of script.
|
||||
*/
|
||||
|
@ -232,15 +222,15 @@ class JSErrorReport : public JSErrorBase {
|
|||
// Associated notes, or nullptr if there's no note.
|
||||
js::UniquePtr<JSErrorNotes> notes;
|
||||
|
||||
// error/warning, etc.
|
||||
unsigned flags;
|
||||
|
||||
// One of the JSExnType constants.
|
||||
int16_t exnType;
|
||||
|
||||
// See the comment in TransitiveCompileOptions.
|
||||
bool isMuted : 1;
|
||||
|
||||
// This error report is actually a warning.
|
||||
bool isWarning_ : 1;
|
||||
|
||||
private:
|
||||
bool ownsLinebuf_ : 1;
|
||||
|
||||
|
@ -250,9 +240,9 @@ class JSErrorReport : public JSErrorBase {
|
|||
linebufLength_(0),
|
||||
tokenOffset_(0),
|
||||
notes(nullptr),
|
||||
flags(0),
|
||||
exnType(0),
|
||||
isMuted(false),
|
||||
isWarning_(false),
|
||||
ownsLinebuf_(false) {}
|
||||
|
||||
~JSErrorReport() { freeLinebuf(); }
|
||||
|
@ -269,7 +259,7 @@ class JSErrorReport : public JSErrorBase {
|
|||
void initBorrowedLinebuf(const char16_t* linebufArg, size_t linebufLengthArg,
|
||||
size_t tokenOffsetArg);
|
||||
|
||||
bool isWarning() const { return !!(flags & JSREPORT_WARNING); }
|
||||
bool isWarning() const { return isWarning_; }
|
||||
|
||||
private:
|
||||
void freeLinebuf();
|
||||
|
|
|
@ -96,7 +96,7 @@ bool CopyExtraData(JSContext* cx, uint8_t** cursor, JSErrorReport* copy,
|
|||
/* Copy non-pointer members. */
|
||||
copy->isMuted = report->isMuted;
|
||||
copy->exnType = report->exnType;
|
||||
copy->flags = report->flags;
|
||||
copy->isWarning_ = report->isWarning_;
|
||||
|
||||
/* Deep copy notes. */
|
||||
if (report->notes) {
|
||||
|
@ -627,7 +627,7 @@ bool ErrorReport::populateUncaughtExceptionReportUTF8(JSContext* cx, ...) {
|
|||
bool ErrorReport::populateUncaughtExceptionReportUTF8VA(JSContext* cx,
|
||||
va_list ap) {
|
||||
new (&ownedReport) JSErrorReport();
|
||||
ownedReport.flags = JSREPORT_ERROR;
|
||||
ownedReport.isWarning_ = false;
|
||||
ownedReport.errorNumber = JSMSG_UNCAUGHT_EXCEPTION;
|
||||
// XXXbz this assumes the stack we have right now is still
|
||||
// related to our exception object. It would be better if we
|
||||
|
|
|
@ -63,7 +63,7 @@ bool js::ReportCompileWarning(JSContext* cx, ErrorMetadata&& metadata,
|
|||
}
|
||||
|
||||
err->notes = std::move(notes);
|
||||
err->flags = JSREPORT_WARNING;
|
||||
err->isWarning_ = true;
|
||||
err->errorNumber = errorNumber;
|
||||
|
||||
err->filename = metadata.filename;
|
||||
|
@ -102,7 +102,7 @@ static void ReportCompileErrorImpl(JSContext* cx, js::ErrorMetadata&& metadata,
|
|||
}
|
||||
|
||||
err->notes = std::move(notes);
|
||||
err->flags = JSREPORT_ERROR;
|
||||
err->isWarning_ = false;
|
||||
err->errorNumber = errorNumber;
|
||||
|
||||
err->filename = metadata.filename;
|
||||
|
@ -465,8 +465,7 @@ bool js::ReportErrorNumberVA(JSContext* cx, IsWarning isWarning,
|
|||
const unsigned errorNumber,
|
||||
ErrorArgumentsType argumentsType, va_list ap) {
|
||||
JSErrorReport report;
|
||||
report.flags =
|
||||
isWarning == IsWarning::Yes ? JSREPORT_WARNING : JSREPORT_ERROR;
|
||||
report.isWarning_ = isWarning == IsWarning::Yes;
|
||||
report.errorNumber = errorNumber;
|
||||
PopulateReportBlame(cx, &report);
|
||||
|
||||
|
@ -506,8 +505,7 @@ static bool ReportErrorNumberArray(JSContext* cx, IsWarning isWarning,
|
|||
"Mismatch between character type and argument type");
|
||||
|
||||
JSErrorReport report;
|
||||
report.flags =
|
||||
isWarning == IsWarning::Yes ? JSREPORT_WARNING : JSREPORT_ERROR;
|
||||
report.isWarning_ = isWarning == IsWarning::Yes;
|
||||
report.errorNumber = errorNumber;
|
||||
PopulateReportBlame(cx, &report);
|
||||
|
||||
|
@ -550,8 +548,7 @@ bool js::ReportErrorVA(JSContext* cx, IsWarning isWarning, const char* format,
|
|||
MOZ_ASSERT_IF(argumentsType == ArgumentsAreASCII,
|
||||
JS::StringIsASCII(message.get()));
|
||||
|
||||
report.flags =
|
||||
isWarning == IsWarning::Yes ? JSREPORT_WARNING : JSREPORT_ERROR;
|
||||
report.isWarning_ = isWarning == IsWarning::Yes;
|
||||
report.errorNumber = JSMSG_USER_DEFINED_ERROR;
|
||||
if (argumentsType == ArgumentsAreASCII || argumentsType == ArgumentsAreUTF8) {
|
||||
report.initOwnedMessage(message.release());
|
||||
|
|
|
@ -373,7 +373,7 @@ static void PrintErrorLine(FILE* file, const char* prefix,
|
|||
JSErrorNotes::Note* note) {}
|
||||
|
||||
template <typename T>
|
||||
static bool PrintSingleError(JSContext* cx, FILE* file,
|
||||
static void PrintSingleError(JSContext* cx, FILE* file,
|
||||
JS::ConstUTF8CharsZ toStringResult, T* report,
|
||||
PrintErrorKind kind) {
|
||||
UniqueChars prefix;
|
||||
|
@ -426,17 +426,16 @@ static bool PrintSingleError(JSContext* cx, FILE* file,
|
|||
fputc('\n', file);
|
||||
|
||||
fflush(file);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool js::PrintError(JSContext* cx, FILE* file,
|
||||
void js::PrintError(JSContext* cx, FILE* file,
|
||||
JS::ConstUTF8CharsZ toStringResult, JSErrorReport* report,
|
||||
bool reportWarnings) {
|
||||
MOZ_ASSERT(report);
|
||||
|
||||
/* Conditionally ignore reported warnings. */
|
||||
if (report->isWarning() && !reportWarnings) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
PrintErrorKind kind = PrintErrorKind::Error;
|
||||
|
@ -451,8 +450,6 @@ bool js::PrintError(JSContext* cx, FILE* file,
|
|||
PrintErrorKind::Note);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void js::ReportIsNotDefined(JSContext* cx, HandleId id) {
|
||||
|
|
|
@ -1054,13 +1054,10 @@ extern void DestroyContext(JSContext* cx);
|
|||
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,
|
||||
// Writes a full report to a file descriptor.
|
||||
// Does nothing for JSErrorReport which are warnings, unless
|
||||
// reportWarnings is set.
|
||||
extern void PrintError(JSContext* cx, FILE* file,
|
||||
JS::ConstUTF8CharsZ toStringResult,
|
||||
JSErrorReport* report, bool reportWarnings);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче