Commit e1a0c893 authored by pfeldman@chromium.org's avatar pfeldman@chromium.org

DevTools: handle call frames with unresolved script sources upon exception break.

Review URL: http://codereview.chromium.org/149329

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20147 0039d316-1c4b-4281-b951-d872f2087c98
parent c09a47ce
...@@ -150,7 +150,7 @@ devtools.DebuggerAgent.prototype.requestScripts = function() { ...@@ -150,7 +150,7 @@ devtools.DebuggerAgent.prototype.requestScripts = function() {
devtools.DebuggerAgent.prototype.resolveScriptSource = function( devtools.DebuggerAgent.prototype.resolveScriptSource = function(
scriptId, callback) { scriptId, callback) {
var script = this.parsedScripts_[scriptId]; var script = this.parsedScripts_[scriptId];
if (!script) { if (!script || script.isUnresolved()) {
callback(null); callback(null);
return; return;
} }
...@@ -798,7 +798,7 @@ devtools.DebuggerAgent.prototype.handleBacktraceResponse_ = function(msg) { ...@@ -798,7 +798,7 @@ devtools.DebuggerAgent.prototype.handleBacktraceResponse_ = function(msg) {
var frames = msg.getBody().frames; var frames = msg.getBody().frames;
for (var i = frames.length - 1; i>=0; i--) { for (var i = frames.length - 1; i>=0; i--) {
var nextFrame = frames[i]; var nextFrame = frames[i];
var f = devtools.DebuggerAgent.formatCallFrame_(nextFrame, script, msg); var f = this.formatCallFrame_(nextFrame, msg);
f.caller = callerFrame; f.caller = callerFrame;
callerFrame = f; callerFrame = f;
} }
...@@ -834,16 +834,20 @@ devtools.DebuggerAgent.prototype.evaluateInCallFrame_ = function(expression) { ...@@ -834,16 +834,20 @@ devtools.DebuggerAgent.prototype.evaluateInCallFrame_ = function(expression) {
/** /**
* @param {Object} stackFrame Frame json object from 'backtrace' response. * @param {Object} stackFrame Frame json object from 'backtrace' response.
* @param {Object} script Script json object from 'break' event.
* @param {devtools.DebuggerMessage} msg Parsed 'backtrace' response. * @param {devtools.DebuggerMessage} msg Parsed 'backtrace' response.
* @return {!devtools.CallFrame} Object containing information related to the * @return {!devtools.CallFrame} Object containing information related to the
* call frame in the format expected by ScriptsPanel and its panes. * call frame in the format expected by ScriptsPanel and its panes.
*/ */
devtools.DebuggerAgent.formatCallFrame_ = function(stackFrame, script, msg) { devtools.DebuggerAgent.prototype.formatCallFrame_ = function(stackFrame, msg) {
var sourceId = script.id;
var func = stackFrame.func; var func = stackFrame.func;
var sourceId = func.scriptId; var sourceId = func.scriptId;
var existingScript = this.parsedScripts_[sourceId];
if (!existingScript) {
this.parsedScripts_[sourceId] = new devtools.ScriptInfo(
sourceId, null /* name */, 0 /* line */, 'unknown' /* type */,
true /* unresolved */);
WebInspector.parsedScriptSource(sourceId, null, null, 0);
}
var funcName = func.name || func.inferredName || '(anonymous function)'; var funcName = func.name || func.inferredName || '(anonymous function)';
var arguments = {}; var arguments = {};
...@@ -998,13 +1002,16 @@ devtools.DebuggerAgent.v8ToWwebkitLineNumber_ = function(line) { ...@@ -998,13 +1002,16 @@ devtools.DebuggerAgent.v8ToWwebkitLineNumber_ = function(line) {
* @param {string} contextType Type of the script's context: * @param {string} contextType Type of the script's context:
* "page" - regular script from html page * "page" - regular script from html page
* "injected" - extension content script * "injected" - extension content script
* @param {bool} opt_isUnresolved If true, script will not be resolved.
* @constructor * @constructor
*/ */
devtools.ScriptInfo = function(scriptId, url, lineOffset, contextType) { devtools.ScriptInfo = function(
scriptId, url, lineOffset, contextType, opt_isUnresolved) {
this.scriptId_ = scriptId; this.scriptId_ = scriptId;
this.lineOffset_ = lineOffset; this.lineOffset_ = lineOffset;
this.contextType_ = contextType; this.contextType_ = contextType;
this.url_ = url; this.url_ = url;
this.isUnresolved_ = opt_isUnresolved;
this.lineToBreakpointInfo_ = {}; this.lineToBreakpointInfo_ = {};
}; };
...@@ -1034,6 +1041,14 @@ devtools.ScriptInfo.prototype.getUrl = function() { ...@@ -1034,6 +1041,14 @@ devtools.ScriptInfo.prototype.getUrl = function() {
}; };
/**
* @return {?bool}
*/
devtools.ScriptInfo.prototype.isUnresolved = function() {
return this.isUnresolved_;
};
/** /**
* @param {number} line 0-based line number in the script. * @param {number} line 0-based line number in the script.
* @return {?devtools.BreakpointInfo} Information on a breakpoint at the * @return {?devtools.BreakpointInfo} Information on a breakpoint at the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment