home *** CD-ROM | disk | FTP | other *** search
- package netscape.jsdebug;
-
- import netscape.security.ForbiddenTargetException;
- import netscape.security.PrivilegeManager;
- import netscape.util.Hashtable;
-
- public final class DebugController {
- private static DebugController controller;
- private ScriptHook scriptHook;
- private Hashtable instructionHookTable;
- private InterruptHook interruptHook;
- private DebugBreakHook debugBreakHook;
- private JSErrorReporter errorReporter;
- private Hashtable scriptTable = new Hashtable();
- private int _nativeContext;
- private static final int majorVersion = 1;
- private static final int minorVersion = 0;
-
- public static synchronized DebugController getDebugController() throws ForbiddenTargetException {
- try {
- PrivilegeManager.checkPrivilegeEnabled("Debugger");
- if (controller == null) {
- controller = new DebugController();
- }
-
- return controller;
- } catch (ForbiddenTargetException var1) {
- System.out.println("failed in check Priv in DebugController.getDebugController()");
- ((Throwable)var1).printStackTrace(System.out);
- throw var1;
- }
- }
-
- private DebugController() {
- this._setController(true);
- }
-
- public synchronized ScriptHook setScriptHook(ScriptHook var1) throws ForbiddenTargetException {
- PrivilegeManager.checkPrivilegeEnabled("Debugger");
- ScriptHook var2 = this.scriptHook;
- this.scriptHook = var1;
- return var2;
- }
-
- public ScriptHook getScriptHook() throws ForbiddenTargetException {
- PrivilegeManager.checkPrivilegeEnabled("Debugger");
- return this.scriptHook;
- }
-
- public synchronized InstructionHook setInstructionHook(PC var1, InstructionHook var2) throws ForbiddenTargetException {
- PrivilegeManager.checkPrivilegeEnabled("Debugger");
- if (this.instructionHookTable == null) {
- this.instructionHookTable = new Hashtable();
- }
-
- InstructionHook var3 = (InstructionHook)this.instructionHookTable.get(var1);
- this.instructionHookTable.put(var1, var2);
- this.setInstructionHook0(var1);
- return var3;
- }
-
- private native void setInstructionHook0(PC var1);
-
- public InstructionHook getInstructionHook(PC var1) throws ForbiddenTargetException {
- PrivilegeManager.checkPrivilegeEnabled("Debugger");
- return this.getInstructionHook0(var1);
- }
-
- private InstructionHook getInstructionHook0(PC var1) {
- return this.instructionHookTable == null ? null : (InstructionHook)this.instructionHookTable.get(var1);
- }
-
- public synchronized InterruptHook setInterruptHook(InterruptHook var1) throws ForbiddenTargetException {
- PrivilegeManager.checkPrivilegeEnabled("Debugger");
- InterruptHook var2 = this.interruptHook;
- this.interruptHook = var1;
- return var2;
- }
-
- public InterruptHook getInterruptHook() throws ForbiddenTargetException {
- PrivilegeManager.checkPrivilegeEnabled("Debugger");
- return this.interruptHook;
- }
-
- public void sendInterrupt() throws ForbiddenTargetException {
- PrivilegeManager.checkPrivilegeEnabled("Debugger");
- this.sendInterrupt0();
- }
-
- private native void sendInterrupt0();
-
- public synchronized DebugBreakHook setDebugBreakHook(DebugBreakHook var1) throws ForbiddenTargetException {
- PrivilegeManager.checkPrivilegeEnabled("Debugger");
- DebugBreakHook var2 = this.debugBreakHook;
- this.debugBreakHook = var1;
- return var2;
- }
-
- public DebugBreakHook getDebugBreakHook() throws ForbiddenTargetException {
- PrivilegeManager.checkPrivilegeEnabled("Debugger");
- return this.debugBreakHook;
- }
-
- public int getNativeContext() throws ForbiddenTargetException {
- PrivilegeManager.checkPrivilegeEnabled("Debugger");
- return this._nativeContext;
- }
-
- private native void _setController(boolean var1);
-
- public String executeScriptInStackFrame(JSStackFrameInfo var1, String var2, String var3, int var4) throws ForbiddenTargetException {
- PrivilegeManager.checkPrivilegeEnabled("Debugger");
- return this.executeScriptInStackFrame0(var1, var2, var3, var4);
- }
-
- private native String executeScriptInStackFrame0(JSStackFrameInfo var1, String var2, String var3, int var4);
-
- public JSErrorReporter getErrorReporter() throws ForbiddenTargetException {
- PrivilegeManager.checkPrivilegeEnabled("Debugger");
- return this.errorReporter;
- }
-
- public JSErrorReporter setErrorReporter(JSErrorReporter var1) throws ForbiddenTargetException {
- PrivilegeManager.checkPrivilegeEnabled("Debugger");
- JSErrorReporter var2 = this.errorReporter;
- this.errorReporter = var1;
- return var2;
- }
-
- public static int getMajorVersion() {
- return 1;
- }
-
- public static int getMinorVersion() {
- return 0;
- }
-
- private static native int getNativeMajorVersion();
-
- private static native int getNativeMinorVersion();
- }
-