Opera, Ajax and Bugs

Opera 9 is a great browser – it small, standards compliant and fast. And not just slightly faster – really fast (I don’t believe Apple’s browser speed comparision they’ve put up with the Safari 3 Beta – its not what I’ve seen in the real world).

For example, out of the box its ten times faster than Firefox at rendering complex SVG drawings. IIt almost fast enough that creating SVG maps is plausible…ah well…skip that…but that is for another post. Anyway, I’ll let you in on a little secret – Firefox’s rendering performance is salveagable – go read SVG’s suspendRedraw and unsuspendRedrawAll apis..

Hashing up Ajax

However, Opera has one awful gotcha – you cannot return an HTTP status code other than 200 in an Ajax request and get the response body back. You might be thinking that’s awfully obscure, but its not.

For example, say your server supports the Atom Publishing Protocol. When a user POSTs a new resource to your server, its job is to return a representation of the new resource with an HTTP status code of 201 CREATED. So something like this:

    HTTP/1.1 201 Created
    Date: Fri, 7 Oct 2005 17:17:11 GMT
    Content-Length: nnn
    Content-Type: application/atom+xml;type=entry;charset="utf-8"
    Location: http://example.org/edit/first-post.atom
    ETag: "c180de84f991g8"  

    <?xml version="1.0"?>
    <entry xmlns="http://www.w3.org/2005/Atom">
      <title>Atom-Powered Robots Run Amok</title>
      <author><name>John Doe</name></author>
      <content>Some text.</content>
      <link rel="edit"

Except Opera won’t return the result! If you check the XmlHttpRequest’s responseText or responseXML attributes they are NULL. This is problematic, because the response contains valuable information – such as the ID the server has assigned the new entry.

It also means you can’t use standard error codes if your client needs access to the response body.

The Frustration of it All

What’s galling about this bug is that its most likely caused by an if statement deep in the bowls of the Opera that intentionally throws away the result when the status code is not 200! Thus, its probably a simpe fix…which leads to the next frustration.

As good as Opera’s browser is, its bug tracking sytem is as bad. I submitted a bug about this over a year ago and obviously it hasn’t been fixed. I can live with that, but it sure would be nice to see its current status.

Except Opera hides its bug reports, like many other companies. I’ve never understood the logic of this. I’ve heard the argument that a bug report could contains information that could competitively disadvantage a company – but how often does that really happen? And when it does, just delete the information – you do read your bug reports, right!

I think the real reason is that corporations don’t like to appear fallible, and bugs are obvious, small failures. However hiding them does not make them go away – instead it just frustrates users. Everyone knows software has bugs – so why not face up to the truth?

So to change the world in my own small way, MapBuzz’s bug reports are public and always will be.

And that’s the end of today’s rant 🙂