cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcus Pridham (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-4858) Android InAppBrowser does not function properly on 4.3
Date Tue, 17 Sep 2013 20:15:53 GMT
Marcus Pridham created CB-4858:
----------------------------------

             Summary: 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: Joe Bowser
            Priority: Critical


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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message