cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject svn commit: r227223 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/javascript/LocationTrackingDebugger.java
Date Wed, 03 Aug 2005 13:51:21 GMT
Author: sylvain
Date: Wed Aug  3 06:51:19 2005
New Revision: 227223

URL: http://svn.apache.org/viewcvs?rev=227223&view=rev
Log:
Yikes! The Debugger API is different in Rhino+cont and Rhino 1.6!

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/javascript/LocationTrackingDebugger.java

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/javascript/LocationTrackingDebugger.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/javascript/LocationTrackingDebugger.java?rev=227223&r1=227222&r2=227223&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/javascript/LocationTrackingDebugger.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/javascript/LocationTrackingDebugger.java
Wed Aug  3 06:51:19 2005
@@ -21,7 +21,6 @@
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.util.location.Location;
 import org.mozilla.javascript.Context;
-import org.mozilla.javascript.EcmaError;
 import org.mozilla.javascript.JavaScriptException;
 import org.mozilla.javascript.NativeFunction;
 import org.mozilla.javascript.Scriptable;
@@ -44,15 +43,36 @@
     private List locations;
     private Throwable throwable;
 
+    /**
+     * Rhino+cont API
+     */
     public void handleCompilationDone(Context cx, DebuggableScript fnOrScript, StringBuffer
source) {
-        // nothing special here
+        // ignore
     }
 
+    /**
+     * Rhino+cont API
+     */
     public DebugFrame enterFrame(Context cx, Scriptable scope, Scriptable thisObj, Object[]
args, DebuggableScript fnOrScript) {
         return new StackTrackingFrame(fnOrScript);
     }
     
     /**
+     * Rhino 1.6 API
+     */
+    public void handleCompilationDone(Context cx, DebuggableScript fnOrScript, String source)
{
+        // nothing
+    }
+
+    /**
+     * Rhino 1.6 API
+     */
+    public DebugFrame getFrame(Context cx, DebuggableScript fnOrScript) {
+        // Rhion 1.6 API
+        return new StackTrackingFrame(fnOrScript);
+    }
+
+    /**
      * Get an exception that reflects the known location stack
      *
      * @param description a description for the exception
@@ -91,21 +111,32 @@
             this.script = script;
         }
         
+        public void onEnter(Context cx, Scriptable activation, Scriptable thisObj, Object[]
args) {
+            // Rhino 1.6 specific
+        }
+        
+        // Rhino+cont API
         public void onLineChange(Context cx, int lineNumber, boolean breakpoint) {
             line = lineNumber;
         }
 
+        // Rhino 1.6 API
+        public void onLineChange(Context cx, int lineNumber) {
+            line = lineNumber;
+        }
+
         public void onExceptionThrown(Context cx, Throwable ex) {
             throwable = ex;
         }
 
         public void onExit(Context cx, boolean byThrow, Object resultOrException) {
             if (byThrow) {
-                Scriptable obj = script.getScriptable();
-                String name = obj instanceof NativeFunction ? ((NativeFunction)obj).getFunctionName()
: "Top-level script";
-                if (name == null || name.length() == 0) {
-                    name = "[unnamed]";
-                }
+// Revisit: Rhino+cont and Rhino 1.6 have different debugger APIs, and we currently don't
use this information
+//                Scriptable obj = script.getScriptable();
+//                String name = obj instanceof NativeFunction ? ((NativeFunction)obj).getFunctionName()
: "Top-level script";
+//                if (name == null || name.length() == 0) {
+//                    name = "[unnamed]";
+//                }
 
                 if (locations == null) {
                     locations = new ArrayList(1); // start small



Mime
View raw message