Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(898)

Unified Diff: third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.js

Issue 2173233002: [DevTools] Better locations for snippets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/bindings/PresentationConsoleMessageHelper.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.js b/third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.js
index b771ffd8ecd29ffe6ed3ba1f52adad1a427697f1..8a771e6784d89a525fed822636b5bf4de14d941a 100644
--- a/third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.js
@@ -225,9 +225,17 @@ WebInspector.ScriptSnippetModel.prototype = {
var mapping = this._mappingForTarget.get(target);
mapping._setEvaluationIndex(evaluationIndex, uiSourceCode);
var evaluationUrl = mapping._evaluationSourceURL(uiSourceCode);
- var expression = uiSourceCode.workingCopy();
- WebInspector.console.show();
- runtimeModel.compileScript(expression, "", true, executionContext.id, compileCallback.bind(this));
+ uiSourceCode.requestContent().then(compileSnippet.bind(this));
+
+ /**
+ * @this {WebInspector.ScriptSnippetModel}
+ */
+ function compileSnippet()
+ {
+ var expression = uiSourceCode.workingCopy();
+ WebInspector.console.show();
+ runtimeModel.compileScript(expression, "", true, executionContext.id, compileCallback.bind(this));
+ }
/**
* @param {!RuntimeAgent.ScriptId=} scriptId
@@ -240,12 +248,12 @@ WebInspector.ScriptSnippetModel.prototype = {
if (mapping.evaluationIndex(uiSourceCode) !== evaluationIndex)
return;
+ mapping._addScript(executionContext.debuggerModel.scriptForId(scriptId || exceptionDetails.scriptId), uiSourceCode);
if (!scriptId) {
this._printRunOrCompileScriptResultFailure(target, exceptionDetails, evaluationUrl);
return;
}
- mapping._addScript(executionContext.debuggerModel.scriptForId(scriptId), uiSourceCode);
var breakpointLocations = this._removeBreakpoints(uiSourceCode);
this._restoreBreakpoints(uiSourceCode, breakpointLocations);
@@ -272,7 +280,7 @@ WebInspector.ScriptSnippetModel.prototype = {
function runCallback(target, result, exceptionDetails)
{
if (!exceptionDetails)
- this._printRunScriptResult(target, result, sourceURL);
+ this._printRunScriptResult(target, result, scriptId, sourceURL);
else
this._printRunOrCompileScriptResultFailure(target, exceptionDetails, sourceURL);
}
@@ -281,9 +289,10 @@ WebInspector.ScriptSnippetModel.prototype = {
/**
* @param {!WebInspector.Target} target
* @param {?RuntimeAgent.RemoteObject} result
+ * @param {!RuntimeAgent.ScriptId} scriptId
* @param {?string=} sourceURL
*/
- _printRunScriptResult: function(target, result, sourceURL)
+ _printRunScriptResult: function(target, result, scriptId, sourceURL)
{
var consoleMessage = new WebInspector.ConsoleMessage(
target,
@@ -296,7 +305,10 @@ WebInspector.ScriptSnippetModel.prototype = {
undefined,
undefined,
[result],
- undefined);
+ undefined,
+ undefined,
+ undefined,
+ scriptId);
target.consoleModel.addMessage(consoleMessage);
},
@@ -318,7 +330,10 @@ WebInspector.ScriptSnippetModel.prototype = {
exceptionDetails.columnNumber,
undefined,
undefined,
- exceptionDetails.stackTrace);
+ exceptionDetails.stackTrace,
+ undefined,
+ undefined,
+ exceptionDetails.stackTrace ? undefined : exceptionDetails.scriptId);
target.consoleModel.addMessage(consoleMessage);
},
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/bindings/PresentationConsoleMessageHelper.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698