Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18118] iOS: ti.cloud - App crashes on launch if you require in ti.cloud module with SDK 3.5.0

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2014-12-07T23:34:11.000+0000
Affected Version/sRelease 3.5.0
Fix Version/sRelease 3.5.0, Release 4.0.0
ComponentsiOS
Labelsqe-3.5.0, regression
ReporterWilson Luu
AssigneeVishal Duggal
Created2014-12-02T02:59:44.000+0000
Updated2014-12-08T19:32:30.000+0000

Description

*Details:* If you require in the GA ti.cloud module (3.2.7) into your app running SDK 3.5.0, then your app will crash on launch. Specifically, this line of code from ti.cloud.js: if (null != b && null != e). However, if you use strict equal, e.g. if (null !== b && null !== e), then the app will launch fine. *Notes:* * This is a *regression* as this does not occur in SDK 3.4.1.GA * -This issue it *not reproducible* if you require in APM- *Steps to reproduce:* 1. Create the default Titanium classic app 2. Include this snippet of code in app.js (snippet of code is from ti.cloud.js):
var e;

null == e && (e = {});

e.declareClass = function(a, d, b) {
    var e = a[d];
    a[d] = b;
    if (null != b && null != e)
        for (var f in e) "prototype" != f && (b[f] = e[f]);
    return b
};

e.declareClass(e, "SignatureMethod", function() {});
3. Install app to device 4. Launch app *Actual:* App will crash on launch; see crash.log and console.log. *Expected:* App should not crash if you require in the GA ti.cloud module.

Attachments

FileDateSize
console.log2014-12-02T02:59:44.000+00001395538
crash.log2014-12-02T02:59:44.000+000044070
ti.cloud.js2014-12-02T21:22:41.000+000051503

Comments

  1. Ingo Muschenetz 2014-12-02

    [~wluu], since the module is common.js, can you strip down the module to see if you can narrow down the cause?
  2. Wilson Luu 2014-12-02

    More info: After beautifying ti.cloud.js and further investigation with Jon, line 681 - 927 seems to be the cause of the issue. It looks like that block of code is using old OAuth code from Netflix. And, if I comment out the block of code (line 681 - 927) and repeat the reproducible steps, my app does not crash. Attached my modified ti.cloud.js.
  3. Wilson Luu 2014-12-03

    More info: In the block of code that I mentioned above (line 681 - 927), the exact error is occurring in the following function:
       e.declareClass = function(a, d, b) {
           var e = a[d];
           a[d] = b;
           if (null != b && null != e)
               for (var f in e) "prototype" != f && (b[f] = e[f]);
           return b
       };
       
    For what ever reason, the function is not reaching the return statement.
  4. Kajenthiran Velummaylum 2014-12-04

    TIMOB-18135 is similar bug to this scenario. Following is the actual code of crash here
       if (null != b && null != e) // It crashes in this line if either 'b' or 'e' is null.
               // some code here
       
  5. Wilson Luu 2014-12-08

    Closing ticket as fixed. Verified that if you require in ti.cloud 3.2.7 into your app.js, your app will not crash. Also, verified the above sample code does not make the app crash. Tested on: Appcelerator Studio, build: 3.4.1.201410281743 SDK build: 3.5.0.v20141208092926 CLI: 3.4.1 Alloy: 1.5.1 Xcode: 6.1.1 GM Devices: iphone 6 plus (8.1.1)

JSON Source