зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1196391, part 2 - Add JSAPI constant for the max number of error arguments. r=Waldo
This will allow users of the API to do checking of values they pass in.
This commit is contained in:
Родитель
7f296622e0
Коммит
6016fb539e
|
@ -4478,6 +4478,10 @@ JS_GetLocaleCallbacks(JSRuntime* rt);
|
|||
* Error reporting.
|
||||
*/
|
||||
|
||||
namespace JS {
|
||||
const uint16_t MaxNumErrorArguments = 10;
|
||||
};
|
||||
|
||||
/*
|
||||
* Report an exception represented by the sprintf-like conversion of format
|
||||
* and its arguments. This exception message string is passed to a pre-set
|
||||
|
|
|
@ -582,9 +582,9 @@ js::ExpandErrorArgumentsVA(ExclusiveContext* cx, JSErrorCallback callback,
|
|||
reportp->exnType = efs->exnType;
|
||||
|
||||
size_t totalArgsLength = 0;
|
||||
size_t argLengths[10]; /* only {0} thru {9} supported */
|
||||
size_t argLengths[JS::MaxNumErrorArguments]; /* only {0} thru {9} supported */
|
||||
argCount = efs->argCount;
|
||||
MOZ_ASSERT(argCount <= 10);
|
||||
MOZ_ASSERT(argCount <= JS::MaxNumErrorArguments);
|
||||
if (argCount > 0) {
|
||||
/*
|
||||
* Gather the arguments into an array, and accumulate
|
||||
|
|
Загрузка…
Ссылка в новой задаче