cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Filip Maj (Resolved) (JIRA)" <>
Subject [jira] [Resolved] (CB-499) Cordova 1.6 breaks with RequireJS
Date Wed, 18 Apr 2012 20:54:39 GMT


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|;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|].
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|;a=commitdiff;h=2a8cdb98b764fcdd513d049ea5a35d95c3a119e2;hp=44f82b8e630e88e1cfc1bd4a57f9b175bd61833b]
and just apply those changes to your cordova.js file.

Hope that helps,
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>                 Key: CB-499
>                 URL:
>             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:!default.jspa
For more information on JIRA, see:


View raw message