Bug 1622562 - Cleanup exnType initialization r=jandem

Differential Revision: https://phabricator.services.mozilla.com/D67140

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Schuster 2020-03-24 06:41:58 +00:00
parent 505dd78fef
commit 4c087e6905
2 changed files with 6 additions and 9 deletions

View File

@ -297,14 +297,6 @@ class MOZ_RAII AutoMessageArgs {
}
};
static void SetExnType(JSErrorReport* reportp, int16_t exnType) {
reportp->exnType = exnType;
}
static void SetExnType(JSErrorNotes::Note* notep, int16_t exnType) {
// Do nothing for JSErrorNotes::Note.
}
/*
* The arguments from ap need to be packaged up into an array and stored
* into the report struct.
@ -339,7 +331,11 @@ static bool ExpandErrorArgumentsHelper(JSContext* cx, JSErrorCallback callback,
}
if (efs) {
SetExnType(reportp, efs->exnType);
if constexpr (std::is_same<T, JSErrorReport>::value) {
reportp->exnType = efs->exnType;
}
MOZ_ASSERT(reportp->errorNumber == errorNumber);
reportp->errorMessageName = efs->name;
MOZ_ASSERT_IF(argumentsType == ArgumentsAreASCII,

View File

@ -639,6 +639,7 @@ static void ReportDataCloneError(JSContext* cx,
MOZ_RELEASE_ASSERT(!cx->isExceptionPending());
JSErrorReport report;
report.errorNumber = errorNumber;
// Get js error message if it's possible and propagate it through callback.
if (JS_ExpandErrorArgumentsASCII(cx, GetErrorMessage, errorNumber, &report,
std::forward<Args>(aArgs)...) &&