Subj : Re: Can SpiderMonkey do this? To : netscape.public.mozilla.jseng From : "Bryan Ashby" Date : Fri Nov 21 2003 09:40 am "Brendan Eich" wrote in message news:3FBD30AF.9020802@meer.net... > 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.) I have access to both the request and responce HTTP headers so I will be able to build the information into objects manually. Also, I don't need 100% accuracy as far as Math.random, current time, etc - slight differences will be fine -- I will still be passing the script (after modification) to the browser. > > >- 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? Here is exactly what I did: I created a .html file called arraytest.html: Using Mozilla Firebird .7, I loaded the file and got "b" printed to the screen. I then sent this to JS_CompileScript and it failed: function aTest(c) { var aTable = new Array(); aTable[" "] = "b"; return aTable[c]; } > > 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'm actually using Borland Delphi 6 Ent using Stirling Bate's wrapper. I don't _think_ this is a fault of his wrapper as I can debug though and the calls go correctly to JS_* and other scripts compile + execute fine. > > 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. Actually I'm already using this approach minus the SpiderMonkey engine (using my own very basic JS parser) and it's quite fast/transparent to the user. I'm just hoping to improve my engine implementing SpiderMonkey so I can be more accurate and capture more advanced JavaScript ad/popup/etc. tricks. This is for all browsers - Since Mozilla and Opera now have some of the functionality of the product, IE is the main target, yes. It works for _all_ web enabled apps though - apps that use the IE/Gecko controls in them, or other web interfaces that can show ads/etc. I'd love for everyone to use Mozilla but that's just not how it is plain and simple. Bryan .