Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5355] Javascript parser crash on device when using commonJS modules

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2012-01-09T12:12:03.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.8.0.1
ComponentsiOS
Labelsmodule_build, qe-testadded
ReporterShannon Hicks
AssigneeBlain Hamon
Created2011-08-30T08:19:32.000+0000
Updated2012-01-09T12:12:03.000+0000

Description

Here's what the app.js file looks like:
var TextEditWindow = require('TextEditWindow').TextEditWindow;
Here's the TextEditWindow.js file:
exports.TextEditWindow = function() {

	var win = Titanium.UI.createWindow();
	
	return win;
};

exports.TextEditWindow.prototype.calculateBottom = function(orientation) {
	var calculatedBottom = 10;
	
	return calculateBottom;
}
Without a ";" at the end of TextEditWindow, it crashes on-device, but works in the Simulator. The crash said there was a parse error at line 3 (obviously nowhere near the problem), and doesn't specify which file. Either the parser should be a little less strict, or we should be able to get a more accurate error message.

Comments

  1. Rick Blalock 2011-09-14

  2. Paul Dowsett 2011-09-23

    Shannon Which device did you test this on, please? Thanks
  3. Shannon Hicks 2011-09-23

    I tried it on an iPhone 4 running the latest [REDACTED], and a 3G running 4.2.1
  4. Blain Hamon 2011-11-07

    Hours recorded on 4825. Pull pending. https://github.com/appcelerator/titanium_mobile/pull/647
  5. Dustin Hyde 2011-12-08

    Bug fixed. Verified on: SDK: 1.8.0.1.v20111208104316 Studio: 1.0.7.201112080131 OS: OS X Lion Devices Tested: iPod 4.3.3
  6. Dustin Hyde 2012-01-09

    Added label qe-testadded.

JSON Source