mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1063241 - Use a constructor instead of manual PodZero to initialize JSErrorReport; r=sfink
--HG-- extra : rebase_source : 7e1e35345b613da651abd0405daac6c823b3c65c
This commit is contained in:
parent
32c440d97e
commit
5f31e3b585
@ -173,11 +173,7 @@ struct CompileError {
|
||||
JSErrorReport report;
|
||||
char *message;
|
||||
ErrorArgumentsType argumentsType;
|
||||
CompileError()
|
||||
: message(nullptr), argumentsType(ArgumentsAreUnicode)
|
||||
{
|
||||
mozilla::PodZero(&report);
|
||||
}
|
||||
CompileError() : message(nullptr), argumentsType(ArgumentsAreUnicode) {}
|
||||
~CompileError();
|
||||
void throwError(JSContext *cx);
|
||||
|
||||
|
@ -4675,10 +4675,19 @@ JS_ReportOutOfMemory(JSContext *cx);
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_ReportAllocationOverflow(JSContext *cx);
|
||||
|
||||
struct JSErrorReport {
|
||||
class JSErrorReport
|
||||
{
|
||||
public:
|
||||
JSErrorReport()
|
||||
: filename(nullptr), lineno(0), column(0), isMuted(false), linebuf(nullptr),
|
||||
tokenptr(nullptr), uclinebuf(nullptr), uctokenptr(nullptr), flags(0), errorNumber(0),
|
||||
ucmessage(nullptr), messageArgs(nullptr), exnType(0)
|
||||
{}
|
||||
|
||||
const char *filename; /* source file name, URL, etc., or null */
|
||||
bool isMuted; /* See the comment in ReadOnlyCompileOptions. */
|
||||
unsigned lineno; /* source line number */
|
||||
unsigned column; /* zero-based column index in line */
|
||||
bool isMuted; /* See the comment in ReadOnlyCompileOptions. */
|
||||
const char *linebuf; /* offending source line without final \n */
|
||||
const char *tokenptr; /* pointer to error token in linebuf */
|
||||
const char16_t *uclinebuf; /* unicode (original) line buffer */
|
||||
@ -4688,7 +4697,6 @@ struct JSErrorReport {
|
||||
const char16_t *ucmessage; /* the (default) error message */
|
||||
const char16_t **messageArgs; /* arguments for the error message */
|
||||
int16_t exnType; /* One of the JSExnType constants */
|
||||
unsigned column; /* zero-based column index in line */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -55,7 +55,6 @@ using namespace js::gc;
|
||||
|
||||
using mozilla::DebugOnly;
|
||||
using mozilla::PodArrayZero;
|
||||
using mozilla::PodZero;
|
||||
using mozilla::PointerRangeSize;
|
||||
|
||||
bool
|
||||
@ -381,7 +380,6 @@ js_ReportOutOfMemory(ThreadSafeContext *cxArg)
|
||||
|
||||
/* Fill out the report, but don't do anything that requires allocation. */
|
||||
JSErrorReport report;
|
||||
PodZero(&report);
|
||||
report.flags = JSREPORT_ERROR;
|
||||
report.errorNumber = JSMSG_OUT_OF_MEMORY;
|
||||
PopulateReportBlame(cx, &report);
|
||||
@ -503,7 +501,6 @@ js_ReportErrorVA(JSContext *cx, unsigned flags, const char *format, va_list ap)
|
||||
return false;
|
||||
messagelen = strlen(message);
|
||||
|
||||
PodZero(&report);
|
||||
report.flags = flags;
|
||||
report.errorNumber = JSMSG_USER_DEFINED_ERROR;
|
||||
report.ucmessage = ucmessage = InflateString(cx, message, &messagelen);
|
||||
@ -808,7 +805,6 @@ js_ReportErrorNumberVA(JSContext *cx, unsigned flags, JSErrorCallback callback,
|
||||
return true;
|
||||
warning = JSREPORT_IS_WARNING(flags);
|
||||
|
||||
PodZero(&report);
|
||||
report.flags = flags;
|
||||
report.errorNumber = errorNumber;
|
||||
PopulateReportBlame(cx, &report);
|
||||
@ -848,7 +844,6 @@ js_ReportErrorNumberUCArray(JSContext *cx, unsigned flags, JSErrorCallback callb
|
||||
bool warning = JSREPORT_IS_WARNING(flags);
|
||||
|
||||
JSErrorReport report;
|
||||
PodZero(&report);
|
||||
report.flags = flags;
|
||||
report.errorNumber = errorNumber;
|
||||
PopulateReportBlame(cx, &report);
|
||||
|
@ -40,7 +40,6 @@ using namespace js::types;
|
||||
|
||||
using mozilla::ArrayLength;
|
||||
using mozilla::PodArrayZero;
|
||||
using mozilla::PodZero;
|
||||
|
||||
static void
|
||||
exn_finalize(FreeOp *fop, JSObject *obj);
|
||||
@ -813,7 +812,7 @@ ErrorReport::init(JSContext *cx, HandleValue exn)
|
||||
}
|
||||
|
||||
reportp = &ownedReport;
|
||||
PodZero(&ownedReport);
|
||||
new (reportp) JSErrorReport();
|
||||
ownedReport.filename = filename.ptr();
|
||||
ownedReport.lineno = lineno;
|
||||
ownedReport.exnType = int16_t(JSEXN_NONE);
|
||||
@ -865,7 +864,7 @@ ErrorReport::populateUncaughtExceptionReport(JSContext *cx, ...)
|
||||
void
|
||||
ErrorReport::populateUncaughtExceptionReportVA(JSContext *cx, va_list ap)
|
||||
{
|
||||
PodZero(&ownedReport);
|
||||
new (&ownedReport) JSErrorReport();
|
||||
ownedReport.flags = JSREPORT_ERROR;
|
||||
ownedReport.errorNumber = JSMSG_UNCAUGHT_EXCEPTION;
|
||||
// XXXbz this assumes the stack we have right now is still
|
||||
|
@ -45,7 +45,7 @@ class JSAtom;
|
||||
struct JSErrorFormatString;
|
||||
class JSLinearString;
|
||||
struct JSJitInfo;
|
||||
struct JSErrorReport;
|
||||
class JSErrorReport;
|
||||
|
||||
namespace JS {
|
||||
template <class T>
|
||||
|
@ -125,7 +125,7 @@ enum JSGCTraceKind {
|
||||
struct JSClass;
|
||||
struct JSCompartment;
|
||||
struct JSCrossCompartmentCall;
|
||||
struct JSErrorReport;
|
||||
class JSErrorReport;
|
||||
struct JSExceptionState;
|
||||
struct JSFunctionSpec;
|
||||
struct JSIdArray;
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "vm/Shape-inl.h"
|
||||
|
||||
using namespace js;
|
||||
using mozilla::PodZero;
|
||||
|
||||
/* static */ Shape *
|
||||
js::ErrorObject::assignInitialShape(ExclusiveContext *cx, Handle<ErrorObject*> obj)
|
||||
@ -116,7 +115,6 @@ js::ErrorObject::getOrCreateErrorReport(JSContext *cx)
|
||||
// We build an error report on the stack and then use CopyErrorReport to do
|
||||
// the nitty-gritty malloc stuff.
|
||||
JSErrorReport report;
|
||||
PodZero(&report);
|
||||
|
||||
// Type.
|
||||
JSExnType type_ = type();
|
||||
|
Loading…
Reference in New Issue
Block a user