Tuesday, April 28, 2009

Firefox 3.5 Beta and AppleScript - Still Broken

I have been holding out hope that Mozilla would, by now, have gotten its act together in fixing AppleScript for Firefox 3.0.x, and now up thru 3.5b.

Unfortunately not the case.

Things are a little different with the nightly builds; however, but still not up to snuff.

The newest 3.5 beta release falls prey to the already documented (here, here, and here) AppleScript bugs introduced with 3.0. The latest nightly builds by and large fix those issues, but introduce a new one, and a particularly glaring omission, at that.

Where before I documented that the properties of a particular window neglected to include the title of said window, in 3.6a pre1, they do.

But where 3.6a pre1 fails is in completely losing the ability to get the URL of the current page. It no longer exists in the properties as the class curl or as "URL". That property has simply ceased to exist.

For reference, this AppleScript is to get the properties of the current, front window in Firefox 3.5:

tell application "Firefox"
get properties of window 1
end tell

And from that I get this result:

{«class pObT»:window, «class pTit»:"Google News", «class curl»:"http://news.google.com/", index:1, bounds:{0, 0, 1440, 900}, «class pLcn»:{0, 0}, closeable:false, titled:false, modal:false, resizable:false, zoomable:false, zoomed:false, «class pNMo»:true, «class pMMo»:false, floating:false, visible:false}

You can see that «class pTit» is now filled properly. But add "activate" to that script and it will fail as it has in previous testing.

Enter Minefield (3.6a1pre) with this AppleScript:

tell application "Minefield"
get properties of window 1
end tell

The results are telling:

{zoomed:false, closeable:true, resizable:true, miniaturized:false, document:missing value, bounds:{440, 22, 1440, 790}, titled:true, floating:false, miniaturizable:true, zoomable:true, modal:false, class:window, name:"Minefield Start Page", id:2071, index:1, visible:true}

A little more cocoa goodness here with class names, etc. in place of «class pTit» is "name" and it is filled appropriately. But gone is «class curl», or "URL" entirely. No mention, thus no way to grab it properly with AppleScript - at least no way that I know of.

Beside that glaring omission, AppleScript no longer errors out as it did under previous versions (not including 2.x). There is promise... and disappointment all in one. Cheers for fixing the breakage, boos for dropping URL support.

So there's obviously a lot of work yet to be done. And for those of us who rely on AppleScript for our jobs, and who wish to use Firefox, we're out of luck. I have been able to work around some of these shortcomings, but with the newest update, all the add-ons have broken (not to mention that it is an ugly, inelegant way to get what I want, and it doesn't work all the time as AppleScript would).

So I'm pretty much left to Safari and Camino here, even though neither is 100% satisfactory. Yes, I've sung the praises of both browsers, and I'm using Safari 4 beta right now which I do like. Problem being that Safari 4 is a memory hog on my aging PowerPC, and Camino tends to leak as well. I have found Firefox tends to be the least leaky of all. Your mileage may vary.

No comments: