You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Nick Eaket (JIRA)" <ji...@apache.org> on 2014/05/23 21:10:01 UTC
[jira] [Created] (CB-6746) Android's JS->Native ONLINE_EVENT does
not work when cordova-js is not loaded before the first message
Nick Eaket created CB-6746:
------------------------------
Summary: Android's JS->Native ONLINE_EVENT does not work when cordova-js is not loaded before the first message
Key: CB-6746
URL: https://issues.apache.org/jira/browse/CB-6746
Project: Apache Cordova
Issue Type: Bug
Components: CordovaJS
Affects Versions: 3.3.0
Environment: Android
Reporter: Nick Eaket
Priority: Minor
Currently if the Cordova-js Android Native->JS message handler registers on the 'online'/'offline event. If a Native message is sent using CordovaWebView.sendJavascript(...) and Cordova-js is currently not loaded, the web view will remain in the 'offline' state. When Cordova-JS is finally loaded, sending another message from Native->JS will continue to fill up the message queue. Cordova-JS will currently never see if the Native code has new messages.
Steps to reproduce:
1. Create a new Cordova Android app
2. Have the app load a web page that does not load cordova-js
3. Have a Cordova Native plugin send a JavaScript message to the app. (expected to be ignored, since cordova-js is not loaded)
4. Navigate to a second web page that does load cordova-js
5. Repeat step 3.
Expected:
Cordova-js should receive the message from step 5
Suggested Fix:
Add a call to 'pollOnceFromOnlineEvent()' after the 'deviceready' event.
The call could potentially go here. https://github.com/apache/cordova-js/blob/master/src/android/exec.js#L266
--
This message was sent by Atlassian JIRA
(v6.2#6252)