Project: titanium
Issue TIMOB-19157: Windows: Ti.Filesystem.File.read() fails on device only if file has .js extension
The following example works in the emulator but fails on the {{.js}} file on device: {code:javascript} var win = Ti.UI.createWindow(); var btn = Ti.UI.createButton({	title: 'Click' }); btn.addEventListener('click', function (e) {	try {	var txt = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'file.txt');	txt.write('Hello world');	txt.read();	} catch (e) {	alert('TXT failed: ' + JSON.stringify(e));	}	try {	var js = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'file.js');	js.write('Hello world');	js.read();	} catch (e) {	alert('JS failed: ' + JSON.stringify(e));	}	alert('all OK'); }); win.add(btn); win.open(); {code} h2. Error {code} { "message": "Could not load module: module_path = C:\\Data\\Users\\DefApps\\APPDATA\\Local\\Packages\com.appc.test_339c21w222ff8\\LocalState\\file.js", "native_stack": ["JSExportClass::CallNamedFunction"], "stack": "read@[native code]\n", "line": 1 } {code} It looks like the {{.js}} extension triggers it (but only on device) to use [readRequiredModule|https://github.com/appcelerator/titanium_mobile_windows/blob/master/Source/Global/src/GlobalObject.cpp#L172-L179] and then fails. It's the only place where I could find this error. In addition the attached screenshots also show another bug, where a caught exception in an event listener still causes another exception raised?
Story points: 5