Changeset 9108

Show
Ignore:
Timestamp:
06/10/08 13:39:57 (5 months ago)
Author:
hannes
Message:

* Use Context.call() for callback invocation so callbacks can also be

invoked when not associated with a context already. This should allow
us to use callbacks for things like scheduler frameworks etc.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • helma-ng/trunk/src/org/helma/javascript/RhinoEngine.java

    r9099 r9108  
    146146        Map<String, Function> funcs = callbacks.get(event); 
    147147        if (funcs != null) { 
    148             Context cx = Context.getCurrentContext(); 
    149             Scriptable scope = ScriptRuntime.getTopCallScope(cx); 
    150             Scriptable thisObject = thisObj == null ? null : Context.toObject(thisObj, scope); 
     148            Scriptable thisObject = thisObj == null ? null : Context.toObject(thisObj, topLevelScope); 
    151149            initArguments(args); 
    152150            for (Function func: funcs.values()) { 
    153                 func.call(cx, scope, thisObject, args); 
     151                Context.call(contextFactory, func, topLevelScope, thisObject, args); 
    154152            } 
    155153        }