third_party/gecko-15/win32/bin/chrome/toolkit/content/global/devtools/dbg-script-actors.js
/**
   * Set a breakpoint using the jsdbg2 API. If the line on which the breakpoint
   * is being set contains no code, then the breakpoint will slide down to the
   * next line that has runnable code. In this case the server breakpoint cache
   * will be updated, so callers that iterate over the breakpoint cache should
   * take that into account.
   *
   * @param object aLocation
   *        The location of the breakpoint as specified in the protocol.
   */
Set a breakpoint using the jsdbg2 API. If the line on which the breakpoint
is being set contains no code, then the breakpoint will slide down to the
next line that has runnable code. In this case the server breakpoint cache
will be updated, so callers that iterate over the breakpoint cache should
take that into account.

@param object aLocation
The location of the breakpoint as specified in the protocol.
Set a breakpoint using the jsdbg2 API . If the line on which the breakpoint is being set contains no code then the breakpoint will slide down to the next line that has runnable code . In this case the server breakpoint cache will be updated so callers that iterate over the breakpoint cache should take that into account . @param object aLocation The location of the breakpoint as specified in the protocol .
function TA__setBreakpoint(aLocation) {
    let scripts = this._scripts[aLocation.url];
    let script = null;
    for (let i = aLocation.line; i >= 0; i--) {
      if (scripts[i]) {
        if (i + scripts[i].lineCount < aLocation.line) {
          continue;
        }
        script = scripts[i];
        break;
      }
    }
    let location = { url: aLocation.url, line: aLocation.line };
    let scriptBreakpoints = this._breakpointStore[location.url];
    let bpActor;
    if (scriptBreakpoints &&
        scriptBreakpoints[location.line] &&
        scriptBreakpoints[location.line].actor) {
      bpActor = scriptBreakpoints[location.line].actor;
    }
    if (!bpActor) {
      bpActor = new BreakpointActor(this, location);
      this._hooks.addToBreakpointPool(bpActor);
      if (scriptBreakpoints[location.line]) {
        scriptBreakpoints[location.line].actor = bpActor;
      }
    }
    if (!script) {
      return { error: "noScript", actor: bpActor.actorID };
    }
    script = this._getInnermostContainer(script, aLocation.line);
    bpActor.addScript(script, this);
    let offsets = script.getLineOffsets(aLocation.line);
    let codeFound = false;
    for (let i = 0; i < offsets.length; i++) {
      script.setBreakpoint(offsets[i], bpActor);
      codeFound = true;
    }
    let actualLocation;
    if (offsets.length == 0) {
      let lines = script.getAllOffsets();
      let oldLine = aLocation.line;
      for (let line = oldLine; line < lines.length; ++line) {
        if (lines[line]) {
          for (let i = 0; i < lines[line].length; i++) {
            script.setBreakpoint(lines[line][i], bpActor);
            codeFound = true;
          }
          actualLocation = {
            url: aLocation.url,
            line: line,
            column: aLocation.column
          };
          bpActor.location = actualLocation;
          scriptBreakpoints[line] = scriptBreakpoints[oldLine];
          scriptBreakpoints[line].line = line;
          delete scriptBreakpoints[oldLine];
          break;
        }
      }
    }
    if (!codeFound) {
      return  { error: "noCodeAtLineColumn", actor: bpActor.actorID };
    }
    return { actor: bpActor.actorID, actualLocation: actualLocation };
  }
function TA__setBreakpoint ( aLocation ) { let scripts = this . _scripts [ aLocation . url ] ; let script = null ; for ( let i = aLocation . line ; i >= 0 ; i -- ) { if ( scripts [ i ] ) { if ( i + scripts [ i ] . lineCount < aLocation . line ) { continue ; } script = scripts [ i ] ; break ; } } let location = { url : aLocation . url , line : aLocation . line } ; let scriptBreakpoints = this . _breakpointStore [ location . url ] ; let bpActor ; if ( scriptBreakpoints && scriptBreakpoints [ location . line ] && scriptBreakpoints [ location . line ] . actor ) { bpActor = scriptBreakpoints [ location . line ] . actor ; } if ( ! bpActor ) { bpActor = new BreakpointActor ( this , location ) ; this . _hooks . addToBreakpointPool ( bpActor ) ; if ( scriptBreakpoints [ location . line ] ) { scriptBreakpoints [ location . line ] . actor = bpActor ; } } if ( ! script ) { return { error : "noScript" , actor : bpActor . actorID } ; } script = this . _getInnermostContainer ( script , aLocation . line ) ; bpActor . addScript ( script , this ) ; let offsets = script . getLineOffsets ( aLocation . line ) ; let codeFound = false ; for ( let i = 0 ; i < offsets . length ; i ++ ) { script . setBreakpoint ( offsets [ i ] , bpActor ) ; codeFound = true ; } let actualLocation ; if ( offsets . length == 0 ) { let lines = script . getAllOffsets ( ) ; let oldLine = aLocation . line ; for ( let line = oldLine ; line < lines . length ; ++ line ) { if ( lines [ line ] ) { for ( let i = 0 ; i < lines [ line ] . length ; i ++ ) { script . setBreakpoint ( lines [ line ] [ i ] , bpActor ) ; codeFound = true ; } actualLocation = { url : aLocation . url , line : line , column : aLocation . column } ; bpActor . location = actualLocation ; scriptBreakpoints [ line ] = scriptBreakpoints [ oldLine ] ; scriptBreakpoints [ line ] . line = line ; delete scriptBreakpoints [ oldLine ] ; break ; } } } if ( ! codeFound ) { return { error : "noCodeAtLineColumn" , actor : bpActor . actorID } ; } return { actor : bpActor . actorID , actualLocation : actualLocation } ; }
Set a breakpoint using the jsdbg2 API.
Set a breakpoint using the jsdbg2 API .
// Fetch the list of scripts in that url. // Fetch the specified script in that list. // Stop when the first script that contains this location is found. // If that first script does not contain the line specified, it's no // good. // Get the list of cached breakpoints in this URL. // No code at that line in any script, skipping forward. // Update the cache as well.