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

📄 mirror-delay.js.svn-base

📁 Google浏览器V8内核代码
💻 SVN-BASE
📖 第 1 页 / 共 4 页
字号:
FrameMirror.prototype.index = function() {  return this.index_;};FrameMirror.prototype.func = function() {  // Get the function for this frame from the VM.  var f = this.details_.func();    // Create a function mirror. NOTE: MakeMirror cannot be used here as the  // value returned from the VM might be a string if the function for the  // frame is unresolved.  if (IS_FUNCTION(f)) {    return new FunctionMirror(f);  } else {    return new UnresolvedFunctionMirror(f);  }};FrameMirror.prototype.receiver = function() {  return MakeMirror(this.details_.receiver());};FrameMirror.prototype.isConstructCall = function() {  return this.details_.isConstructCall();};FrameMirror.prototype.isDebuggerFrame = function() {  return this.details_.isDebuggerFrame();};FrameMirror.prototype.argumentCount = function() {  return this.details_.argumentCount();};FrameMirror.prototype.argumentName = function(index) {  return this.details_.argumentName(index);};FrameMirror.prototype.argumentValue = function(index) {  return MakeMirror(this.details_.argumentValue(index));};FrameMirror.prototype.localCount = function() {  return this.details_.localCount();};FrameMirror.prototype.localName = function(index) {  return this.details_.localName(index);};FrameMirror.prototype.localValue = function(index) {  return MakeMirror(this.details_.localValue(index));};FrameMirror.prototype.sourcePosition = function() {  return this.details_.sourcePosition();};FrameMirror.prototype.sourceLocation = function() {  if (this.func().resolved() && this.func().script()) {    return this.func().script().locationFromPosition(this.sourcePosition());  }};FrameMirror.prototype.sourceLine = function() {  if (this.func().resolved()) {    var location = this.sourceLocation();    if (location) {      return location.line;    }  }};FrameMirror.prototype.sourceColumn = function() {  if (this.func().resolved()) {    var location = this.sourceLocation();    if (location) {      return location.column;    }  }};FrameMirror.prototype.sourceLineText = function() {  if (this.func().resolved()) {    var location = this.sourceLocation();    if (location) {      return location.sourceText();    }  }};FrameMirror.prototype.evaluate = function(source, disable_break) {  var result = %DebugEvaluate(this.break_id_, this.details_.frameId(),                              source, Boolean(disable_break));  return MakeMirror(result);};FrameMirror.prototype.fillJSON_ = function(content, details) {  FrameMirror.super_.fillJSONType_.call(this, content);  content.push(MakeJSONPair_('index', NumberToJSON_(this.index())));  content.push(MakeJSONPair_('receiver', this.receiver().toJSONProtocol(false)));  content.push(MakeJSONPair_('func', this.func().toJSONProtocol(false)));  content.push(MakeJSONPair_('constructCall', BooleanToJSON_(this.isConstructCall())));  content.push(MakeJSONPair_('debuggerFrame', BooleanToJSON_(this.isDebuggerFrame())));  var x = new Array(this.argumentCount());  for (var i = 0; i < this.argumentCount(); i++) {    arg = new Array();    var argument_name = this.argumentName(i)    if (argument_name) {      arg.push(MakeJSONPair_('name', StringToJSON_(argument_name)));    }    arg.push(MakeJSONPair_('value', this.argumentValue(i).toJSONProtocol(false)));    x[i] = ArrayToJSONObject_(arg);  }  content.push(MakeJSONPair_('arguments', ArrayToJSONArray_(x)));  var x = new Array(this.localCount());  for (var i = 0; i < this.localCount(); i++) {    var name = MakeJSONPair_('name', StringToJSON_(this.localName(i)));    var value = MakeJSONPair_('value', this.localValue(i).toJSONProtocol(false));    x[i] = '{' + name + ',' + value + '}';  }  content.push(MakeJSONPair_('locals', ArrayToJSONArray_(x)));  content.push(MakeJSONPair_('position', NumberToJSON_(this.sourcePosition())));  var line = this.sourceLine();  if (!IS_UNDEFINED(line)) {    content.push(MakeJSONPair_('line', NumberToJSON_(line)));  }  var column = this.sourceColumn();  if (!IS_UNDEFINED(column)) {    content.push(MakeJSONPair_('column', NumberToJSON_(column)));  }  var source_line_text = this.sourceLineText();  if (!IS_UNDEFINED(source_line_text)) {    content.push(MakeJSONPair_('sourceLineText', StringToJSON_(source_line_text)));  }}FrameMirror.prototype.invocationText = function() {  // Format frame invoaction (receiver, function and arguments).  var result = '';  var func = this.func();  var receiver = this.receiver();  if (this.isConstructCall()) {    // For constructor frames display new followed by the function name.    result += 'new ';    result += func.name() ? func.name() : '[anonymous]';  } else   if (this.isDebuggerFrame()) {    result += '[debugger]';  } else {    // If the receiver has a className which is 'global' don't display it.    var display_receiver = !receiver.className || receiver.className() != 'global';    if (display_receiver) {      result += receiver.toText();    }    // Try to find the function as a property in the receiver. Include the    // prototype chain in the lookup.    var property = new UndefinedMirror();    if (!receiver.isUndefined()) {      for (var r = receiver; !r.isNull() && property.isUndefined(); r = r.protoObject()) {        property = r.lookupProperty(func);      }    }    if (!property.isUndefined()) {      // The function invoked was found on the receiver. Use the property name      // for the backtrace.      if (!property.isIndexed()) {        if (display_receiver) {          result += '.';        }        result += property.name();      } else {        result += '[';        result += property.name();        result += ']';      }      // Also known as - if the name in the function doesn't match the name      // under which it was looked up.      if (func.name() && func.name() != property.name()) {        result += '(aka ' + func.name() + ')';      }          } else {      // The function invoked was not found on the receiver. Use the function      // name if available for the backtrace.      if (display_receiver) {        result += '.';      }      result += func.name() ? func.name() : '[anonymous]';    }  }  // Render arguments for normal frames.  if (!this.isDebuggerFrame()) {    result += '(';    for (var i = 0; i < this.argumentCount(); i++) {      if (i != 0) result += ', ';      if (this.argumentName(i)) {        result += this.argumentName(i);        result += '=';      }      result += this.argumentValue(i).toText();    }    result += ')';  }    return result;}FrameMirror.prototype.sourceAndPositionText = function() {  // Format source and position.  var result = '';  var func = this.func();  if (func.resolved()) {    if (func.script()) {      if (func.script().name()) {        result += func.script().name();      } else {        result += '[unnamed]';      }      if (!this.isDebuggerFrame()) {        var location = this.sourceLocation();        result += ' line ';        result += !IS_UNDEFINED(location) ? (location.line + 1) : '?';        result += ' column ';        result += !IS_UNDEFINED(location) ? (location.column + 1) : '?';        if (!IS_UNDEFINED(this.sourcePosition())) {          result += ' (position ' + (this.sourcePosition() + 1) + ')';        }      }    } else {      result += '[no source]';    }  } else {    result += '[unresolved]';  }  return result;}FrameMirror.prototype.localsText = function() {  // Format local variables.  var result = '';  var locals_count = this.localCount()  if (locals_count > 0) {    for (var i = 0; i < locals_count; ++i) {      result += '      var ';      result += this.localName(i);      result += ' = ';      result += this.localValue(i).toText();      if (i < locals_count - 1) result += '\n';    }  }  return result;}FrameMirror.prototype.toText = function(opt_locals) {  var result = '';  result += '#' + (this.index() <= 9 ? '0' : '') + this.index();  result += ' ';  result += this.invocationText();  result += ' ';  result += this.sourceAndPositionText();  if (opt_locals) {    result += '\n';    result += this.localsText();  }  return result;}/** * Mirror object for script source. * @param {Script} script The script object * @constructor * @extends Mirror */function ScriptMirror(script) {  Mirror.call(this, SCRIPT_TYPE);  this.script_ = script;};inherits(ScriptMirror, Mirror);ScriptMirror.prototype.name = function() {  return this.script_.name;};ScriptMirror.prototype.lineOffset = function() {  return this.script_.line_offset;};ScriptMirror.prototype.columnOffset = function() {  return this.script_.column_offset;};ScriptMirror.prototype.scriptType = function() {  return this.script_.type;};ScriptMirror.prototype.lineCount = function() {  return this.script_.lineCount();};ScriptMirror.prototype.locationFromPosition = function(position) {  return this.script_.locationFromPosition(position);}ScriptMirror.prototype.sourceSlice = function (opt_from_line, opt_to_line) {  return this.script_.sourceSlice(opt_from_line, opt_to_line);}ScriptMirror.prototype.fillJSON_ = function(content, details) {  ScriptMirror.super_.fillJSONType_.call(this, content);  if (this.name()) {    content.push(MakeJSONPair_('name', StringToJSON_(this.name())));  }  content.push(MakeJSONPair_('lineOffset', NumberToJSON_(this.lineOffset())));  content.push(MakeJSONPair_('columnOffset', NumberToJSON_(this.columnOffset())));  content.push(MakeJSONPair_('lineCount', NumberToJSON_(this.lineCount())));  content.push(MakeJSONPair_('scriptType', NumberToJSON_(this.scriptType())));}    ScriptMirror.prototype.toText = function() {  var result = '';  result += this.name();  result += ' (lines: ';  if (this.lineOffset() > 0) {    result += this.lineOffset();    result += '-';    result += this.lineOffset() + this.lineCount() - 1;  } else {    result += this.lineCount();  }  result += ')';  return result;}function MakeJSONPair_(name, value) {  return '"' + name + '":' + value;};function ArrayToJSONObject_(content) {  return '{' + content.join(',') + '}';};function ArrayToJSONArray_(content) {  return '[' + content.join(',') + ']';};function BooleanToJSON_(value) {  return String(value); };function NumberToJSON_(value) {  return String(value); };// Mapping of some control characters to avoid the \uXXXX syntax for most// commonly used control cahracters.const ctrlCharMap_ = {  '\b': '\\b',  '\t': '\\t',  '\n': '\\n',  '\f': '\\f',  '\r': '\\r',  '"' : '\\"',  '\\': '\\\\'};// Regular expression testing for ", \ and control characters (0x00 - 0x1F).const ctrlCharTest_ = new RegExp('["\\\\\x00-\x1F]');// Regular expression matching ", \ and control characters (0x00 - 0x1F)// globally.const ctrlCharMatch_ = new RegExp('["\\\\\x00-\x1F]', 'g');/** * Convert a String to its JSON representation (see http://www.json.org/). To * avoid depending on the String object this method calls the functions in * string.js directly and not through the value. * @param {String} value The String value to format as JSON * @return {string} JSON formatted String value */function StringToJSON_(value) {  // Check for" , \ and control characters (0x00 - 0x1F). No need to call  // RegExpTest as ctrlchar is constructed using RegExp.  if (ctrlCharTest_.test(value)) {    // Replace ", \ and control characters (0x00 - 0x1F).    return '"' +      value.replace(ctrlCharMatch_, function (char) {        // Use charmap if possible.        var mapped = ctrlCharMap_[char];        if (mapped) return mapped;        mapped = char.charCodeAt();        // Convert control character to unicode escape sequence.        return '\\u00' +          %NumberToRadixString(Math.floor(mapped / 16), 16) +          %NumberToRadixString(mapped % 16, 16);      })    + '"';  }  // Simple string with no special characters.  return '"' + value + '"';};/** * Convert a Date to ISO 8601 format. To avoid depending on the Date object * this method calls the functions in date.js directly and not through the * value. * @param {Date} value The Date value to format as JSON * @return {string} JSON formatted Date value */function DateToISO8601_(value) {  function f(n) {    return n < 10 ? '0' + n : n;  }  function g(n) {    return n < 10 ? '00' + n : n < 100 ? '0' + n : n;  }  return builtins.GetUTCFullYearFrom(value)         + '-' +          f(builtins.GetUTCMonthFrom(value) + 1)    + '-' +          f(builtins.GetUTCDateFrom(value))         + 'T' +          f(builtins.GetUTCHoursFrom(value))        + ':' +          f(builtins.GetUTCMinutesFrom(value))      + ':' +          f(builtins.GetUTCSecondsFrom(value))      + '.' +          g(builtins.GetUTCMillisecondsFrom(value)) + 'Z';};/** * Convert a Date to ISO 8601 format. To avoid depending on the Date object * this method calls the functions in date.js directly and not through the * value. * @param {Date} value The Date value to format as JSON * @return {string} JSON formatted Date value */function DateToJSON_(value) {  return '"' + DateToISO8601_(value) + '"';};

⌨️ 快捷键说明

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