Bug 1034627 part 5 - Make quick stubs work with Latin1 strings and nursery strings. r=bz

This commit is contained in:
Jan de Mooij 2014-07-11 16:22:35 +02:00
parent 6ce5c1be7d
commit 044e0a2a99
2 changed files with 6 additions and 13 deletions

View File

@ -422,15 +422,9 @@ xpc_qsDOMString::xpc_qsDOMString(JSContext *cx, HandleValue v,
if (!s)
return;
size_t len;
const jschar *chars = JS_GetStringCharsZAndLength(cx, s, &len);
if (!chars) {
mValid = false;
return;
}
nsAutoString *str = new(mBuf) implementation_type();
new(mBuf) implementation_type(chars, len);
mValid = true;
mValid = AssignJSString(cx, *str, s);
}
xpc_qsACString::xpc_qsACString(JSContext *cx, HandleValue v,
@ -471,14 +465,13 @@ xpc_qsAUTF8String::xpc_qsAUTF8String(JSContext *cx, HandleValue v, MutableHandle
if (!s)
return;
size_t len;
const char16_t *chars = JS_GetStringCharsZAndLength(cx, s, &len);
if (!chars) {
nsAutoJSString str;
if (!str.init(cx, s)) {
mValid = false;
return;
}
new(mBuf) implementation_type(chars, len);
new(mBuf) implementation_type(str);
mValid = true;
}

View File

@ -281,7 +281,7 @@ protected:
* the string from garbage collection. The caller must leave the jsval alone
* for the lifetime of the xpc_qsDOMString.
*/
class xpc_qsDOMString : public xpc_qsBasicString<nsAString, nsDependentString>
class xpc_qsDOMString : public xpc_qsBasicString<nsAString, nsAutoString>
{
public:
xpc_qsDOMString(JSContext *cx, JS::HandleValue v,