Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Medium
-
Resolution: Fixed
-
Affects Version/s: Release 8.1.0
-
Fix Version/s: Release 9.0.3
-
Component/s: Android
-
Labels:
-
Story Points:3
Description
Summary:
If a project contains a JS file ending with *.bootstrap.js, then every Android incremental build performed will duplicate its entry within our ti.internal/bootstrap.json file. This causes the bootstrap JS file to be executed multiple times on startup.
This regression was introduced in Titanium 8.1.0.
Note:
This only negatively impacts bootstraps that have an execute() function such as ti.playservices, because that function will end up being invoked multiple times.
Steps to reproduce:
- Create a Titanium app project.
- Copy the below test.bootstrap.js to the Resources directory.
- Build and run on Android.
- Notice a bootstrap dialog appears once. (This is good.)
- Build and run on Android again.
- Notice two bootstrap dialogs appear on startup. (This is bad.)
- Build and run on Android again.
- Notice three bootstrap dialogs appear on startup. (This is bad.)
./Resources/test.bootstrap.js
Ti.API.info("### Bootstrap was required-in."); |
|
var wasExecuted = false; |
exports.execute = function(finished) { |
Ti.API.info("### Bootstrap execute() method was called."); |
var message = "This is the bootstrap dialog."; |
if (wasExecuted) { |
message = "Uh-oh!!! Bootstrap was wrongly executed again."; |
}
|
var dialog = Ti.UI.createAlertDialog({ |
message: message,
|
buttonNames: ['OK'], |
cancel: 0,
|
persistent: true, |
});
|
dialog.addEventListener('click', finished); |
dialog.addEventListener('cancel', finished); |
dialog.show();
|
wasExecuted = true; |
};
|
Cause:
The incremental build changes made in Titanium 8.1.0 by TIMOB-27043 moved bootstrap script finding code to our core process-js-task.js file. The iOS _build.js was changed to not fetch bootstrap scripts itself anymore... but the same as not done in Android's _build.js which is why the entries are being duplicated.