Modified: trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js (99202 => 99203)
--- trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2011-11-03 16:16:37 UTC (rev 99202)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2011-11-03 16:28:29 UTC (rev 99203)
@@ -36,7 +36,9 @@
{
// FIXME: apply formatter from outside as a generic mapping.
this._formatter = new WebInspector.ScriptFormatter();
- this._rawSourceCode = {};
+ this._rawSourceCodeForScriptId = {};
+ this._rawSourceCodeForURL = {};
+ this._rawSourceCodeForDocumentURL = {};
this._presentationCallFrames = [];
this._breakpointManager = new WebInspector.BreakpointManager(WebInspector.settings.breakpoints, this._breakpointAdded.bind(this), this._breakpointRemoved.bind(this), WebInspector.debuggerModel);
@@ -109,24 +111,43 @@
*/
_addScript: function(script)
{
- var rawSourceCodeId = this._createRawSourceCodeId(script);
- var rawSourceCode = this._rawSourceCode[rawSourceCodeId];
- if (rawSourceCode) {
- rawSourceCode.addScript(script);
- return;
+ var resource;
+ var isInlineScript = false;
+ if (script.isInlineScript()) {
+ resource = WebInspector.networkManager.inflightResourceForURL(script.sourceURL) || WebInspector.resourceForURL(script.sourceURL);
+ if (resource && resource.type === WebInspector.Resource.Type.Document) {
+ isInlineScript = true;
+ var rawSourceCode = this._rawSourceCodeForDocumentURL[script.sourceURL];
+ if (rawSourceCode) {
+ rawSourceCode.addScript(script);
+ this._bindScriptToRawSourceCode(script, rawSourceCode);
+ return;
+ }
+ }
}
- var resource;
- if (script.sourceURL)
- resource = WebInspector.networkManager.inflightResourceForURL(script.sourceURL) || WebInspector.resourceForURL(script.sourceURL);
- rawSourceCode = new WebInspector.RawSourceCode(rawSourceCodeId, script, resource, this._formatter, this._formatSource);
- this._rawSourceCode[rawSourceCodeId] = rawSourceCode;
+ rawSourceCode = new WebInspector.RawSourceCode(script.scriptId, script, resource, this._formatter, this._formatSource);
+ this._bindScriptToRawSourceCode(script, rawSourceCode);
+
+ if (isInlineScript)
+ this._rawSourceCodeForDocumentURL[script.sourceURL] = rawSourceCode;
+
if (rawSourceCode.sourceMapping)
this._updateSourceMapping(rawSourceCode, null);
rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, this._sourceMappingUpdated, this);
},
/**
+ * @param {WebInspector.Script} script
+ * @param {WebInspector.RawSourceCode} rawSourceCode
+ */
+ _bindScriptToRawSourceCode: function(script, rawSourceCode)
+ {
+ this._rawSourceCodeForScriptId[script.scriptId] = rawSourceCode;
+ this._rawSourceCodeForURL[script.sourceURL] = rawSourceCode;
+ },
+
+ /**
* @param {WebInspector.Event} event
*/
_sourceMappingUpdated: function(event)
@@ -142,8 +163,8 @@
uiSourceCodes: function()
{
var result = [];
- for (var id in this._rawSourceCode) {
- var uiSourceCodeList = this._rawSourceCode[id].sourceMapping.uiSourceCodeList();
+ for (var id in this._rawSourceCodeForScriptId) {
+ var uiSourceCodeList = this._rawSourceCodeForScriptId[id].sourceMapping.uiSourceCodeList();
for (var i = 0; i < uiSourceCodeList.length; ++i)
result.push(uiSourceCodeList[i]);
}
@@ -297,8 +318,8 @@
this._formatSource = formatSource;
this._breakpointManager.reset();
- for (var id in this._rawSourceCode)
- this._rawSourceCode[id].setFormatted(this._formatSource);
+ for (var id in this._rawSourceCodeForScriptId)
+ this._rawSourceCodeForScriptId[id].setFormatted(this._formatSource);
},
/**
@@ -338,8 +359,8 @@
_consoleCleared: function()
{
- for (var id in this._rawSourceCode)
- this._rawSourceCode[id].messages = [];
+ for (var id in this._rawSourceCodeForScriptId)
+ this._rawSourceCodeForScriptId[id].messages = [];
this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.ConsoleMessagesCleared);
},
@@ -580,7 +601,7 @@
*/
_rawSourceCodeForScriptWithURL: function(sourceURL)
{
- return this._rawSourceCode[sourceURL];
+ return this._rawSourceCodeForURL[sourceURL];
},
/**
@@ -588,7 +609,7 @@
*/
_rawSourceCodeForScript: function(script)
{
- return this._rawSourceCode[this._createRawSourceCodeId(script)];
+ return this._rawSourceCodeForScriptId[script.scriptId];
},
/**
@@ -603,23 +624,15 @@
*/
function filter(script)
{
- return this._createRawSourceCodeId(script) === rawSourceCode.id;
+ return script.scriptId === rawSourceCode.id;
}
return WebInspector.debuggerModel.queryScripts(filter.bind(this))[0];
},
- /**
- * @param {WebInspector.Script} script
- */
- _createRawSourceCodeId: function(script)
- {
- return script.sourceURL || script.scriptId;
- },
-
_debuggerReset: function()
{
- for (var id in this._rawSourceCode) {
- var rawSourceCode = this._rawSourceCode[id];
+ for (var id in this._rawSourceCodeForScriptId) {
+ var rawSourceCode = this._rawSourceCodeForScriptId[id];
if (rawSourceCode.sourceMapping) {
var uiSourceCodeList = rawSourceCode.sourceMapping.uiSourceCodeList();
for (var i = 0; i < uiSourceCodeList.length; ++i)
@@ -627,7 +640,9 @@
}
rawSourceCode.removeAllListeners();
}
- this._rawSourceCode = {};
+ this._rawSourceCodeForScriptId = {};
+ this._rawSourceCodeForURL = {};
+ this._rawSourceCodeForDocumentURL = {};
this._presentationCallFrames = [];
this._selectedCallFrame = null;
this._breakpointManager.debuggerReset();
@@ -960,8 +975,8 @@
reset: function()
{
for (var id in this._anchorsForRawSourceCode) {
- if (this._model._rawSourceCode[id]) // In case of navigation the list of rawSourceCodes is empty.
- this._model._rawSourceCode[id].removeEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, this._updateSourceAnchors, this);
+ if (this._model._rawSourceCodeForScriptId[id]) // In case of navigation the list of rawSourceCodes is empty.
+ this._model._rawSourceCodeForScriptId[id].removeEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, this._updateSourceAnchors, this);
}
this._anchorsForRawSourceCode = {};
},
Modified: trunk/Source/WebCore/inspector/front-end/RawSourceCode.js (99202 => 99203)
--- trunk/Source/WebCore/inspector/front-end/RawSourceCode.js 2011-11-03 16:16:37 UTC (rev 99202)
+++ trunk/Source/WebCore/inspector/front-end/RawSourceCode.js 2011-11-03 16:28:29 UTC (rev 99203)
@@ -211,7 +211,7 @@
var originalContentProvider = this._createContentProvider();
if (!this._formatted) {
- var uiSourceCode = new WebInspector.UISourceCode(this.id, this.url, this.isContentScript, this, originalContentProvider);
+ var uiSourceCode = new WebInspector.UISourceCode(this.url, this.url, this.isContentScript, this, originalContentProvider);
var sourceMapping = new WebInspector.RawSourceCode.PlainSourceMapping(this, uiSourceCode);
callback(sourceMapping);
return;
@@ -232,7 +232,7 @@
function didFormatContent(formattedContent, mapping)
{
var contentProvider = new WebInspector.StaticContentProvider(mimeType, formattedContent)
- var uiSourceCode = new WebInspector.UISourceCode("deobfuscated:" + this.id, this.url, this.isContentScript, this, contentProvider);
+ var uiSourceCode = new WebInspector.UISourceCode("deobfuscated:" + this.url, this.url, this.isContentScript, this, contentProvider);
var sourceMapping = new WebInspector.RawSourceCode.FormattedSourceMapping(this, uiSourceCode, mapping);
callback(sourceMapping);
}
Modified: trunk/Source/WebCore/inspector/front-end/Script.js (99202 => 99203)
--- trunk/Source/WebCore/inspector/front-end/Script.js 2011-11-03 16:16:37 UTC (rev 99202)
+++ trunk/Source/WebCore/inspector/front-end/Script.js 2011-11-03 16:28:29 UTC (rev 99203)
@@ -126,5 +126,10 @@
DebuggerAgent.setScriptSource(this.scriptId, newSource, undefined, didEditScriptSource.bind(this));
} else
callback("Script failed to parse");
+ },
+
+ isInlineScript: function()
+ {
+ return this.sourceURL && this.lineOffset !== 0 && this.columnOffset !== 0;
}
}