[TIMOB-19181] Windows: Implement toJSON for Titanium proxy classes
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2015-07-22T11:52:59.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Windows |
Labels | n/a |
Reporter | Christopher Williams |
Assignee | Kota Iguchi |
Created | 2015-07-06T23:31:00.000+0000 |
Updated | 2017-03-17T18:06:48.000+0000 |
Description
Calling JSON.stringify(proxy) on a Titanium proxy results in an error. We can control the JSON representation that a custom class returns by having a special toJSON() function that returns a JSObject, which is then converted internally by JSC into JSON.
https://github.com/appcelerator/webkit/blob/master/Source/JavaScriptCore/runtime/JSONObject.cpp#L328
Even if we can't get a great initial representation, we may be able to simply return undefined and avoid this runtime error?
https://github.com/appcelerator/titanium_mobile/blob/0ff8c6818ca7a1b1cd0da18c11c60bab00ccb423/android/modules/ui/src/js/ui.js#L91 https://github.com/appcelerator/titanium_mobile/blob/17dc8754653daaff170ea0c18f74218168a5633e/android/runtime/common/src/js/titanium.js#L304 https://github.com/appcelerator/titanium_mobile/blob/0ff8c6818ca7a1b1cd0da18c11c60bab00ccb423/iphone/Classes/TiProxy.m#L1293
Closing ticket as invalid.