Bug 1034689 part 3 - Fix remaining places in Gecko to handle Latin1 strings. r=bz

This commit is contained in:
Jan de Mooij
2014-07-12 09:43:08 +02:00
parent bcc76546cb
commit 1fd3719a70
6 changed files with 32 additions and 35 deletions

View File

@@ -7,6 +7,7 @@
#include "AndroidBridge.h"
#include "mozilla/Vector.h"
#include "prthread.h"
#include "nsJSUtils.h"
using namespace mozilla;
using namespace mozilla::widget;
@@ -502,14 +503,11 @@ struct StringProperty
static Type FromValue(JNIEnv* env, jobject instance,
JSContext* cx, const JS::HandleString str) {
size_t strLen = 0;
const jschar* const strChars =
JS_GetStringCharsAndLength(cx, str, &strLen);
if (!CheckJSCall(env, !!strChars)) {
nsAutoJSString autoStr;
if (!CheckJSCall(env, autoStr.init(cx, str))) {
return nullptr;
}
jstring ret = env->NewString(
reinterpret_cast<const jchar*>(strChars), strLen);
jstring ret = env->NewString(autoStr.BeginReading(), autoStr.Length());
MOZ_ASSERT(ret);
return ret;
}