On Mar 18, 5:58 pm, scott <[EMAIL PROTECTED]> wrote:
> It did not seem that I have to use the context from the running thread
> in evaluating my script. The following worked in my tests:
>
> (new Context()).evaluateString(threadScope, "myscriptsource",
> "threadScript", 1, null);
I "think" that this 'new Context()' does not make any sense and
corrupts your test case. AFAIK you can't run code against arbitrary
Contexts, you must properly enter/exit them since some place will
refer to the related thread local variable.
That is:
Context cx = ContextFactory.enter(); // new in 1.7rc1, as
Context.enter() before
try {
cx.evaluateString(...)
}
finally { cx.exit(); }
> This was based on the understanding that "You can create a scope using
> one Context and then evaluate a script using that scope and another
> Context ...".
Yes, this seems to work fine for me. Just make sure that the 'other
Context' is always the one attached to the current Java thread.
Greets,
Helge
--
http://www.helgehess.eu/
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino