cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julian Horn (JIRA)" <>
Subject [jira] [Commented] (CB-7992) Weird behavior when more than one <script> tag for cordova.js
Date Tue, 25 Nov 2014 22:28:12 GMT


Julian Horn commented on CB-7992:

Of course this case is a user error.  The JIRA asks for more graceful error recovery when
a user makes that mistake.

I had in mind that this could be avoided by adding code that detects that cordova.js was already
included and simply return, doing nothing the second time.  If that's not possible for some
reason, then it would be better to raise an alert saying what you did wrong.  The present
behavior is really weird looking and can hang.

> Weird behavior when more than one <script> tag for cordova.js
> -------------------------------------------------------------
>                 Key: CB-7992
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 3.4.0
>            Reporter: Julian Horn
>            Priority: Trivial
> If a program has more than one <script> tag for cordova.js, weird behavior ensues.
 This file should protect itself against multiple inclusion; this is a not-uncommon newbie
> The problems I've seen are in the android version of cordova.js, but it's possible that
other platforms have similar problems.
> The weird behavior states with this console message:
> Falling back on PROMPT mode since _cordovaNative is missing. Expected for Android 3.2
and lower only.
> Then you see a dialog that says 
> gap:["PluginManager","startup","PluginManager818789619"]
> (OK) (Cancel)
> Without going into all the details, if you click Cancel you live.  If you click OK you
will hang.
> These weird dialogs are put up by this code:
> {code}// file: src/android/android/promptbasednativeapi.js
> define("cordova/android/promptbasednativeapi", function(require, exports, module) {
> /**
>  * Implements the API of, but uses prompt() to communicate.
>  * This is used only on the 2.3 simulator, where addJavascriptInterface() is broken.
>  */
> module.exports = {
>     exec: function(service, action, callbackId, argsJson) {
>         return prompt(argsJson, 'gap:'+JSON.stringify([service, action, callbackId]));
>     },{code}
> This is some kind of error recovery code.  You can probably work out how this gets activated
when I tell you that the console also shows this message:
> Uncaught module cordova/plugin_list already defined

This message was sent by Atlassian JIRA

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

View raw message