[TIMOB-11294] Android: console: log functions fail in commonjs require
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-08-14T20:57:52.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | Release 3.0.0, Release 3.1.0, 2012 Sprint 22 Core, 2012 Sprint 22 |
Components | Android |
Labels | core, module_require, qe-and100112, qe-manualtest, qe-port |
Reporter | Aaron K. Saunders |
Assignee | Allen Yeung |
Created | 2012-09-17T06:33:16.000+0000 |
Updated | 2014-08-14T20:57:52.000+0000 |
Description
[ERROR][TiJSError( 744)] (main) [0,1111] - Message: Uncaught ReferenceError: console is not defined
[ERROR][TiJSError( 744)] (main) [0,1111] - Source:console.debug("drawAnnotation");
Another Log:
[ERROR][TiExceptionHandler( 656)] (main) [618,1470] ----- Titanium Javascript Runtime Error -----
[ERROR][TiExceptionHandler( 656)] (main) [1,1471] - In require.js:1,1
[ERROR][TiExceptionHandler( 656)] (main) [0,1471] - Message: Uncaught ReferenceError: console is not defined
[ERROR][TiExceptionHandler( 656)] (main) [0,1471] - Source: console.log('require');
[ERROR][V8Exception( 656)] Exception occurred at require.js:1: Uncaught ReferenceError: console is not defined
seems like console works fine on IOS but throws errors on Android.
Any console object calls in a commonjs module will fail on android, they work from app.js though.
This is not a regression.
Docs: http://docs.appcelerator.com/titanium/2.1/index.html#!/api/Global.console
Steps to Reproduce:
1. Run code:
require.js
console.log('console.log');
console.debug('console.debug');
console.warn('console.warn');
console.error('console.error');
console.info('console.info');
app.js
require('require');
Actual Result:
Runtime error.
Expected Result:
Console message logged.
This was originally logged as a TC ticket, then moved to ALOY. As "drawAnnotation" is used nowhere in the Alloy code, I'm assuming this is either related to the test code used to generate this error, or an underlying Android issue. I"ll add myself as a watcher in case this does in fact turn out to be Alloy-specific. Aaron, can you provide the test code necessary to reproduce this error?
Updating ticket.
It's a scope problem.
PR: https://github.com/appcelerator/titanium_mobile/pull/3360
Also fails in win.url files. app.js
module.js
Console Output:
PR for fixing window URL file: https://github.com/appcelerator/titanium_mobile/pull/3371
3_0_X PR https://github.com/appcelerator/titanium_mobile/pull/3465
Closing as fixed. Tested on: Titanium Studio, build: 3.0.0.201211301903 Titanium SDK, builds: 3.0.0.v20121130200208; 3.1.0.v20121203181001 Devices: Samsung Galaxy S III (4.0.4)