2002/04/30 01:48:53
[org.ibex.core.git] / src / org / xwt / util / JSObject.java
index 81f36ea..4692aff 100644 (file)
@@ -26,7 +26,12 @@ public class JSObject implements Scriptable {
 
     /** helper; retrieves the 'source code filename' (usually the nodeName) of the currently-executing function in this thread */
     public static String getCurrentFunctionSourceName() {
-        Function cf = Context.getCurrentContext().currentFunction;
+        Context cx = Context.getCurrentContext();
+        if (cx == null) {
+            if (Log.on) Log.log(JSObject.class, "Context.getCurrentContext() is null in getCurrentFunctionSourceName()");
+            return "unknown";
+        }
+        Function cf = cx.currentFunction;
         if (cf == null) return null;
         return (cf instanceof InterpretedFunction) ?
             ((InterpretedFunction)cf).getSourceName() : ((InterpretedScript)cf).getSourceName();
@@ -151,6 +156,7 @@ public class JSObject implements Scriptable {
             if (name.equals("Array")) return JSObject.defaultObjects.get("Array", null);
             if (name.equals("Function")) return JSObject.defaultObjects.get("Function", null);
             if (name.equals("TypeError")) return JSObject.defaultObjects.get("TypeError", null);
+            if (name.equals("ConversionError")) return JSObject.defaultObjects.get("ConversionError", null);
             return ((JSObject)lastByThread.get(Thread.currentThread())).get(name, start);
         }