Diff
Modified: trunk/LayoutTests/ChangeLog (103404 => 103405)
--- trunk/LayoutTests/ChangeLog 2011-12-21 13:48:36 UTC (rev 103404)
+++ trunk/LayoutTests/ChangeLog 2011-12-21 13:52:11 UTC (rev 103405)
@@ -1,3 +1,12 @@
+2011-12-09 Pavel Podivilov <podivi...@chromium.org>
+
+ Web Inspector: auto detect source map url.
+ https://bugs.webkit.org/show_bug.cgi?id=74088
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/debugger/raw-source-code.html:
+
2011-12-21 Csaba Osztrogonác <o...@webkit.org>
[Qt] Unreviewed gardening. Update Qt specific expected results.
Modified: trunk/Source/WebCore/ChangeLog (103404 => 103405)
--- trunk/Source/WebCore/ChangeLog 2011-12-21 13:48:36 UTC (rev 103404)
+++ trunk/Source/WebCore/ChangeLog 2011-12-21 13:52:11 UTC (rev 103405)
@@ -1,3 +1,26 @@
+2011-12-09 Pavel Podivilov <podivi...@chromium.org>
+
+ Web Inspector: auto detect source map url.
+ https://bugs.webkit.org/show_bug.cgi?id=74088
+
+ Reviewed by Pavel Feldman.
+
+ Check to see if "X-SourceMap" HTTP response header was sent with script resource.
+ Header value will be used as auto suggestion for source map url in UI.
+
+ * inspector/Inspector.json:
+ * inspector/InspectorDebuggerAgent.cpp:
+ (WebCore::InspectorDebuggerAgent::sourceMapURLForScript):
+ (WebCore::InspectorDebuggerAgent::didParseSource):
+ * inspector/InspectorDebuggerAgent.h:
+ * inspector/front-end/DebuggerModel.js:
+ (WebInspector.DebuggerModel.prototype._parsedScriptSource):
+ (WebInspector.DebuggerDispatcher.prototype.scriptParsed):
+ * inspector/front-end/RawSourceCode.js:
+ (WebInspector.RawSourceCode):
+ * inspector/front-end/Script.js:
+ (WebInspector.Script):
+
2011-12-21 Pierre Rossi <pierre.ro...@gmail.com>
[Qt] Mobile theme refinements
Modified: trunk/Source/WebCore/inspector/Inspector.json (103404 => 103405)
--- trunk/Source/WebCore/inspector/Inspector.json 2011-12-21 13:48:36 UTC (rev 103404)
+++ trunk/Source/WebCore/inspector/Inspector.json 2011-12-21 13:52:11 UTC (rev 103405)
@@ -2058,7 +2058,8 @@
{ "name": "startColumn", "type": "integer", "description": "Column offset of the script within the resource with given URL." },
{ "name": "endLine", "type": "integer", "description": "Last line of the script." },
{ "name": "endColumn", "type": "integer", "description": "Length of the last line of the script." },
- { "name": "isContentScript", "type": "boolean", "optional": true, "description": "Determines whether this script is a user extension script." }
+ { "name": "isContentScript", "type": "boolean", "optional": true, "description": "Determines whether this script is a user extension script." },
+ { "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with script (if any)." }
],
"description": "Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger."
},
Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp (103404 => 103405)
--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp 2011-12-21 13:48:36 UTC (rev 103404)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp 2011-12-21 13:52:11 UTC (rev 103405)
@@ -35,6 +35,7 @@
#include "InjectedScript.h"
#include "InjectedScriptManager.h"
#include "InspectorFrontend.h"
+#include "InspectorPageAgent.h"
#include "InspectorState.h"
#include "InspectorValues.h"
#include "InstrumentingAgents.h"
@@ -473,12 +474,28 @@
return injectedScript.wrapCallFrames(m_currentCallStack);
}
+String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script)
+{
+ DEFINE_STATIC_LOCAL(String, sourceMapHttpHeader, ("X-SourceMap"));
+
+ if (script.url.isEmpty())
+ return String();
+
+ InspectorPageAgent* pageAgent = m_instrumentingAgents->inspectorPageAgent();
+ CachedResource* resource = pageAgent->cachedResource(pageAgent->mainFrame(), KURL(ParsedURLString, script.url));
+ if (resource)
+ return resource->response().httpHeaderField(sourceMapHttpHeader);
+ return String();
+}
+
// _javascript_DebugListener functions
void InspectorDebuggerAgent::didParseSource(const String& scriptId, const Script& script)
{
// Don't send script content to the front end until it's really needed.
- m_frontend->scriptParsed(scriptId, script.url, script.startLine, script.startColumn, script.endLine, script.endColumn, script.isContentScript ? &script.isContentScript : 0);
+ const bool* isContentScript = script.isContentScript ? &script.isContentScript : 0;
+ String sourceMapURL = sourceMapURLForScript(script);
+ m_frontend->scriptParsed(scriptId, script.url, script.startLine, script.startColumn, script.endLine, script.endColumn, isContentScript, sourceMapURL);
m_scripts.set(scriptId, script);
Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h (103404 => 103405)
--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h 2011-12-21 13:48:36 UTC (rev 103404)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h 2011-12-21 13:52:11 UTC (rev 103405)
@@ -141,6 +141,8 @@
bool assertPaused(ErrorString*);
void clearBreakDetails();
+ String sourceMapURLForScript(const Script&);
+
typedef HashMap<String, Script> ScriptsMap;
typedef HashMap<String, Vector<String> > BreakpointIdToDebugServerBreakpointIdsMap;
Modified: trunk/Source/WebCore/inspector/front-end/DebuggerModel.js (103404 => 103405)
--- trunk/Source/WebCore/inspector/front-end/DebuggerModel.js 2011-12-21 13:48:36 UTC (rev 103404)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerModel.js 2011-12-21 13:52:11 UTC (rev 103405)
@@ -325,9 +325,9 @@
* @param {number} endColumn
* @param {boolean} isContentScript
*/
- _parsedScriptSource: function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript)
+ _parsedScriptSource: function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL)
{
- var script = new WebInspector.Script(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript);
+ var script = new WebInspector.Script(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL);
this._scripts[scriptId] = script;
this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ParsedScriptSource, script);
},
@@ -394,9 +394,9 @@
* @param {number} endColumn
* @param {boolean=} isContentScript
*/
- scriptParsed: function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript)
+ scriptParsed: function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL)
{
- this._debuggerModel._parsedScriptSource(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, !!isContentScript);
+ this._debuggerModel._parsedScriptSource(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, !!isContentScript, sourceMapURL);
},
/**
Modified: trunk/Source/WebCore/inspector/front-end/RawSourceCode.js (103404 => 103405)
--- trunk/Source/WebCore/inspector/front-end/RawSourceCode.js 2011-12-21 13:48:36 UTC (rev 103404)
+++ trunk/Source/WebCore/inspector/front-end/RawSourceCode.js 2011-12-21 13:52:11 UTC (rev 103405)
@@ -45,6 +45,7 @@
this.id = id;
this.url = ""
this.isContentScript = script.isContentScript;
+ this.sourceMapURL = script.sourceMapURL;
this._scripts = [script];
this._formatter = formatter;
this._formatted = formatted;
Modified: trunk/Source/WebCore/inspector/front-end/Script.js (103404 => 103405)
--- trunk/Source/WebCore/inspector/front-end/Script.js 2011-12-21 13:48:36 UTC (rev 103404)
+++ trunk/Source/WebCore/inspector/front-end/Script.js 2011-12-21 13:52:11 UTC (rev 103405)
@@ -33,7 +33,7 @@
* @param {number} endColumn
* @param {boolean} isContentScript
*/
-WebInspector.Script = function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript)
+WebInspector.Script = function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL)
{
this.scriptId = scriptId;
this.sourceURL = sourceURL;
@@ -42,6 +42,7 @@
this.endLine = endLine;
this.endColumn = endColumn;
this.isContentScript = isContentScript;
+ this.sourceMapURL = sourceMapURL;
}
WebInspector.Script.prototype = {
@@ -96,14 +97,14 @@
}
callback(result || []);
}
-
+
if (this.scriptId) {
// Script failed to parse.
DebuggerAgent.searchInContent(this.scriptId, query, caseSensitive, isRegex, innerCallback.bind(this));
} else
callback([]);
},
-
+
/**
* @param {string} newSource
* @param {function(?Protocol.Error, Array.<DebuggerAgent.CallFrame>=)} callback