You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Tony Homer (JIRA)" <ji...@apache.org> on 2016/05/25 20:35:12 UTC

[jira] [Updated] (CB-11292) calling loadUrl more than once breaks messageChannel

     [ https://issues.apache.org/jira/browse/CB-11292?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tony Homer updated CB-11292:
----------------------------
    Assignee: Joe Bowser  (was: Tony Homer)

> calling loadUrl more than once breaks messageChannel
> ----------------------------------------------------
>
>                 Key: CB-11292
>                 URL: https://issues.apache.org/jira/browse/CB-11292
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>            Reporter: Tony Homer
>            Assignee: Joe Bowser
>
> CordovaWebViewImpl.sendJavascriptEvent caches a reference to the CoreAndroid plugin instance. This plugin manages Cordova's messageChannel. One of the things messageChannel is used for is sending system events from native to JS, for example backbutton events.
> By default, CordovaWebViewImpl.loadUrl unloads all plugins. This has the side effect of rendering CordovaWebViewImpl's cached instance of CoreAndroid stale. That is, a new instance is created and bound to a new messageChannel callback.
> After this happens, when CordovaWebViewImpl sends messages to JS, the callback id has changed and the messages are not handled.
> There are at least 2 approaches that should fix this.
> 1. (tested) do not cache the CoreAndroid instance. If CordovaWebViewImpl.sendJavascriptEvent gets the reference from PluginManager every time, it will not become stale.
> 2. (not tested, but better encapsulated) when plugins are recreated, clear the cached reference



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org