On Jul 3, 7:52 am, Florian 'Workflo' Wolff <[EMAIL PROTECTED]>
wrote:
> Hi!
>
> We are using dynamic scopes to share functions and prototypes between
> several instance scopes. Sometimes we have JavaScript code that triggers
> the creation of a new instance scope (for instance 'callbacks' in our
> application).
> Each new instance scope has its own global object G that is created and
> 'put' into the freshly created scope. This works as long as we don't
> create a new instance scope from within another -- the outer -- one. In
> this case the inner instance scope somehow inherits the global G from
> the 'parent' -- the outer -- instance scope.
>
> This is probably because of Context.topCallScope. (Scott has described
> the same problem in more detail 
> here:http://groups.google.com/group/mozilla.dev.tech.js-engine.rhino/brows...)
>
> What we seem to need is a means to have two (or more) Contexts in one
> and the same Java Thread. Scott said, he used
>   new Context()
> to achive this. But Context() is deprecated. I can't figure out any
> alternative way to get a second Context for a given Thread.
> Is there really a reason why we are not to have more than one Context?
> Couldn't ContextFactory.makeContext() simple be public?
>
> Thanks a lot for your help!
>
> Florian.

The problem is that the Context is a thread local. In certain
situations Rhino will look up the context from the thread, and if
somehow you have two Contexts, it may not get the right one.

--N
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to