[TIMOB-27633] Android: Additional parameters in require cause app to crash
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-01-13T11:00:39.000+0000 |
Affected Version/s | Release 8.0.0 |
Fix Version/s | Release 9.0.0 |
Components | Android |
Labels | android, engSchedule |
Reporter | Jan Vennemann |
Assignee | Christopher Williams |
Created | 2019-11-26T19:19:27.000+0000 |
Updated | 2020-01-13T11:00:39.000+0000 |
Description
*Steps to reproduce the behavior*
Create a new JS files that can be required, for example
Create a new JS files that can be required, for example test.js
. The content doesn't matter
Require that JS file with an additional parameter
require('./test.js', true);
Run on Android
*Actual behavior* The app crashes during runtime with the following error:
[ERROR] TiExceptionHandler: (main) [157,157] ti:/module.js:596
[ERROR] TiExceptionHandler: context.sourceUrl = url;
[ERROR] TiExceptionHandler: ^
[ERROR] TiExceptionHandler: TypeError: Cannot create property 'sourceUrl' on boolean 'true'
[ERROR] TiExceptionHandler: at Module._runScript (ti:/module.js:596:20)
[ERROR] TiExceptionHandler: at Module.load (ti:/module.js:107:7)
[ERROR] TiExceptionHandler: at Module.loadJavascriptText (ti:/module.js:453:9)
[ERROR] TiExceptionHandler: at Module.loadAsFile (ti:/module.js:503:15)
[ERROR] TiExceptionHandler: at Module.loadAsFileOrDirectory (ti:/module.js:425:20)
[ERROR] TiExceptionHandler: at Module.require (ti:/module.js:255:17)
[ERROR] TiExceptionHandler: at Module.global.Module.require (/ti.main.js:9505:34)
[ERROR] TiExceptionHandler: at require (ti:/module.js:566:15)
[ERROR] TiExceptionHandler: at /app.js:20:1
[ERROR] TiExceptionHandler: at Module._runScript (ti:/module.js:608:9)
[ERROR] TiExceptionHandler:
[ERROR] TiExceptionHandler: org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModuleBytes(Native Method)
[ERROR] TiExceptionHandler: org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModuleBytes(V8Runtime.java:162)
[ERROR] TiExceptionHandler: org.appcelerator.kroll.KrollRuntime.runModuleBytes(KrollRuntime.java:212)
[ERROR] TiExceptionHandler: org.appcelerator.titanium.TiLaunchActivity.loadScript(TiLaunchActivity.java:101)
[ERROR] TiExceptionHandler: org.appcelerator.titanium.TiRootActivity.loadScript(TiRootActivity.java:480)
[ERROR] TiExceptionHandler: org.appcelerator.titanium.TiLaunchActivity.onResume(TiLaunchActivity.java:192)
[ERROR] TiExceptionHandler: org.appcelerator.titanium.TiRootActivity.onResume(TiRootActivity.java:499)
[ERROR] TiExceptionHandler: android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1355)
[ERROR] TiExceptionHandler: android.app.Activity.performResume(Activity.java:7117)
[ERROR] TiExceptionHandler: android.app.ActivityThread.performResumeActivity(ActivityThread.java:3556)
*Expected behavior*
Additional parameter to require will be ignored.
*Additional notes*
If the file was required before without any additional parameters the require works as expected.
// This won't crash
require('./test');
require('./test', true);
[~gmathews] put up a PR https://github.com/appcelerator/titanium_mobile/pull/11378 for a possible solution and further discussion.
WIP PR: https://github.com/appcelerator/titanium_mobile/pull/11380
https://github.com/appcelerator/titanium_mobile/pull/11380
FR Passed, Waiting on Jenkins build.
merged to master for 9.0.0
*Closing ticket*, fix verified in SDK Version
9.0.0.v20200110103446
. Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/11380