debugger.d.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { promise as wdpromise } from 'selenium-webdriver';
  2. import { ProtractorBrowser } from './browser';
  3. export declare class DebugHelper {
  4. private browserUnderDebug_;
  5. /**
  6. * Set to true when we validate that the debug port is open. Since the debug
  7. * port is held open forever once the debugger is attached, it's important
  8. * we only do validation once.
  9. */
  10. debuggerValidated_: boolean;
  11. dbgCodeExecutor: any;
  12. constructor(browserUnderDebug_: ProtractorBrowser);
  13. initBlocking(debuggerClientPath: string, onStartFn: Function, opt_debugPort?: number): void;
  14. init(debuggerClientPath: string, onStartFn: Function, opt_debugPort?: number): void;
  15. /**
  16. * 1) Set up helper functions for debugger clients to call on (e.g.
  17. * execute code, get autocompletion).
  18. * 2) Enter process into debugger mode. (i.e. process._debugProcess).
  19. * 3) Invoke the debugger client specified by debuggerClientPath.
  20. *
  21. * @param {string} debuggerClientPath Absolute path of debugger client to use.
  22. * @param {boolean} blockUntilExit Whether to block the flow until process exit or resume
  23. * immediately.
  24. * @param {Function} onStartFn Function to call when the debugger starts. The
  25. * function takes a single parameter, which represents whether this is the
  26. * first time that the debugger is called.
  27. * @param {number=} opt_debugPort Optional port to use for the debugging
  28. * process.
  29. *
  30. * @return {Promise} If blockUntilExit, a promise resolved when the debugger process
  31. * exits. Otherwise, resolved when the debugger process is ready to begin.
  32. */
  33. init_(debuggerClientPath: string, blockUntilExit: boolean, onStartFn: Function, opt_debugPort?: number): wdpromise.Promise<{}>;
  34. /**
  35. * Validates that the port is free to use. This will only validate the first
  36. * time it is called. The reason is that on subsequent calls, the port will
  37. * already be bound to the debugger, so it will not be available, but that is
  38. * okay.
  39. *
  40. * @returns {Promise<boolean>} A promise that becomes ready when the
  41. * validation
  42. * is done. The promise will resolve to a boolean which represents whether
  43. * this is the first time that the debugger is called.
  44. */
  45. private validatePortAvailability_(port);
  46. isAttached(): boolean;
  47. }