Diff
Modified: trunk/LayoutTests/ChangeLog (103407 => 103408)
--- trunk/LayoutTests/ChangeLog 2011-12-21 15:28:58 UTC (rev 103407)
+++ trunk/LayoutTests/ChangeLog 2011-12-21 15:48:44 UTC (rev 103408)
@@ -1,3 +1,13 @@
+2011-12-12 Pavel Podivilov <[email protected]>
+
+ Web Inspector: fix source map url resolving.
+ https://bugs.webkit.org/show_bug.cgi?id=74305
+
+ Reviewed by Pavel Feldman.
+
+ * http/tests/inspector/compiler-source-mapping-expected.txt:
+ * http/tests/inspector/compiler-source-mapping.html:
+
2011-12-21 Renata Hodovan <[email protected]>
New renderer for SVGRectElement
Modified: trunk/LayoutTests/http/tests/inspector/compiler-source-mapping-expected.txt (103407 => 103408)
--- trunk/LayoutTests/http/tests/inspector/compiler-source-mapping-expected.txt 2011-12-21 15:28:58 UTC (rev 103407)
+++ trunk/LayoutTests/http/tests/inspector/compiler-source-mapping-expected.txt 2011-12-21 15:48:44 UTC (rev 103408)
@@ -9,5 +9,7 @@
Running: testSections
+Running: testResolveSourceMappingURL
+
Running: testLoad
Modified: trunk/LayoutTests/http/tests/inspector/compiler-source-mapping.html (103407 => 103408)
--- trunk/LayoutTests/http/tests/inspector/compiler-source-mapping.html 2011-12-21 15:28:58 UTC (rev 103407)
+++ trunk/LayoutTests/http/tests/inspector/compiler-source-mapping.html 2011-12-21 15:48:44 UTC (rev 103408)
@@ -97,7 +97,7 @@
"offset": { "line": 1, "column": 0 },
"map": {
"mappings":"AAAA,CAEC",
- "sources":["source1.js"]
+ "sources":["source1.js", "source2.js"]
}
}, {
"offset": { "line": 3, "column": 10 },
@@ -109,6 +109,7 @@
]};
var mapping = new WebInspector.ClosureCompilerSourceMapping();
mapping._parseMappingPayload(mappingPayload);
+ InspectorTest.assertEquals(2, mapping.sources().length);
checkMapping(0, 0, "source1.js", 0, 0, mapping);
checkMapping(0, 1, "source1.js", 2, 1, mapping);
checkMapping(2, 10, "source2.js", 0, 0, mapping);
@@ -116,6 +117,15 @@
next();
},
+ function testResolveSourceMappingURL(next)
+ {
+ var func = WebInspector.ClosureCompilerSourceMapping.prototype._resolveSourceMapURL;
+ InspectorTest.assertEquals("http://example.com/map.json", func("http://example.com/map.json", "http://example.com/script.js"));
+ InspectorTest.assertEquals("http://example.com/map.json", func("/map.json", "http://example.com/script.js"));
+ InspectorTest.assertEquals("http://example.com/scripts/../maps/map.json", func("../maps/map.json", "http://example.com/scripts/script.js"));
+ next();
+ },
+
function testLoad(next)
{
var sourceMapping = new WebInspector.ClosureCompilerSourceMapping("http://localhost:8000/inspector/resources/source-map.json");
Modified: trunk/Source/WebCore/ChangeLog (103407 => 103408)
--- trunk/Source/WebCore/ChangeLog 2011-12-21 15:28:58 UTC (rev 103407)
+++ trunk/Source/WebCore/ChangeLog 2011-12-21 15:48:44 UTC (rev 103408)
@@ -1,3 +1,22 @@
+2011-12-12 Pavel Podivilov <[email protected]>
+
+ Web Inspector: fix source map url resolving.
+ https://bugs.webkit.org/show_bug.cgi?id=74305
+
+ Reviewed by Pavel Feldman.
+
+ Also fix the bug with repeated source urls in mapping sections.
+
+ * inspector/front-end/CompilerSourceMapping.js:
+ (WebInspector.ClosureCompilerSourceMapping):
+ (WebInspector.ClosureCompilerSourceMapping.prototype.sources):
+ (WebInspector.ClosureCompilerSourceMapping.prototype._parseMap):
+ (WebInspector.ClosureCompilerSourceMapping.prototype._resolveSourceMapURL):
+ * inspector/front-end/DebuggerPresentationModel.js:
+ (WebInspector.DebuggerPresentationModel.prototype.installCompilerSourceMapping):
+ * inspector/front-end/utilities.js:
+ (String.prototype.asParsedURL):
+
2011-12-21 Renata Hodovan <[email protected]>
New renderer for SVGRectElement
Modified: trunk/Source/WebCore/inspector/front-end/CompilerSourceMapping.js (103407 => 103408)
--- trunk/Source/WebCore/inspector/front-end/CompilerSourceMapping.js 2011-12-21 15:28:58 UTC (rev 103407)
+++ trunk/Source/WebCore/inspector/front-end/CompilerSourceMapping.js 2011-12-21 15:48:44 UTC (rev 103408)
@@ -72,8 +72,9 @@
* @implements {WebInspector.CompilerSourceMapping}
* @constructor
* @param {string} sourceMappingURL
+ * @param {string} sourceURL
*/
-WebInspector.ClosureCompilerSourceMapping = function(sourceMappingURL)
+WebInspector.ClosureCompilerSourceMapping = function(sourceMappingURL, scriptSourceOrigin)
{
if (!WebInspector.ClosureCompilerSourceMapping.prototype._base64Map) {
const base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -82,8 +83,7 @@
WebInspector.ClosureCompilerSourceMapping.prototype._base64Map[base64Digits.charAt(i)] = i;
}
- this._sourceMappingURL = sourceMappingURL;
- this._sources = [];
+ this._sourceMappingURL = this._resolveSourceMapURL(sourceMappingURL, scriptSourceOrigin);
this._mappings = [];
this._reverseMappingsBySourceURL = {};
}
@@ -131,7 +131,10 @@
*/
sources: function()
{
- return this._sources;
+ var sources = [];
+ for (var sourceURL in this._reverseMappingsBySourceURL)
+ sources.push(sourceURL);
+ return sources;
},
/**
@@ -185,19 +188,21 @@
_parseMap: function(map, lineNumber, columnNumber)
{
- var sourceIndex = this._sources.length;
+ var sourceIndex = 0;
var sourceLineNumber = 0;
var sourceColumnNumber = 0;
var nameIndex = 0;
+ var sources = [];
for (var i = 0; i < map.sources.length; ++i) {
var url = "" map.sources[i]);
- this._sources.push(url);
- this._reverseMappingsBySourceURL[url] = [];
+ sources.push(url);
+ if (!this._reverseMappingsBySourceURL[url])
+ this._reverseMappingsBySourceURL[url] = [];
}
var stringCharIterator = new WebInspector.ClosureCompilerSourceMapping.StringCharIterator(map.mappings);
- var sourceURL = this._sources[sourceIndex];
+ var sourceURL = sources[sourceIndex];
var reverseMappings = this._reverseMappingsBySourceURL[sourceURL];
while (true) {
@@ -218,7 +223,7 @@
var sourceIndexDelta = this._decodeVLQ(stringCharIterator);
if (sourceIndexDelta) {
sourceIndex += sourceIndexDelta;
- sourceURL = this._sources[sourceIndex];
+ sourceURL = sources[sourceIndex];
reverseMappings = this._reverseMappingsBySourceURL[sourceURL];
}
sourceLineNumber += this._decodeVLQ(stringCharIterator);
@@ -260,6 +265,21 @@
return sourceRoot ? sourceRoot + "/" + sourceURL : sourceURL;
},
+ _resolveSourceMapURL: function(sourceMappingURL, scriptSourceOrigin)
+ {
+ if (!sourceMappingURL || !scriptSourceOrigin)
+ return sourceMappingURL;
+
+ if (sourceMappingURL.asParsedURL())
+ return sourceMappingURL;
+
+ var origin = scriptSourceOrigin.asParsedURL();
+ var baseURL = origin.scheme + "://" + origin.host + (origin.port ? ":" + origin.port : "");
+ if (sourceMappingURL[0] === "/")
+ return baseURL + sourceMappingURL;
+ return baseURL + origin.firstPathComponents + sourceMappingURL;
+ },
+
_VLQ_BASE_SHIFT: 5,
_VLQ_BASE_MASK: (1 << 5) - 1,
_VLQ_CONTINUATION_MASK: 1 << 5
Modified: trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js (103407 => 103408)
--- trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2011-12-21 15:28:58 UTC (rev 103407)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2011-12-21 15:48:44 UTC (rev 103408)
@@ -341,7 +341,7 @@
*/
setCompilerSourceMapping: function(uiSourceCode, sourceMappingURL)
{
- var sourceMapping = new WebInspector.ClosureCompilerSourceMapping(sourceMappingURL);
+ var sourceMapping = new WebInspector.ClosureCompilerSourceMapping(sourceMappingURL, uiSourceCode.url);
uiSourceCode.rawSourceCode.setCompilerSourceMapping(sourceMapping);
},
Modified: trunk/Source/WebCore/inspector/front-end/utilities.js (103407 => 103408)
--- trunk/Source/WebCore/inspector/front-end/utilities.js 2011-12-21 15:28:58 UTC (rev 103407)
+++ trunk/Source/WebCore/inspector/front-end/utilities.js 2011-12-21 15:48:44 UTC (rev 103408)
@@ -469,8 +469,10 @@
// Then take last path component.
var lastSlashIndex = path.lastIndexOf("/");
- if (lastSlashIndex !== -1)
+ if (lastSlashIndex !== -1) {
+ result.firstPathComponents = path.substring(0, lastSlashIndex + 1);
result.lastPathComponent = path.substring(lastSlashIndex + 1);
+ }
}
return result;
}