It isn't such a big problem to get the things working.
First, Location is a DOM, and HREF is a property of Location, so you can't define them as variable.
Put this at the beginning of JavaScript code:
function my_location () {
this.href = "http://www.something.com";
};
location = new my_location;
This way you define an object Location, define a HREF property, and make an instance of the object.
Same way you can define document properties (cookies etc.).
Lately, I have problems with more complicated scripts that are using CreateElement, GetElementByID etc. and these can't be implemented in easy way.
btw. do you have a GCC on Mac? I can send you the code of hacked SpiderMonkey (that I use in Malzilla), so you won't need to replace eval() anymore. It will write temp file at every eval() call, so you can see what it does.