Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-27633

Android: Additional parameters in require cause app to crash

    Details

    • Story Points:
      8
    • Sprint:
      2019 Sprint 26

      Description

      Steps to reproduce the behavior

      1. Create a new JS files that can be required, for example test.js. The content doesn't matter
      2. Require that JS file with an additional parameter

        require('./test.js', true);
        

      3. 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);
      

        Attachments

          Activity

            People

            • Assignee:
              cwilliams Christopher Williams
              Reporter:
              jvennemann Jan Vennemann
              Reviewer:
              Gary Mathews
              Tester:
              Samir Mohammed
            • Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration