My other concern with the "inject if not there already" approach is that the object might be there, but may not work fully. E.g. early versions of FileReader. I think if what we'd actually want here is a way to describe in the plugin.xml what OS version to apply the module for.
For now, we can do this with <runs />, so I don't think it's worth bothering with atm. On Thu, Jul 11, 2013 at 1:21 PM, Filip Maj <f...@adobe.com> wrote: > Yep these are all potentials. > > I guess it comes down to, how much is doing it today considered a > workaround and how much benefit / clarity would extending the spec bring > > On 7/11/13 10:18 AM, "Michal Mocny" <mmo...@chromium.org> wrote: > > >Fil, I kinda like that proposal, but Andrew previously brought up some > >valid concerns: That would work great if there was only one object to > >clobber, but if there is a set of them, you likely want to clobber > >all-or-none. Not sure if this should be handled at the plugin manifest > >level. > > > >Also, perhaps <clobbers force=false /> (force defaults to true), akin to > >how mv fails if target exists without a -f? > > > >-Michal > > > > > >On Thu, Jul 11, 2013 at 12:55 PM, Filip Maj <f...@adobe.com> wrote: > > > >> Perhaps worth extending <js-module> with another child element, > >><polyfill> > >> or something that only assigns it to a global if it does not exist? > >> > >> On 7/11/13 5:23 AM, "Andrew Grieve" <agri...@chromium.org> wrote: > >> > >> >I did the same thing for the console plugin yesterday - copy & pasted > >>the > >> >js-module into all <platform> tags except Android. It's a bit annoying, > >> >but > >> >it will mean the module doesn't even end up being loaded for the > >>platform > >> >that doesn't need it. > >> > > >> > > >> >On Wed, Jul 10, 2013 at 7:52 PM, Filip Maj <f...@adobe.com> wrote: > >> > > >> >> I think you may have to use a combination of both to get it right > >> >> > >> >> On 7/10/13 4:46 PM, "Jesse" <purplecabb...@gmail.com> wrote: > >> >> > >> >> >Thanks Fil, > >> >> >Trying option 1: > >> >> >move the <js-module> definition into the platform definitions, so > >>then > >> >> >you can do something different for windows phone. > >> >> > > >> >> >@purplecabbage > >> >> >risingj.com > >> >> > > >> >> > > >> >> >On Wed, Jul 10, 2013 at 4:35 PM, Filip Maj <f...@adobe.com> wrote: > >> >> > > >> >> >> I don't think there's anything in the spec that specifically > >>models > >> >> >>"only > >> >> >> patch global `x` if it doesn't exist" if that¹s what you're > >>asking. > >> >> >> > >> >> >> A few workarounds: > >> >> >> - move the <js-module> definition into the platform definitions, > >>so > >> >>then > >> >> >> you can do something different for windows phone. > >> >> >> - use the <require> tag instead of <clobbers> or <merges>, and do > >>the > >> >> >> global assignment yourself in the JS > >> >> >> > >> >> >> On 7/10/13 4:14 PM, "Jesse" <purplecabb...@gmail.com> wrote: > >> >> >> > >> >> >> >So in the plugin breakout for Geolocation, we have come across an > >> >>issue > >> >> >> >for > >> >> >> >windows phone. > >> >> >> >The WebBrowser control already has a W3C compliant > >>implementation of > >> >> >>the > >> >> >> >spec, and so we actually don't need to do much to 'install' this > >> >> >>plugin. > >> >> >> >However, because of the following config.xml fragment, and the > >> >> >>resulting > >> >> >> >modification to navigator.geolocation, the working browser code > >>is > >> >> >> >clobbered, and we are left with js code that attempts to call > >> >> >>cordova.exec > >> >> >> >into non-existent native code. > >> >> >> > > >> >> >> ><clobbers target="navigator.geolocation" /> > >> >> >> > > >> >> >> >What would be the preferred way of NOT clobbering the working > >> >> >> >implementation, or at least storing a reference to the clobbered > >> >> >> >implementation so we can duckpunch back to it, or to specify that > >> >>our > >> >> >> >version of the plugin will NOT be including js at all? > >> >> >> > > >> >> >> > > >> >> >> >@purplecabbage > >> >> >> >risingj.com > >> >> >> > >> >> >> > >> >> > >> >> > >> > >> > >