This is very interesting. I have been working with selenium lately and i have had to deal with some shortcomings of the callback events by writing javascript code to be executed directly by phantomjs, even at this level there is a lot of micromanagement that needs to be done in order to keep headers like referrer, static for one request and dynamic for all the rest. I like the idea of keeping the tests in XML and then writing the js code from that, what i would propose is a python script parsing the xml input and outputing the javascript code, using many reusable js functions for certain commands.
Let me know if you would like to give this a try :)