Subj : Re: Can SpiderMonkey do this? To : Bryan Ashby From : Brendan Eich Date : Thu Nov 20 2003 01:22 pm Bryan Ashby wrote: >- Common functionality, for example alert() will break the parser >(JS_ExecuteScript() fails). I'm assuming I would have to "bridge" my >own functionaly into the engine for these? So I'll have to write a >complete up-to-browser-spec system for all of these common functions? > > Of course. If you're running JS as if it were executing in a browser, you have to cope. You won't be able to execute faithfully as if you had all the user's cookies, the current time of day, the output of Math.random, etc. -- in other words, stuff may leak through that executes differently for a given user, based on per-user state. (Hmm, maybe you can see all the relevant cookies if you scan HTTP headers.) >- Some code (without "external" function calls) seems to fail in the >engine whereas it works fine in Mozilla (SpiderMonkey 1.5 BTW): >function SomeThing(c) { >var aArray = new Array(); >aArray["a"] = "A"; >return aArray[c]; >} // works fine in Mozilla but JS_ExecuteScript() fails? > > With what error report? Are you showing the entire script that fails, or are you leaving out a call to SomeThing? Are you developing on Windows using MSVC? If so, please see http://www.mozilla.org/js/spidermonkey/release-notes/NOICF.html, recently posted in Phil's message to this group, at news://news.mozilla.org:119/bpdpjb$8r52@ripley.netscape.com. >I guess more than just questions, I'm looking for suggestions here. Am >I going about this all wrong? Can SpiderMonkey be used for what I am >trying to do here? I'm open to any insight anyone can provide! > I am skeptical of the approach, unless you cache the "stripped" results for others to hit. You'll be taking a big cycle hit emulated client-side JS, without 100% fidelity. Is this supposed to be a transparent proxy that strips out annoyances for users of IE? Make 'em upgrade to Firebird or Mozilla! ;-) Seriously, Opera has good annoyance controls, I hear, and I know Apple does. So it seems to me you're going too many extra miles to help IE users, when those users should help themselves. /be .