Expected Result:
A CommonJS project should build and run without build errors or runtime errors.
Actual Result:
Rhino and V8 crash every time with the following error:
TypeError: Cant use instance of a non-object. (Resources/app.js#4)
Steps to Reproduce:
Create a new project using 1.8.0.1 (V8 or Rhino), choose next (instead of finish).
Use the code below to create the app
Run the project (emulator or device) on a windows OS.
// This is a single context application with mutliple windows in a stack
(function() {
var Window = require('ApplicationWindow').ApplicationWindow;
new Window().open();
})();
//Application Window Component Constructor
exports.ApplicationWindow = function() {
//create object instance
var self = Ti.UI.createWindow();
return self;
};
Tested and works without producing any exceptions on 1.8.0.1 with both engines:
Further clarification from Matt - this is a Windows-specific issue. Title and steps to reproduce have been amended. Previous tests were on Ubuntu. Tests on windows to follow.
PR ready: https://github.com/appcelerator/titanium_mobile/pull/812 If you run into the error above, make sure you do a a full clean build before launching the emulator.
I have tested this on Windows 7, ensuring that the project was cleaned before launch. The following exception is generated, and "Uncaught TypeError: Cannot use 'in' operator to search for 'Resources/ApplicationWindow.js' in null" is displayed on the emulator:
The following results are from an Ubuntu system. No exception is generated, or error in the emulator, but the message
jsValueToJavaObject returning null
is shown in the console (not sure if it's relevant to this windows issue, tho):Bug fixed. Verified on: SDK: 1.8.0.1.v20111206151102 Runtimes: Android V8/Rhino Studio: 1.0.7.201112060130 OS: Windows 7 Devices Tested: Nexus One 2.2.2, Droid3 2.3.4, G-Slate 3.1, Android Emulator 4.0
Added label qe-testadded.