I consider this change a stop-gap until we have a CLI-based mobile-spec app to work with.
Before the change, the project is broken by default and requires you to copy in a script for it to work. After the change, it's still broken by default, but now allows you to have a script-per-platform, so that can run the mobile-spec on multiple platforms without mistakenly including the wrong platform's cordova.js in it. E.g. workflow: jake && cp pkg/* ../cordova-mobile-spec instead of jake && cp pkg/cordova.ios.js ../cordova-mobile-spec/cordova-SOME_VERSION.js and having to re-run each time you switch platforms. I think I do recall now that synchronous xhrs throw exceptions when they fail. try/catch addresses this. On Wed, Mar 20, 2013 at 3:12 PM, Braden Shepherdson <[email protected]>wrote: > The correct solution, to me, is mobile-spec as a plugin. Why does it even > have a cordova.js in it? > > I've turned our chrome-spec test suite for the Chrome Apps stuff into a > plugin that just has an <asset src="www" /> in it to copy its whole > contents into the platform www folders when you install it. It works very > well. > > Braden > > > On Wed, Mar 20, 2013 at 2:53 PM, Filip Maj <[email protected]> wrote: > > > 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 > > > > >
