Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17489] Do not process data returned by callbacks

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsbridge, callback, crashes, kroll, triageSupport
ReporterFokke Zandbergen
AssigneePedro Enrique
Created2014-07-08T08:41:57.000+0000
Updated2014-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.

Comments

  1. Ingo Muschenetz 2014-08-11

    [~fokke] Is this specific to a particular platform, or does it happen both Android and iOS?
  2. Fokke Zandbergen 2014-08-12

    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.
  3. Ingo Muschenetz 2014-08-25

    [~penrique] to review for possible 3.5.0 inclusion.

JSON Source