[
https://issues.apache.org/jira/browse/CB-10705?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nikhil Khandelwal updated CB-10705:
-----------------------------------
Component/s: (was: CordovaLib)
> Backbutton not working when an error page is set in cordova
> -----------------------------------------------------------
>
> Key: CB-10705
> URL: https://issues.apache.org/jira/browse/CB-10705
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 3.5.0
> Environment: android 4.4.4 using cordova 6
> Reporter: Grayson Kleine
> Labels: triaged
>
> The issue is that when you have the an error page set to be displayed in the
> cordova config xml and you get an error and the user is on that page the
> backbutton hardware key will not work anymore.
> This is how to reproduce the issue.
> Preparation:
> You need atleast 2 page one normal page and 1 error page
> Turn off the wifi (so you will get error -2 (easy to test and reproduce))
> One page 1
> The a link on page one to google or some other site.
> Add a listener to the backbutton event (js) with something like alert('1') or
> console.log('1').
> One the error page
> Add a listener to the backbutton event, again set the function to do
> something that you can easily see like an alert.
> Compile and start the application in android.
> Execution:
> On the first page click the hardware back button, you should see an alert if
> you have set the function to display an alert.
> Now press the link
> You should now be on the error page
> Press the hardware back button, nothing happens.
> Issue and Solution:
> After some debugging I found out wat was going on:
> When an error page should be displayed the function loadUrlIntoView in the
> CordovaWebViewImpl class will be called. In normal page navigation the
> pluginManager is not reinitialized by the CordovaWebViewImpl but that is
> something that happens when an error page is displayed. The problem here is
> that while the pluginManager was reinitialized the variable hold the
> reference to the CoreAndroid object was not. Meaning that after the
> initialization CordovaWebViewImpl would try to fire js events using the
> wrong reference to the core plugin (CoreAndroid).
> So the solution in here is to set appPlugin = null just before the
> pluginManager is reinitialized.
> If this is accepted as a bug and my proposed change is accepted I would like
> to make a pull request my self.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]