public static void AddContextListener(ContextListener listener)
{
// Special workaround for the debugger
string DBG = "org.mozilla.javascript.tools.debugger.Main";
if (DBG.Equals(listener.GetType().FullName))
{
Type cl = listener.GetType();
Type factoryClass = Kit.ClassOrNull("org.mozilla.javascript.ContextFactory");
Type[] sig = new Type[] { factoryClass };
object[] args = new object[] { ContextFactory.GetGlobal() };
try
{
MethodInfo m = cl.GetMethod("attachTo", sig);
m.Invoke(listener, args);
}
catch (Exception ex)
{
Exception rex = new Exception();
Kit.InitCause(rex, ex);
throw rex;
}
return;
}
ContextFactory.GetGlobal().AddListener(listener);
}