| 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);
|
| },
|
|
|
|
|