home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 September / PCO_0998.ISO / browser / ns405lyc / nav40.z / jsd10.jar / netscape / jsdebug / DebugController.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-03-24  |  3.5 KB  |  142 lines

  1. package netscape.jsdebug;
  2.  
  3. import netscape.security.ForbiddenTargetException;
  4. import netscape.security.PrivilegeManager;
  5. import netscape.util.Hashtable;
  6.  
  7. public final class DebugController {
  8.    private static DebugController controller;
  9.    private ScriptHook scriptHook;
  10.    private Hashtable instructionHookTable;
  11.    private InterruptHook interruptHook;
  12.    private DebugBreakHook debugBreakHook;
  13.    private JSErrorReporter errorReporter;
  14.    private Hashtable scriptTable = new Hashtable();
  15.    private int _nativeContext;
  16.    private static final int majorVersion = 1;
  17.    private static final int minorVersion = 0;
  18.  
  19.    public static synchronized DebugController getDebugController() throws ForbiddenTargetException {
  20.       try {
  21.          PrivilegeManager.checkPrivilegeEnabled("Debugger");
  22.          if (controller == null) {
  23.             controller = new DebugController();
  24.          }
  25.  
  26.          return controller;
  27.       } catch (ForbiddenTargetException var1) {
  28.          System.out.println("failed in check Priv in DebugController.getDebugController()");
  29.          ((Throwable)var1).printStackTrace(System.out);
  30.          throw var1;
  31.       }
  32.    }
  33.  
  34.    private DebugController() {
  35.       this._setController(true);
  36.    }
  37.  
  38.    public synchronized ScriptHook setScriptHook(ScriptHook var1) throws ForbiddenTargetException {
  39.       PrivilegeManager.checkPrivilegeEnabled("Debugger");
  40.       ScriptHook var2 = this.scriptHook;
  41.       this.scriptHook = var1;
  42.       return var2;
  43.    }
  44.  
  45.    public ScriptHook getScriptHook() throws ForbiddenTargetException {
  46.       PrivilegeManager.checkPrivilegeEnabled("Debugger");
  47.       return this.scriptHook;
  48.    }
  49.  
  50.    public synchronized InstructionHook setInstructionHook(PC var1, InstructionHook var2) throws ForbiddenTargetException {
  51.       PrivilegeManager.checkPrivilegeEnabled("Debugger");
  52.       if (this.instructionHookTable == null) {
  53.          this.instructionHookTable = new Hashtable();
  54.       }
  55.  
  56.       InstructionHook var3 = (InstructionHook)this.instructionHookTable.get(var1);
  57.       this.instructionHookTable.put(var1, var2);
  58.       this.setInstructionHook0(var1);
  59.       return var3;
  60.    }
  61.  
  62.    private native void setInstructionHook0(PC var1);
  63.  
  64.    public InstructionHook getInstructionHook(PC var1) throws ForbiddenTargetException {
  65.       PrivilegeManager.checkPrivilegeEnabled("Debugger");
  66.       return this.getInstructionHook0(var1);
  67.    }
  68.  
  69.    private InstructionHook getInstructionHook0(PC var1) {
  70.       return this.instructionHookTable == null ? null : (InstructionHook)this.instructionHookTable.get(var1);
  71.    }
  72.  
  73.    public synchronized InterruptHook setInterruptHook(InterruptHook var1) throws ForbiddenTargetException {
  74.       PrivilegeManager.checkPrivilegeEnabled("Debugger");
  75.       InterruptHook var2 = this.interruptHook;
  76.       this.interruptHook = var1;
  77.       return var2;
  78.    }
  79.  
  80.    public InterruptHook getInterruptHook() throws ForbiddenTargetException {
  81.       PrivilegeManager.checkPrivilegeEnabled("Debugger");
  82.       return this.interruptHook;
  83.    }
  84.  
  85.    public void sendInterrupt() throws ForbiddenTargetException {
  86.       PrivilegeManager.checkPrivilegeEnabled("Debugger");
  87.       this.sendInterrupt0();
  88.    }
  89.  
  90.    private native void sendInterrupt0();
  91.  
  92.    public synchronized DebugBreakHook setDebugBreakHook(DebugBreakHook var1) throws ForbiddenTargetException {
  93.       PrivilegeManager.checkPrivilegeEnabled("Debugger");
  94.       DebugBreakHook var2 = this.debugBreakHook;
  95.       this.debugBreakHook = var1;
  96.       return var2;
  97.    }
  98.  
  99.    public DebugBreakHook getDebugBreakHook() throws ForbiddenTargetException {
  100.       PrivilegeManager.checkPrivilegeEnabled("Debugger");
  101.       return this.debugBreakHook;
  102.    }
  103.  
  104.    public int getNativeContext() throws ForbiddenTargetException {
  105.       PrivilegeManager.checkPrivilegeEnabled("Debugger");
  106.       return this._nativeContext;
  107.    }
  108.  
  109.    private native void _setController(boolean var1);
  110.  
  111.    public String executeScriptInStackFrame(JSStackFrameInfo var1, String var2, String var3, int var4) throws ForbiddenTargetException {
  112.       PrivilegeManager.checkPrivilegeEnabled("Debugger");
  113.       return this.executeScriptInStackFrame0(var1, var2, var3, var4);
  114.    }
  115.  
  116.    private native String executeScriptInStackFrame0(JSStackFrameInfo var1, String var2, String var3, int var4);
  117.  
  118.    public JSErrorReporter getErrorReporter() throws ForbiddenTargetException {
  119.       PrivilegeManager.checkPrivilegeEnabled("Debugger");
  120.       return this.errorReporter;
  121.    }
  122.  
  123.    public JSErrorReporter setErrorReporter(JSErrorReporter var1) throws ForbiddenTargetException {
  124.       PrivilegeManager.checkPrivilegeEnabled("Debugger");
  125.       JSErrorReporter var2 = this.errorReporter;
  126.       this.errorReporter = var1;
  127.       return var2;
  128.    }
  129.  
  130.    public static int getMajorVersion() {
  131.       return 1;
  132.    }
  133.  
  134.    public static int getMinorVersion() {
  135.       return 0;
  136.    }
  137.  
  138.    private static native int getNativeMajorVersion();
  139.  
  140.    private static native int getNativeMinorVersion();
  141. }
  142.