Backed out changeset f78470faff8e (bug 1034627) Valgrind Test failures on a CLOSED TREE

This commit is contained in:
Carsten "Tomcat" Book 2014-07-11 11:00:52 +02:00
parent 8d5ad53d61
commit 6f8c5db933
2 changed files with 10 additions and 9 deletions

View File

@ -557,10 +557,9 @@ nsXPCComponents_InterfacesByID::NewResolve(nsIXPConnectWrappedNative *wrapper,
if (38 != JS_GetStringLength(str))
return NS_OK;
JSAutoByteString utf8str;
if (utf8str.encodeUtf8(cx, str)) {
if (const jschar *name = JS_GetInternedStringChars(str)) {
nsID iid;
if (!iid.Parse(utf8str.ptr()))
if (!iid.Parse(NS_ConvertUTF16toUTF8(name).get()))
return NS_OK;
nsCOMPtr<nsIInterfaceInfo> info;
@ -2606,12 +2605,13 @@ nsXPCComponents_Utils::ReportError(HandleValue error, JSContext *cx)
frame->GetLineNumber(&lineNo);
}
nsAutoJSString msg;
if (!msg.init(cx, msgstr))
const jschar *msgchars = JS_GetStringCharsZ(cx, msgstr);
if (!msgchars)
return NS_OK;
nsresult rv = scripterr->InitWithWindowID(
msg, fileName, EmptyString(), lineNo, 0, 0,
nsDependentString(static_cast<const char16_t *>(msgchars)),
fileName, EmptyString(), lineNo, 0, 0,
"XPConnect JavaScript", innerWindowID);
NS_ENSURE_SUCCESS(rv, NS_OK);

View File

@ -368,12 +368,13 @@ nsXPCWrappedJSClass::BuildPropertyEnumerator(XPCCallContext& ccx,
if (!name)
return NS_ERROR_FAILURE;
nsAutoJSString autoStr;
if (!autoStr.init(cx, name))
size_t length;
const jschar *chars = JS_GetStringCharsAndLength(cx, name, &length);
if (!chars)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIProperty> property =
new xpcProperty(autoStr.get(), (uint32_t)autoStr.Length(), value);
new xpcProperty(chars, (uint32_t) length, value);
if (!propertyArray.AppendObject(property))
return NS_ERROR_FAILURE;