cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (CB-11292) calling loadUrl more than once breaks messageChannel
Date Fri, 20 May 2016 20:23:12 GMT


ASF GitHub Bot commented on CB-11292:

GitHub user tony-- opened a pull request:

    CB-11292 fix broken MessageChannel after plugins are recreated

    also added a new test to prevent regression - probably overkill but the issue was hard
to isolate

You can merge this pull request into a Git repository by running:

    $ git pull CB-11292

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #307
commit a5d0e2778c07ca9b6075debe3385981272e1721a
Author: Tony Homer <>
Date:   2016-05-20T20:13:46Z

    CB-11292 fix broken MessageChannel after plugins are recreated


> calling loadUrl more than once breaks messageChannel
> ----------------------------------------------------
>                 Key: CB-11292
>                 URL:
>             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

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message