| 1 | /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
| 2 | * |
| 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
| 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 6 | |
| 7 | // API class |
| 8 | |
| 9 | package org.mozilla.javascript.debug; |
| 10 | |
| 11 | import org.mozilla.javascript.Context; |
| 12 | import org.mozilla.javascript.Scriptable; |
| 13 | |
| 14 | /** |
| 15 | Interface to implement if the application is interested in receiving debug |
| 16 | information during execution of a particular script or function. |
| 17 | */ |
| 18 | public interface DebugFrame { |
| 19 | |
| 20 | /** |
| 21 | Called when execution is ready to start bytecode interpretation for entered a particular function or script. |
| 22 | |
| 23 | @param cx current Context for this thread |
| 24 | @param activation the activation scope for the function or script. |
| 25 | @param thisObj value of the JavaScript <code>this</code> object |
| 26 | @param args the array of arguments |
| 27 | */ |
| 28 | public void onEnter(Context cx, Scriptable activation, |
| 29 | Scriptable thisObj, Object[] args); |
| 30 | /** |
| 31 | Called when executed code reaches new line in the source. |
| 32 | @param cx current Context for this thread |
| 33 | @param lineNumber current line number in the script source |
| 34 | */ |
| 35 | public void onLineChange(Context cx, int lineNumber); |
| 36 | |
| 37 | /** |
| 38 | Called when thrown exception is handled by the function or script. |
| 39 | @param cx current Context for this thread |
| 40 | @param ex exception object |
| 41 | */ |
| 42 | public void onExceptionThrown(Context cx, Throwable ex); |
| 43 | |
| 44 | /** |
| 45 | Called when the function or script for this frame is about to return. |
| 46 | @param cx current Context for this thread |
| 47 | @param byThrow if true function will leave by throwing exception, otherwise it |
| 48 | will execute normal return |
| 49 | @param resultOrException function result in case of normal return or |
| 50 | exception object if about to throw exception |
| 51 | */ |
| 52 | public void onExit(Context cx, boolean byThrow, Object resultOrException); |
| 53 | |
| 54 | /** |
| 55 | Called when the function or script executes a 'debugger' statement. |
| 56 | @param cx current Context for this thread |
| 57 | */ |
| 58 | public void onDebuggerStatement(Context cx); |
| 59 | } |