Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-25468] Android: Always include 'source' property with events #9643

Merged
merged 6 commits into from Dec 15, 2017

Conversation

garymathews
Copy link
Contributor

@garymathews garymathews commented Nov 30, 2017

  • Always include source property in proxy events
TEST CASE
var win = Ti.UI.createWindow({
		backgroundColor : 'gray'
	}),
	webView = Ti.UI.createWebView({
	    url : 'https://appcelerator.com'
	});

webView.addEventListener('load', function(e) {
    alert('source:' + JSON.stringify(e.source, null, 2));
});

win.add(webView);
win.open();

JIRA Ticket

@build
Copy link
Contributor

build commented Nov 30, 2017

Messages
📖

💾 Here's the generated SDK zipfile.

Generated by 🚫 dangerJS

@jquick-axway
Copy link
Contributor

Question:
Shouldn't this be fixed in KrollProxy.doFireEvent() instead? That's where we set the event source, but it only gets set if the eventListeners collection is not empty. Perhaps event listeners are being managed on the C/C++ side and the Java eventListeners is no longer used?
https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/java/org/appcelerator/kroll/KrollProxy.java#L855

@hansemannn
Copy link
Collaborator

@garymathews @jquick-axway Going with this one or a different solution? We're trying code-freeze for 7.0.1 on Monday :-).

@garymathews
Copy link
Contributor Author

garymathews commented Dec 7, 2017

@jquick-axway Yep, updated PR. eventListeners isn't used anymore. But I still fixed it in doFireEvent()

Copy link
Contributor

@jquick-axway jquick-axway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: Pass

@lokeshchdhry
Copy link
Contributor

lokeshchdhry commented Dec 13, 2017

@garymathews , When I run the test code on pixel android 7.1.1 I do not get any alert with source info. Android 6.0.1 device is fine. Also android emulator 7.1.1 shows the info but android 8.0 emulator does not.

This happens on 6.3.0.GA as well.

I also checked on my samsung s8+ running android 7.1.1 & I get the same issue.

Below are the logs for pixel 7.1.1 device:

[INFO] :   art: Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.eb>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/RenderProcessGoneDetail;
[INFO] :   art:   at com.android.webview.chromium.Ap com.android.webview.chromium.WebViewChromiumFactoryProvider.G(android.webkit.WebView, android.content.Context) (WebViewChromiumFactoryProvider.java:323)
[INFO] :   art:   at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:42)
[INFO] :   art:   at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int, java.util.Map, boolean) (WebView.java:636)
[INFO] :   art:   at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int) (WebView.java:572)
[INFO] :   art:   at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int) (WebView.java:555)
[INFO] :   art:   at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet) (WebView.java:542)
[INFO] :   art:   at void android.webkit.WebView.<init>(android.content.Context) (WebView.java:532)
[INFO] :   art:   at void ti.modules.titanium.ui.widget.webview.TiUIWebView$TiWebView.<init>(ti.modules.titanium.ui.widget.webview.TiUIWebView, android.content.Context) (TiUIWebView.java:97)
[INFO] :   art:   at void ti.modules.titanium.ui.widget.webview.TiUIWebView$NonHTCWebView.<init>(ti.modules.titanium.ui.widget.webview.TiUIWebView, android.content.Context) (TiUIWebView.java:249)
[INFO] :   art:   at void ti.modules.titanium.ui.widget.webview.TiUIWebView.<init>(org.appcelerator.titanium.proxy.TiViewProxy) (TiUIWebView.java:302)
[INFO] :   art:   at org.appcelerator.titanium.view.TiUIView ti.modules.titanium.ui.WebViewProxy.createView(android.app.Activity) (WebViewProxy.java:84)
[INFO] :   art:   at org.appcelerator.titanium.view.TiUIView org.appcelerator.titanium.proxy.TiViewProxy.handleGetView() (TiViewProxy.java:506)
[INFO] :   art:   at org.appcelerator.titanium.view.TiUIView org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView() (TiViewProxy.java:492)
[INFO] :   art:   at void org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(org.appcelerator.titanium.view.TiUIView) (TiViewProxy.java:530)
[INFO] :   art:   at org.appcelerator.titanium.view.TiUIView org.appcelerator.titanium.proxy.TiViewProxy.handleGetView() (TiViewProxy.java:514)
[INFO] :   art:   at org.appcelerator.titanium.view.TiUIView org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView() (TiViewProxy.java:492)
[INFO] :   art:   at void org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(org.appcelerator.titanium.proxy.TiViewProxy) (TiViewProxy.java:702)
[INFO] :   art:   at void org.appcelerator.titanium.proxy.TiViewProxy.add(java.lang.Object) (TiViewProxy.java:595)
[INFO] :   art:   at void ti.modules.titanium.ui.WindowProxy.windowCreated(org.appcelerator.titanium.TiBaseActivity, android.os.Bundle) (WindowProxy.java:266)
[INFO] :   art:   at void org.appcelerator.titanium.TiActivityWindows.windowCreated(org.appcelerator.titanium.TiBaseActivity, int, android.os.Bundle) (TiActivityWindows.java:33)
[INFO] :   art:   at void org.appcelerator.titanium.TiBaseActivity.windowCreated(android.os.Bundle) (TiBaseActivity.java:531)
[INFO] :   art:   at void org.appcelerator.titanium.TiBaseActivity.onCreate(android.os.Bundle) (TiBaseActivity.java:651)
[INFO] :   art:   at void org.appcelerator.titanium.TiActivity.onCreate(android.os.Bundle) (TiActivity.java:21)
[INFO] :   art:   at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6679)
[INFO] :   art:   at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
[INFO] :   art:   at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2618)
[INFO] :   art:   at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2726)
[INFO] :   art:   at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
[INFO] :   art:   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1477)
[INFO] :   art:   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
[INFO] :   art:   at void android.os.Looper.loop() (Looper.java:154)
[INFO] :   art:   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6119)
[INFO] :   art:   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
[INFO] :   art:   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:886)
[INFO] :   art:   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:776)
[INFO] :   art: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.webkit.RenderProcessGoneDetail" on path: DexPathList[[zip file "/data/app/com.android.chrome-2/base.apk"],nativeLibraryDirectories=[/data/app/com.android.chrome-2/lib/arm64, /data/app/com.android.chrome-2/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
[INFO] :   art:   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
[INFO] :   art:   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
[INFO] :   art:   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
[INFO] :   art:   at com.android.webview.chromium.Ap com.android.webview.chromium.WebViewChromiumFactoryProvider.G(android.webkit.WebView, android.content.Context) (WebViewChromiumFactoryProvider.java:323)
[INFO] :   art:   at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:42)
[INFO] :   art:   at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int, java.util.Map, boolean) (WebView.java:636)
[INFO] :   art:   at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int) (WebView.java:572)
[INFO] :   art:   at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int) (WebView.java:555)
[INFO] :   art:   at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet) (WebView.java:542)
[INFO] :   art:   at void android.webkit.WebView.<init>(android.content.Context) (WebView.java:532)
[INFO] :   art:   at void ti.modules.titanium.ui.widget.webview.TiUIWebView$TiWebView.<init>(ti.modules.titanium.ui.widget.webview.TiUIWebView, android.content.Context) (TiUIWebView.java:97)
[INFO] :   art:   at void ti.modules.titanium.ui.widget.webview.TiUIWebView$NonHTCWebView.<init>(ti.modules.titanium.ui.widget.webview.TiUIWebView, android.content.Context) (TiUIWebView.java:249)
[INFO] :   art:   at void ti.modules.titanium.ui.widget.webview.TiUIWebView.<init>(org.appcelerator.titanium.proxy.TiViewProxy) (TiUIWebView.java:302)
[INFO] :   art:   at org.appcelerator.titanium.view.TiUIView ti.modules.titanium.ui.WebViewProxy.createView(android.app.Activity) (WebViewProxy.java:84)
[INFO] :   art:   at org.appcelerator.titanium.view.TiUIView org.appcelerator.titanium.proxy.TiViewProxy.handleGetView() (TiViewProxy.java:506)
[INFO] :   art:   at org.appcelerator.titanium.view.TiUIView org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView() (TiViewProxy.java:492)
[INFO] :   art:   at void org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(org.appcelerator.titanium.view.TiUIView) (TiViewProxy.java:530)
[INFO] :   art:   at org.appcelerator.titanium.view.TiUIView org.appcelerator.titanium.proxy.TiViewProxy.handleGetView() (TiViewProxy.java:514)
[INFO] :   art:   at org.appcelerator.titanium.view.TiUIView org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView() (TiViewProxy.java:492)
[INFO] :   art:   at void org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(org.appcelerator.titanium.proxy.TiViewProxy) (TiViewProxy.java:702)
[INFO] :   art:   at void org.appcelerator.titanium.proxy.TiViewProxy.add(java.lang.Object) (TiViewProxy.java:595)
[INFO] :   art:   at void ti.modules.titanium.ui.WindowProxy.windowCreated(org.appcelerator.titanium.TiBaseActivity, android.os.Bundle) (WindowProxy.java:266)
[INFO] :   art:   at void org.appcelerator.titanium.TiActivityWindows.windowCreated(org.appcelerator.titanium.TiBaseActivity, int, android.os.Bundle) (TiActivityWindows.java:33)
[INFO] :   art:   at void org.appcelerator.titanium.TiBaseActivity.windowCreated(android.os.Bundle) (TiBaseActivity.java:531)
[INFO] :   art:   at void org.appcelerator.titanium.TiBaseActivity.onCreate(android.os.Bundle) (TiBaseActivity.java:651)
[INFO] :   art:   at void org.appcelerator.titanium.TiActivity.onCreate(android.os.Bundle) (TiActivity.java:21)
[INFO] :   art:   at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6679)
[INFO] :   art:   at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
[INFO] :   art:   at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2618)
[INFO] :   art:   at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2726)
[INFO] :   art:   at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
[INFO] :   art:   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1477)
[INFO] :   art:   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
[INFO] :   art:   at void android.os.Looper.loop() (Looper.java:154)
[INFO] :   art:   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6119)
[INFO] :   art:   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
[INFO] :   art:   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:886)
[INFO] :   art:   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:776)
[INFO] :   art:
[INFO] :   I/System.out: ActivityRecorder: after org.appcelerator.titanium.TiActivity@1594316_onCreate(), launchUrl = null
[INFO] :   I/System.out: ActivityRecorder: after org.appcelerator.titanium.TiActivity@1594316_onCreate(), launchUrl = null
[ERROR] :  libEGL: validate_display:99 error 3008 (EGL_BAD_DISPLAY)
[WARN] :   VideoCapabilities: Unrecognized profile 2130706433 for video/avc
[WARN] :   VideoCapabilities: Unrecognized profile 2130706434 for video/avc
[INFO] :   VideoCapabilities: Unsupported profile 4 for video/mp4v-es
[INFO] :   OpenGLRenderer: Initialized EGL, version 1.4
[WARN] :   cr_CrashFileManager: /data/user/0/com.app.timob25468/cache/WebView/Crash Reports does not exist or is not a directory
[INFO] :   I/TiWebChromeClient.console: (main) [2399,2399] JW Player does not support XML skins, please update your config (4:https://content.jwplatform.com/libraries/qvSX7uhk.js)
[INFO] :   I/TiWebChromeClient.console: (main) [488,2887] JW Plugin already loaded (2:https://content.jwplatform.com/libraries/qvSX7uhk.js)
[INFO] :   I/TiWebChromeClient.console: (main) [651,3538] Failed to load https://636-nhj-871.mktoresp.com/webevents/visitWebPage?_mchNc=1513121622461&_mchCn=&_mchId=636-NHJ-871&_mchTk=_mch-appcelerator.com-1513120195341-77410&_mchHo=www.appcelerator.com&_mchPo=&_mchRu=%2F&_mchPc=https%3A&_mchVr=153&_mchHa=&_mchRe=&_mchQp=: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.appcelerator.com' is therefore not allowed access. (0:https://www.appcelerator.com/)
[INFO] :   I/TiWebChromeClient.console: (main) [632,4170] This version of the Oktopost tracking code has been deprecated. We loaded the new version of the code instead. Please refer to your account setting to get the new code. (1:https://static.oktopost.com/okt.js)
[INFO] :   TouchTestDriver: 15:33:45,349 [main][25] Set the page load to (thread: main): true
[INFO] :   APSAnalyticsService: Analytics Service Started
[INFO] :   APSAnalyticsService: Stopping Analytics Service

@garymathews
Copy link
Contributor Author

@lokeshchdhry So it is a chromium issue, but it's of no concern. I receive the source alert dialog on both 8.1 emulator and an 8.0 device. Although, it does take a few seconds for the page to finish loading.

@build build added the android label Dec 13, 2017
@lokeshchdhry
Copy link
Contributor

lokeshchdhry commented Dec 15, 2017

FR Passed.

According to @garymathews the errors above are due to soasta & not related to this PR. There will be another PR for it.

source property is included with the events.

Studio Ver: 5.0.0.201712081732
SDK Ver: 7.1.0 local build
OS Ver: 10.12.3
Xcode Ver: Xcode 8.3.3
Appc NPM: 4.2.11
Appc CLI: 7.0.0
Daemon Ver: 1.0.0
Ti CLI Ver: 5.0.14
Alloy Ver: 1.10.10
Node Ver: 8.9.1
Java Ver: 1.8.0_101
Devices: ⇨ google Nexus 5 --- Android 6.0.1
⇨ google Pixel --- Android 7.1.1

@build build added the android label Dec 15, 2017
@lokeshchdhry lokeshchdhry merged commit 31225d4 into tidev:master Dec 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants