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

Android: Runtime error is thrown for require method when called from window opened via URL

    Details

      Description

      This is a regression. It works fine on 2.1.3GA.

      When the app is run, a runtime error is thrown - "Message: Uncaught ReferenceError: require is not defined". Log attached.

      Steps to reproduce:
      1. Use the following code in app.js

      Ti.UI.createWindow({
      	url: "win.js", // causes new JS context
      	backgroundColor: "#000",
      	exitOnClose: true
      }).open();
      

      2. Create a file 'included.js' under 'Resources' folder and add the code below in it-

      var includedWord = "YES";
      

      3. Create another file win.js under 'Resources' folder and add the code below in it-

      require("module"); // Don't need return value, just important that this runs.
      Ti.include("included.js");
      alert("Does this app work (YES/NO)? \nAnswer: " + includedWord);
      

      4. Paste the attached file 'module.js' under the 'Resources' folder.

      5. Run the app on android device.

      Expected result:
      App should display an alert 'Does this app work? YES!'

      Actual result:
      A runtime error is thrown. Error log attached.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pwang Ping Wang
                Reporter:
                sbhadauria Shyam Bhadauria
                Reviewer:
                Allen Yeung
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-14666
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration