[ 
https://issues.apache.org/jira/browse/CB-6746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14008897#comment-14008897
 ] 

Andrew Grieve commented on CB-6746:
-----------------------------------

We should certainly fix how broken this is (your fix sounds good), but likely 
I'd want to log a warning if this case occurs. It's generally not a good idea 
to use sendJavascript() at all and instead to always use sendPluginResult where 
keepCallback=true. Is it one of Cordova's plugins that causes this to happen?

> 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)

Reply via email to