Index: Source/devtools/front_end/bindings/CompilerScriptMapping.js |
diff --git a/Source/devtools/front_end/bindings/CompilerScriptMapping.js b/Source/devtools/front_end/bindings/CompilerScriptMapping.js |
index 2892139490363ba2bc48ee3daa0fd48de638a5c7..fdbeea35dbd03fed4ad2209dd3903f6535d5710b 100644 |
--- a/Source/devtools/front_end/bindings/CompilerScriptMapping.js |
+++ b/Source/devtools/front_end/bindings/CompilerScriptMapping.js |
@@ -55,6 +55,11 @@ WebInspector.CompilerScriptMapping = function(debuggerModel, workspace, networkW |
this._scriptForSourceMap = new Map(); |
/** @type {!Map.<string, !WebInspector.SourceMap>} */ |
this._sourceMapForURL = new Map(); |
+ /** @type {!Map.<string, !WebInspector.UISourceCode>} */ |
+ this._stubUISourceCodes = new Map(); |
+ |
+ this._stubProjectID = "compiler-script-project"; |
+ this._stubProjectDelegate = new WebInspector.ContentProviderBasedProjectDelegate(this._workspace, this._stubProjectID, WebInspector.projectTypes.Service); |
debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this); |
} |
@@ -66,6 +71,11 @@ WebInspector.CompilerScriptMapping.prototype = { |
rawLocationToUILocation: function(rawLocation) |
{ |
var debuggerModelLocation = /** @type {!WebInspector.DebuggerModel.Location} */ (rawLocation); |
+ |
+ var stubUISourceCode = this._stubUISourceCodes.get(debuggerModelLocation.scriptId); |
+ if (stubUISourceCode) |
+ return new WebInspector.UILocation(stubUISourceCode, 0, 0); |
+ |
var sourceMap = this._sourceMapForScriptId[debuggerModelLocation.scriptId]; |
if (!sourceMap) |
return null; |
@@ -89,6 +99,8 @@ WebInspector.CompilerScriptMapping.prototype = { |
*/ |
uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) |
{ |
+ if (uiSourceCode.project().type() === WebInspector.projectTypes.Service) |
+ return null; |
if (!uiSourceCode.url) |
return null; |
var sourceMap = this._sourceMapForURL.get(uiSourceCode.url); |
@@ -113,6 +125,7 @@ WebInspector.CompilerScriptMapping.prototype = { |
script.addEventListener(WebInspector.Script.Events.SourceMapURLAdded, this._sourceMapURLAdded.bind(this)); |
return; |
} |
+ |
this._processScript(script); |
}, |
@@ -132,6 +145,16 @@ WebInspector.CompilerScriptMapping.prototype = { |
*/ |
_processScript: function(script) |
{ |
+ // Create stub UISourceCode for the time source mapping is being loaded. |
+ var url = script.sourceURL; |
+ var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url); |
+ var projectName = splitURL[0]; |
+ var parentPath = splitURL.slice(1, -1).join("/"); |
+ var name = splitURL.peekLast() || ""; |
+ var uiSourceCodePath = this._stubProjectDelegate.addContentProvider(parentPath, name, url, url, new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Script, "\n\n\n\n\n// Please wait a bit.\n// Compiled script is not shown while source map is being loaded!", url)); |
+ var stubUISourceCode = /** @type {!WebInspector.UISourceCode} */ (this._workspace.uiSourceCode(this._stubProjectID, uiSourceCodePath)); |
+ this._stubUISourceCodes.set(script.scriptId, stubUISourceCode); |
+ |
this._debuggerWorkspaceBinding.pushSourceMapping(script, this); |
this._loadSourceMapForScript(script, sourceMapLoaded.bind(this)); |
@@ -141,8 +164,13 @@ WebInspector.CompilerScriptMapping.prototype = { |
*/ |
function sourceMapLoaded(sourceMap) |
{ |
- if (!sourceMap) |
+ this._stubUISourceCodes.delete(script.scriptId); |
+ this._stubProjectDelegate.removeFile(uiSourceCodePath); |
+ |
+ if (!sourceMap) { |
+ this._debuggerWorkspaceBinding.updateLocations(script); |
return; |
+ } |
if (this._scriptForSourceMap.get(sourceMap)) { |
this._sourceMapForScriptId[script.scriptId] = sourceMap; |