Please see CB-2600 for details, but I want to bring this issue back to the list: the cordova.js loader in mobile-spec inspecting userAgent to determine what extra cordova.js to load.
Why I'm against it: 1. It's sole purpose is to pander to laziness. The SINGLE use case it exists for is making a change in cordova-js, rebuilding cordova-js, and copying cordova.platform.js into a cordova project with mobile-spec as its app, and not requiring a rename of the cordova.platform.js file. As if running an extra `mv cordova.platform.js cordova-x.x.x.js` was too much! 2. Currently we only inspect for the string "Android" in the userAgent [1]. FirefoxOS, webos, windows phone platforms, etc. etc. not accounted for. Every new platform that comes in needs to be accounted for in the test suite. 3. Failed script loads lead to unreliable behavior on certain platforms. See the comment at [2]. So just wrap it in try-catch? 4. Introduction of a new global flag to completely avoid this behavior? [3] This all looks like amateur hour to me for, at best, marginal benefit. [1] https://github.com/apache/cordova-mobile-spec/blob/master/cordova.js#L23 [2] https://github.com/apache/cordova-mobile-spec/blob/master/cordova.js#L32 [3] https://github.com/apache/cordova-mobile-spec/blob/master/cordova.js#L46 On 3/20/13 11:43 AM, "Filip Maj (JIRA)" <[email protected]> wrote: > > [ >https://issues.apache.org/jira/browse/CB-2600?page=com.atlassian.jira.plug >in.system.issuetabpanels:comment-tabpanel&focusedCommentId=13607986#commen >t-13607986 ] > >Filip Maj commented on CB-2600: >------------------------------- > >I _really really really_ dislike this whole approach. It offers little to >no benefit, and maintaining this function requires reviewing the >mobile-spec cordova.js loader with every platform we introduce. > >I am adamantly against inspecting userAgent for anything we do. This is >not in the spirit of the cordova project, let alone a good practice. > >> Mobile Spec cordova.js only works for Android and IOS >> ----------------------------------------------------- >> >> Key: CB-2600 >> URL: https://issues.apache.org/jira/browse/CB-2600 >> Project: Apache Cordova >> Issue Type: Bug >> Components: mobile-spec >> Reporter: Jeffrey Heifetz >> Assignee: Tim Kim >> Priority: Blocker >> Original Estimate: 12h >> Remaining Estimate: 12h >> >> Cordova.js attempts to load platform specific JS, but limits to only >>android or ios. > >-- >This message is automatically generated by JIRA. >If you think it was sent incorrectly, please contact your JIRA >administrators >For more information on JIRA, see: http://www.atlassian.com/software/jira
