I ran across this post: http://ejohn.org/blog/bringing-the-browser-to-the-server/ where he uses Rhino and a custom window library to mimic the interface of the window: http://jqueryjs.googlecode.com/svn/trunk/jquery/build/runtest/env.js
He's using Rhino which is a java engine... It would suprise me if Spidermonkey, which as python bindings, would not work.
Update the env.js library has bindings to java classes so it won't work... I'll have to create an interface to those.