Hi,

i'm at a point where source code no longer helps, as some scenarios
seem to interact unexpectedly...

we have a fairly complex rhino integration which i try to motivate in
the following:

- we support host objects (with reflective style method
implementation) to interact with the host application
- we allow the user to create scripts to enhance the application
- the user inputs arguments to the scripts
- in the scripts properties and functions of the receiver (host)
object are used
- scripts must be able to run in multithreaded context

1) initially we created a "scope" NativeObject to hold the per call
context and associated the "this" object as parent. The script is
called with "scope" as scope.

This seemed ok until we called a host object method - there is code in
the FunctionObject that will check for the receiver class (which is
NativeObject now) and then falls back to the parent scope of the
FunctionObject (which is useless also, as the host object is stateful
and the parent is the protoype). The parent scope chain of the call
scope is never used (this is where the host object lives).

2) To work around this, we separated the scope (plain NativeObject)
and "this" (the host object). We now call the script via
"ScriptRuntime.doTopCall" after a brutal cast - well, at least this
worked. Scope chain and receiver are separated and the result is
fine.

My first question is "is this as its meant to be"? What is best
practice to call a script with per call scope.

Then we started to use the debugger and this is when we fail again. we
have scripts in the style:

...
function f() {
  var diedel = doedel;
}

f();
...

where "doedel" is supplied with the call scope. This works fine until
we attach the debugger - for some reason this switches on
"useActivation" and this is the cause for using the top level scope
for executing "f". Only if debugger is active. What is the workaround
for this?
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to