зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1847469 - Part 20: Use column number types in JSErrorBase. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D185758
This commit is contained in:
Родитель
6eeb584f68
Коммит
b23c224e33
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "JSOracleParent.h"
|
||||
#include "js/CallAndConstruct.h" // JS::Call
|
||||
#include "js/ColumnNumber.h" // JS::TaggedColumnNumberOneOrigin
|
||||
#include "js/ColumnNumber.h" // JS::TaggedColumnNumberOneOrigin, JS::ColumnNumberOneOrigin
|
||||
#include "js/CharacterEncoding.h"
|
||||
#include "js/Object.h" // JS::GetClass
|
||||
#include "js/PropertyAndElement.h" // JS_DefineProperty, JS_DefinePropertyById, JS_Enumerate, JS_GetProperty, JS_GetPropertyById, JS_SetProperty, JS_SetPropertyById, JS::IdVector
|
||||
|
@ -1628,8 +1628,8 @@ void ChromeUtils::CreateError(const GlobalObject& aGlobal,
|
|||
|
||||
JS::Rooted<JS::Value> err(cx);
|
||||
if (!JS::CreateError(cx, JSEXN_ERR, stack, fileName, line,
|
||||
column.oneOriginValue(), nullptr, message,
|
||||
JS::NothingHandleValue, &err)) {
|
||||
JS::ColumnNumberOneOrigin(column.oneOriginValue()),
|
||||
nullptr, message, JS::NothingHandleValue, &err)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,8 @@ bool ClonedErrorHolder::WriteStructuredClone(JSContext* aCx,
|
|||
return JS_WriteUint32Pair(aWriter, SCTAG_DOM_CLONED_ERROR_OBJECT, 0) &&
|
||||
WriteStringPair(aWriter, mName, mMessage) &&
|
||||
WriteStringPair(aWriter, mFilename, mSourceLine) &&
|
||||
JS_WriteUint32Pair(aWriter, mLineNumber, mColumn) &&
|
||||
JS_WriteUint32Pair(aWriter, mLineNumber,
|
||||
*mColumn.addressOfValueForTranscode()) &&
|
||||
JS_WriteUint32Pair(aWriter, mTokenOffset, mErrorNumber) &&
|
||||
JS_WriteUint32Pair(aWriter, uint32_t(mType), uint32_t(mExnType)) &&
|
||||
JS_WriteUint32Pair(aWriter, mCode, uint32_t(mResult)) &&
|
||||
|
@ -193,7 +194,8 @@ bool ClonedErrorHolder::Init(JSContext* aCx, JSStructuredCloneReader* aReader) {
|
|||
uint32_t type, exnType, result, code;
|
||||
if (!(ReadStringPair(aReader, mName, mMessage) &&
|
||||
ReadStringPair(aReader, mFilename, mSourceLine) &&
|
||||
JS_ReadUint32Pair(aReader, &mLineNumber, &mColumn) &&
|
||||
JS_ReadUint32Pair(aReader, &mLineNumber,
|
||||
mColumn.addressOfValueForTranscode()) &&
|
||||
JS_ReadUint32Pair(aReader, &mTokenOffset, &mErrorNumber) &&
|
||||
JS_ReadUint32Pair(aReader, &type, &exnType) &&
|
||||
JS_ReadUint32Pair(aReader, &code, &result) &&
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#define mozilla_dom_ClonedErrorHolder_h
|
||||
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberOneOrigin
|
||||
#include "js/ErrorReport.h"
|
||||
#include "js/TypeDecls.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
|
@ -82,10 +83,10 @@ class ClonedErrorHolder final {
|
|||
nsCString mFilename; // JSError only
|
||||
nsCString mSourceLine; // JSError only
|
||||
|
||||
uint32_t mLineNumber = 0; // JSError only, (1-origin)
|
||||
uint32_t mColumn = 0; // JSError only, (1-origin)
|
||||
uint32_t mTokenOffset = 0; // JSError only
|
||||
uint32_t mErrorNumber = 0; // JSError only
|
||||
uint32_t mLineNumber = 0; // JSError only
|
||||
JS::ColumnNumberOneOrigin mColumn; // JSError only
|
||||
uint32_t mTokenOffset = 0; // JSError only
|
||||
uint32_t mErrorNumber = 0; // JSError only
|
||||
|
||||
Type mType = Type::Uninitialized;
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ void WorkletNodeEngine::SendProcessorError(AudioNodeTrack* aTrack,
|
|||
xpc::ErrorReport::ErrorReportToMessageString(jsReport.report(),
|
||||
details.mMessage);
|
||||
details.mLineno = jsReport.report()->lineno;
|
||||
details.mColno = jsReport.report()->column;
|
||||
details.mColno = jsReport.report()->column.oneOriginValue();
|
||||
MOZ_ASSERT(!jsReport.report()->isMuted);
|
||||
|
||||
SendErrorToMainThread(aTrack, details);
|
||||
|
|
|
@ -226,7 +226,7 @@ class ReportGenericErrorRunnable final : public WorkerDebuggeeRunnable {
|
|||
void WorkerErrorBase::AssignErrorBase(JSErrorBase* aReport) {
|
||||
CopyUTF8toUTF16(MakeStringSpan(aReport->filename.c_str()), mFilename);
|
||||
mLineNumber = aReport->lineno;
|
||||
mColumnNumber = aReport->column;
|
||||
mColumnNumber = aReport->column.oneOriginValue();
|
||||
mErrorNumber = aReport->errorNumber;
|
||||
}
|
||||
|
||||
|
|
|
@ -1803,7 +1803,8 @@ static void CheckErrorsAndWarnings(JS::FrontendContext* aFc,
|
|||
NS_WARNING(
|
||||
nsPrintfCString(
|
||||
"Had compilation error in ScriptCompileTask: %s at %s:%u:%u",
|
||||
message, filename, report->lineno, report->column)
|
||||
message, filename, report->lineno,
|
||||
report->column.oneOriginValue())
|
||||
.get());
|
||||
}
|
||||
|
||||
|
@ -1837,7 +1838,7 @@ static void CheckErrorsAndWarnings(JS::FrontendContext* aFc,
|
|||
NS_WARNING(
|
||||
nsPrintfCString(
|
||||
"Had compilation warning in ScriptCompileTask: %s at %s:%u:%u",
|
||||
message, filename, report->lineno, report->column)
|
||||
message, filename, report->lineno, report->column.oneOriginValue())
|
||||
.get());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include "js/Array.h" // JS::GetArrayLength
|
||||
#include "js/CompilationAndEvaluation.h"
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin, JS::ColumnNumberOneOrigin
|
||||
#include "js/ContextOptions.h" // JS::ContextOptionsRef
|
||||
#include "js/ErrorReport.h" // JSErrorBase
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
|
@ -728,8 +728,8 @@ nsresult ModuleLoaderBase::HandleResolveFailure(
|
|||
}
|
||||
|
||||
if (!JS::CreateError(aCx, JSEXN_TYPEERR, nullptr, filename, aLineNumber,
|
||||
aColumnNumber.oneOriginValue(), nullptr, string,
|
||||
JS::NothingHandleValue, aErrorOut)) {
|
||||
JS::ColumnNumberOneOrigin(aColumnNumber), nullptr,
|
||||
string, JS::NothingHandleValue, aErrorOut)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "js/AllocPolicy.h"
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberOneOrigin
|
||||
#include "js/RootingAPI.h" // JS::HandleObject, JS::RootedObject
|
||||
#include "js/UniquePtr.h" // js::UniquePtr
|
||||
#include "js/Value.h" // JS::Value
|
||||
|
@ -120,8 +121,8 @@ class JSErrorBase {
|
|||
// Source line number (1-origin).
|
||||
uint32_t lineno;
|
||||
|
||||
// Column number in line in UTF-16 code units (1-origin).
|
||||
uint32_t column;
|
||||
// Column number in line in UTF-16 code units.
|
||||
JS::ColumnNumberOneOrigin column;
|
||||
|
||||
// the error number, e.g. see js/public/friend/ErrorNumbers.msg.
|
||||
unsigned errorNumber;
|
||||
|
@ -138,7 +139,6 @@ class JSErrorBase {
|
|||
: filename(nullptr),
|
||||
sourceId(0),
|
||||
lineno(0),
|
||||
column(0),
|
||||
errorNumber(0),
|
||||
errorMessageName(nullptr),
|
||||
ownsMessage_(false) {}
|
||||
|
@ -188,7 +188,8 @@ class JSErrorNotes {
|
|||
js::Vector<js::UniquePtr<Note>, 1, js::SystemAllocPolicy> notes_;
|
||||
|
||||
bool addNoteVA(js::FrontendContext* fc, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno, uint32_t column,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber,
|
||||
js::ErrorArgumentsType argumentsType, va_list ap);
|
||||
|
@ -198,29 +199,31 @@ class JSErrorNotes {
|
|||
~JSErrorNotes();
|
||||
|
||||
// Add a note to the given position.
|
||||
// column is 1-origin.
|
||||
bool addNoteASCII(JSContext* cx, const char* filename, unsigned sourceId,
|
||||
uint32_t lineno, uint32_t column,
|
||||
uint32_t lineno, JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...);
|
||||
bool addNoteASCII(js::FrontendContext* fc, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno, uint32_t column,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...);
|
||||
bool addNoteLatin1(JSContext* cx, const char* filename, unsigned sourceId,
|
||||
uint32_t lineno, uint32_t column,
|
||||
uint32_t lineno, JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...);
|
||||
bool addNoteLatin1(js::FrontendContext* fc, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno, uint32_t column,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...);
|
||||
bool addNoteUTF8(JSContext* cx, const char* filename, unsigned sourceId,
|
||||
uint32_t lineno, uint32_t column,
|
||||
uint32_t lineno, JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...);
|
||||
bool addNoteUTF8(js::FrontendContext* fc, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno, uint32_t column,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...);
|
||||
|
||||
|
@ -531,12 +534,11 @@ extern JS_PUBLIC_API void JS_ReportAllocationOverflow(JSContext* cx);
|
|||
|
||||
namespace JS {
|
||||
|
||||
// columnNumber is 1-origin.
|
||||
extern JS_PUBLIC_API bool CreateError(
|
||||
JSContext* cx, JSExnType type, HandleObject stack, HandleString fileName,
|
||||
uint32_t lineNumber, uint32_t columnNumber, JSErrorReport* report,
|
||||
HandleString message, Handle<mozilla::Maybe<Value>> cause,
|
||||
MutableHandleValue rval);
|
||||
uint32_t lineNumber, JS::ColumnNumberOneOrigin column,
|
||||
JSErrorReport* report, HandleString message,
|
||||
Handle<mozilla::Maybe<Value>> cause, MutableHandleValue rval);
|
||||
|
||||
} /* namespace JS */
|
||||
|
||||
|
|
|
@ -1925,7 +1925,7 @@ bool DebuggerObject::getErrorColumnNumber(JSContext* cx,
|
|||
return true;
|
||||
}
|
||||
|
||||
result.setNumber(report->column);
|
||||
result.setNumber(report->column.oneOriginValue());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
#include "frontend/ScriptIndex.h" // ScriptIndex
|
||||
#include "frontend/TokenStream.h" // IsKeyword, ReservedWordTokenKind, ReservedWordToCharZ, DeprecatedContent, *TokenStream*, CharBuffer, TokenKindToDesc
|
||||
#include "irregexp/RegExpAPI.h"
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin, JS::ColumnNumberZeroOrigin
|
||||
#include "js/ErrorReport.h" // JSErrorBase
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin, JS::ColumnNumberZeroOrigin, JS::ColumnNumberOneOrigin
|
||||
#include "js/ErrorReport.h" // JSErrorBase
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
#include "js/HashTable.h"
|
||||
#include "js/RegExpFlags.h" // JS::RegExpFlags
|
||||
|
@ -478,8 +478,8 @@ void GeneralParser<ParseHandler, Unit>::reportMissingClosing(
|
|||
SprintfLiteral(lineNumber, "%" PRIu32, line);
|
||||
|
||||
if (!notes->addNoteASCII(this->fc_, getFilename().c_str(), 0, line,
|
||||
column.oneOriginValue(), GetErrorMessage, nullptr,
|
||||
noteNumber, lineNumber, columnNumber)) {
|
||||
JS::ColumnNumberOneOrigin(column), GetErrorMessage,
|
||||
nullptr, noteNumber, lineNumber, columnNumber)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -520,8 +520,9 @@ void GeneralParser<ParseHandler, Unit>::reportRedeclarationHelper(
|
|||
SprintfLiteral(lineNumber, "%" PRIu32, line);
|
||||
|
||||
if (!notes->addNoteASCII(this->fc_, getFilename().c_str(), 0, line,
|
||||
column.oneOriginValue(), GetErrorMessage, nullptr,
|
||||
noteErrorNumber, lineNumber, columnNumber)) {
|
||||
JS::ColumnNumberOneOrigin(column), GetErrorMessage,
|
||||
nullptr, noteErrorNumber, lineNumber,
|
||||
columnNumber)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "frontend/ParserAtom.h"
|
||||
#include "frontend/ReservedWords.h"
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin, JS::ColumnNumberZeroOrigin, JS::TaggedColumnNumberZeroOrigin
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin, JS::ColumnNumberZeroOrigin, JS::ColumnNumberOneOrigin, JS::TaggedColumnNumberZeroOrigin
|
||||
#include "js/ErrorReport.h" // JSErrorBase
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
#include "js/Printf.h" // JS_smprintf
|
||||
|
@ -916,8 +916,9 @@ MOZ_COLD void TokenStreamChars<Utf8Unit, AnyCharsAccess>::internalEncodingError(
|
|||
computeLineAndColumn(offset, &line, &column);
|
||||
|
||||
if (!notes->addNoteASCII(anyChars.fc, anyChars.getFilename().c_str(), 0,
|
||||
line, column.oneOriginValue(), GetErrorMessage,
|
||||
nullptr, JSMSG_BAD_CODE_UNITS, badUnitsStr)) {
|
||||
line, JS::ColumnNumberOneOrigin(column),
|
||||
GetErrorMessage, nullptr, JSMSG_BAD_CODE_UNITS,
|
||||
badUnitsStr)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ bool testCompile() {
|
|||
const js::CompileError& error = fc->maybeError().ref();
|
||||
CHECK(JSEXN_SYNTAXERR == error.exnType);
|
||||
CHECK(error.lineno == 1);
|
||||
CHECK(error.column == 10);
|
||||
CHECK(error.column.oneOriginValue() == 10);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -199,7 +199,7 @@ bool testCompileModule() {
|
|||
const js::CompileError& error = fc->maybeError().ref();
|
||||
CHECK(JSEXN_SYNTAXERR == error.exnType);
|
||||
CHECK(error.lineno == 1);
|
||||
CHECK(error.column == 10);
|
||||
CHECK(error.column.oneOriginValue() == 10);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -26,7 +26,7 @@ BEGIN_TEST(testErrorCopying_columnCopied) {
|
|||
JS::ErrorReportBuilder report(cx);
|
||||
CHECK(report.init(cx, exnStack, JS::ErrorReportBuilder::WithSideEffects));
|
||||
|
||||
CHECK_EQUAL(report.report()->column, 28u);
|
||||
CHECK_EQUAL(report.report()->column.oneOriginValue(), 28u);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "js/CallAndConstruct.h" // JS_CallFunctionValue
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberOneOrigin
|
||||
#include "js/PropertyAndElement.h" // JS_GetProperty
|
||||
#include "jsapi-tests/tests.h"
|
||||
|
||||
|
@ -73,15 +74,17 @@ BEGIN_TEST(testException_createErrorWithCause) {
|
|||
JS::Rooted<mozilla::Maybe<JS::Value>> cause(
|
||||
cx, mozilla::Some(JS::Int32Value(-1)));
|
||||
JS::RootedValue err(cx);
|
||||
CHECK(JS::CreateError(cx, JSEXN_ERR, nullptr, empty, 1, 1, nullptr, empty,
|
||||
cause, &err));
|
||||
CHECK(JS::CreateError(cx, JSEXN_ERR, nullptr, empty, 1,
|
||||
JS::ColumnNumberOneOrigin(1), nullptr, empty, cause,
|
||||
&err));
|
||||
CHECK(err.isObject());
|
||||
JS::Rooted<mozilla::Maybe<JS::Value>> maybeCause(
|
||||
cx, JS::GetExceptionCause(&err.toObject()));
|
||||
CHECK(maybeCause.isSome());
|
||||
CHECK_SAME(*cause, *maybeCause);
|
||||
|
||||
CHECK(JS::CreateError(cx, JSEXN_ERR, nullptr, empty, 1, 1, nullptr, empty,
|
||||
CHECK(JS::CreateError(cx, JSEXN_ERR, nullptr, empty, 1,
|
||||
JS::ColumnNumberOneOrigin(1), nullptr, empty,
|
||||
JS::NothingHandleValue, &err));
|
||||
CHECK(err.isObject());
|
||||
maybeCause = JS::GetExceptionCause(&err.toObject());
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "jit/JitSpewer.h"
|
||||
#include "js/CallAndConstruct.h" // JS::IsCallable
|
||||
#include "js/CharacterEncoding.h"
|
||||
#include "js/ColumnNumber.h" // JS::TaggedColumnNumberZeroOrigin
|
||||
#include "js/ColumnNumber.h" // JS::TaggedColumnNumberZeroOrigin, JS::ColumnNumberOneOrigin
|
||||
#include "js/CompileOptions.h"
|
||||
#include "js/ContextOptions.h" // JS::ContextOptions{,Ref}
|
||||
#include "js/Conversions.h"
|
||||
|
@ -3933,12 +3933,11 @@ JSErrorNotes::JSErrorNotes() : notes_() {}
|
|||
|
||||
JSErrorNotes::~JSErrorNotes() = default;
|
||||
|
||||
// column is 1-origin.
|
||||
static UniquePtr<JSErrorNotes::Note> CreateErrorNoteVA(
|
||||
FrontendContext* fc, const char* filename, unsigned sourceId,
|
||||
uint32_t lineno, uint32_t column, JSErrorCallback errorCallback,
|
||||
void* userRef, const unsigned errorNumber, ErrorArgumentsType argumentsType,
|
||||
va_list ap) {
|
||||
uint32_t lineno, JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef, const unsigned errorNumber,
|
||||
ErrorArgumentsType argumentsType, va_list ap) {
|
||||
auto note = MakeUnique<JSErrorNotes::Note>();
|
||||
if (!note) {
|
||||
ReportOutOfMemory(fc);
|
||||
|
@ -3961,8 +3960,9 @@ static UniquePtr<JSErrorNotes::Note> CreateErrorNoteVA(
|
|||
|
||||
bool JSErrorNotes::addNoteVA(FrontendContext* fc, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
uint32_t column, JSErrorCallback errorCallback,
|
||||
void* userRef, const unsigned errorNumber,
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber,
|
||||
ErrorArgumentsType argumentsType, va_list ap) {
|
||||
auto note =
|
||||
CreateErrorNoteVA(fc, filename, sourceId, lineno, column, errorCallback,
|
||||
|
@ -3980,9 +3980,9 @@ bool JSErrorNotes::addNoteVA(FrontendContext* fc, const char* filename,
|
|||
|
||||
bool JSErrorNotes::addNoteASCII(JSContext* cx, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
uint32_t column, JSErrorCallback errorCallback,
|
||||
void* userRef, const unsigned errorNumber,
|
||||
...) {
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...) {
|
||||
AutoReportFrontendContext fc(cx);
|
||||
va_list ap;
|
||||
va_start(ap, errorNumber);
|
||||
|
@ -3994,9 +3994,9 @@ bool JSErrorNotes::addNoteASCII(JSContext* cx, const char* filename,
|
|||
|
||||
bool JSErrorNotes::addNoteASCII(FrontendContext* fc, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
uint32_t column, JSErrorCallback errorCallback,
|
||||
void* userRef, const unsigned errorNumber,
|
||||
...) {
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, errorNumber);
|
||||
bool ok = addNoteVA(fc, filename, sourceId, lineno, column, errorCallback,
|
||||
|
@ -4007,9 +4007,9 @@ bool JSErrorNotes::addNoteASCII(FrontendContext* fc, const char* filename,
|
|||
|
||||
bool JSErrorNotes::addNoteLatin1(JSContext* cx, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
uint32_t column, JSErrorCallback errorCallback,
|
||||
void* userRef, const unsigned errorNumber,
|
||||
...) {
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...) {
|
||||
AutoReportFrontendContext fc(cx);
|
||||
va_list ap;
|
||||
va_start(ap, errorNumber);
|
||||
|
@ -4021,9 +4021,9 @@ bool JSErrorNotes::addNoteLatin1(JSContext* cx, const char* filename,
|
|||
|
||||
bool JSErrorNotes::addNoteLatin1(FrontendContext* fc, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
uint32_t column, JSErrorCallback errorCallback,
|
||||
void* userRef, const unsigned errorNumber,
|
||||
...) {
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, errorNumber);
|
||||
bool ok = addNoteVA(fc, filename, sourceId, lineno, column, errorCallback,
|
||||
|
@ -4034,8 +4034,9 @@ bool JSErrorNotes::addNoteLatin1(FrontendContext* fc, const char* filename,
|
|||
|
||||
bool JSErrorNotes::addNoteUTF8(JSContext* cx, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
uint32_t column, JSErrorCallback errorCallback,
|
||||
void* userRef, const unsigned errorNumber, ...) {
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...) {
|
||||
AutoReportFrontendContext fc(cx);
|
||||
va_list ap;
|
||||
va_start(ap, errorNumber);
|
||||
|
@ -4047,8 +4048,9 @@ bool JSErrorNotes::addNoteUTF8(JSContext* cx, const char* filename,
|
|||
|
||||
bool JSErrorNotes::addNoteUTF8(FrontendContext* fc, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
uint32_t column, JSErrorCallback errorCallback,
|
||||
void* userRef, const unsigned errorNumber, ...) {
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, errorNumber);
|
||||
bool ok = addNoteVA(fc, filename, sourceId, lineno, column, errorCallback,
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "frontend/FrontendContext.h" // AutoReportFrontendContext
|
||||
#include "js/CharacterEncoding.h" // JS::UTF8Chars, JS::ConstUTF8CharsZ
|
||||
#include "js/Class.h"
|
||||
#include "js/ColumnNumber.h" // JS::TaggedColumnNumberZeroOrigin
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberOneOrigin, JS::TaggedColumnNumberZeroOrigin
|
||||
#include "js/Conversions.h"
|
||||
#include "js/ErrorReport.h" // JS::PrintError
|
||||
#include "js/Exception.h" // JS::ExceptionStack
|
||||
|
@ -337,7 +337,7 @@ bool js::ErrorToException(JSContext* cx, JSErrorReport* reportp,
|
|||
|
||||
uint32_t sourceId = reportp->sourceId;
|
||||
uint32_t lineNumber = reportp->lineno;
|
||||
uint32_t columnNumber = reportp->column;
|
||||
JS::ColumnNumberOneOrigin columnNumber = reportp->column;
|
||||
|
||||
// Error reports don't provide a |cause|, so we default to |Nothing| here.
|
||||
auto cause = JS::NothingHandleValue;
|
||||
|
@ -352,9 +352,9 @@ bool js::ErrorToException(JSContext* cx, JSErrorReport* reportp,
|
|||
return false;
|
||||
}
|
||||
|
||||
ErrorObject* errObject =
|
||||
ErrorObject::create(cx, exnType, stack, fileName, sourceId, lineNumber,
|
||||
columnNumber, std::move(report), messageStr, cause);
|
||||
ErrorObject* errObject = ErrorObject::create(
|
||||
cx, exnType, stack, fileName, sourceId, lineNumber,
|
||||
columnNumber.oneOriginValue(), std::move(report), messageStr, cause);
|
||||
if (!errObject) {
|
||||
return false;
|
||||
}
|
||||
|
@ -594,7 +594,7 @@ bool JS::ErrorReportBuilder::init(JSContext* cx,
|
|||
ownedReport.filename = JS::ConstUTF8CharsZ(filename.get());
|
||||
ownedReport.lineno = lineno;
|
||||
ownedReport.exnType = JSEXN_INTERNALERR;
|
||||
ownedReport.column = column;
|
||||
ownedReport.column = JS::ColumnNumberOneOrigin(column);
|
||||
|
||||
if (str) {
|
||||
// Note that using |str| for |message_| here is kind of wrong,
|
||||
|
@ -675,7 +675,8 @@ bool JS::ErrorReportBuilder::populateUncaughtExceptionReportUTF8VA(
|
|||
ownedReport.filename = JS::ConstUTF8CharsZ(filename.get());
|
||||
ownedReport.sourceId = frame->getSourceId();
|
||||
ownedReport.lineno = frame->getLine();
|
||||
ownedReport.column = frame->getColumn().oneOriginValue();
|
||||
ownedReport.column =
|
||||
JS::ColumnNumberOneOrigin(frame->getColumn().oneOriginValue());
|
||||
ownedReport.isMuted = frame->getMutedErrors();
|
||||
} else {
|
||||
// XXXbz this assumes the stack we have right now is still
|
||||
|
@ -687,7 +688,7 @@ bool JS::ErrorReportBuilder::populateUncaughtExceptionReportUTF8VA(
|
|||
ownedReport.sourceId =
|
||||
iter.hasScript() ? iter.script()->scriptSource()->id() : 0;
|
||||
ownedReport.lineno = iter.computeLine(&column);
|
||||
ownedReport.column = column.oneOriginValue();
|
||||
ownedReport.column = JS::ColumnNumberOneOrigin(column.oneOriginValue());
|
||||
ownedReport.isMuted = iter.mutedErrors();
|
||||
}
|
||||
}
|
||||
|
@ -751,7 +752,8 @@ JSObject* js::CopyErrorObject(JSContext* cx, Handle<ErrorObject*> err) {
|
|||
|
||||
JS_PUBLIC_API bool JS::CreateError(JSContext* cx, JSExnType type,
|
||||
HandleObject stack, HandleString fileName,
|
||||
uint32_t lineNumber, uint32_t columnNumber,
|
||||
uint32_t lineNumber,
|
||||
JS::ColumnNumberOneOrigin columnNumber,
|
||||
JSErrorReport* report, HandleString message,
|
||||
Handle<mozilla::Maybe<Value>> cause,
|
||||
MutableHandleValue rval) {
|
||||
|
@ -766,9 +768,9 @@ JS_PUBLIC_API bool JS::CreateError(JSContext* cx, JSExnType type,
|
|||
}
|
||||
}
|
||||
|
||||
JSObject* obj =
|
||||
js::ErrorObject::create(cx, type, stack, fileName, 0, lineNumber,
|
||||
columnNumber, std::move(rep), message, cause);
|
||||
JSObject* obj = js::ErrorObject::create(
|
||||
cx, type, stack, fileName, 0, lineNumber, columnNumber.oneOriginValue(),
|
||||
std::move(rep), message, cause);
|
||||
if (!obj) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -3895,7 +3895,7 @@ static bool CopyErrorReportToObject(JSContext* cx, JSErrorReport* report,
|
|||
return false;
|
||||
}
|
||||
|
||||
RootedValue columnVal(cx, Int32Value(report->column));
|
||||
RootedValue columnVal(cx, Int32Value(report->column.oneOriginValue()));
|
||||
if (!DefineDataProperty(cx, obj, cx->names().columnNumber, columnVal)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -585,7 +585,7 @@ JSErrorReport* js::ErrorObject::getOrCreateErrorReport(JSContext* cx) {
|
|||
// Coordinates.
|
||||
report.sourceId = sourceId();
|
||||
report.lineno = lineNumber();
|
||||
report.column = columnNumber();
|
||||
report.column = JS::ColumnNumberOneOrigin(columnNumber());
|
||||
|
||||
// Message. Note that |new Error()| will result in an undefined |message|
|
||||
// slot, so we need to explicitly substitute the empty string in that case.
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
#include "frontend/FrontendContext.h" // AutoReportFrontendContext
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin, JS::TaggedColumnNumberZeroOrigin
|
||||
#include "js/ErrorReport.h" // JSErrorBase
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin, JS::ColumnNumberOneOrigin, JS::TaggedColumnNumberZeroOrigin
|
||||
#include "js/ErrorReport.h" // JSErrorBase
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
#include "js/Printf.h" // JS_vsmprintf
|
||||
#include "js/Warnings.h" // JS::WarningReporter
|
||||
|
@ -68,7 +68,7 @@ bool js::ReportCompileWarning(FrontendContext* fc, ErrorMetadata&& metadata,
|
|||
|
||||
err.filename = JS::ConstUTF8CharsZ(metadata.filename);
|
||||
err.lineno = metadata.lineNumber;
|
||||
err.column = metadata.columnNumber.oneOriginValue();
|
||||
err.column = JS::ColumnNumberOneOrigin(metadata.columnNumber);
|
||||
err.isMuted = metadata.isMuted;
|
||||
|
||||
if (UniqueTwoByteChars lineOfContext = std::move(metadata.lineOfContext)) {
|
||||
|
@ -97,7 +97,7 @@ static void ReportCompileErrorImpl(FrontendContext* fc,
|
|||
|
||||
err.filename = JS::ConstUTF8CharsZ(metadata.filename);
|
||||
err.lineno = metadata.lineNumber;
|
||||
err.column = metadata.columnNumber.oneOriginValue();
|
||||
err.column = JS::ColumnNumberOneOrigin(metadata.columnNumber);
|
||||
err.isMuted = metadata.isMuted;
|
||||
|
||||
if (UniqueTwoByteChars lineOfContext = std::move(metadata.lineOfContext)) {
|
||||
|
@ -198,7 +198,7 @@ static void PopulateReportBlame(JSContext* cx, JSErrorReport* report) {
|
|||
}
|
||||
JS::TaggedColumnNumberZeroOrigin column;
|
||||
report->lineno = iter.computeLine(&column);
|
||||
report->column = column.oneOriginValue();
|
||||
report->column = JS::ColumnNumberOneOrigin(column.oneOriginValue());
|
||||
report->isMuted = iter.mutedErrors();
|
||||
}
|
||||
|
||||
|
|
|
@ -479,7 +479,7 @@ static void PrintSingleError(FILE* file, JS::ConstUTF8CharsZ toStringResult,
|
|||
|
||||
if (report->lineno) {
|
||||
prefix = JS_smprintf("%s%u:%u ", prefix ? prefix.get() : "", report->lineno,
|
||||
report->column);
|
||||
report->column.oneOriginValue());
|
||||
}
|
||||
|
||||
if (kind != PrintErrorKind::Error) {
|
||||
|
@ -704,7 +704,7 @@ JSObject* js::CreateErrorNotesArray(JSContext* cx, JSErrorReport* report) {
|
|||
if (!DefineDataProperty(cx, noteObj, cx->names().lineNumber, linenoVal)) {
|
||||
return nullptr;
|
||||
}
|
||||
RootedValue columnVal(cx, Int32Value(note->column));
|
||||
RootedValue columnVal(cx, Int32Value(note->column.oneOriginValue()));
|
||||
if (!DefineDataProperty(cx, noteObj, cx->names().columnNumber, columnVal)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -19,17 +19,17 @@
|
|||
#include "ds/Sort.h"
|
||||
#include "frontend/BytecodeCompiler.h" // js::frontend::CompileModule
|
||||
#include "frontend/FrontendContext.h" // js::AutoReportFrontendContext
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "js/Context.h" // js::AssertHeapIsIdle
|
||||
#include "js/ErrorReport.h" // JSErrorBase
|
||||
#include "js/RootingAPI.h" // JS::MutableHandle
|
||||
#include "js/Value.h" // JS::Value
|
||||
#include "vm/EnvironmentObject.h" // js::ModuleEnvironmentObject
|
||||
#include "vm/JSAtomUtils.h" // AtomizeString
|
||||
#include "vm/JSContext.h" // CHECK_THREAD, JSContext
|
||||
#include "vm/JSObject.h" // JSObject
|
||||
#include "vm/List.h" // ListObject
|
||||
#include "vm/Runtime.h" // JSRuntime
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin, JS::ColumnNumberOneOrigin
|
||||
#include "js/Context.h" // js::AssertHeapIsIdle
|
||||
#include "js/ErrorReport.h" // JSErrorBase
|
||||
#include "js/RootingAPI.h" // JS::MutableHandle
|
||||
#include "js/Value.h" // JS::Value
|
||||
#include "vm/EnvironmentObject.h" // js::ModuleEnvironmentObject
|
||||
#include "vm/JSAtomUtils.h" // AtomizeString
|
||||
#include "vm/JSContext.h" // CHECK_THREAD, JSContext
|
||||
#include "vm/JSObject.h" // JSObject
|
||||
#include "vm/List.h" // ListObject
|
||||
#include "vm/Runtime.h" // JSRuntime
|
||||
|
||||
#include "vm/JSAtomUtils-inl.h" // AtomToId
|
||||
#include "vm/JSContext-inl.h" // JSContext::{c,releaseC}heck
|
||||
|
@ -907,7 +907,7 @@ static void ThrowResolutionError(JSContext* cx, Handle<ModuleObject*> module,
|
|||
|
||||
RootedValue error(cx);
|
||||
if (!JS::CreateError(cx, JSEXN_SYNTAXERR, nullptr, filename, line,
|
||||
column.oneOriginValue(), nullptr, message,
|
||||
JS::ColumnNumberOneOrigin(column), nullptr, message,
|
||||
JS::NothingHandleValue, &error)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ void xpc::ErrorBase::Init(JSErrorBase* aReport) {
|
|||
|
||||
mSourceId = aReport->sourceId;
|
||||
mLineNumber = aReport->lineno;
|
||||
mColumn = aReport->column;
|
||||
mColumn = aReport->column.oneOriginValue();
|
||||
}
|
||||
|
||||
void xpc::ErrorNote::Init(JSErrorNotes::Note* aNote) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче