Backed out 4 changesets (bug 1831845) for causing spidermonkey bustages. CLOSED TREE
Backed out changeset a9765ccd45b1 (bug 1831845) Backed out changeset 0d23be10f378 (bug 1831845) Backed out changeset 5c31df65197e (bug 1831845) Backed out changeset 11e79bc5149a (bug 1831845)
This commit is contained in:
@@ -57,7 +57,7 @@ struct DevTools : public ::testing::Test {
|
||||
static void reportError(JSContext* cx, const char* message,
|
||||
JSErrorReport* report) {
|
||||
fprintf(stderr, "%s:%u:%s\n",
|
||||
report->filename ? report->filename.c_str() : "<no filename>",
|
||||
report->filename ? report->filename : "<no filename>",
|
||||
(unsigned int)report->lineno, message);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ void ClonedErrorHolder::Init(JSContext* aCx, JS::Handle<JSObject*> aError,
|
||||
mMessage = err->message().c_str();
|
||||
}
|
||||
if (err->filename) {
|
||||
mFilename = err->filename.c_str();
|
||||
mFilename = err->filename;
|
||||
}
|
||||
if (err->linebuf()) {
|
||||
AppendUTF16toUTF8(
|
||||
|
||||
@@ -230,9 +230,8 @@ void WorkletNodeEngine::SendProcessorError(AudioNodeTrack* aTrack,
|
||||
|
||||
ProcessorErrorDetails details;
|
||||
|
||||
CopyUTF8toUTF16(
|
||||
mozilla::MakeStringSpan(jsReport.report()->filename.c_str()),
|
||||
details.mFilename);
|
||||
CopyUTF8toUTF16(mozilla::MakeStringSpan(jsReport.report()->filename),
|
||||
details.mFilename);
|
||||
|
||||
xpc::ErrorReport::ErrorReportToMessageString(jsReport.report(),
|
||||
details.mMessage);
|
||||
|
||||
@@ -224,7 +224,7 @@ class ReportGenericErrorRunnable final : public WorkerDebuggeeRunnable {
|
||||
} // namespace
|
||||
|
||||
void WorkerErrorBase::AssignErrorBase(JSErrorBase* aReport) {
|
||||
CopyUTF8toUTF16(MakeStringSpan(aReport->filename.c_str()), mFilename);
|
||||
CopyUTF8toUTF16(MakeStringSpan(aReport->filename), mFilename);
|
||||
mLineNumber = aReport->lineno;
|
||||
mColumnNumber = aReport->column;
|
||||
mErrorNumber = aReport->errorNumber;
|
||||
|
||||
@@ -142,12 +142,6 @@ class JS_PUBLIC_API ConstUTF8CharsZ {
|
||||
|
||||
ConstUTF8CharsZ() : data_(nullptr) {}
|
||||
|
||||
explicit ConstUTF8CharsZ(const char* aBytes) : data_(aBytes) {
|
||||
#ifdef DEBUG
|
||||
validateWithoutLength();
|
||||
#endif
|
||||
}
|
||||
|
||||
ConstUTF8CharsZ(const char* aBytes, size_t aLength) : data_(aBytes) {
|
||||
MOZ_ASSERT(aBytes[aLength] == '\0');
|
||||
#ifdef DEBUG
|
||||
@@ -164,7 +158,6 @@ class JS_PUBLIC_API ConstUTF8CharsZ {
|
||||
private:
|
||||
#ifdef DEBUG
|
||||
void validate(size_t aLength);
|
||||
void validateWithoutLength();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -60,8 +60,7 @@
|
||||
|
||||
#include "jstypes.h" // JS_PUBLIC_API
|
||||
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/TypeDecls.h" // JS::MutableHandle (fwd)
|
||||
#include "js/TypeDecls.h" // JS::MutableHandle (fwd)
|
||||
|
||||
namespace JS {
|
||||
|
||||
@@ -124,9 +123,11 @@ class JS_PUBLIC_API TransitiveCompileOptions {
|
||||
protected:
|
||||
// non-POD options:
|
||||
|
||||
JS::ConstUTF8CharsZ filename_;
|
||||
// UTF-8 encoded file name.
|
||||
const char* filename_ = nullptr;
|
||||
|
||||
JS::ConstUTF8CharsZ introducerFilename_;
|
||||
// UTF-8 encoded introducer file name.
|
||||
const char* introducerFilename_ = nullptr;
|
||||
|
||||
const char16_t* sourceMapURL_ = nullptr;
|
||||
|
||||
@@ -299,8 +300,8 @@ class JS_PUBLIC_API TransitiveCompileOptions {
|
||||
return eagerDelazificationStrategy_;
|
||||
}
|
||||
bool sourcePragmas() const { return sourcePragmas_; }
|
||||
JS::ConstUTF8CharsZ filename() const { return filename_; }
|
||||
JS::ConstUTF8CharsZ introducerFilename() const { return introducerFilename_; }
|
||||
const char* filename() const { return filename_; }
|
||||
const char* introducerFilename() const { return introducerFilename_; }
|
||||
const char16_t* sourceMapURL() const { return sourceMapURL_; }
|
||||
|
||||
TransitiveCompileOptions(const TransitiveCompileOptions&) = delete;
|
||||
@@ -479,7 +480,7 @@ class MOZ_STACK_CLASS JS_PUBLIC_API CompileOptions final
|
||||
: ReadOnlyCompileOptions() {}
|
||||
|
||||
CompileOptions& setFile(const char* f) {
|
||||
filename_ = JS::ConstUTF8CharsZ(f);
|
||||
filename_ = f;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -489,7 +490,7 @@ class MOZ_STACK_CLASS JS_PUBLIC_API CompileOptions final
|
||||
}
|
||||
|
||||
CompileOptions& setFileAndLine(const char* f, unsigned l) {
|
||||
filename_ = JS::ConstUTF8CharsZ(f);
|
||||
filename_ = f;
|
||||
lineno = l;
|
||||
return *this;
|
||||
}
|
||||
@@ -562,7 +563,7 @@ class MOZ_STACK_CLASS JS_PUBLIC_API CompileOptions final
|
||||
CompileOptions& setIntroductionInfo(const char* introducerFn,
|
||||
const char* intro, unsigned line,
|
||||
uint32_t offset) {
|
||||
introducerFilename_ = JS::ConstUTF8CharsZ(introducerFn);
|
||||
introducerFilename_ = introducerFn;
|
||||
introductionType = intro;
|
||||
introductionLineno = line;
|
||||
introductionOffset = offset;
|
||||
@@ -662,7 +663,7 @@ class JS_PUBLIC_API DecodeOptions {
|
||||
bool allocateInstantiationStorage = false;
|
||||
bool forceAsync = false;
|
||||
|
||||
const JS::ConstUTF8CharsZ introducerFilename;
|
||||
const char* introducerFilename = nullptr;
|
||||
|
||||
// See `TransitiveCompileOptions::introductionType` field for details.
|
||||
const char* introductionType = nullptr;
|
||||
|
||||
@@ -111,8 +111,8 @@ class JSErrorBase {
|
||||
JS::ConstUTF8CharsZ message_;
|
||||
|
||||
public:
|
||||
// Source file name, URL, etc., or null.
|
||||
JS::ConstUTF8CharsZ filename;
|
||||
// The UTF-8 encoded source file name, URL, etc., or null.
|
||||
const char* filename;
|
||||
|
||||
// Unique identifier for the script source.
|
||||
unsigned sourceId;
|
||||
|
||||
@@ -489,7 +489,7 @@ void GeneralParser<ParseHandler, Unit>::reportMissingClosing(
|
||||
char lineNumber[MaxWidth];
|
||||
SprintfLiteral(lineNumber, "%" PRIu32, line);
|
||||
|
||||
if (!notes->addNoteASCII(this->fc_, getFilename().c_str(), 0, line, column,
|
||||
if (!notes->addNoteASCII(this->fc_, getFilename(), 0, line, column,
|
||||
GetErrorMessage, nullptr, noteNumber, lineNumber,
|
||||
columnNumber)) {
|
||||
return;
|
||||
@@ -529,7 +529,7 @@ void GeneralParser<ParseHandler, Unit>::reportRedeclaration(
|
||||
char lineNumber[MaxWidth];
|
||||
SprintfLiteral(lineNumber, "%" PRIu32, line);
|
||||
|
||||
if (!notes->addNoteASCII(this->fc_, getFilename().c_str(), 0, line, column,
|
||||
if (!notes->addNoteASCII(this->fc_, getFilename(), 0, line, column,
|
||||
GetErrorMessage, nullptr, JSMSG_REDECLARED_PREV,
|
||||
lineNumber, columnNumber)) {
|
||||
return;
|
||||
|
||||
@@ -183,7 +183,6 @@
|
||||
#include "frontend/SharedContext.h"
|
||||
#include "frontend/SyntaxParseHandler.h"
|
||||
#include "frontend/TokenStream.h"
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/friend/ErrorMessages.h" // JSErrNum, JSMSG_*
|
||||
#include "vm/GeneratorAndAsyncKind.h" // js::GeneratorKind, js::FunctionAsyncKind
|
||||
|
||||
@@ -327,7 +326,7 @@ class MOZ_STACK_CLASS ParserBase : public ParserSharedBase,
|
||||
|
||||
bool checkOptions();
|
||||
|
||||
JS::ConstUTF8CharsZ getFilename() const { return anyChars.getFilename(); }
|
||||
const char* getFilename() const { return anyChars.getFilename(); }
|
||||
TokenPos pos() const { return anyChars.currentToken().pos; }
|
||||
|
||||
// Determine whether |yield| is a valid name in the current context.
|
||||
|
||||
@@ -4338,14 +4338,6 @@ struct DumpOptionsFields {
|
||||
}
|
||||
json.nullProperty(name);
|
||||
}
|
||||
|
||||
void operator()(const char* name, JS::ConstUTF8CharsZ value) {
|
||||
if (value) {
|
||||
json.property(name, value.c_str());
|
||||
return;
|
||||
}
|
||||
json.nullProperty(name);
|
||||
}
|
||||
};
|
||||
|
||||
static void DumpOptionsFields(js::JSONPrinter& json,
|
||||
|
||||
@@ -1314,8 +1314,8 @@ XDRResult StencilXDR::codeSource(XDRState<mode>* xdr,
|
||||
source->introductionType_ = maybeOptions->introductionType;
|
||||
source->setIntroductionOffset(maybeOptions->introductionOffset);
|
||||
if (maybeOptions->introducerFilename) {
|
||||
if (!source->setIntroducerFilename(
|
||||
fc, maybeOptions->introducerFilename.c_str())) {
|
||||
if (!source->setIntroducerFilename(fc,
|
||||
maybeOptions->introducerFilename)) {
|
||||
return xdr->fail(JS::TranscodeResult::Throw);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "frontend/Parser.h"
|
||||
#include "frontend/ParserAtom.h"
|
||||
#include "frontend/ReservedWords.h"
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
#include "js/Printf.h" // JS_smprintf
|
||||
#include "js/RegExpFlags.h" // JS::RegExpFlags
|
||||
@@ -1035,8 +1034,8 @@ MOZ_COLD void TokenStreamChars<Utf8Unit, AnyCharsAccess>::internalEncodingError(
|
||||
uint32_t line, column;
|
||||
computeLineAndColumn(offset, &line, &column);
|
||||
|
||||
if (!notes->addNoteASCII(anyChars.fc, anyChars.getFilename().c_str(), 0,
|
||||
line, column, GetErrorMessage, nullptr,
|
||||
if (!notes->addNoteASCII(anyChars.fc, anyChars.getFilename(), 0, line,
|
||||
column, GetErrorMessage, nullptr,
|
||||
JSMSG_BAD_CODE_UNITS, badUnitsStr)) {
|
||||
break;
|
||||
}
|
||||
@@ -1596,7 +1595,7 @@ bool TokenStreamAnyChars::fillExceptingContext(ErrorMetadata* err,
|
||||
FrameIter::FOLLOW_DEBUGGER_EVAL_PREV_LINK,
|
||||
maybeCx->realm()->principals());
|
||||
if (!iter.done() && iter.filename()) {
|
||||
err->filename = JS::ConstUTF8CharsZ(iter.filename());
|
||||
err->filename = iter.filename();
|
||||
err->lineNumber = iter.computeLine(&err->columnNumber);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -204,7 +204,6 @@
|
||||
#include "frontend/ParserAtom.h" // ParserAtom, ParserAtomsTable, TaggedParserAtomIndex
|
||||
#include "frontend/Token.h"
|
||||
#include "frontend/TokenKind.h"
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/CompileOptions.h"
|
||||
#include "js/friend/ErrorMessages.h" // JSMSG_*
|
||||
#include "js/HashTable.h" // js::HashMap
|
||||
@@ -574,7 +573,7 @@ class TokenStreamAnyChars : public TokenStreamShared {
|
||||
StrictModeGetter* const strictModeGetter_;
|
||||
|
||||
/** Input filename or null. */
|
||||
JS::ConstUTF8CharsZ filename_;
|
||||
const char* const filename_;
|
||||
|
||||
// Column number computation fields.
|
||||
|
||||
@@ -1021,7 +1020,7 @@ class TokenStreamAnyChars : public TokenStreamShared {
|
||||
|
||||
const JS::ReadOnlyCompileOptions& options() const { return options_; }
|
||||
|
||||
JS::ConstUTF8CharsZ getFilename() const { return filename_; }
|
||||
const char* getFilename() const { return filename_; }
|
||||
};
|
||||
|
||||
constexpr char16_t CodeUnitValue(char16_t unit) { return unit; }
|
||||
|
||||
@@ -42,7 +42,7 @@ static void checkBool(bool success) {
|
||||
/* The warning reporter callback. */
|
||||
void reportWarning(JSContext* cx, JSErrorReport* report) {
|
||||
fprintf(stderr, "%s:%u: %s\n",
|
||||
report->filename ? report->filename.c_str() : "<no filename>",
|
||||
report->filename ? report->filename : "<no filename>",
|
||||
(unsigned int)report->lineno, report->message().c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -382,7 +382,7 @@ class JSAPIRuntimeTest : public JSAPITest {
|
||||
MOZ_RELEASE_ASSERT(report->isWarning());
|
||||
|
||||
fprintf(stderr, "%s:%u:%s\n",
|
||||
report->filename ? report->filename.c_str() : "<no filename>",
|
||||
report->filename ? report->filename : "<no filename>",
|
||||
(unsigned int)report->lineno, report->message().c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -2345,21 +2345,21 @@ JS::OwningCompileOptions::OwningCompileOptions(JSContext* cx)
|
||||
|
||||
void JS::OwningCompileOptions::release() {
|
||||
// OwningCompileOptions always owns these, so these casts are okay.
|
||||
js_free(const_cast<char*>(filename_.c_str()));
|
||||
js_free(const_cast<char*>(filename_));
|
||||
js_free(const_cast<char16_t*>(sourceMapURL_));
|
||||
js_free(const_cast<char*>(introducerFilename_.c_str()));
|
||||
js_free(const_cast<char*>(introducerFilename_));
|
||||
|
||||
filename_ = JS::ConstUTF8CharsZ();
|
||||
filename_ = nullptr;
|
||||
sourceMapURL_ = nullptr;
|
||||
introducerFilename_ = JS::ConstUTF8CharsZ();
|
||||
introducerFilename_ = nullptr;
|
||||
}
|
||||
|
||||
JS::OwningCompileOptions::~OwningCompileOptions() { release(); }
|
||||
|
||||
size_t JS::OwningCompileOptions::sizeOfExcludingThis(
|
||||
mozilla::MallocSizeOf mallocSizeOf) const {
|
||||
return mallocSizeOf(filename_.c_str()) + mallocSizeOf(sourceMapURL_) +
|
||||
mallocSizeOf(introducerFilename_.c_str());
|
||||
return mallocSizeOf(filename_) + mallocSizeOf(sourceMapURL_) +
|
||||
mallocSizeOf(introducerFilename_);
|
||||
}
|
||||
|
||||
bool JS::OwningCompileOptions::copy(JSContext* cx,
|
||||
@@ -2371,11 +2371,10 @@ bool JS::OwningCompileOptions::copy(JSContext* cx,
|
||||
copyPODTransitiveOptions(rhs);
|
||||
|
||||
if (rhs.filename()) {
|
||||
const char* str = DuplicateString(cx, rhs.filename().c_str()).release();
|
||||
if (!str) {
|
||||
filename_ = DuplicateString(cx, rhs.filename()).release();
|
||||
if (!filename_) {
|
||||
return false;
|
||||
}
|
||||
filename_ = JS::ConstUTF8CharsZ(str);
|
||||
}
|
||||
|
||||
if (rhs.sourceMapURL()) {
|
||||
@@ -2386,12 +2385,11 @@ bool JS::OwningCompileOptions::copy(JSContext* cx,
|
||||
}
|
||||
|
||||
if (rhs.introducerFilename()) {
|
||||
const char* str =
|
||||
DuplicateString(cx, rhs.introducerFilename().c_str()).release();
|
||||
if (!str) {
|
||||
introducerFilename_ =
|
||||
DuplicateString(cx, rhs.introducerFilename()).release();
|
||||
if (!introducerFilename_) {
|
||||
return false;
|
||||
}
|
||||
introducerFilename_ = JS::ConstUTF8CharsZ(str);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -3884,7 +3882,7 @@ static UniquePtr<JSErrorNotes::Note> CreateErrorNoteVA(
|
||||
}
|
||||
|
||||
note->errorNumber = errorNumber;
|
||||
note->filename = JS::ConstUTF8CharsZ(filename);
|
||||
note->filename = filename;
|
||||
note->sourceId = sourceId;
|
||||
note->lineno = lineno;
|
||||
note->column = column;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "jstypes.h"
|
||||
|
||||
#include "frontend/FrontendContext.h" // AutoReportFrontendContext
|
||||
#include "js/CharacterEncoding.h" // JS::UTF8Chars, JS::ConstUTF8CharsZ
|
||||
#include "js/CharacterEncoding.h"
|
||||
#include "js/Class.h"
|
||||
#include "js/Conversions.h"
|
||||
#include "js/ErrorReport.h" // JS::PrintError
|
||||
@@ -147,8 +147,7 @@ static UniquePtr<T> CopyErrorHelper(JSContext* cx, T* report) {
|
||||
static_assert(sizeof(T) % sizeof(const char*) == 0);
|
||||
static_assert(sizeof(const char*) % sizeof(char16_t) == 0);
|
||||
|
||||
size_t filenameSize =
|
||||
report->filename ? strlen(report->filename.c_str()) + 1 : 0;
|
||||
size_t filenameSize = report->filename ? strlen(report->filename) + 1 : 0;
|
||||
size_t messageSize = 0;
|
||||
if (report->message()) {
|
||||
messageSize = strlen(report->message().c_str()) + 1;
|
||||
@@ -175,8 +174,8 @@ static UniquePtr<T> CopyErrorHelper(JSContext* cx, T* report) {
|
||||
}
|
||||
|
||||
if (report->filename) {
|
||||
copy->filename = JS::ConstUTF8CharsZ((const char*)cursor);
|
||||
js_memcpy(cursor, report->filename.c_str(), filenameSize);
|
||||
copy->filename = (const char*)cursor;
|
||||
js_memcpy(cursor, report->filename, filenameSize);
|
||||
cursor += filenameSize;
|
||||
}
|
||||
|
||||
@@ -325,7 +324,7 @@ void js::ErrorToException(JSContext* cx, JSErrorReport* reportp,
|
||||
}
|
||||
|
||||
Rooted<JSString*> fileName(cx);
|
||||
if (const char* filename = reportp->filename.c_str()) {
|
||||
if (const char* filename = reportp->filename) {
|
||||
fileName =
|
||||
JS_NewStringCopyUTF8N(cx, JS::UTF8Chars(filename, strlen(filename)));
|
||||
if (!fileName) {
|
||||
@@ -590,7 +589,7 @@ bool JS::ErrorReportBuilder::init(JSContext* cx,
|
||||
|
||||
reportp = &ownedReport;
|
||||
new (reportp) JSErrorReport();
|
||||
ownedReport.filename = JS::ConstUTF8CharsZ(filename.get());
|
||||
ownedReport.filename = filename.get();
|
||||
ownedReport.lineno = lineno;
|
||||
ownedReport.exnType = JSEXN_INTERNALERR;
|
||||
ownedReport.column = column;
|
||||
@@ -671,7 +670,7 @@ bool JS::ErrorReportBuilder::populateUncaughtExceptionReportUTF8VA(
|
||||
}
|
||||
|
||||
// |ownedReport.filename| inherits the lifetime of |ErrorReport::filename|.
|
||||
ownedReport.filename = JS::ConstUTF8CharsZ(filename.get());
|
||||
ownedReport.filename = filename.get();
|
||||
ownedReport.sourceId = frame->getSourceId();
|
||||
ownedReport.lineno = frame->getLine();
|
||||
// Follow FixupColumnForDisplay and set column to 1 for WASM.
|
||||
@@ -682,7 +681,7 @@ bool JS::ErrorReportBuilder::populateUncaughtExceptionReportUTF8VA(
|
||||
// related to our exception object.
|
||||
NonBuiltinFrameIter iter(cx, cx->realm()->principals());
|
||||
if (!iter.done()) {
|
||||
ownedReport.filename = JS::ConstUTF8CharsZ(iter.filename());
|
||||
ownedReport.filename = iter.filename();
|
||||
uint32_t column;
|
||||
ownedReport.sourceId =
|
||||
iter.hasScript() ? iter.script()->scriptSource()->id() : 0;
|
||||
|
||||
@@ -582,10 +582,6 @@ void JS::ConstUTF8CharsZ::validate(size_t aLength) {
|
||||
};
|
||||
InflateUTF8ToUTF16<OnUTF8Error::Crash>(/* cx = */ nullptr, chars, nop);
|
||||
}
|
||||
void JS::ConstUTF8CharsZ::validateWithoutLength() {
|
||||
MOZ_ASSERT(data_);
|
||||
validate(strlen(data_));
|
||||
}
|
||||
#endif
|
||||
|
||||
bool JS::StringIsASCII(const char* s) {
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include "frontend/BytecodeCompiler.h" // frontend::IsIdentifier
|
||||
#include "frontend/CompilationStencil.h" // for frontened::{CompilationStencil, BorrowingCompilationStencil, CompilationGCOutput}
|
||||
#include "frontend/FrontendContext.h" // js::AutoReportFrontendContext
|
||||
#include "frontend/Parser.h" // frontend::Parser, frontend::ParseGoal
|
||||
#include "js/CharacterEncoding.h" // JS::UTF8Chars, JS::ConstUTF8CharsZ, JS::UTF8CharsToNewTwoByteCharsZ
|
||||
#include "frontend/Parser.h" // frontend::Parser, frontend::ParseGoal
|
||||
#include "js/CharacterEncoding.h" // JS::UTF8Chars, JS::UTF8CharsToNewTwoByteCharsZ
|
||||
#include "js/experimental/JSStencil.h" // JS::Stencil
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
#include "js/RootingAPI.h" // JS::Rooted
|
||||
@@ -62,7 +62,7 @@ static void ReportSourceTooLongImpl(JS::FrontendContext* fc, ...) {
|
||||
va_start(args, fc);
|
||||
|
||||
js::ErrorMetadata metadata;
|
||||
metadata.filename = JS::ConstUTF8CharsZ("<unknown>");
|
||||
metadata.filename = "<unknown>";
|
||||
metadata.lineNumber = 0;
|
||||
metadata.columnNumber = 0;
|
||||
metadata.lineLength = 0;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "gc/GCContext.h"
|
||||
#include "js/CallArgs.h"
|
||||
#include "js/CallNonGenericMethod.h"
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/CharacterEncoding.h"
|
||||
#include "js/Class.h"
|
||||
#include "js/Conversions.h"
|
||||
#include "js/ErrorReport.h"
|
||||
@@ -577,7 +577,7 @@ JSErrorReport* js::ErrorObject::getOrCreateErrorReport(JSContext* cx) {
|
||||
if (!filenameStr) {
|
||||
return nullptr;
|
||||
}
|
||||
report.filename = JS::ConstUTF8CharsZ(filenameStr.get());
|
||||
report.filename = filenameStr.get();
|
||||
|
||||
// Coordinates.
|
||||
report.sourceId = sourceId();
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
#include "frontend/FrontendContext.h" // AutoReportFrontendContext
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
#include "js/Printf.h" // JS_vsmprintf
|
||||
#include "js/Warnings.h" // JS::WarningReporter
|
||||
@@ -64,7 +63,7 @@ bool js::ReportCompileWarning(FrontendContext* fc, ErrorMetadata&& metadata,
|
||||
err.isWarning_ = true;
|
||||
err.errorNumber = errorNumber;
|
||||
|
||||
err.filename = JS::ConstUTF8CharsZ(metadata.filename);
|
||||
err.filename = metadata.filename;
|
||||
err.lineno = metadata.lineNumber;
|
||||
err.column = metadata.columnNumber;
|
||||
err.isMuted = metadata.isMuted;
|
||||
@@ -93,7 +92,7 @@ static void ReportCompileErrorImpl(FrontendContext* fc,
|
||||
err.isWarning_ = false;
|
||||
err.errorNumber = errorNumber;
|
||||
|
||||
err.filename = JS::ConstUTF8CharsZ(metadata.filename);
|
||||
err.filename = metadata.filename;
|
||||
err.lineno = metadata.lineNumber;
|
||||
err.column = metadata.columnNumber;
|
||||
err.isMuted = metadata.isMuted;
|
||||
@@ -169,7 +168,7 @@ static void PopulateReportBlame(JSContext* cx, JSErrorReport* report) {
|
||||
return;
|
||||
}
|
||||
|
||||
report->filename = JS::ConstUTF8CharsZ(iter.filename());
|
||||
report->filename = iter.filename();
|
||||
if (iter.hasScript()) {
|
||||
report->sourceId = iter.script()->scriptSource()->id();
|
||||
}
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
|
||||
#include "jsfriendapi.h" // for ScriptEnvironmentPreparer
|
||||
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/ErrorReport.h" // for JSErrorNotes, JSErrorReport
|
||||
#include "js/UniquePtr.h" // for UniquePtr
|
||||
#include "js/Utility.h" // for UniqueTwoByteChars
|
||||
#include "js/ErrorReport.h" // for JSErrorNotes, JSErrorReport
|
||||
#include "js/UniquePtr.h" // for UniquePtr
|
||||
#include "js/Utility.h" // for UniqueTwoByteChars
|
||||
|
||||
namespace js {
|
||||
|
||||
@@ -32,7 +31,7 @@ using JSAllocator = JSContext;
|
||||
*/
|
||||
struct ErrorMetadata {
|
||||
// The file/URL where the error occurred.
|
||||
JS::ConstUTF8CharsZ filename;
|
||||
const char* filename;
|
||||
|
||||
// The line and column numbers where the error occurred. If the error
|
||||
// is with respect to the entire script and not with respect to a
|
||||
|
||||
@@ -482,7 +482,7 @@ static void PrintSingleError(FILE* file, JS::ConstUTF8CharsZ toStringResult,
|
||||
T* report, PrintErrorKind kind) {
|
||||
UniqueChars prefix;
|
||||
if (report->filename) {
|
||||
prefix = JS_smprintf("%s:", report->filename.c_str());
|
||||
prefix = JS_smprintf("%s:", report->filename);
|
||||
}
|
||||
|
||||
if (report->lineno) {
|
||||
@@ -696,7 +696,7 @@ JSObject* js::CreateErrorNotesArray(JSContext* cx, JSErrorReport* report) {
|
||||
}
|
||||
|
||||
RootedValue filenameVal(cx);
|
||||
if (const char* filename = note->filename.c_str()) {
|
||||
if (const char* filename = note->filename) {
|
||||
JS::UTF8Chars utf8chars(filename, strlen(filename));
|
||||
Rooted<JSString*> filenameStr(cx, NewStringCopyUTF8N(cx, utf8chars));
|
||||
if (!filenameStr) {
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "gc/Allocator.h" // CanGC
|
||||
#include "gc/Tracer.h" // JS::TraceRoot
|
||||
#include "js/AllocPolicy.h" // ReportOutOfMemory
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/ErrorReport.h" // JS_ReportErrorNumberASCII
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
#include "js/GCVector.h" // JS::GCVector
|
||||
@@ -1053,7 +1052,7 @@ void JSONSyntaxParseHandler<CharT>::reportError(const char* msg,
|
||||
const char* columnString) {
|
||||
ErrorMetadata metadata;
|
||||
metadata.isMuted = false;
|
||||
metadata.filename = JS::ConstUTF8CharsZ("");
|
||||
metadata.filename = "";
|
||||
metadata.lineNumber = 0;
|
||||
metadata.columnNumber = 0;
|
||||
|
||||
|
||||
@@ -1884,7 +1884,7 @@ bool ScriptSource::initFromOptions(FrontendContext* fc,
|
||||
if (options.hasIntroductionInfo) {
|
||||
MOZ_ASSERT(options.introductionType != nullptr);
|
||||
const char* filename =
|
||||
options.filename() ? options.filename().c_str() : "<unknown>";
|
||||
options.filename() ? options.filename() : "<unknown>";
|
||||
UniqueChars formatted = FormatIntroducedFilename(
|
||||
filename, options.introductionLineno, options.introductionType);
|
||||
if (!formatted) {
|
||||
@@ -1895,13 +1895,13 @@ bool ScriptSource::initFromOptions(FrontendContext* fc,
|
||||
return false;
|
||||
}
|
||||
} else if (options.filename()) {
|
||||
if (!setFilename(fc, options.filename().c_str())) {
|
||||
if (!setFilename(fc, options.filename())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (options.introducerFilename()) {
|
||||
if (!setIntroducerFilename(fc, options.introducerFilename().c_str())) {
|
||||
if (!setIntroducerFilename(fc, options.introducerFilename())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ PrecompiledScript::PrecompiledScript(nsISupports* aParent,
|
||||
JS::ReadOnlyCompileOptions& aOptions)
|
||||
: mParent(aParent),
|
||||
mStencil(aStencil),
|
||||
mURL(aOptions.filename().c_str()),
|
||||
mURL(aOptions.filename()),
|
||||
mHasReturnValue(!aOptions.noScriptRval) {
|
||||
MOZ_ASSERT(aParent);
|
||||
MOZ_ASSERT(aStencil);
|
||||
|
||||
@@ -1421,7 +1421,7 @@ nsXPCComponents_Utils::ReportError(HandleValue error, HandleValue stack,
|
||||
if (err) {
|
||||
// It's a proper JS Error
|
||||
nsAutoString fileUni;
|
||||
CopyUTF8toUTF16(mozilla::MakeStringSpan(err->filename.c_str()), fileUni);
|
||||
CopyUTF8toUTF16(mozilla::MakeStringSpan(err->filename), fileUni);
|
||||
|
||||
uint32_t column = err->tokenOffset();
|
||||
|
||||
|
||||
@@ -1159,7 +1159,7 @@ static nsresult JSErrorToXPCException(JSContext* cx, const char* toStringResult,
|
||||
|
||||
data = new nsScriptError();
|
||||
data->nsIScriptError::InitWithWindowID(
|
||||
bestMessage, NS_ConvertUTF8toUTF16(report->filename.c_str()),
|
||||
bestMessage, NS_ConvertUTF8toUTF16(report->filename),
|
||||
linebuf ? nsDependentString(linebuf, report->linebufLength())
|
||||
: EmptyString(),
|
||||
report->lineno, report->tokenOffset(), flags, "XPConnect JavaScript"_ns,
|
||||
|
||||
@@ -189,8 +189,7 @@ void xpc::ErrorBase::Init(JSErrorBase* aReport) {
|
||||
if (!aReport->filename) {
|
||||
mFileName.SetIsVoid(true);
|
||||
} else {
|
||||
CopyUTF8toUTF16(mozilla::MakeStringSpan(aReport->filename.c_str()),
|
||||
mFileName);
|
||||
CopyUTF8toUTF16(mozilla::MakeStringSpan(aReport->filename), mFileName);
|
||||
}
|
||||
|
||||
mSourceId = aReport->sourceId;
|
||||
|
||||
Reference in New Issue
Block a user