Diff
Modified: trunk/LayoutTests/ChangeLog (96584 => 96585)
--- trunk/LayoutTests/ChangeLog 2011-10-04 11:37:25 UTC (rev 96584)
+++ trunk/LayoutTests/ChangeLog 2011-10-04 12:32:51 UTC (rev 96585)
@@ -1,3 +1,14 @@
+2011-09-29 Pavel Podivilov <[email protected]>
+
+ Web Inspector: add compiler source mapping support to RawSourceCode.
+ https://bugs.webkit.org/show_bug.cgi?id=68891
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/debugger/breakpoint-manager.html:
+ * inspector/debugger/raw-source-code-expected.txt:
+ * inspector/debugger/raw-source-code.html:
+
2011-10-04 Hans Wennborg <[email protected]>
[Chromium] Update expectations for svg/W3C-SVG-1.1/pservers-grad-06-b.svg
Modified: trunk/LayoutTests/inspector/debugger/breakpoint-manager.html (96584 => 96585)
--- trunk/LayoutTests/inspector/debugger/breakpoint-manager.html 2011-10-04 11:37:25 UTC (rev 96584)
+++ trunk/LayoutTests/inspector/debugger/breakpoint-manager.html 2011-10-04 12:32:51 UTC (rev 96585)
@@ -69,10 +69,10 @@
var uiSourceCodeA = createUISourceCode("a.js", "a.js",
function(rawLocation) { return rawLocation; },
- function(lineNumber, columnNumber) { return { scriptId: "a.js", lineNumber: lineNumber, columnNumber: columnNumber }; });
+ function(uiSourceCode, lineNumber) { return { scriptId: "a.js", lineNumber: lineNumber, columnNumber: 0 }; });
var uiSourceCodeB = createUISourceCode("b.js", "b.js",
function(rawLocation) { return rawLocation; },
- function(lineNumber, columnNumber) { return { scriptId: "b.js", lineNumber: lineNumber, columnNumber: columnNumber }; });
+ function(uiSourceCode, lineNumber) { return { scriptId: "b.js", lineNumber: lineNumber, columnNumber: 0 }; });
function createBreakpointManager(breakpoints)
{
@@ -205,10 +205,10 @@
var breakpointManager = createBreakpointManager([createBreakpoint("c.js", 4, "", true)]);
var uiSourceCodeC = createUISourceCode("c.js", "c.js",
function(rawLocation) { return rawLocation; },
- function(lineNumber, columnNumber) { return { scriptId: "c.js", lineNumber: lineNumber, columnNumber: columnNumber }; });
+ function(uiSourceCode, lineNumber) { return { scriptId: "c.js", lineNumber: lineNumber, columnNumber: 0 }; });
var uiSourceCodeCFormatted = createUISourceCode("deobfuscated:c.js", "c.js",
function(rawLocation) { return { lineNumber: rawLocation.lineNumber * 2, columnNumber: rawLocation.columnNumber * 2 }; },
- function(lineNumber, columnNumber) { return { scriptId: "c.js", lineNumber: Math.floor(lineNumber / 2), columnNumber: Math.floor(columnNumber / 2) }; });
+ function(uiSourceCode, lineNumber) { return { scriptId: "c.js", lineNumber: Math.floor(lineNumber / 2), columnNumber: 0 }; });
breakpointManager.uiSourceCodeAdded(uiSourceCodeC);
setTimeout(format, 0);
Modified: trunk/LayoutTests/inspector/debugger/raw-source-code-expected.txt (96584 => 96585)
--- trunk/LayoutTests/inspector/debugger/raw-source-code-expected.txt 2011-10-04 11:37:25 UTC (rev 96584)
+++ trunk/LayoutTests/inspector/debugger/raw-source-code-expected.txt 2011-10-04 12:32:51 UTC (rev 96585)
@@ -15,3 +15,5 @@
Running: testFormattingWithPendingResource
+Running: testCompilerSourceMapping
+
Modified: trunk/LayoutTests/inspector/debugger/raw-source-code.html (96584 => 96585)
--- trunk/LayoutTests/inspector/debugger/raw-source-code.html 2011-10-04 11:37:25 UTC (rev 96584)
+++ trunk/LayoutTests/inspector/debugger/raw-source-code.html 2011-10-04 12:32:51 UTC (rev 96585)
@@ -111,7 +111,7 @@
InspectorTest.assertEquals(true, uiSourceCode.isContentScript);
InspectorTest.assertEquals(rawSourceCode, uiSourceCode.rawSourceCode);
checkUILocation(uiSourceCode, 0, 5, sourceMapping.rawLocationToUILocation(createRawLocation(0, 5)));
- checkRawLocation(script, 0, 10, sourceMapping.uiLocationToRawLocation(0, 10));
+ checkRawLocation(script, 10, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 10));
uiSourceCode.requestContent(didRequestContent);
function didRequestContent(mimeType, content)
@@ -174,8 +174,8 @@
rawSourceCode.addScript(script2);
rawSourceCode.forceUpdateSourceMapping();
checkUILocation(uiSourceCode, 1, 20, sourceMapping.rawLocationToUILocation(createRawLocation(1, 20)));
- checkRawLocation(script1, 1, 20, sourceMapping.uiLocationToRawLocation(1, 20));
- checkRawLocation(script2, 6, 2, sourceMapping.uiLocationToRawLocation(6, 2));
+ checkRawLocation(script1, 1, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 1));
+ checkRawLocation(script2, 6, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 6));
next();
}
@@ -283,7 +283,7 @@
var sourceMapping = rawSourceCode.sourceMapping;
var uiSourceCode = sourceMapping.uiSourceCode;
checkUILocation(uiSourceCode, 1, 2, sourceMapping.rawLocationToUILocation(createRawLocation(1, 2)));
- checkRawLocation(script, 1, 2, sourceMapping.uiLocationToRawLocation(1, 2));
+ checkRawLocation(script, 2, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 2));
uiSourceCode.requestContent(didRequestContent);
function didRequestContent(mimeType, content)
@@ -301,7 +301,7 @@
var sourceMapping = rawSourceCode.sourceMapping;
var uiSourceCode = sourceMapping.uiSourceCode;
checkUILocation(uiSourceCode, 2, 4, sourceMapping.rawLocationToUILocation(createRawLocation(1, 2)));
- checkRawLocation(script, 1, 2, sourceMapping.uiLocationToRawLocation(2, 4));
+ checkRawLocation(script, 1, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 2));
uiSourceCode.requestContent(didRequestFormattedContent);
}
@@ -319,7 +319,7 @@
var sourceMapping = rawSourceCode.sourceMapping;
var uiSourceCode = sourceMapping.uiSourceCode;
checkUILocation(uiSourceCode, 1, 2, sourceMapping.rawLocationToUILocation(createRawLocation(1, 2)));
- checkRawLocation(script, 1, 2, sourceMapping.uiLocationToRawLocation(1, 2));
+ checkRawLocation(script, 2, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 2));
uiSourceCode.requestContent(didRequestNotFormattedContent);
}
@@ -348,9 +348,74 @@
var sourceMapping = rawSourceCode.sourceMapping;
var uiSourceCode = sourceMapping.uiSourceCode;
checkUILocation(uiSourceCode, 2, 4, sourceMapping.rawLocationToUILocation(createRawLocation(1, 2)));
- checkRawLocation(script, 1, 2, sourceMapping.uiLocationToRawLocation(2, 4));
+ checkRawLocation(script, 1, 0, sourceMapping.uiLocationToRawLocation(uiSourceCode, 2));
next();
}
+ },
+
+ function testCompilerSourceMapping(next)
+ {
+ function createCompilerSourceMappingMock()
+ {
+ return {
+ compiledLocationToSourceLocation: function(lineNumber, columnNumber)
+ {
+ if (lineNumber < 10)
+ return { sourceURL: "source1.js", lineNumber: lineNumber * 2, columnNumber: columnNumber * 2 };
+ return { sourceURL: "source2.js", lineNumber: (lineNumber - 10) * 2, columnNumber: columnNumber * 2 };
+ },
+ sourceLocationToCompiledLocation: function(sourceURL, lineNumber)
+ {
+ if (sourceURL === "source1.js")
+ return { lineNumber: Math.floor(lineNumber / 2), columnNumber: 0 };
+ return { lineNumber: Math.floor(lineNumber / 2) + 10, columnNumber: 0 };
+ },
+ sources: function() { return ["source1.js", "source2.js"]; }
+ };
+ }
+ function createCompilerSourceMappingProviderMock()
+ {
+ return {
+ loadSourceMapping: function(callback) { callback(createCompilerSourceMappingMock()); },
+ loadSourceCode: function(url, callback) { callback("<content of " + url + ">"); }
+ }
+ }
+
+ var script = createScriptMock("compiled.js", 0, 0, true, "<script source>");
+ var resource = createPendingResourceMock("script", "<resource content>");
+ var rawSourceCode = createRawSourceCode(script, resource);
+ var uiSourceCodeList;
+
+ waitForSourceMappingEvent(rawSourceCode, checkMapping);
+ rawSourceCode.setCompilerSourceMappingProvider(createCompilerSourceMappingProviderMock());
+ function checkMapping()
+ {
+ var sourceMapping = rawSourceCode.sourceMapping;
+ uiSourceCodeList = sourceMapping.uiSourceCodeList;
+ var uiSourceCodeByURL = {};
+ for (var i = 0; i < uiSourceCodeList.length; ++i)
+ uiSourceCodeByURL[uiSourceCodeList[i].url] = uiSourceCodeList[i];
+ checkUILocation(uiSourceCodeByURL["source1.js"], 2, 4, sourceMapping.rawLocationToUILocation(createRawLocation(1, 2)));
+ checkUILocation(uiSourceCodeByURL["source2.js"], 10, 40, sourceMapping.rawLocationToUILocation(createRawLocation(15, 20)));
+ checkRawLocation(script, 1, 0, sourceMapping.uiLocationToRawLocation(uiSourceCodeByURL["source1.js"], 2));
+ checkRawLocation(script, 15, 0, sourceMapping.uiLocationToRawLocation(uiSourceCodeByURL["source2.js"], 10));
+
+ uiSourceCodeList[0].requestContent(didRequestContent1);
+ }
+
+ function didRequestContent1(mimeType, content)
+ {
+ InspectorTest.assertEquals("text/_javascript_", mimeType);
+ InspectorTest.assertEquals("<content of source1.js>", content);
+ uiSourceCodeList[1].requestContent(didRequestContent2);
+ }
+
+ function didRequestContent2(mimeType, content)
+ {
+ InspectorTest.assertEquals("text/_javascript_", mimeType);
+ InspectorTest.assertEquals("<content of source2.js>", content);
+ next();
+ }
}
]);
};
Modified: trunk/Source/WebCore/ChangeLog (96584 => 96585)
--- trunk/Source/WebCore/ChangeLog 2011-10-04 11:37:25 UTC (rev 96584)
+++ trunk/Source/WebCore/ChangeLog 2011-10-04 12:32:51 UTC (rev 96585)
@@ -1,3 +1,43 @@
+2011-09-29 Pavel Podivilov <[email protected]>
+
+ Web Inspector: add compiler source mapping support to RawSourceCode.
+ https://bugs.webkit.org/show_bug.cgi?id=68891
+
+ Reviewed by Pavel Feldman.
+
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * inspector/front-end/BreakpointManager.js:
+ (WebInspector.BreakpointManager.prototype.uiSourceCodeAdded):
+ (WebInspector.BreakpointManager.prototype.setBreakpoint):
+ (WebInspector.BreakpointManager.prototype._materializeBreakpoint):
+ * inspector/front-end/CompilerSourceMappingProvider.js: Added.
+ (WebInspector.CompilerSourceMappingProvider):
+ (WebInspector.CompilerSourceMappingProvider.prototype.loadSourceMapping):
+ (WebInspector.CompilerSourceMappingProvider.prototype.loadSourceCode):
+ * inspector/front-end/DebuggerPresentationModel.js:
+ (WebInspector.DebuggerPresentationModel.prototype.continueToLine):
+ * inspector/front-end/RawSourceCode.js:
+ (WebInspector.RawSourceCode.prototype.setCompilerSourceMappingProvider):
+ (WebInspector.RawSourceCode.prototype._resourceFinished):
+ (WebInspector.RawSourceCode.prototype._updateSourceMapping.didCreateSourceMapping):
+ (WebInspector.RawSourceCode.prototype._updateSourceMapping):
+ (WebInspector.RawSourceCode.prototype._createSourceMapping.didLoadSourceMapping):
+ (WebInspector.RawSourceCode.PlainSourceMapping.prototype.uiLocationToRawLocation):
+ (WebInspector.RawSourceCode.FormattedSourceMapping.prototype.uiLocationToRawLocation):
+ (WebInspector.RawSourceCode.CompilerSourceMapping):
+ (WebInspector.RawSourceCode.CompilerSourceMapping.prototype.rawLocationToUILocation):
+ (WebInspector.RawSourceCode.CompilerSourceMapping.prototype.uiLocationToRawLocation):
+ (WebInspector.RawSourceCode.CompilerSourceMapping.prototype.get uiSourceCodeList):
+ (WebInspector.CompilerSourceMappingProvider):
+ (WebInspector.CompilerSourceMappingProvider.prototype.loadSourceMapping):
+ (WebInspector.CompilerSourceMappingProvider.prototype.loadSourceCode):
+ * inspector/front-end/UISourceCodeContentProviders.js:
+ (WebInspector.CompilerSourceMappingContentProvider):
+ (WebInspector.CompilerSourceMappingContentProvider.prototype.requestContent):
+ * inspector/front-end/WebKit.qrc:
+ * inspector/front-end/inspector.html:
+
2011-10-04 Pavel Feldman <[email protected]>
Web Inspector: start adding UI components to the compilation process.
Modified: trunk/Source/WebCore/WebCore.gypi (96584 => 96585)
--- trunk/Source/WebCore/WebCore.gypi 2011-10-04 11:37:25 UTC (rev 96584)
+++ trunk/Source/WebCore/WebCore.gypi 2011-10-04 12:32:51 UTC (rev 96585)
@@ -6215,6 +6215,7 @@
'inspector/front-end/Checkbox.js',
'inspector/front-end/Color.js',
'inspector/front-end/CompilerSourceMapping.js',
+ 'inspector/front-end/CompilerSourceMappingProvider.js',
'inspector/front-end/ConsoleMessage.js',
'inspector/front-end/ConsoleModel.js',
'inspector/front-end/ConsolePanel.js',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (96584 => 96585)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2011-10-04 11:37:25 UTC (rev 96584)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2011-10-04 12:32:51 UTC (rev 96585)
@@ -69101,6 +69101,10 @@
>
</File>
<File
+ RelativePath="..\inspector\front-end\CompilerSourceMappingProvider.js"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\ConsoleMessage.js"
>
</File>
Modified: trunk/Source/WebCore/inspector/front-end/BreakpointManager.js (96584 => 96585)
--- trunk/Source/WebCore/inspector/front-end/BreakpointManager.js 2011-10-04 11:37:25 UTC (rev 96584)
+++ trunk/Source/WebCore/inspector/front-end/BreakpointManager.js 2011-10-04 12:32:51 UTC (rev 96585)
@@ -57,7 +57,7 @@
for (var lineNumber in breakpoints) {
var breakpoint = breakpoints[lineNumber];
breakpoint.uiSourceCode = uiSourceCode;
- this._materializeBreakpoint(breakpoint);
+ this._materializeBreakpoint(breakpoint, uiSourceCode.rawSourceCode.sourceMapping, uiSourceCode);
if (breakpoint._debuggerLocation)
this._breakpointDebuggerLocationChanged(breakpoint);
}
@@ -77,7 +77,7 @@
var breakpoint = new WebInspector.Breakpoint(uiSourceCode.id, lineNumber, condition, enabled, persistent);
breakpoint.uiSourceCode = uiSourceCode;
this._addBreakpointToUI(breakpoint);
- this._materializeBreakpoint(breakpoint);
+ this._materializeBreakpoint(breakpoint, uiSourceCode.rawSourceCode.sourceMapping, uiSourceCode);
},
removeBreakpoint: function(uiSourceCode, lineNumber)
@@ -89,13 +89,13 @@
this._removeBreakpointFromDebugger(breakpoint);
},
- _materializeBreakpoint: function(breakpoint)
+ _materializeBreakpoint: function(breakpoint, sourceMapping, uiSourceCode)
{
if (!breakpoint.enabled || breakpoint._materialized)
return;
breakpoint._materialized = true;
- var rawLocation = breakpoint.uiSourceCode.rawSourceCode.sourceMapping.uiLocationToRawLocation(breakpoint.lineNumber, 0);
+ var rawLocation = sourceMapping.uiLocationToRawLocation(uiSourceCode, breakpoint.lineNumber);
this._setBreakpointInDebugger(breakpoint, rawLocation);
},
Added: trunk/Source/WebCore/inspector/front-end/CompilerSourceMappingProvider.js (0 => 96585)
--- trunk/Source/WebCore/inspector/front-end/CompilerSourceMappingProvider.js (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/CompilerSourceMappingProvider.js 2011-10-04 12:32:51 UTC (rev 96585)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @constructor
+ */
+WebInspector.CompilerSourceMappingProvider = function()
+{
+}
+
+WebInspector.CompilerSourceMappingProvider.prototype = {
+ loadSourceMapping: function(callback)
+ {
+ // FIXME: load the map from source map server.
+ },
+
+ loadSourceCode: function(sourceURL, callback)
+ {
+ // FIXME: load source code from source map server.
+ }
+}
Property changes on: trunk/Source/WebCore/inspector/front-end/CompilerSourceMappingProvider.js
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/inspector/front-end/ContentProviders.js (96584 => 96585)
--- trunk/Source/WebCore/inspector/front-end/ContentProviders.js 2011-10-04 11:37:25 UTC (rev 96584)
+++ trunk/Source/WebCore/inspector/front-end/ContentProviders.js 2011-10-04 12:32:51 UTC (rev 96585)
@@ -162,6 +162,30 @@
* @constructor
* @implements {WebInspector.ContentProvider}
*/
+WebInspector.CompilerSourceMappingContentProvider = function(sourceURL, compilerSourceMappingProvider)
+{
+ this._mimeType = "text/_javascript_";
+ this._sourceURL = sourceURL;
+ this._compilerSourceMappingProvider = compilerSourceMappingProvider;
+};
+
+WebInspector.CompilerSourceMappingContentProvider.prototype = {
+ requestContent: function(callback)
+ {
+ function didLoadSourceCode(sourceCode)
+ {
+ callback(this._mimeType, sourceCode);
+ }
+ this._compilerSourceMappingProvider.loadSourceCode(this._sourceURL, didLoadSourceCode.bind(this));
+ }
+}
+
+WebInspector.CompilerSourceMappingContentProvider.prototype.__proto__ = WebInspector.ContentProvider.prototype;
+
+/**
+ * @constructor
+ * @implements {WebInspector.ContentProvider}
+ */
WebInspector.StaticContentProvider = function(mimeType, content)
{
this._mimeType = mimeType;
Modified: trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js (96584 => 96585)
--- trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2011-10-04 11:37:25 UTC (rev 96584)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2011-10-04 12:32:51 UTC (rev 96585)
@@ -283,7 +283,8 @@
continueToLine: function(uiSourceCode, lineNumber)
{
- var rawLocation = uiSourceCode.rawSourceCode.sourceMapping.uiLocationToRawLocation(lineNumber, 0);
+ // FIXME: use RawSourceCode.uiLocationToRawLocation.
+ var rawLocation = uiSourceCode.rawSourceCode.sourceMapping.uiLocationToRawLocation(uiSourceCode, lineNumber);
WebInspector.debuggerModel.continueToLocation(rawLocation);
},
Modified: trunk/Source/WebCore/inspector/front-end/RawSourceCode.js (96584 => 96585)
--- trunk/Source/WebCore/inspector/front-end/RawSourceCode.js 2011-10-04 11:37:25 UTC (rev 96584)
+++ trunk/Source/WebCore/inspector/front-end/RawSourceCode.js 2011-10-04 12:32:51 UTC (rev 96585)
@@ -78,6 +78,14 @@
this._updateSourceMapping();
},
+ setCompilerSourceMappingProvider: function(provider)
+ {
+ if (provider)
+ this._useTemporaryContent = false;
+ this._compilerSourceMappingProvider = provider;
+ this._updateSourceMapping();
+ },
+
contentEdited: function()
{
this._updateSourceMapping();
@@ -85,6 +93,8 @@
_resourceFinished: function()
{
+ if (this._compilerSourceMappingProvider)
+ return;
this._useTemporaryContent = false;
this._updateSourceMapping();
},
@@ -120,14 +130,13 @@
this._updatingSourceMapping = true;
this._updateNeeded = false;
- var originalContentProvider = this._createContentProvider();
- this._createSourceMapping(originalContentProvider, didCreateSourceMapping.bind(this));
+ this._createSourceMapping(didCreateSourceMapping.bind(this));
- function didCreateSourceMapping(contentProvider, mapping)
+ function didCreateSourceMapping(sourceMapping)
{
this._updatingSourceMapping = false;
if (!this._updateNeeded)
- this._saveSourceMapping(contentProvider, mapping);
+ this._saveSourceMapping(sourceMapping);
else
this._updateSourceMapping();
}
@@ -142,8 +151,27 @@
return new WebInspector.ConcatenatedScriptsContentProvider(this._scripts);
},
- _createSourceMapping: function(originalContentProvider, callback)
+ _createSourceMapping: function(callback)
{
+ if (this._compilerSourceMappingProvider) {
+ function didLoadSourceMapping(compilerSourceMapping)
+ {
+ var uiSourceCodeList = [];
+ var sourceURLs = compilerSourceMapping.sources();
+ for (var i = 0; i < sourceURLs.length; ++i) {
+ var sourceURL = sourceURLs[i];
+ var contentProvider = new WebInspector.CompilerSourceMappingContentProvider(sourceURL, this._compilerSourceMappingProvider);
+ var uiSourceCode = new WebInspector.UISourceCode(sourceURL, sourceURL, this.isContentScript, this, contentProvider);
+ uiSourceCodeList.push(uiSourceCode);
+ }
+ var sourceMapping = new WebInspector.RawSourceCode.CompilerSourceMapping(this, uiSourceCodeList, compilerSourceMapping);
+ callback(sourceMapping);
+ }
+ this._compilerSourceMappingProvider.loadSourceMapping(didLoadSourceMapping.bind(this));
+ return;
+ }
+
+ var originalContentProvider = this._createContentProvider();
if (!this._formatted) {
var uiSourceCode = new WebInspector.UISourceCode(this.id, this.url, this.isContentScript, this, originalContentProvider);
var sourceMapping = new WebInspector.RawSourceCode.PlainSourceMapping(this, uiSourceCode);
@@ -193,9 +221,10 @@
return new WebInspector.UILocation(this._uiSourceCode, rawLocation.lineNumber, rawLocation.columnNumber);
},
- uiLocationToRawLocation: function(lineNumber, columnNumber)
+ uiLocationToRawLocation: function(uiSourceCode, lineNumber)
{
- var rawLocation = { lineNumber: lineNumber, columnNumber: columnNumber };
+ console.assert(uiSourceCode === this._uiSourceCode);
+ var rawLocation = { lineNumber: lineNumber, columnNumber: 0 };
rawLocation.scriptId = this._rawSourceCode._scriptForRawLocation(rawLocation.lineNumber, rawLocation.columnNumber).scriptId;
return rawLocation;
},
@@ -223,9 +252,10 @@
return new WebInspector.UILocation(this._uiSourceCode, location.lineNumber, location.columnNumber);
},
- uiLocationToRawLocation: function(lineNumber, columnNumber)
+ uiLocationToRawLocation: function(uiSourceCode, lineNumber)
{
- var rawLocation = this._mapping.formattedToOriginal({ lineNumber: lineNumber, columnNumber: columnNumber });
+ console.assert(uiSourceCode === this._uiSourceCode);
+ var rawLocation = this._mapping.formattedToOriginal({ lineNumber: lineNumber, columnNumber: 0 });
rawLocation.scriptId = this._rawSourceCode._scriptForRawLocation(rawLocation.lineNumber, rawLocation.columnNumber).scriptId;
return rawLocation;
},
@@ -239,6 +269,40 @@
/**
* @constructor
*/
+WebInspector.RawSourceCode.CompilerSourceMapping = function(rawSourceCode, uiSourceCodeList, mapping)
+{
+ this._rawSourceCode = rawSourceCode;
+ this._uiSourceCodeList = uiSourceCodeList;
+ this._mapping = mapping;
+ this._uiSourceCodeByURL = {};
+ for (var i = 0; i < uiSourceCodeList.length; ++i)
+ this._uiSourceCodeByURL[uiSourceCodeList[i].url] = uiSourceCodeList[i];
+}
+
+WebInspector.RawSourceCode.CompilerSourceMapping.prototype = {
+ rawLocationToUILocation: function(rawLocation)
+ {
+ var location = this._mapping.compiledLocationToSourceLocation(rawLocation.lineNumber, rawLocation.columnNumber);
+ var uiSourceCode = this._uiSourceCodeByURL[location.sourceURL];
+ return new WebInspector.UILocation(uiSourceCode, location.lineNumber, location.columnNumber);
+ },
+
+ uiLocationToRawLocation: function(uiSourceCode, lineNumber)
+ {
+ var rawLocation = this._mapping.sourceLocationToCompiledLocation(uiSourceCode.url, lineNumber);
+ rawLocation.scriptId = this._rawSourceCode._scriptForRawLocation(rawLocation.lineNumber, rawLocation.columnNumber).scriptId;
+ return rawLocation;
+ },
+
+ get uiSourceCodeList()
+ {
+ return this._uiSourceCodeList;
+ }
+}
+
+/**
+ * @constructor
+ */
WebInspector.UILocation = function(uiSourceCode, lineNumber, columnNumber)
{
this.uiSourceCode = uiSourceCode;
Modified: trunk/Source/WebCore/inspector/front-end/WebKit.qrc (96584 => 96585)
--- trunk/Source/WebCore/inspector/front-end/WebKit.qrc 2011-10-04 11:37:25 UTC (rev 96584)
+++ trunk/Source/WebCore/inspector/front-end/WebKit.qrc 2011-10-04 12:32:51 UTC (rev 96585)
@@ -16,6 +16,7 @@
<file>Checkbox.js</file>
<file>Color.js</file>
<file>CompilerSourceMapping.js</file>
+ <file>CompilerSourceMappingProvider.js</file>
<file>ConsoleMessage.js</file>
<file>ConsoleModel.js</file>
<file>ConsolePanel.js</file>
Modified: trunk/Source/WebCore/inspector/front-end/inspector.html (96584 => 96585)
--- trunk/Source/WebCore/inspector/front-end/inspector.html 2011-10-04 11:37:25 UTC (rev 96584)
+++ trunk/Source/WebCore/inspector/front-end/inspector.html 2011-10-04 12:32:51 UTC (rev 96585)
@@ -164,6 +164,7 @@
<script type="text/_javascript_" src=""
<script type="text/_javascript_" src=""
<script type="text/_javascript_" src=""
+ <script type="text/_javascript_" src=""
<script type="text/_javascript_" src=""
<script type="text/_javascript_" src=""
<script type="text/_javascript_" src=""