From 1bb88cbe10b45208746248924aca065110e8dd0a Mon Sep 17 00:00:00 2001 From: YorkShen Date: Tue, 8 Jan 2019 14:31:28 +0800 Subject: [PATCH] * [Android] Add eagle support in JSC to fix the problem of updateComponentData not invoked. Cherry-pick file of weex_jsc_utils.c cherry pick from 2fd9885f82e6b31c43cf419dd1d1301ecc586d94 --- weex_core/Source/android/jsengine/weex_jsc_utils.cpp | 2 +- weex_core/Source/android/jsengine/wson/wson_jsc.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/weex_core/Source/android/jsengine/weex_jsc_utils.cpp b/weex_core/Source/android/jsengine/weex_jsc_utils.cpp index 145864d614..f1182a0ad2 100644 --- a/weex_core/Source/android/jsengine/weex_jsc_utils.cpp +++ b/weex_core/Source/android/jsengine/weex_jsc_utils.cpp @@ -109,7 +109,7 @@ std::unique_ptr getCharOrJSONStringFromState(ExecState *state, int argum return nullptr; } JSValue val = state->argument(argument); - if (val.isString()) { + if (val.isString() || val.isNumber()) { String str(val.toWTFString(state)); CString data = str.utf8(); return newCharString(data.data(), data.length()); diff --git a/weex_core/Source/android/jsengine/wson/wson_jsc.cpp b/weex_core/Source/android/jsengine/wson/wson_jsc.cpp index 296f4122b4..92de910bd0 100644 --- a/weex_core/Source/android/jsengine/wson/wson_jsc.cpp +++ b/weex_core/Source/android/jsengine/wson/wson_jsc.cpp @@ -262,6 +262,12 @@ namespace wson { JSValue wson_to_js_value(ExecState* exec, wson_buffer* buffer, IdentifierCache* localIdentifiers, const int& localCount){ uint8_t type = wson_next_type(buffer); switch (type) { + case WSON_UINT8_STRING_TYPE: { + int size = wson_next_uint(buffer); + uint8_t *utf8 = wson_next_bts(buffer, size); + String s = String::fromUTF8(reinterpret_cast(utf8), size); + return jsString(exec, s); + } case WSON_STRING_TYPE: case WSON_NUMBER_BIG_INT_TYPE: case WSON_NUMBER_BIG_DECIMAL_TYPE:{