diff --git a/lib/rpc.js b/lib/rpc.js index 675489da..46075bfc 100644 --- a/lib/rpc.js +++ b/lib/rpc.js @@ -90,6 +90,10 @@ function serialize(realmId, value) { return {type: objectTypes.FUNCTION}; } + if (typeof value === 'undefined') { + return {type: 'undefined'}; + } + if (!value || typeof value != 'object') { return {value: value}; } diff --git a/src/RealmRPC.cpp b/src/RealmRPC.cpp index 32392e24..45ce0782 100644 --- a/src/RealmRPC.cpp +++ b/src/RealmRPC.cpp @@ -315,6 +315,10 @@ JSValueRef RPCServer::deserialize_json_value(const json dict) } return date; } + else if (type_string == "undefined") { + return JSValueMakeUndefined(m_context); + } + assert(0); } if (value.is_null()) { @@ -353,5 +357,5 @@ JSValueRef RPCServer::deserialize_json_value(const json dict) return js_object; } - return JSValueMakeUndefined(m_context); + assert(0); }