Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26518] Android: Webview FireEvent not get fired in correct sequence

GitHub Issuen/a
TypeStory
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2018-11-06T18:00:38.000+0000
Affected Version/sRelease 7.4.1
Fix Version/sRelease 8.0.0
ComponentsAndroid
Labelsn/a
ReporterAminul Islam
AssigneeGary Mathews
Created2018-11-05T12:40:30.000+0000
Updated2018-11-16T11:59:48.000+0000

Description

Hi team, For Android Platform, I have added "evenlistener" in webview local html file. The event is fired from app.js. The issue is, fireEvent get fired in reverse order for Android. For iOS, the sequence is right and for Android, the sequence is wrong. App.js
var win = Ti.UI.createWindow({

});

var webView = Ti.UI.createWebView({
	visible : false,
	url : 'index.html'

});

win.add(webView);
webView = null;

win.open();

setTimeout(function() {

	for (var i = 0; i < 5; i++) {
		var data = {
			value : i
		};

		Ti.API.info("value passed:" + i);
		Ti.App.fireEvent('testevent', data);
	}
}, 5000);
index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>

	</head>
	<body>

		<script type="text/javascript">
			function passdatatoserver(e) {

				Ti.API.info("testevent:" + e.value);

			}


			Ti.App.addEventListener('testevent', passdatatoserver);

		</script>
	</body>
</html>
Log for adroid:
[INFO] :   value passed:0
[INFO] :   value passed:1
[INFO] :   value passed:2
[INFO] :   value passed:3
[INFO] :   value passed:4
[WARN] :   TiVerify: (Timer-0) [4992,4993] Verifying module licenses...
[INFO] :   I/System.out: Thread-63102(ApacheHTTPLog):Reading from variable values from setDefaultValuesToVariables
[INFO] :   I/System.out: Thread-63102(ApacheHTTPLog):isSBSettingEnabled false
[INFO] :   I/System.out: Thread-63102(ApacheHTTPLog):isShipBuild true
[INFO] :   I/System.out: Thread-63102(ApacheHTTPLog):getDebugLevel 0x4f4c
[INFO] :   I/System.out: Thread-63102(ApacheHTTPLog):Smart Bonding Setting is false
[INFO] :   I/System.out: Thread-63102(ApacheHTTPLog):SmartBonding Setting is false, SHIP_BUILD is true, log to file is false, DBG is false, DEBUG_LEVEL (1-LOW, 2-MID, 3-HIGH) is 1
[INFO] :   I/System.out: Timer-0 calls detatch()
[INFO] :   TiVerify: (Timer-0) [838,5831] Succesfully verified module licenses
[INFO] :   testevent:4
[INFO] :   testevent:3
[INFO] :   testevent:2
[INFO] :   testevent:1
[INFO] :   testevent:0
Test Environment:
Operating System
  Name                        = Microsoft Windows 10 Pro
  Version                     = 10.0.17134
  Architecture                = 32bit
  # CPUs                      = 4
  Memory                      = 17091956736
Node.js
  Node.js Version             = 8.9.1
  npm Version                 = 5.5.1
Titanium CLI
  CLI Version                 = 5.1.1
Titanium SDK
  SDK Version                 = 7.4.1.GA

Attachments

FileDateSize
androidlogs.png2018-11-05T12:41:00.000+000012668
ioslogs.png2018-11-05T12:41:00.000+000013278

Comments

  1. Gary Mathews 2018-11-05

    master: https://github.com/appcelerator/titanium_mobile/pull/10422
  2. Samir Mohammed 2018-11-16

    *Closing ticket*. Fix verified in SDK Version 8.0.0.v20181114074027 Webview FireEvent now gets fired in correct sequence. *Test steps (FR passed):*

    Created a new titanium project

    Added the test case from https://github.com/appcelerator/titanium_mobile/pull/10422

    Ran the program

    Following output was seen (Correct sequence):

       [INFO] :   value passed:0
       [INFO] :   value passed:1
       [INFO] :   value passed:2
       [INFO] :   value passed:3
       [INFO] :   value passed:4
       [INFO] :   TiVerify: (Timer-0) [5000,5000] Verifying module licenses...
       [INFO] :   testevent:0
       [INFO] :   testevent:1
       [INFO] :   testevent:2
       [INFO] :   testevent:3
       [INFO] :   testevent:4
       
    *Test Environment*
       APPC Studio: 5.1.1.201809051655
       Nexus 5X 7.1 (Sim)
       APPC CLI: 7.0.8-5
       Operating System Name: Mac OS Mojave
       Operating System Version: 10.14.1
       Node.js Version: 8.9.1
       Xcode 10.1
       

JSON Source