[
https://issues.apache.org/jira/browse/CB-11292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15294157#comment-15294157
]
ASF GitHub Bot commented on CB-11292:
-------------------------------------
Github user codecov-io commented on the pull request:
https://github.com/apache/cordova-android/pull/307#issuecomment-220714174
## [Current coverage][cc-pull] is **34.21%**
> Merging [#307][cc-pull] into [master][cc-base-branch] will not change
coverage
```diff
@@ master #307 diff @@
==========================================
Files 11 11
Lines 947 947
Methods 194 194
Messages 0 0
Branches 153 153
==========================================
Hits 324 324
Misses 623 623
Partials 0 0
```
> Powered by [Codecov](https://codecov.io?src=pr). Last updated by
[9738079...e37c1f4][cc-compare]
[cc-base-branch]:
https://codecov.io/gh/apache/cordova-android/branch/master?src=pr
[cc-compare]:
https://codecov.io/gh/apache/cordova-android/compare/9738079c42994666655b1b251febdd5b16c07c86...e37c1f471e4138cdbdc7edcad1bda868749c94e8
[cc-pull]: https://codecov.io/gh/apache/cordova-android/pull/307?src=pr
> 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: Tony Homer
>
> 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: [email protected]
For additional commands, e-mail: [email protected]