You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Dewang Shah (Created) (JIRA)" <ji...@apache.org> on 2012/04/13 12:30:13 UTC

[jira] [Created] (CB-499) Cordova 1.6 breaks with RequireJS

Cordova 1.6 breaks with RequireJS
---------------------------------

                 Key: CB-499
                 URL: https://issues.apache.org/jira/browse/CB-499
             Project: Apache Callback
          Issue Type: Bug
    Affects Versions: 1.6.0
         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
            Reporter: Dewang Shah


Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Michał Letyński (Commented JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13254280#comment-13254280 ] 

Michał Letyński commented on CB-499:
------------------------------------

I have the same problem for IOS, i have cordova defined as module. I get such error:

2012-04-15 12:20:57.382 fwuiPadClient[8730:13403] Error: executing module function 'setInfo' in module 'cordova/plugin/ios/device'. Have you included the iOS version of the cordova-1.6.0.js file?

When i move cordova from requiredJs and define it in index.html this error disappear. However i have problem with my custom plugins ... Im adding them via:

cordova.addConstructor(function() {
 //code
});

However this constructor is never invoked. When i remove required.js reference everythink works ...  
Also everythink worked in 1.5 version. 
I didn't notice any information/warnings in update guide according to required.js and new cordova 1.6.
                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 1.6.0
>         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Filip Maj (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Filip Maj updated CB-499:
-------------------------

    Component/s: CordovaJS
       Assignee: Filip Maj

It sounds like this may be a JS issue, however cordova's {{require}} and {{define}} methods are closured to only the cordova.js file.

What exactly do you mean by compatibility? Are you using cordova's require/define methods (i.e. {{cordova.require}}) to load in a RequireJS-compatible module? If so: that would never work. Cordova uses a simplified definition of a module and thus, a simpler implementation of the loader.

Can you please provide an example HTML file and describe exactly what you are seeing is failing?

Thanks
                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 1.6.0
>         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Filip Maj (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Filip Maj updated CB-499:
-------------------------

    Attachment: www-michal.tar.gz

The attached example (thank you Michal for the code) can reproduce the issue. I was using 1.6.1 (although 1.6.0's cordova.js is inside the attachment).
                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS, iOS
>    Affects Versions: 1.6.0, 1.6.1
>         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>             Fix For: 1.7.0
>
>         Attachments: www-michal.tar.gz
>
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Reopened] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Filip Maj (Reopened) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Filip Maj reopened CB-499:
--------------------------


I can confirm that this is can be reproduce on an iPod Touch using cordova 1.6.1. It cannot, interestingly enough, be reproduced on and Android 4.0.2 device using cordova 1.6.1.
                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 1.6.0
>         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Patrick Mueller (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13256510#comment-13256510 ] 

Patrick Mueller commented on CB-499:
------------------------------------

I've been working on a similar issue w/Dojo and Cordova.  

In the Dojo case, we could only get Dojo and Cordova to play nice if the <script src=> for the two was in a certain order - I can't remember what the order was off the top of my head.  

Additionally, we had to set some Dojo config properties just so: thinking it was async: false, parseOnLoad: true that actually worked for us.  

I assume RequireJS has similar configuration options (prolly not a parseOnLoad equivalent, but maybe an "asyncLoad" option/property?), and you can certainly play with switching the order of the <script> elements around.

You might want to hit up a RequireJS mailing list; someone there may have more experience with this (but: I doubt it).
                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS, iOS
>    Affects Versions: 1.6.0, 1.6.1
>         Environment: iOS (iPod Touch), Cordova 1.6.0 or 1.6.1, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>             Fix For: 1.7.0
>
>         Attachments: www-michal.tar.gz
>
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Michał Letyński (Issue Comment Edited JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13254280#comment-13254280 ] 

Michał Letyński edited comment on CB-499 at 4/15/12 8:27 AM:
-------------------------------------------------------------

I have the same problem for IOS, i have cordova defined as module. I get such error:

2012-04-15 12:20:57.382 [8730:13403] Error: executing module function 'setInfo' in module 'cordova/plugin/ios/device'. Have you included the iOS version of the cordova-1.6.0.js file?

When i move cordova from requiredJs and define it in index.html this error disappear. However i have problem with my custom plugins ... Im adding them via:

cordova.addConstructor(function() {
 //code
});

However this constructor is never invoked. When i remove required.js reference everythink works ...  
Also everythink worked in 1.5 version. 
I didn't notice any information/warnings in update guide according to required.js and new cordova 1.6.
                
      was (Author: mikel):
    I have the same problem for IOS, i have cordova defined as module. I get such error:

2012-04-15 12:20:57.382 fwuiPadClient[8730:13403] Error: executing module function 'setInfo' in module 'cordova/plugin/ios/device'. Have you included the iOS version of the cordova-1.6.0.js file?

When i move cordova from requiredJs and define it in index.html this error disappear. However i have problem with my custom plugins ... Im adding them via:

cordova.addConstructor(function() {
 //code
});

However this constructor is never invoked. When i remove required.js reference everythink works ...  
Also everythink worked in 1.5 version. 
I didn't notice any information/warnings in update guide according to required.js and new cordova 1.6.
                  
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 1.6.0
>         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Shazron Abdullah (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13254439#comment-13254439 ] 

Shazron Abdullah commented on CB-499:
-------------------------------------

Just throwing out ideas to isolate the problem - even though cordova's define/require methods are local and should not be in the global namespace, there is always a possibility of a leak somehow, so we need to verify this 100%. We could inspect requirejs' globals before loading cordova, then inspect them again after and see if there is a change, to rule this possibility out.
                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 1.6.0
>         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Filip Maj (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Filip Maj resolved CB-499.
--------------------------

    Resolution: Won't Fix

If I understand correctly, you guys are not using the cordova.js file properly. You do not include:

{code}
<script src="cordova.js"></script> 
{code}

... as the first script tag in your HTML page, but rather somehow wrap the the loading of cordova.js in a require call.

Currently it is not possible to load in cordova.js via a require call, as cordova needs to hijack a bunch of DOM methods (such as {{document.addEventListener}}) to provide its hooks for events such as {{deviceready}} (among other things).

Instead of using the approach you are for this issue, include cordova.js as the top-level script tag, and then include requirejs, and any other scripts/modules, as you would normally. It is *imperative* that cordova.js be the first script tag though. Related to this, there's no reason to asynchronously load in cordova.js in the WebView: you have a compile step for native apps anyways, you know ahead of time that you, at the very minimum, _need_ cordova.js in the HTML page of your app.

Bottom line: cordova doesn't BREAK requirejs, you are just using cordova INSIDE of requirejs for no real reason. If you can prove that this is an important use case to cover, then we should reconsider re-opening this issue, but cordova applications are not completely analogous to web applications, where asynchronous loading of *all* scripts is an actual use case. If you are building a cordova application, you _know_ you _need_ to have cordova.js included anyways, and it's included in your application package, so you do not (and actually should not) load it in asynchronously.
                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 1.6.0
>         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Michał Letyński (Commented JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13254517#comment-13254517 ] 

Michał Letyński commented on CB-499:
------------------------------------

Shazron i have it my main and it looks like that:

require({
    paths: {
        phonegap: 'lib/cordova/cordova-1.6.0',
        ....
    }
}, [
    'order!phonegap',
    ...
], function(Phonegap, ...) {
    $(function() {
        ...
    });
});
                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 1.6.0
>         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Dewang Shah (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13255414#comment-13255414 ] 

Dewang Shah commented on CB-499:
--------------------------------

If that is how Cordova *must* be loaded then fair enough. I did not realise that loading it as a module would cause everything to break. It was made stranger by the fact that it worked perfectly with 1.5 but did not work with 1.6.

I have now changed to load it as a top level script and it seems to be fine with 1.6.
                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 1.6.0
>         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Dewang Shah (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13254083#comment-13254083 ] 

Dewang Shah commented on CB-499:
--------------------------------

This is different from CB-500. This issue is with Cordova 1.6 preventing any other modules loaded through RequireJS from being loaded. This code works perfectly fine with Cordova 1.5.
You could use the sample from CB-500 and use Cordova 1.6 to reproduce this problem.
I am not using the cordova.require/define methods. I am using the RequireJS methods. However the modules all fail to load with a timeout error. This _only_ happens when used with Cordova 1.6.
                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 1.6.0
>         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Dewang Shah (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13256448#comment-13256448 ] 

Dewang Shah commented on CB-499:
--------------------------------

@Filip - I doubt it is because of Cordova's require and define methods. That was a problem with 1.5.0 which I patched in my JS file using the fix that is now part of 1.6.0. I then had the code working with 1.5.0.

Something else broke it in 1.6.0 but in my case I was using RequireJS to also load Cordova.

I fixed my project to load Cordova as a top level script and that was fine on Android but did not work on iOS. The deviceready event never fired on iOS even with Cordova being a top level script. I have now had to abandon using RequireJS completely since I cannot abandon Cordova :-).

                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS, iOS
>    Affects Versions: 1.6.0, 1.6.1
>         Environment: iOS (iPod Touch), Cordova 1.6.0 or 1.6.1, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>             Fix For: 1.7.0
>
>         Attachments: www-michal.tar.gz
>
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Michał Letyński (Commented JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13255310#comment-13255310 ] 

Michał Letyński commented on CB-499:
------------------------------------

Dear Filip,

What about my use case ? When i define cordova and plugin via:
 <script src="cordova.js"></script> 
<script src="plugin.js"></script> 
<script src="required.js"></script> 

and inside plugin i have:

cordova.addConstructor(function() { //code });

constructor is not invoked ... 


                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 1.6.0
>         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Issue Comment Edited] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Michał Letyński (Issue Comment Edited JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13254517#comment-13254517 ] 

Michał Letyński edited comment on CB-499 at 4/16/12 5:57 AM:
-------------------------------------------------------------

Shazron i have it my main and it looks like that:

require({
    paths: {
        phonegap: 'lib/cordova/cordova-1.6.0',
        ....
    }
}, [
    'order!phonegap',
    ...
], function(Phonegap, ...) {
    $(function() {
        ...
    });
});


BTW.
Isn't it connected with CB-487 ?
                
      was (Author: mikel):
    Shazron i have it my main and it looks like that:

require({
    paths: {
        phonegap: 'lib/cordova/cordova-1.6.0',
        ....
    }
}, [
    'order!phonegap',
    ...
], function(Phonegap, ...) {
    $(function() {
        ...
    });
});
                  
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 1.6.0
>         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Dewang Shah (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13254438#comment-13254438 ] 

Dewang Shah commented on CB-499:
--------------------------------

Hi Shazron,

You can use the code sample from CB-500.
                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 1.6.0
>         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Filip Maj (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13255695#comment-13255695 ] 

Filip Maj commented on CB-499:
------------------------------

@Michał: The {{addConstructor}} method is still there (although it is slated for removal in 2.0 - just a heads up). You can see the code for it [here|https://github.com/apache/incubator-cordova-js/blob/master/lib/cordova.js#L224-L232]. Can you check your device logs for the "Failed to run constructor" error? Perhaps there is something in there that is failing. Feel free to e-mail me (fil at adobe dot com) so I can help you with your plugin off this thread (as that is a different issue).

@Dewang: I believe this is something to do with the fact that cordova uses its own definitions of {{require}} and {{define}} inside the script - which may be "overriding" any other module loader's implementation implicitly inside the cordova.js file. I think what you are looking for is the feature defined in CB-341, so keep tabs on that issue.
                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 1.6.0
>         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Filip Maj (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Filip Maj updated CB-499:
-------------------------

          Component/s: iOS
          Environment: iOS (iPod Touch), Cordova 1.6.0 or 1.6.1, RequireJS 1.0.7  (was: Android, Cordova 1.6.0, RequireJS 1.0.7)
    Affects Version/s: 1.6.1
        Fix Version/s: 1.7.0
    
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS, iOS
>    Affects Versions: 1.6.0, 1.6.1
>         Environment: iOS (iPod Touch), Cordova 1.6.0 or 1.6.1, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>             Fix For: 1.7.0
>
>         Attachments: www-michal.tar.gz
>
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Filip Maj (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Filip Maj resolved CB-499.
--------------------------

    Resolution: Fixed

Found the issue. All about timing and some peculiarities about how iOS changes the {{document.readyState}}. I've fixed it in [2a8cdb|http://git-wip-us.apache.org/repos/asf?p=incubator-cordova-js.git;a=commit;h=2a8cdb98b764fcdd513d049ea5a35d95c3a119e2].

Tweaking the ordering of some code around in cordova-js fixed the issue. One thing we do is [listen for the DOMContentLoaded event to fire on document before we start building up the cordova API on the window|https://github.com/apache/incubator-cordova-js/blob/master/lib/scripts/bootstrap.js#L12-L17]. This is all fine, however, we attach to the {{DOMContentLoaded}} event pretty late: the {{boot}} function I link to above does not get called until the native side of cordova is all instantiated (all cordova APIs and everything) and fires the {{onNativeReady}} Channel. By the time we attach to {{DOMContentLoaded}}, it is already fired, and we never build up the cordova JS objects, and thus, deviceready never fires.

With how this relates to requirejs, I'm not sure. My theory is that because requirejs creates and attaches new <script> tags as its loading method, this probably somehow messes with {{document.readyState}}. Funny that it only affects iOS.

In any case, the fix worked for me on my iPod Touch. As a quick fix, check out the [commit diff here|http://git-wip-us.apache.org/repos/asf?p=incubator-cordova-js.git;a=commitdiff;h=2a8cdb98b764fcdd513d049ea5a35d95c3a119e2;hp=44f82b8e630e88e1cfc1bd4a57f9b175bd61833b] and just apply those changes to your cordova.js file.

Hope that helps,
Fil
                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS, iOS
>    Affects Versions: 1.6.0, 1.6.1
>         Environment: iOS (iPod Touch), Cordova 1.6.0 or 1.6.1, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>             Fix For: 1.7.0
>
>         Attachments: www-michal.tar.gz
>
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Filip Maj (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13256902#comment-13256902 ] 

Filip Maj commented on CB-499:
------------------------------

I think I made a little bit of progress. When I include require.js (1.0.7) on iOS, the DOMContentLoaded cordova Channel never gets fired. My guess is require does something funky with that event.

I am digging into it some more.
                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS, iOS
>    Affects Versions: 1.6.0, 1.6.1
>         Environment: iOS (iPod Touch), Cordova 1.6.0 or 1.6.1, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>             Fix For: 1.7.0
>
>         Attachments: www-michal.tar.gz
>
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Shazron Abdullah (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13254435#comment-13254435 ] 

Shazron Abdullah commented on CB-499:
-------------------------------------

@Michael or @Dewang can you post how you are using cordova as a requirejs module so we can take a look? (sample file)
                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 1.6.0
>         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-499) Cordova 1.6 breaks with RequireJS

Posted by "Joe Bowser (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13253592#comment-13253592 ] 

Joe Bowser commented on CB-499:
-------------------------------

See CB-500 for the example
                
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>
>                 Key: CB-499
>                 URL: https://issues.apache.org/jira/browse/CB-499
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 1.6.0
>         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
>
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops all other Require modules from loading. The deviceready event fires within seconds (much sooner that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira