Dojo is being designed to run in multiple rendering environments, including Adobe’s SVG Viewer. This is in the main a good thing, but for the past couple of days I’ve been cursing Adobe with words I didn’t even know were in my vocabulary.
Breifly, when Mark donated the new bootstrap code for Dojo, he was counting on all of our execution environments supporting some form of synchronous file loading (at least for the core scripts). This avoids all kinds of thorny and nasty dependency tracking and satisfaction requirements that would otherwise be placed on the core stuff. In Burst, he had a very nice OO-style of handling these issues, but we thought we could save ourselves much pain and gnashing of deadlock’d teeth by simply decreeing “thou shalt load core files synchronously!”. But then along came Adobe’s SVG viewer (hereafter, “ASVG”).
Thankfully, ASVG supports a method of fetching text files from a server that is analogous to XMLHTTP (which is what we use for loading inside of browsers), but to our chagrin it doesn’t include a synchronous option.
Well, after 3 or 4 days of hacking, Dojo now supports async loading mechanisms in the module system. Not pretty, but it works. *phew*
At this point, I suspected we were out of the woods. Just implement the correct getText() interface for the ASVG host environment file, and voila!….or not.
It seems that while Adobe’s getURL and postURL methods do indeed accept a callback function as an argument (as almost every other async system does), it does something entirely broken with closure references inside of those callbacks. Now, for those who don’t know or care what a closure is, this is kind of like if C++ suddenly didn’t support objects in one corner case, or if Python suddenly required that you put main() in it’s own class just because you called it strangely. You would expect peace in the middle east before you expected this kind of thing. Every other host environment functions correctly, just not ASVG. I was agog. Simply agog. I almost gave up right then and there.
But after a train ride and some time to cool off from my initial rage at Adobe’s hubris and stupidity, I finally came up with a functioning workaround: we serialize asynchronous requests. Yes, you heard that right, the only way to get ASVG to “play nice” is to remove the only potential benefit to all of the effort to getting async loading working in the first place, which is request concurrency.
The good news in all of this is that we now have a functional Adobe SVG host environment, the bad news is that I think ASVG is going to replace IE (and NN4 before it) as my nemesis. Mozilla will have SVG enabled in it’s default build sooner or later, and I think that’s going to be where we focus our SVG-widget effort until and unless Adobe picks up the slack and releases a less borken plugin. The current one is a disaster.
From time to time I consider buying a license to Photoshop and giving up the GIMP, but I’m not really feeling the Adobe love right now. If anyone at Adobe ever finds this, could you please drop me mail and kindly explain why I should consider ever buying your products when your free tools (the ambassadors and compliments of you products) are this poor?