Bug 682727 - Handle OOM in xpc_qsDOMString and xpc_qsAUTF8String

This commit is contained in:
Michal Novotny 2011-09-30 21:13:55 +02:00
parent f4b39ee317
commit a8787b2748

View File

@ -726,8 +726,10 @@ xpc_qsDOMString::xpc_qsDOMString(JSContext *cx, jsval v, jsval *pval,
size_t len;
const jschar *chars = JS_GetStringCharsZAndLength(cx, s, &len);
if (!chars)
if (!chars) {
mValid = JS_FALSE;
return;
}
new(mBuf) implementation_type(chars, len);
mValid = JS_TRUE;
@ -772,8 +774,10 @@ xpc_qsAUTF8String::xpc_qsAUTF8String(JSContext *cx, jsval v, jsval *pval)
size_t len;
const PRUnichar *chars = JS_GetStringCharsZAndLength(cx, s, &len);
if (!chars)
if (!chars) {
mValid = JS_FALSE;
return;
}
new(mBuf) implementation_type(chars, len);
mValid = JS_TRUE;