Anne van Kesteren

Thoughts on XMLHttpRequest

XMLHttpRequest finally got to W3C Candidate Recommendation. Maybe finally is not the right word. It did take over four years, but defining a specification around something that is already deployed by multiple incompatible implementations is hard work. (HTML5 and CSS 2.1 are other examples of this.) W3C Candidate Recommendation means that we now have to finalize the test suite and get two fully conforming implementations. Once that is done XMLHttpRequest can become a W3C Recommendation.

There is quite some history to XMLHttpRequest prior to its standardization. It started out at Microsoft, was copied by Mozilla, and then gradually made it into other browsers. Most all of that was before I got involved.

I think I got involved because it seemed fun to work on editing a small part of the documentation of the Web platform. Put your name on something. I also underestimated the amount of work. I thought that apart from some minor issues most of the work was already done by Ian in the HTML5 draft (Web Applications 1.0 at the time — that name now refers to something else). I ended up rewriting the normative parts of the draft — that what matters most — several times. This is in part because I was obviously very inexperienced as editor and in part because our understanding of the Web platform increased dramatically since 2006. That we actually had to define the specifics of event queues was not at all anticipated.

Diving into all the little technical changes that have been made over time is probably not too interesting. So I will conclude with a brief summary of the history of the draft. The earliest archived copy of XMLHttpRequest is in the Web Applications 1.0 draft of 1 September 2005 in section 6.2, written by Ian. The W3C published its initial XMLHttpRequest Working Draft in April 2006. It was mostly the same. In February 2007 the initial Last Call Working Draft was published. It already had a lot more detail and the next three years were effectively put into fiddling with the details and fixing minor bugs discovered during implementation — e.g. Alexey from the WebKit project put quite a bit of effort into implementing the draft and giving feedback. Development of additions to XMLHttpRequest — such as events indicating the progress, cross-origin requests, and native support for timeouts — were put into an XMLHttpRequest Level 2 draft. Initially separate, but now XMLHttpRequest and XMLHttpRequest Level 2 drafts are created from the same source, ensuring their text stays consistent.

It is probably worth mentioning that the goals of the W3C Working Group — which itself also changed over time from the Web API WG to the WebApps WG — shifted from simply defining the interoperable subset among browsers to defining a specification all browsers would have to converge towards. Browsers had so many little differences that if we would only prescribe what works everywhere it would not be a very meaningful document and not actually help fight the interoperability issues some browsers were facing. (Again, HTML5 and CSS 2.1 are other examples of this.)

My plan now is to address some outstanding feature requests for XMLHttpRequest Level 2 and start focusing on the test suite. Hallvord and I created some hundred fifty tests in the course of writing the XMLHttpRequest specification, but they need cleaning up and some more need to be added.