Subj : Script.thaw compiles the script into the global object? To : netscape.public.mozilla.jseng From : mike@morearty.com (Mike Morearty) Date : Thu May 15 2003 11:52 am I don't have a proper understanding of how to use the Script freeze/thaw functionality -- especially when you do NOT want the script you are thawing to go into the "global object". I've looked for sample code, but haven't been able to find any. First let me present a very simple JavaScript fragment that demonstrates the problem -- you can try this with the jsshell: // create a script: script1 = new Script("function f() { print(3) }"); // this will fail, which is correct behavior, because f() // is only defined in script1, not in the global object: f(); // freeze the script: frozenstring = script1.freeze(); // this will still fail, which is correct: f(); // create a new script, and thaw the other one into it: script2 = new Script(); script2.thaw(frozenstring); // this will succeed!!! It shouldn't, should it? I thought // 'thaw' was just supposed to change script2, not the global // object! f(); The actual code I'm writing is C++, but the above code demonstrates the basic problem: I do not want the contents of the script to go into the global context -- I was hoping to execute that script and store its contents into a DIFFERENT object. I'd be happy to share my C++ code if that will help; but is the above behavior correct? If so, why? Thanks - Mike Morearty .