org.apache.cocoon.components.flow.javascript
Class LocationTrackingDebugger

java.lang.Object
  extended byorg.apache.cocoon.components.flow.javascript.LocationTrackingDebugger
All Implemented Interfaces:
org.mozilla.javascript.debug.Debugger

public class LocationTrackingDebugger
extends Object
implements org.mozilla.javascript.debug.Debugger

A Rhino debugger that tracks location information when an exception is raised in some JavaScript code. It's purpose is to build a ProcessingException that holds the stacktrace in the JavaScript code.

This debugger implementation is designed to be as lightweight and fast as possible, in order to have a negligible impact on the performances of the Rhino interpreter.

Since:
2.1.8
Version:
$Id: LocationTrackingDebugger.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
protected  List locations
           
protected  Throwable throwable
           
 
Constructor Summary
LocationTrackingDebugger()
           
 
Method Summary
 Exception getException(String description, Exception originalException)
          Get an exception that reflects the known location stack
 org.mozilla.javascript.debug.DebugFrame getFrame(org.mozilla.javascript.Context cx, org.mozilla.javascript.debug.DebuggableScript fnOrScript)
           
 void handleCompilationDone(org.mozilla.javascript.Context cx, org.mozilla.javascript.debug.DebuggableScript fnOrScript, String source)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

locations

protected List locations

throwable

protected Throwable throwable
Constructor Detail

LocationTrackingDebugger

public LocationTrackingDebugger()
Method Detail

handleCompilationDone

public void handleCompilationDone(org.mozilla.javascript.Context cx,
                                  org.mozilla.javascript.debug.DebuggableScript fnOrScript,
                                  String source)
Specified by:
handleCompilationDone in interface org.mozilla.javascript.debug.Debugger

getFrame

public org.mozilla.javascript.debug.DebugFrame getFrame(org.mozilla.javascript.Context cx,
                                                        org.mozilla.javascript.debug.DebuggableScript fnOrScript)
Specified by:
getFrame in interface org.mozilla.javascript.debug.Debugger

getException

public Exception getException(String description,
                              Exception originalException)
                       throws org.apache.cocoon.ProcessingException
Get an exception that reflects the known location stack

Parameters:
description - a description for the exception
originalException - the original exception
Returns:
a suitable exception to throw
Throws:
org.apache.cocoon.ProcessingException
See Also:
ProcessingException.throwLocated(String, Throwable, Location)


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.