⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debug-delay.js.svn-base

📁 Google浏览器V8内核代码
💻 SVN-BASE
📖 第 1 页 / 共 4 页
字号:
};Debug.disableBreakPoint = function(break_point_number) {  var break_point = this.findBreakPoint(break_point_number, false);  break_point.disable();};Debug.changeBreakPointCondition = function(break_point_number, condition) {  var break_point = this.findBreakPoint(break_point_number, false);  break_point.setCondition(condition);};Debug.changeBreakPointIgnoreCount = function(break_point_number, ignoreCount) {  if (ignoreCount < 0) {    throw new Error('Invalid argument');  }  var break_point = this.findBreakPoint(break_point_number, false);  break_point.setIgnoreCount(ignoreCount);};Debug.clearBreakPoint = function(break_point_number) {  var break_point = this.findBreakPoint(break_point_number, true);  if (break_point) {    return %ClearBreakPoint(break_point);  } else {    break_point = this.findScriptBreakPoint(break_point_number, true);    if (!break_point) {      throw new Error('Invalid breakpoint');    }  }};Debug.clearAllBreakPoints = function() {  for (var i = 0; i < break_points.length; i++) {    break_point = break_points[i];    %ClearBreakPoint(break_point);  }  break_points = [];};Debug.findScriptBreakPoint = function(break_point_number, remove) {  var script_break_point;  for (var i = 0; i < script_break_points.length; i++) {    if (script_break_points[i].number() == break_point_number) {      script_break_point = script_break_points[i];      // Remove the break point from the list if requested.      if (remove) {        script_break_point.clear();        script_break_points.splice(i,1);      }      break;    }  }  return script_break_point;}// Sets a breakpoint in a script identified through script name at the// specified source line and column within that line.Debug.setScriptBreakPoint = function(script_name, opt_line, opt_column, opt_condition) {  // Create script break point object.  var script_break_point = new ScriptBreakPoint(script_name, opt_line, opt_column);  // Assign number to the new script break point and add it.  script_break_point.number_ = next_break_point_number++;  script_break_point.setCondition(opt_condition);  script_break_points.push(script_break_point);  // Run through all scripts to see it this script break point matches any  // loaded scripts.  var scripts = this.scripts();  for (var i = 0; i < scripts.length; i++) {    if (script_break_point.matchesScript(scripts[i])) {      script_break_point.set(scripts[i]);    }  }  return script_break_point.number();}Debug.enableScriptBreakPoint = function(break_point_number) {  var script_break_point = this.findScriptBreakPoint(break_point_number, false);  script_break_point.enable();};Debug.disableScriptBreakPoint = function(break_point_number) {  var script_break_point = this.findScriptBreakPoint(break_point_number, false);  script_break_point.disable();};Debug.changeScriptBreakPointCondition = function(break_point_number, condition) {  var script_break_point = this.findScriptBreakPoint(break_point_number, false);  script_break_point.setCondition(condition);};Debug.changeScriptBreakPointIgnoreCount = function(break_point_number, ignoreCount) {  if (ignoreCount < 0) {    throw new Error('Invalid argument');  }  var script_break_point = this.findScriptBreakPoint(break_point_number, false);  script_break_point.setIgnoreCount(ignoreCount);};Debug.scriptBreakPoints = function() {  return script_break_points;}Debug.clearStepping = function() {  %ClearStepping();}Debug.setBreakOnException = function() {  return %ChangeBreakOnException(Debug.ExceptionBreak.All, true);};Debug.clearBreakOnException = function() {  return %ChangeBreakOnException(Debug.ExceptionBreak.All, false);};Debug.setBreakOnUncaughtException = function() {  return %ChangeBreakOnException(Debug.ExceptionBreak.Uncaught, true);};Debug.clearBreakOnUncaughtException = function() {  return %ChangeBreakOnException(Debug.ExceptionBreak.Uncaught, false);};Debug.showBreakPoints = function(f, full) {  if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.');  var source = full ? this.scriptSource(f) : this.source(f);  var offset = full ? this.sourcePosition(f) : 0;  var locations = this.breakLocations(f);  if (!locations) return source;  locations.sort(function(x, y) { return x - y; });  var result = "";  var prev_pos = 0;  var pos;  for (var i = 0; i < locations.length; i++) {    pos = locations[i] - offset;    result += source.slice(prev_pos, pos);    result += "[B" + i + "]";    prev_pos = pos;  }  pos = source.length;  result += source.substring(prev_pos, pos);  return result;};// Get all the scripts currently loaded. Locating all the scripts is based on// scanning the heap.Debug.scripts = function() {  // Collect all scripts in the heap.  return %DebugGetLoadedScripts();}function MakeExecutionState(break_id) {  return new ExecutionState(break_id);};function ExecutionState(break_id) {  this.break_id = break_id;  this.selected_frame = 0;};ExecutionState.prototype.prepareStep = function(opt_action, opt_count) {  var action = Debug.StepAction.StepIn;  if (!IS_UNDEFINED(opt_action)) action = %ToNumber(opt_action);  var count = opt_count ? %ToNumber(opt_count) : 1;  return %PrepareStep(this.break_id, action, count);}ExecutionState.prototype.evaluateGlobal = function(source, disable_break) {  return MakeMirror(      %DebugEvaluateGlobal(this.break_id, source, Boolean(disable_break)));};ExecutionState.prototype.frameCount = function() {  return %GetFrameCount(this.break_id);};ExecutionState.prototype.frame = function(opt_index) {  // If no index supplied return the selected frame.  if (opt_index == null) opt_index = this.selected_frame;  return new FrameMirror(this.break_id, opt_index);};ExecutionState.prototype.cframesValue = function(opt_from_index, opt_to_index) {  return %GetCFrames(this.break_id);};ExecutionState.prototype.setSelectedFrame = function(index) {  var i = %ToNumber(index);  if (i < 0 || i >= this.frameCount()) throw new Error('Illegal frame index.');  this.selected_frame = i;};ExecutionState.prototype.selectedFrame = function() {  return this.selected_frame;};ExecutionState.prototype.debugCommandProcessor = function(protocol) {  return new DebugCommandProcessor(this, protocol);};function MakeBreakEvent(exec_state, break_points_hit) {  return new BreakEvent(exec_state, break_points_hit);};function BreakEvent(exec_state, break_points_hit) {  this.exec_state_ = exec_state;  this.break_points_hit_ = break_points_hit;};BreakEvent.prototype.func = function() {  return this.exec_state_.frame(0).func();};BreakEvent.prototype.sourceLine = function() {  return this.exec_state_.frame(0).sourceLine();};BreakEvent.prototype.sourceColumn = function() {  return this.exec_state_.frame(0).sourceColumn();};BreakEvent.prototype.sourceLineText = function() {  return this.exec_state_.frame(0).sourceLineText();};BreakEvent.prototype.breakPointsHit = function() {  return this.break_points_hit_;};BreakEvent.prototype.details = function() {  // Build the break details.  var details = '';  if (this.breakPointsHit()) {    details += 'breakpoint';    if (this.breakPointsHit().length > 1) {      details += 's';    }    details += ' ';    for (var i = 0; i < this.breakPointsHit().length; i++) {      if (i > 0) {        details += ',';      }      details += this.breakPointsHit()[i].number();    }  } else {    details += 'break';  }  details += ' in ';  details += this.exec_state_.frame(0).invocationText();  details += ' at ';  details += this.exec_state_.frame(0).sourceAndPositionText();  details += '\n'  if (this.func().script()) {    details += FrameSourceUnderline(this.exec_state_.frame(0));  }  return details;};BreakEvent.prototype.debugPrompt = function() {  // Build the debug break prompt.  if (this.breakPointsHit()) {    return 'breakpoint';  } else {    return 'break';  }};BreakEvent.prototype.toJSONProtocol = function() {  var o = { seq: next_response_seq++,            type: "event",            event: "break",            body: { invocationText: this.exec_state_.frame(0).invocationText(),                  }          }  // Add script related information to the event if available.  var script = this.func().script();  if (script) {    o.body.sourceLine = this.sourceLine(),    o.body.sourceColumn = this.sourceColumn(),    o.body.sourceLineText = this.sourceLineText(),    o.body.script = { name: script.name(),                      lineOffset: script.lineOffset(),                      columnOffset: script.columnOffset(),                      lineCount: script.lineCount()                    };  }  // Add an Array of break points hit if any.  if (this.breakPointsHit()) {    o.body.breakpoints = [];    for (var i = 0; i < this.breakPointsHit().length; i++) {      // Find the break point number. For break points originating from a      // script break point supply the script break point number.      var breakpoint = this.breakPointsHit()[i];      var script_break_point = breakpoint.script_break_point();      var number;      if (script_break_point) {        number = script_break_point.number();      } else {        number = breakpoint.number();      }      o.body.breakpoints.push(number);    }  }  return SimpleObjectToJSON_(o);};function MakeExceptionEvent(exec_state, exception, uncaught) {  return new ExceptionEvent(exec_state, exception, uncaught);};function ExceptionEvent(exec_state, exception, uncaught) {  this.exec_state_ = exec_state;  this.exception_ = exception;  this.uncaught_ = uncaught;};ExceptionEvent.prototype.uncaught = function() {  return this.uncaught_;}ExceptionEvent.prototype.func = function() {  return this.exec_state_.frame(0).func();};ExceptionEvent.prototype.sourceLine = function() {  return this.exec_state_.frame(0).sourceLine();};ExceptionEvent.prototype.sourceColumn = function() {  return this.exec_state_.frame(0).sourceColumn();};ExceptionEvent.prototype.sourceLineText = function() {  return this.exec_state_.frame(0).sourceLineText();};ExceptionEvent.prototype.details = function() {  var details = "";  if (this.uncaught_) {    details += "Uncaught: ";  } else {    details += "Exception: ";  }  details += '"';  details += MakeMirror(this.exception_).toText();  details += '" at ';  details += this.exec_state_.frame(0).sourceAndPositionText();  details += '\n';  details += FrameSourceUnderline(this.exec_state_.frame(0));  return details;};ExceptionEvent.prototype.debugPrompt = function() {  if (this.uncaught_) {    return "uncaught exception";  } else {    return "exception";  }};ExceptionEvent.prototype.toJSONProtocol = function() {  var o = { seq: next_response_seq++,            type: "event",            event: "exception",            body: { uncaught: this.uncaught_,                    exception: MakeMirror(this.exception_),                    sourceLine: this.sourceLine(),                    sourceColumn: this.sourceColumn(),                    sourceLineText: this.sourceLineText(),                  }          }  // Add script information to the event if available.  var script = this.func().script();  if (script) {    o.body.script = { name: script.name(),                      lineOffset: script.lineOffset(),                      columnOffset: script.columnOffset(),                      lineCount: script.lineCount()                    };  }  return SimpleObjectToJSON_(o);};function MakeCompileEvent(script_source, script_name, script_function) {  return new CompileEvent(script_source, script_name, script_function);};function CompileEvent(script_source, script_name, script_function) {  this.scriptSource = script_source;  this.scriptName = script_name;  this.scriptFunction = script_function;};CompileEvent.prototype.details = function() {  var result = "";  result = "Script added"  if (this.scriptData) {    result += ": '";    result += this.scriptData;    result += "'";  }  return result;};CompileEvent.prototype.debugPrompt = function() {  var result = "source"  if (this.scriptData) {    result += " '";    result += this.scriptData;    result += "'";  }  if (this.func) {    result += " added";  } else {    result += " compiled";  }  return result;};function MakeNewFunctionEvent(func) {  return new NewFunctionEvent(func);};function NewFunctionEvent(func) {  this.func = func;};NewFunctionEvent.prototype.details = function() {  var result = "";  result = "Function added: ";  result += this.func.name;  return result;};NewFunctionEvent.prototype.debugPrompt = function() {  var result = "function";  if (this.func.name) {    result += " '";    result += this.func.name;    result += "'";  }  result += " added";  return result;};NewFunctionEvent.prototype.name = function() {  return this.func.name;};NewFunctionEvent.prototype.setBreakPoint = function(p) {  Debug.setBreakPoint(this.func, p || 0);};function DebugCommandProcessor(exec_state) {  this.exec_state_ = exec_state;};// Convenience function for C debugger code to process a text command. This// function converts the text command to a JSON request, performs the request// and converts the request to a text result for display. The result is an// object containing the text result and the intermediate results.DebugCommandProcessor.prototype.processDebugCommand = function (command) {  var request;  var response;  var text_result;  var running;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -