[
https://issues.apache.org/jira/browse/CB-680?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13272689#comment-13272689
]
Filip Maj commented on CB-680:
------------------------------
Using mobile-spec, I did a simple test: loading the index page, loading another
page, and then hitting the back button to re-load the index page. On both
pages, I added {{console.log}}s in the {{window.onload}}, {{window.onunload}},
and {{deviceready}} events (I have seperated these logs with ---- for clarity).
My logcat output is below (interspersed with small notices on when I loaded the
next page / hit the back button):
{noformat}
D/DroidGap(24070): DroidGap.onCreate()
D/DroidGap(24070): DroidGap.loadUrl(file:///android_asset/www/index.html)
D/DroidGap(24070): DroidGap: url=file:///android_asset/www/index.html
baseUrl=null
V/PhoneStatusBar( 271): setLightsOn(true)
D/DroidGap(24070): DroidGap.init()
D/CordovaWebView(24070): Origin to allow: http://127.0.0.1*
I/CordovaLog(24070): Found log level DEBUG
I/CordovaLog(24070): Changing log level to DEBUG(3)
I/CordovaLog(24070): Found preference for useBrowserHistory
D/PluginManager(24070): init()
D/SoftKeyboardDetect(24070): Ignore this event
I/WindowManager( 196): createSurface Window{41c8fc10
ca.filmaj.cwv/ca.filmaj.cwv.CordovaWebView paused=false}: DRAW NOW PENDING
D/chromium(24070): Unknown chromium error: -6
D/chromium(24070): Unknown chromium error: -6
D/SoftKeyboardDetect(24070): Ignore this event
D/OpenGLRenderer( 447): Flushing caches (mode 1)
V/PhoneStatusBar( 271): setLightsOn(true)
----
D/CordovaLog(24070): index load
D/CordovaLog(24070): file:///android_asset/www/main.js: Line 137 : index load
I/Web Console(24070): index load at file:///android_asset/www/main.js:137
D/CordovaLog(24070): index deviceready
D/CordovaLog(24070): file:///android_asset/www/main.js: Line 2 : index
deviceready
I/Web Console(24070): index deviceready at file:///android_asset/www/main.js:2
----
D/OpenGLRenderer( 447): Flushing caches (mode 0)
W/InputManagerService( 196): Starting input on non-focused client
com.android.internal.view.IInputMethodClient$Stub$Proxy@41d6b780 (uid=10028
pid=447)
I/ActivityManager( 196): Displayed ca.filmaj.cwv/.CordovaWebView: +649ms
----
LOAD NEXT PAGE
----
D/CordovaLog(24070): JSCallback Error: Request failed.
D/CordovaLog(24070): file:///android_asset/www/cordova-1.7.0.js: Line 3570 :
JSCallback Error: Request failed.
I/Web Console(24070): JSCallback Error: Request failed. at
file:///android_asset/www/cordova-1.7.0.js:3570
----
D/CordovaLog(24070): index unload
D/CordovaLog(24070): file:///android_asset/www/main.js: Line 139 : index unload
I/Web Console(24070): index unload at file:///android_asset/www/main.js:139
----
D/CordovaLog(24070): Viewport argument value "1.0;" for key "initial-scale" was
truncated to its numeric prefix.
D/CordovaLog(24070): file:///android_asset/www/autotest/index.html: Line 5 :
Viewport argument value "1.0;" for key "initial-scale" was truncated to its
numeric prefix.
V/Web Console(24070): Viewport argument value "1.0;" for key "initial-scale"
was truncated to its numeric prefix. at
file:///android_asset/www/autotest/index.html:5
D/chromium(24070): Unknown chromium error: -6
D/chromium(24070): Unknown chromium error: -6
----
D/CordovaLog(24070): autotest load
D/CordovaLog(24070): file:///android_asset/www/autotest/index.html: Line 13 :
autotest load
I/Web Console(24070): autotest load at
file:///android_asset/www/autotest/index.html:13
D/CordovaLog(24070): autotest deviceready
D/CordovaLog(24070): file:///android_asset/www/autotest/index.html: Line 18 :
autotest deviceready
I/Web Console(24070): autotest deviceready at
file:///android_asset/www/autotest/index.html:18
----
HIT BACK BUTTON
----
D/CordovaLog(24070): JSCallback Error: Request failed.
D/CordovaLog(24070): file:///android_asset/www/cordova-1.7.0.js: Line 3570 :
JSCallback Error: Request failed.
I/Web Console(24070): JSCallback Error: Request failed. at
file:///android_asset/www/cordova-1.7.0.js:3570
----
D/CordovaLog(24070): autotest unload
D/CordovaLog(24070): file:///android_asset/www/autotest/index.html: Line 15 :
autotest unload
I/Web Console(24070): autotest unload at
file:///android_asset/www/autotest/index.html:15
----
D/chromium(24070): Unknown chromium error: -6
D/chromium(24070): Unknown chromium error: -6
----
D/CordovaLog(24070): index load
D/CordovaLog(24070): file:///android_asset/www/main.js: Line 137 : index load
I/Web Console(24070): index load at file:///android_asset/www/main.js:137
D/CordovaLog(24070): index deviceready
D/CordovaLog(24070): file:///android_asset/www/main.js: Line 2 : index
deviceready
I/Web Console(24070): index deviceready at file:///android_asset/www/main.js:2
----
{noformat}
This confirms my intuition that the request failed log message happens during a
page UNLOAD.
Now will dive into native code and see why this is happening and what, if
anything, we can do to stop this from happening.
> onNativeReady fires before the server is taking new connections
> ---------------------------------------------------------------
>
> Key: CB-680
> URL: https://issues.apache.org/jira/browse/CB-680
> Project: Apache Cordova
> Issue Type: Sub-task
> Components: Android
> Affects Versions: 1.7.0
> Reporter: Joe Bowser
> Assignee: Filip Maj
> Priority: Blocker
> Fix For: 1.8.0
>
>
> This issue is able to be ignored in Android 1.7, but it has come to a head in
> Android 1.8, since we moved where the Callback Server lives.
> D/CordovaLog( 3395): file:///android_asset/www/cordova-1.7.0.js: Line 3570 :
> JSCallback Error: Request failed.
> When this occurs, and you have methods that are called onDeviceReady, while
> the interfaces exist, there's no way to get the callback, which means that it
> hangs forever and always fails when using the CordovaWebView branch. This
> indicates that we are calling onNativeReady prematurely when we go from page
> to page, and that we have to wait for the server to be ready before calling
> this.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira