Patch from Michael Daumling <daumling@adobe.com> to let the OOM message be localized (318767, r=me).

git-svn-id: svn://10.0.0.236/trunk@185713 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
brendan%mozilla.org 2005-12-05 21:35:15 +00:00
parent fe4a2e23cc
commit ca09fca52a
3 changed files with 6 additions and 5 deletions

View File

@ -4507,7 +4507,7 @@ JS_ReportErrorFlagsAndNumberUC(JSContext *cx, uintN flags,
JS_PUBLIC_API(void)
JS_ReportOutOfMemory(JSContext *cx)
{
js_ReportOutOfMemory(cx, js_GetErrorMessage);
js_ReportOutOfMemory(cx);
}
JS_PUBLIC_API(JSErrorReporter)

View File

@ -712,14 +712,15 @@ ReportError(JSContext *cx, const char *message, JSErrorReport *reportp)
* type message, and then hope the process ends swiftly.
*/
void
js_ReportOutOfMemory(JSContext *cx, JSErrorCallback callback)
js_ReportOutOfMemory(JSContext *cx)
{
JSStackFrame *fp;
JSErrorReport report;
JSErrorReporter onError = cx->errorReporter;
/* Get the message for this error, but we won't expand any arguments. */
const JSErrorFormatString *efs = callback(NULL, NULL, JSMSG_OUT_OF_MEMORY);
const JSErrorFormatString *efs =
js_GetLocalizedErrorMessage(cx, NULL, NULL, JSMSG_OUT_OF_MEMORY);
const char *msg = efs ? efs->format : "Out of memory";
/* Fill out the report, but don't do anything that requires allocation. */
@ -876,7 +877,7 @@ js_ExpandErrorArguments(JSContext *cx, JSErrorCallback callback,
jschar *buffer, *fmt, *out;
int expandedArgs = 0;
size_t expandedLength;
size_t len = strlen (efs->format);
size_t len = strlen(efs->format);
buffer = fmt = js_InflateString (cx, efs->format, &len);
if (!buffer)

View File

@ -629,7 +629,7 @@ js_ExpandErrorArguments(JSContext *cx, JSErrorCallback callback,
#endif
extern void
js_ReportOutOfMemory(JSContext *cx, JSErrorCallback errorCallback);
js_ReportOutOfMemory(JSContext *cx);
/*
* Report an exception using a previously composed JSErrorReport.