You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Andrew Grieve (JIRA)" <ji...@apache.org> on 2013/10/10 18:15:42 UTC

[jira] [Assigned] (CB-4858) Android InAppBrowser does not function properly on 4.3

     [ https://issues.apache.org/jira/browse/CB-4858?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Grieve reassigned CB-4858:
---------------------------------

    Assignee: Andrew Grieve  (was: David Kemp)

> Android InAppBrowser does not function properly on 4.3
> ------------------------------------------------------
>
>                 Key: CB-4858
>                 URL: https://issues.apache.org/jira/browse/CB-4858
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, Plugin InAppBrowser
>    Affects Versions: 3.0.0
>         Environment: Android 4.3
>            Reporter: Marcus Pridham
>            Assignee: Andrew Grieve
>
> Try using the full example for the executeScript on a 4.3 emulator.
> http://cordova.apache.org/docs/en/3.0.0/cordova_inappbrowser_inappbrowser.md.html#executeScript
> You will get a syntax issue around the replaceHeaderImage function it is missing a }; at the end of the executeScript call.
> Correct function should look like:
> {code}
>     function replaceHeaderImage() {
>         iabRef.executeScript({
>             code: "var img=document.querySelector('#header img'); img.src='http://cordova.apache.org/images/cordova_bot.png';"
>         }, function() {
>             alert("Image Element Successfully Hijacked");
>         });
>     }
> {code}
> Anyway if you run this sample it will fail on a 4.3 emulator with the following stack trace but it will work fine on a 4.0 emulator.
> {code}
> 09-17 15:45:34.236: W/webview_proxy(2553): java.lang.Throwable: Warning: A WebView method was called on thread 'WebViewCoreThread'. All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.
> 09-17 15:45:34.236: W/webview_proxy(2553): 	at android.webkit.WebView.checkThread(WebView.java:1918)
> 09-17 15:45:34.236: W/webview_proxy(2553): 	at android.webkit.WebView.loadUrl(WebView.java:771)
> 09-17 15:45:34.236: W/webview_proxy(2553): 	at org.apache.cordova.inappbrowser.InAppBrowser.injectDeferredObject(InAppBrowser.java:245)
> 09-17 15:45:34.236: W/webview_proxy(2553): 	at org.apache.cordova.inappbrowser.InAppBrowser.execute(InAppBrowser.java:169)
> 09-17 15:45:34.236: W/webview_proxy(2553): 	at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:65)
> 09-17 15:45:34.236: W/webview_proxy(2553): 	at org.apache.cordova.PluginManager.execHelper(PluginManager.java:229)
> 09-17 15:45:34.236: W/webview_proxy(2553): 	at org.apache.cordova.PluginManager.exec(PluginManager.java:214)
> 09-17 15:45:34.236: W/webview_proxy(2553): 	at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:53)
> 09-17 15:45:34.236: W/webview_proxy(2553): 	at android.webkit.JWebCoreJavaBridge.setNetworkOnLine(Native Method)
> 09-17 15:45:34.236: W/webview_proxy(2553): 	at android.webkit.JWebCoreJavaBridge.setNetworkOnLine(Native Method)
> 09-17 15:45:34.236: W/webview_proxy(2553): 	at android.webkit.WebViewCore$EventHub$1.handleMessage(WebViewCore.java:1431)
> 09-17 15:45:34.236: W/webview_proxy(2553): 	at android.os.Handler.dispatchMessage(Handler.java:99)
> 09-17 15:45:34.236: W/webview_proxy(2553): 	at android.os.Looper.loop(Looper.java:137)
> 09-17 15:45:34.236: W/webview_proxy(2553): 	at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:814)
> 09-17 15:45:34.236: W/webview_proxy(2553): 	at java.lang.Thread.run(Thread.java:841)
> 09-17 15:45:34.236: W/System.err(2553): java.lang.RuntimeException: java.lang.Throwable: Warning: A WebView method was called on thread 'WebViewCoreThread'. All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.
> 09-17 15:45:34.246: W/System.err(2553): 	at android.webkit.WebView.checkThread(WebView.java:1927)
> 09-17 15:45:34.246: W/System.err(2553): 	at android.webkit.WebView.loadUrl(WebView.java:771)
> 09-17 15:45:34.246: W/System.err(2553): 	at org.apache.cordova.inappbrowser.InAppBrowser.injectDeferredObject(InAppBrowser.java:245)
> 09-17 15:45:34.246: W/System.err(2553): 	at org.apache.cordova.inappbrowser.InAppBrowser.execute(InAppBrowser.java:169)
> 09-17 15:45:34.246: W/System.err(2553): 	at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:65)
> 09-17 15:45:34.246: W/System.err(2553): 	at org.apache.cordova.PluginManager.execHelper(PluginManager.java:229)
> 09-17 15:45:34.246: W/System.err(2553): 	at org.apache.cordova.PluginManager.exec(PluginManager.java:214)
> 09-17 15:45:34.246: W/System.err(2553): 	at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:53)
> 09-17 15:45:34.246: W/System.err(2553): 	at android.webkit.JWebCoreJavaBridge.setNetworkOnLine(Native Method)
> 09-17 15:45:34.246: W/System.err(2553): 	at android.webkit.JWebCoreJavaBridge.setNetworkOnLine(Native Method)
> 09-17 15:45:34.246: W/System.err(2553): 	at android.webkit.WebViewCore$EventHub$1.handleMessage(WebViewCore.java:1431)
> 09-17 15:45:34.246: W/System.err(2553): 	at android.os.Handler.dispatchMessage(Handler.java:99)
> 09-17 15:45:34.246: W/System.err(2553): 	at android.os.Looper.loop(Looper.java:137)
> 09-17 15:45:34.246: W/System.err(2553): 	at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:814)
> 09-17 15:45:34.246: W/System.err(2553): 	at java.lang.Thread.run(Thread.java:841)
> 09-17 15:45:34.246: W/System.err(2553): Caused by: java.lang.Throwable: Warning: A WebView method was called on thread 'WebViewCoreThread'. All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.
> 09-17 15:45:34.246: W/System.err(2553): 	at android.webkit.WebView.checkThread(WebView.java:1918)
> 09-17 15:45:34.246: W/System.err(2553): 	... 14 more
> {code}
> This is related to CB-4586 but is by no means a minor issue.  The Android InAppBrowser code needs to run all webview methods on the UI thread now.
> Here are web thread related issues:
> 1.  Loading a relative url will fail in the InAppBrowser because the updateUrl method is calling webView.getUrl() outside the UI thread.
> 2.  Execute script will fail because injectDeferredObject is calling inAppWebView.loadUrl outside the UI thread.



--
This message was sent by Atlassian JIRA
(v6.1#6144)