Fix for setting properties through RPC
This commit is contained in:
parent
ebb400ed41
commit
3c9fb1a323
|
@ -122,11 +122,11 @@ static JSGlobalContextRef s_context;
|
||||||
return @{@"result": [self resultForJSValue:propertyValue]};
|
return @{@"result": [self resultForJSValue:propertyValue]};
|
||||||
};
|
};
|
||||||
s_requests["/set_property"] = [=](NSDictionary *dict) {
|
s_requests["/set_property"] = [=](NSDictionary *dict) {
|
||||||
JSValueRef exception = NULL;
|
|
||||||
JSStringRef propString = RJSStringForString([dict[@"name"] UTF8String]);
|
JSStringRef propString = RJSStringForString([dict[@"name"] UTF8String]);
|
||||||
RPCObjectID realmId = [dict[@"realmId"] longValue];
|
RPCObjectID realmId = [dict[@"objectId"] longValue];
|
||||||
JSValueRef value = [[JSValue valueWithObject:dict[@"value"]
|
JSValueRef value = [self valueFromDictionary:dict[@"value"]];
|
||||||
inContext:[JSContext contextWithJSGlobalContextRef:s_context]] JSValueRef];
|
JSValueRef exception = NULL;
|
||||||
|
|
||||||
ObjectSetProperty(s_context, s_objects[realmId], propString, value, &exception);
|
ObjectSetProperty(s_context, s_objects[realmId], propString, value, &exception);
|
||||||
JSStringRelease(propString);
|
JSStringRelease(propString);
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@ function getObjectProperty(realmId, objectId, name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setObjectProperty(realmId, objectId, name, value) {
|
function setObjectProperty(realmId, objectId, name, value) {
|
||||||
|
value = serialize(realmId, value);
|
||||||
sendRequest('set_property', {realmId, objectId, name, value});
|
sendRequest('set_property', {realmId, objectId, name, value});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue