[TIMOB-17489] Do not process data returned by callbacks
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | High |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | bridge, callback, crashes, kroll, triageSupport |
Reporter | Fokke Zandbergen |
Assignee | Pedro Enrique |
Created | 2014-07-08T08:41:57.000+0000 |
Updated | 2014-09-04T15:16:03.000+0000 |
Description
If a JavaScript callback - e.g. via
Ti.*.addEventListener('event', fn);
or Ti.Network.createHTTPClient({ onload: fn });
- returns a value, that value will be converted to a native object.
If this is a large object this can crash the app, like demonstrated by the first button in this [example app](https://github.com/wappzapp/whatsup).
I can't think of any use-case why the proxy needs the value the callback returns. So if there is a way to keep Kroll from converting it, this would help to prevent people from spending days - like we did - on nailing the crash.
I'll publish a [post on tiDev.io](http://www.tidev.io/2014/07/08/dont-let-callbacks-cross-the-bridge/) at 5pm UTC explaining this issue.
[~fokke] Is this specific to a particular platform, or does it happen both Android and iOS?
Can't say (am on holiday) but I'd suspect it's the same on Android and since it has no value other then potentially consuming memory and crashing I'd strip it.
[~penrique] to review for possible 3.5.0 inclusion.