/** Creates a new StackFrame. */
 private StackFrame(Context cx, Dim dim, FunctionSource fsource) {
   this.dim = dim;
   this.contextData = ContextData.get(cx);
   this.fsource = fsource;
   this.breakpoints = fsource.sourceInfo().breakpoints;
   this.lineNumber = fsource.firstLine();
 }
  /** Registers the given script as a top-level script in the debugger. */
  private void registerTopScript(DebuggableScript topScript, String source) {
    if (!topScript.isTopLevel()) {
      throw new IllegalArgumentException();
    }
    String url = getNormalizedUrl(topScript);
    DebuggableScript[] functions = getAllFunctions(topScript);
    final SourceInfo sourceInfo = new SourceInfo(source, functions, url);

    synchronized (urlToSourceInfo) {
      SourceInfo old = urlToSourceInfo.get(url);
      if (old != null) {
        sourceInfo.copyBreakpointsFrom(old);
      }
      urlToSourceInfo.put(url, sourceInfo);
      for (int i = 0; i != sourceInfo.functionSourcesTop(); ++i) {
        FunctionSource fsource = sourceInfo.functionSource(i);
        String name = fsource.name();
        if (name.length() != 0) {
          functionNames.put(name, fsource);
        }
      }
    }

    synchronized (functionToSource) {
      for (int i = 0; i != functions.length; ++i) {
        FunctionSource fsource = sourceInfo.functionSource(i);
        functionToSource.put(functions[i], fsource);
      }
    }

    callback.updateSourceText(sourceInfo);
  }
 /** Returns the source URL. */
 public String getUrl() {
   return fsource.sourceInfo().url();
 }
 /** Returns the SourceInfo object for the function. */
 public SourceInfo sourceInfo() {
   return fsource.sourceInfo();
 }