Modified: trunk/LayoutTests/ChangeLog (111388 => 111389)
--- trunk/LayoutTests/ChangeLog 2012-03-20 12:57:04 UTC (rev 111388)
+++ trunk/LayoutTests/ChangeLog 2012-03-20 14:01:05 UTC (rev 111389)
@@ -1,3 +1,13 @@
+2012-03-15 Pavel Podivilov <podivi...@chromium.org>
+
+ Web Inspector: support inline source maps.
+ https://bugs.webkit.org/show_bug.cgi?id=81248
+
+ Reviewed by Pavel Feldman.
+
+ * http/tests/inspector/compiler-source-mapping-expected.txt:
+ * http/tests/inspector/compiler-source-mapping.html:
+
2012-03-20 Pavel Feldman <pfeld...@chromium.org>
Web Inspector: treat Uint* external arrays as arrays in console.
Modified: trunk/LayoutTests/http/tests/inspector/compiler-source-mapping-expected.txt (111388 => 111389)
--- trunk/LayoutTests/http/tests/inspector/compiler-source-mapping-expected.txt 2012-03-20 12:57:04 UTC (rev 111388)
+++ trunk/LayoutTests/http/tests/inspector/compiler-source-mapping-expected.txt 2012-03-20 14:01:05 UTC (rev 111389)
@@ -13,5 +13,7 @@
Running: testCompilerScriptMapping
+Running: testInlinedSourceMap
+
Running: testCompilerSourceMappingCouldNotBeLoaded
Modified: trunk/LayoutTests/http/tests/inspector/compiler-source-mapping.html (111388 => 111389)
--- trunk/LayoutTests/http/tests/inspector/compiler-source-mapping.html 2012-03-20 12:57:04 UTC (rev 111388)
+++ trunk/LayoutTests/http/tests/inspector/compiler-source-mapping.html 2012-03-20 14:01:05 UTC (rev 111389)
@@ -129,6 +129,7 @@
function testCompilerScriptMapping(next)
{
+ WebInspector.debuggerModel._scripts = [];
var mapping = new WebInspector.CompilerScriptMapping();
var script = InspectorTest.createScriptMock("compiled.js", 0, 0, true, "");
script.sourceMapURL = "http://localhost:8000/inspector/resources/source-map.json";
@@ -162,8 +163,39 @@
}
},
+ function testInlinedSourceMap(next)
+ {
+ WebInspector.debuggerModel._scripts = [];
+ var mapping = new WebInspector.CompilerScriptMapping();
+ var script = InspectorTest.createScriptMock("http://example.com/compiled.js", 0, 0, true, "");
+ var sourceMap = {
+ "file":"compiled.js",
+ "mappings":"AAASA,QAAAA,IAAG,CAACC,CAAD,CAAaC,CAAb,CACZ,CACI,MAAOD,EAAP,CAAoBC,CADxB,CAIA,IAAIC,OAAS;",
+ "sources":["source.js"],
+ "sourcesContent":["<source content>"]
+ };
+ script.sourceMapURL = "data:application/json;base64," + btoa(JSON.stringify(sourceMap));
+ mapping.addScript(script);
+
+ var uiSourceCodeList = mapping.uiSourceCodeList();
+ InspectorTest.assertEquals(1, uiSourceCodeList.length);
+ InspectorTest.assertEquals("source.js", uiSourceCodeList[0].url);
+
+ InspectorTest.checkUILocation(uiSourceCodeList[0], 2, 4, mapping.rawLocationToUILocation(WebInspector.debuggerModel.createRawLocation(script, 0, 18)));
+ InspectorTest.checkRawLocation(script, 0, 18, mapping.uiLocationToRawLocation(uiSourceCodeList[0], 2, 4));
+
+ uiSourceCodeList[0].requestContent(didRequestContent);
+
+ function didRequestContent(mimeType, content)
+ {
+ InspectorTest.assertEquals("<source content>", content);
+ next();
+ }
+ },
+
function testCompilerSourceMappingCouldNotBeLoaded(next)
{
+ WebInspector.debuggerModel._scripts = [];
var mainScriptMapping = new WebInspector.MainScriptMapping();
mainScriptMapping.addEventListener(WebInspector.MainScriptMapping.Events.UISourceCodeListChanged, uiSourceCodeListChanged);
Modified: trunk/Source/WebCore/ChangeLog (111388 => 111389)
--- trunk/Source/WebCore/ChangeLog 2012-03-20 12:57:04 UTC (rev 111388)
+++ trunk/Source/WebCore/ChangeLog 2012-03-20 14:01:05 UTC (rev 111389)
@@ -1,3 +1,19 @@
+2012-03-15 Pavel Podivilov <podivi...@chromium.org>
+
+ Web Inspector: support inline source maps.
+ https://bugs.webkit.org/show_bug.cgi?id=81248
+
+ - support optional map.sourcesContent array with sources content
+ - support data: url as script sourceMapURL, e.g. "//@ sourceMappingURL=data:application/json;base64,<base64-encoded map>"
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/front-end/CompilerSourceMapping.js:
+ (WebInspector.ClosureCompilerSourceMapping):
+ (WebInspector.ClosureCompilerSourceMapping.prototype.loadSourceCode):
+ (WebInspector.ClosureCompilerSourceMapping.prototype._parseMap):
+ (WebInspector.ClosureCompilerSourceMapping.prototype._canonicalizeURL):
+
2012-03-20 Pavel Feldman <pfeld...@chromium.org>
Web Inspector: treat Uint* external arrays as arrays in console.
Modified: trunk/Source/WebCore/inspector/front-end/CompilerSourceMapping.js (111388 => 111389)
--- trunk/Source/WebCore/inspector/front-end/CompilerSourceMapping.js 2012-03-20 12:57:04 UTC (rev 111388)
+++ trunk/Source/WebCore/inspector/front-end/CompilerSourceMapping.js 2012-03-20 14:01:05 UTC (rev 111389)
@@ -86,6 +86,7 @@
this._sourceMappingURL = this._canonicalizeURL(sourceMappingURL, scriptSourceOrigin);
this._mappings = [];
this._reverseMappingsBySourceURL = {};
+ this._sourceContentByURL = {};
}
WebInspector.ClosureCompilerSourceMapping.prototype = {
@@ -145,6 +146,9 @@
*/
loadSourceCode: function(sourceURL)
{
+ if (this._sourceContentByURL[sourceURL])
+ return this._sourceContentByURL[sourceURL];
+
try {
// FIXME: make sendRequest async.
return InspectorFrontendHost.loadResourceSynchronously(sourceURL);
@@ -204,6 +208,8 @@
sources.push(url);
if (!this._reverseMappingsBySourceURL[url])
this._reverseMappingsBySourceURL[url] = [];
+ if (map.sourcesContent && map.sourcesContent[i])
+ this._sourceContentByURL[url] = map.sourcesContent[i];
}
var stringCharIterator = new WebInspector.ClosureCompilerSourceMapping.StringCharIterator(map.mappings);
@@ -267,7 +273,7 @@
_canonicalizeURL: function(url, baseURL)
{
- if (!url || !baseURL || url.asParsedURL())
+ if (!url || !baseURL || url.asParsedURL() || url.substring(0, 5) === "data:")
return url;
var base = baseURL.asParsedURL();