Antonin's code probably targets 1.4.
I spent a lot of time with the FF sandbox thing. I eventually gave up
and created the monster we have now for command line evaluation. The
sandbox thing was more a "quicksand box". Every time you tweak it or
try another case it breaks in some way.
If your goal is to create an object in the page the easy way is to
inject a script tag in the page. This is safe for users of your
extension and you know exactly how it works.
jjb