Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23871] iOS: Safari/WebInspector Debugger crashes app when hitting breakpoint

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-09-07T03:22:00.000+0000
Affected Version/sRelease 5.5.0
Fix Version/sRelease 6.0.0
ComponentsiOS
Labelsqe-6.0.0
ReporterChristopher Williams
AssigneeChristopher Williams
Created2016-09-06T14:39:03.000+0000
Updated2016-09-28T11:46:27.000+0000

Description

When attempting to hit a breakpoint in a callback function (i.e. inside a setInterval function callback, or on a click event callback for a label), the Safari WebInspector debugger crashes the Titanium app. Note you need to set the value to try in your tiapp.xml to test. This uses the "provided" JSCore engine for Titanium apps. As such, we should be able to use standard iOS tooling to debug the app, like Safari's debugger. However, the way we set up on particular object in the JS world, our code doesn't handle it. Specifically e hang a "Kroll" object off the global and ave it wrap a single instance of our KrollContext class in Obj-C. But all our code for handling wrapped JS objects assume it _always_ a KrollObject inside. In tis case, it's a KrollContext. So our Kroll*Property functions in KrollObject need to check for and handle this special object.

Comments

  1. Christopher Williams 2016-09-06

    Here's the error causing the crash:
       Sep  2 16:21:09 ChrisWilliamsMBP example[66933]: -[KrollContext objectForTiString:context:]: unrecognized selector sent to instance 0x7b393810
       Sep  2 16:21:09 ChrisWilliamsMBP com.apple.CoreSimulator.SimDevice.DBBD80F0-74C7-422D-8366-6FA5A343413A.launchd_sim[64739] (UIKitApplication:dsg.sdfg[0xa317][66933]): Service exited due to Segmentation fault: 11
       
    To reproduce: * launch a Titanium app with use-jscore-framework set to true and run-on-main-thread. (I used the standard template and just added a click listener for the label on each tab's content) * Open Safari > Develop > Simulator > JSContext. * Set a breakpoint in a callback function (i.e. on the label click event handler or a setInterval callback). * When it hits the breakpoint, it crashes.
  2. Chee Kiat Ng 2016-09-07

    Steps to test

    1. appc new --classic 2. include true in in tiapp.xml 3. in app.js, add an 'click' event listener to label. 4. appc run -p ios 5. Open Safari > Develop > Simulator > JSContext. 6. *inside* the opened Webinspector->Resources select app.js and add a breakpoint in the event listener added earlier 7. click on label

    Expected Result

    App will not crash and breakpoint works correctly. PRs reviewed and merged.
  3. Harry Bryant 2016-09-20

    Verified as fixed, Following the above test steps provided and using the latest 6.0.X SDK build, the app no longer crashes when hitting a breakpoint using the Safari/WebInspector Debugger, and the breakpoint works correctly. Tested On: iPhone 7 10.0 Simulator iPhone 6S 9.3 Simulator Mac OSX El Capitan 10.11.6 Ti SDK: 6.0.0.v20160919141738 Appc Studio: 4.8.0.201609101003 Appc NPM: 4.2.8-6 App CLI: 6.0.0-45 Xcode 8.0 Node v4.4.7 *Closing ticket.*

JSON Source