Diff
Modified: trunk/LayoutTests/ChangeLog (94741 => 94742)
--- trunk/LayoutTests/ChangeLog 2011-09-08 01:38:22 UTC (rev 94741)
+++ trunk/LayoutTests/ChangeLog 2011-09-08 03:00:31 UTC (rev 94742)
@@ -1,3 +1,18 @@
+2011-09-07 Sheriff Bot <[email protected]>
+
+ Unreviewed, rolling out r94674 and r94689.
+ http://trac.webkit.org/changeset/94674
+ http://trac.webkit.org/changeset/94689
+ https://bugs.webkit.org/show_bug.cgi?id=67754
+
+ Broke inspector/debugger/script-formatter.html (Requested by
+ rniwa on #webkit).
+
+ * inspector/debugger/raw-source-code-expected.txt: Removed.
+ * inspector/debugger/raw-source-code.html: Removed.
+ * inspector/debugger/script-formatter.html:
+ * inspector/debugger/source-file.html:
+
2011-09-07 Adam Barth <[email protected]>
Update baselines for svg/as-background-image. These results all appear
Deleted: trunk/LayoutTests/inspector/debugger/raw-source-code-expected.txt (94741 => 94742)
--- trunk/LayoutTests/inspector/debugger/raw-source-code-expected.txt 2011-09-08 01:38:22 UTC (rev 94741)
+++ trunk/LayoutTests/inspector/debugger/raw-source-code-expected.txt 2011-09-08 03:00:31 UTC (rev 94742)
@@ -1,17 +0,0 @@
-Tests RawSourceCode class.
-
-
-Running: testScriptWithoutResource
-
-Running: testHTMLWithPendingResource
-
-Running: testHTMLWithFinishedResource
-
-Running: testContentEdited
-
-Running: testForceUpdateSourceMapping
-
-Running: testFormattingWithFinishedResource
-
-Running: testFormattingWithPendingResource
-
Deleted: trunk/LayoutTests/inspector/debugger/raw-source-code.html (94741 => 94742)
--- trunk/LayoutTests/inspector/debugger/raw-source-code.html 2011-09-08 01:38:22 UTC (rev 94741)
+++ trunk/LayoutTests/inspector/debugger/raw-source-code.html 2011-09-08 03:00:31 UTC (rev 94742)
@@ -1,346 +0,0 @@
-<html>
-<head>
-<script src=""
-
-<script>
-
-function test()
-{
- function createScriptMock(url, startLine, startColumn, isContentScript, source)
- {
- var lineCount = source.lineEndings().length;
- var endLine = startLine + lineCount - 1;
- var endColumn = lineCount === 1 ? startColumn + source.length : source.length - source.lineEndings()[lineCount - 2];
- var script = new WebInspector.Script(null, url, startLine, startColumn, endLine, endColumn, undefined, undefined, isContentScript);
- script.requestSource = function(callback) { callback(source); };
- return script;
- }
-
- function createResourceMock(type, finished, content)
- {
- var resource = {};
- resource.type = type === "document" ? WebInspector.Resource.Type.Document : WebInspector.Resource.Type.Script;
- resource.finished = finished;
- resource.content = content;
- resource.requestContent = function(callback) { callback(resource.content); };
- resource.finish = function() { resource.finished = true; resource.dispatchEventToListeners("finished"); };
- resource.__proto__ = WebInspector.Object.prototype;
- return resource;
- }
- function createPendingResourceMock(type, content) { return createResourceMock(type, false, content); }
- function createFinishedResourceMock(type, content) { return createResourceMock(type, true, content); }
-
- function createScriptFormatterMock()
- {
- var sourceMapping = {
- originalToFormatted: function(location)
- {
- var formattedLocation = {};
- formattedLocation.lineNumber = location.lineNumber * 2;
- formattedLocation.columnNumber = location.columnNumber * 2;
- return formattedLocation;
- },
-
- formattedToOriginal: function(location)
- {
- var originalLocation = {};
- originalLocation.lineNumber = Math.floor(location.lineNumber / 2);
- originalLocation.columnNumber = Math.floor(location.columnNumber / 2);
- return originalLocation;
- }
- };
- var formatter = {
- formatContent: function(mimeType, content, callback) { formatter._callback = callback.bind(null, "<formatted> " + content, sourceMapping); },
- finish: function() { formatter._callback(); }
- };
- return formatter;
- };
-
- function createRawSourceCode(script, resource, formatted)
- {
- var rawSourceCode = new WebInspector.RawSourceCode("id", script, resource, createScriptFormatterMock(), !!formatted);
- rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, defaultSourceMappingUpdatedHandler);
- return rawSourceCode;
- }
-
- function waitForSourceMappingEvent(rawSourceCode, callback)
- {
- rawSourceCode.removeEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, defaultSourceMappingUpdatedHandler);
- rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, sourceMappingUpdated);
- function sourceMappingUpdated(event)
- {
- rawSourceCode.removeEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, sourceMappingUpdated);
- rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, defaultSourceMappingUpdatedHandler);
- callback(event);
- }
- }
-
- function defaultSourceMappingUpdatedHandler()
- {
- throw "Unexpected SourceMappingUpdated event.";
- }
-
- InspectorTest.runTestSuite([
- function testScriptWithoutResource(next)
- {
- var script = createScriptMock("foo.js", 0, 0, true, "<script source>");
- var rawSourceCode = createRawSourceCode(script, null);
-
- InspectorTest.assertTrue(!!rawSourceCode.uiSourceCode);
- var uiSourceCode = rawSourceCode.uiSourceCode;
- InspectorTest.assertEquals("foo.js", uiSourceCode.url);
- InspectorTest.assertEquals(true, uiSourceCode.isContentScript);
- InspectorTest.assertEquals(rawSourceCode, uiSourceCode.rawSourceCode);
- uiSourceCode.requestContent(didRequestContent);
-
- function didRequestContent(mimeType, content)
- {
- InspectorTest.assertEquals("text/_javascript_", mimeType);
- InspectorTest.assertEquals("<script source>", content);
- next();
- }
- },
-
- function testHTMLWithPendingResource(next)
- {
- var script1 = createScriptMock("index.html", 0, 10, false, "<script source 1>");
- var script2 = createScriptMock("index.html", 0, 45, false, "<script source 2>");
- var resource = createPendingResourceMock("document", "<resource content>");
- var rawSourceCode = createRawSourceCode(script1, resource);
-
- InspectorTest.assertTrue(!rawSourceCode.uiSourceCode);
- waitForSourceMappingEvent(rawSourceCode, mappingReady);
- resource.finish();
-
- function mappingReady(event)
- {
- InspectorTest.assertTrue(!event.data.oldSourceCode);
- var uiSourceCode = rawSourceCode.uiSourceCode;
- InspectorTest.assertEquals("index.html", uiSourceCode.url);
- InspectorTest.assertEquals(false, uiSourceCode.isContentScript);
- uiSourceCode.requestContent(didRequestContent);
- }
-
- function didRequestContent(mimeType, content)
- {
- InspectorTest.assertEquals(mimeType, "text/html");
- InspectorTest.assertEquals("<resource content>", content);
-
- rawSourceCode.addScript(script2);
- rawSourceCode.forceUpdateSourceMapping();
- next();
- }
- },
-
- function testHTMLWithFinishedResource(next)
- {
- var script1 = createScriptMock("index.html", 0, 10, false, "<script source 1>");
- var script2 = createScriptMock("index.html", 0, 45, false, "<script source 2>");
- var resource = createFinishedResourceMock("document", "<resource content>");
- var rawSourceCode = createRawSourceCode(script1, resource);
-
- InspectorTest.assertTrue(!!rawSourceCode.uiSourceCode);
- var uiSourceCode = rawSourceCode.uiSourceCode;
- InspectorTest.assertEquals("index.html", uiSourceCode.url);
- InspectorTest.assertEquals(false, uiSourceCode.isContentScript);
- uiSourceCode.requestContent(didRequestContent);
-
- function didRequestContent(mimeType, content)
- {
- InspectorTest.assertEquals(mimeType, "text/html");
- InspectorTest.assertEquals("<resource content>", content);
-
- rawSourceCode.addScript(script2);
- rawSourceCode.forceUpdateSourceMapping();
- next();
- }
- },
-
- function testContentEdited(next)
- {
- var script = createScriptMock("foo.js", 0, 0, true, "<script source>");
- var resource = createFinishedResourceMock("script", "<resource content>");
- var rawSourceCode = createRawSourceCode(script, resource);
-
- InspectorTest.assertTrue(!!rawSourceCode.uiSourceCode);
- rawSourceCode.uiSourceCode.requestContent(didRequestContent);
-
- function didRequestContent(mimeType, content)
- {
- InspectorTest.assertEquals("text/_javascript_", mimeType);
- InspectorTest.assertEquals("<resource content>", content);
-
- waitForSourceMappingEvent(rawSourceCode, mappingReadyAfterEdit);
- resource.content = "<edited resource content>";
- rawSourceCode.contentEdited();
- }
-
- function mappingReadyAfterEdit()
- {
- rawSourceCode.uiSourceCode.requestContent(didRequestContentAfterEdit);
- }
-
- function didRequestContentAfterEdit(mimeType, content)
- {
- InspectorTest.assertEquals(mimeType, "text/_javascript_");
- InspectorTest.assertEquals("<edited resource content>", content);
- next();
- }
- },
-
- function testForceUpdateSourceMapping(next)
- {
- var script1 = createScriptMock("index.html", 0, 10, false, "<script source 1>");
- var script2 = createScriptMock("index.html", 0, 45, false, "<script source 2>");
- var script3 = createScriptMock("index.html", 1, 10, false, "<script source 3>");
- var resource = createPendingResourceMock("document", "<resource content>");
- var rawSourceCode = createRawSourceCode(script1, resource);
-
- InspectorTest.assertTrue(!rawSourceCode.uiSourceCode);
- waitForSourceMappingEvent(rawSourceCode, requestContent);
- rawSourceCode.forceUpdateSourceMapping();
-
- function requestContent()
- {
- rawSourceCode.uiSourceCode.requestContent(didRequestContentOneScript);
- }
-
- function didRequestContentOneScript(mimeType, content)
- {
- InspectorTest.assertEquals(mimeType, "text/html");
- InspectorTest.assertEquals(" <script><script source 1></" + "script>", content);
-
- rawSourceCode.forceUpdateSourceMapping();
- rawSourceCode.addScript(script2);
- waitForSourceMappingEvent(rawSourceCode, requestContentTwoScripts);
- rawSourceCode.forceUpdateSourceMapping();
- }
-
- function requestContentTwoScripts()
- {
- rawSourceCode.uiSourceCode.requestContent(didRequestContentTwoScripts);
- }
-
- function didRequestContentTwoScripts(mimeType, content)
- {
- InspectorTest.assertEquals(mimeType, "text/html");
- InspectorTest.assertEquals(" <script><script source 1></" + "script> <script><script source 2></" + "script>", content);
-
- rawSourceCode.forceUpdateSourceMapping();
- waitForSourceMappingEvent(rawSourceCode, requestContentResource);
- resource.finish();
- }
-
- function requestContentResource()
- {
- rawSourceCode.uiSourceCode.requestContent(didRequestContentResource);
- }
-
- function didRequestContentResource(mimeType, content)
- {
- InspectorTest.assertEquals(mimeType, "text/html");
- InspectorTest.assertEquals("<resource content>", content);
-
- rawSourceCode.addScript(script3);
- rawSourceCode.forceUpdateSourceMapping();
-
- next();
- }
- },
-
- function testFormattingWithFinishedResource(next)
- {
- var script = createScriptMock("foo.js", 0, 0, true, "<script source>");
- var resource = createFinishedResourceMock("script", "<resource content>");
- var rawSourceCode = createRawSourceCode(script, resource, false);
-
- InspectorTest.assertTrue(!!rawSourceCode.uiSourceCode);
- var uiSourceCode = rawSourceCode.uiSourceCode;
- var uiLocation = rawSourceCode.rawLocationToUILocation({ lineNumber : 1, columnNumber: 2 });
- InspectorTest.assertEquals(uiSourceCode, uiLocation.uiSourceCode);
- InspectorTest.assertEquals(1, uiLocation.lineNumber);
- InspectorTest.assertEquals(2, uiLocation.columnNumber);
- uiSourceCode.requestContent(didRequestContent);
-
- function didRequestContent(mimeType, content)
- {
- InspectorTest.assertEquals("text/_javascript_", mimeType);
- InspectorTest.assertEquals("<resource content>", content);
-
- rawSourceCode.setFormatted(true);
- waitForSourceMappingEvent(rawSourceCode, requestFormattedContent);
- rawSourceCode._formatter.finish();
- }
-
- function requestFormattedContent()
- {
- var uiSourceCode = rawSourceCode.uiSourceCode;
- var uiLocation = rawSourceCode.rawLocationToUILocation({ lineNumber : 1, columnNumber: 2 });
- InspectorTest.assertEquals(uiSourceCode, uiLocation.uiSourceCode);
- InspectorTest.assertEquals(2, uiLocation.lineNumber);
- InspectorTest.assertEquals(4, uiLocation.columnNumber);
- uiSourceCode.requestContent(didRequestFormattedContent);
- }
-
- function didRequestFormattedContent(mimeType, content)
- {
- InspectorTest.assertEquals(mimeType, "text/_javascript_");
- InspectorTest.assertEquals("<formatted> <resource content>", content);
-
- waitForSourceMappingEvent(rawSourceCode, requestNotFormattedContent);
- rawSourceCode.setFormatted(false);
- }
-
- function requestNotFormattedContent()
- {
- var uiSourceCode = rawSourceCode.uiSourceCode;
- var uiLocation = rawSourceCode.rawLocationToUILocation({ lineNumber : 1, columnNumber: 2 });
- InspectorTest.assertEquals(uiSourceCode, uiLocation.uiSourceCode);
- InspectorTest.assertEquals(1, uiLocation.lineNumber);
- InspectorTest.assertEquals(2, uiLocation.columnNumber);
- uiSourceCode.requestContent(didRequestNotFormattedContent);
- }
-
- function didRequestNotFormattedContent(mimeType, content)
- {
- InspectorTest.assertEquals("text/_javascript_", mimeType);
- InspectorTest.assertEquals("<resource content>", content);
-
- next();
- }
- },
-
- function testFormattingWithPendingResource(next)
- {
- var script = createScriptMock("foo.js", 0, 0, true, "<script source>");
- var resource = createPendingResourceMock("script", "<resource content>");
- var rawSourceCode = createRawSourceCode(script, resource, true);
-
- InspectorTest.assertTrue(!rawSourceCode.uiSourceCode);
- resource.finish();
- waitForSourceMappingEvent(rawSourceCode, checkMapping);
- rawSourceCode._formatter.finish();
-
- function checkMapping()
- {
- var uiSourceCode = rawSourceCode.uiSourceCode;
- var uiLocation = rawSourceCode.rawLocationToUILocation({ lineNumber : 1, columnNumber: 2 });
- InspectorTest.assertEquals(uiSourceCode, uiLocation.uiSourceCode);
- InspectorTest.assertEquals(2, uiLocation.lineNumber);
- InspectorTest.assertEquals(4, uiLocation.columnNumber);
-
- next();
- }
- }
- ]);
-};
-
-</script>
-
-</head>
-
-<body _onload_="runTest()">
-<p>Tests RawSourceCode class.</p>
-
-</body>
-</html>
Modified: trunk/LayoutTests/inspector/debugger/script-formatter.html (94741 => 94742)
--- trunk/LayoutTests/inspector/debugger/script-formatter.html 2011-09-08 01:38:22 UTC (rev 94741)
+++ trunk/LayoutTests/inspector/debugger/script-formatter.html 2011-09-08 03:00:31 UTC (rev 94742)
@@ -185,10 +185,16 @@
function didEvaluate()
{
dumpConsoleMessageURLs();
- InspectorTest.addSniffer(WebInspector, "formatLinkText", InspectorTest.runAfterPendingDispatches.bind(InspectorTest, didFormatLinkText));
+ panel._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.UISourceCodeAdded, uiSourceCodeReplaced);
panel._toggleFormatSource();
}
+ function uiSourceCodeReplaced(event)
+ {
+ if (event.data.uiSourceCode.url.indexOf("script-formatter.html") !== -1)
+ InspectorTest.runAfterPendingDispatches(didFormatLinkText);
+ }
+
function didFormatLinkText()
{
dumpConsoleMessageURLs();
Modified: trunk/LayoutTests/inspector/debugger/source-file.html (94741 => 94742)
--- trunk/LayoutTests/inspector/debugger/source-file.html 2011-09-08 01:38:22 UTC (rev 94741)
+++ trunk/LayoutTests/inspector/debugger/source-file.html 2011-09-08 03:00:31 UTC (rev 94742)
@@ -81,7 +81,7 @@
function testFormattedConvertLocation(next)
{
var script = new WebInspector.Script("1", "foo.js", 0, 0, 20, 80, undefined, undefined, false);
- var rawSourceCode = new WebInspector.RawSourceCode("id", script, null, mockScriptFormatter, true);
+ var rawSourceCode = new WebInspector.RawSourceCode("id", script, mockScriptFormatter, true);
function didCreateSourceMapping()
{
@@ -96,7 +96,7 @@
{
var script1 = new WebInspector.Script("1", "foo.js", 10, 20, 30, 40, undefined, undefined, false);
var script2 = new WebInspector.Script("2", "foo.js", 50, 60, 70, 80, undefined, undefined, false);
- var rawSourceCode = new WebInspector.RawSourceCode("id", script1, null, mockScriptFormatter, true);
+ var rawSourceCode = new WebInspector.RawSourceCode("id", script1, mockScriptFormatter, true);
rawSourceCode.addScript(script2);
function didCreateSourceMapping()
Modified: trunk/Source/WebCore/ChangeLog (94741 => 94742)
--- trunk/Source/WebCore/ChangeLog 2011-09-08 01:38:22 UTC (rev 94741)
+++ trunk/Source/WebCore/ChangeLog 2011-09-08 03:00:31 UTC (rev 94742)
@@ -1,3 +1,34 @@
+2011-09-07 Sheriff Bot <[email protected]>
+
+ Unreviewed, rolling out r94674 and r94689.
+ http://trac.webkit.org/changeset/94674
+ http://trac.webkit.org/changeset/94689
+ https://bugs.webkit.org/show_bug.cgi?id=67754
+
+ Broke inspector/debugger/script-formatter.html (Requested by
+ rniwa on #webkit).
+
+ * inspector/front-end/DebuggerPresentationModel.js:
+ (WebInspector.DebuggerPresentationModel):
+ (WebInspector.DebuggerPresentationModel.prototype.addSourceMappingListener):
+ (WebInspector.DebuggerPresentationModel.prototype.removeSourceMappingListener):
+ (WebInspector.DebuggerPresentationModel.prototype.linkifyLocation):
+ (WebInspector.DebuggerPresentationModel.prototype._addScript):
+ (WebInspector.DebuggerPresentationModel.prototype._sourceMappingUpdated):
+ (WebInspector.DebuggerPresentationModel.prototype._restoreBreakpoints):
+ (WebInspector.DebuggerPresentationModel.prototype.setFormatSource):
+ (WebInspector.DebuggerPresentationModel.prototype._createRawSourceCodeId):
+ (WebInspector.DebuggerPresentationModel.prototype._debuggerReset):
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel.prototype._toggleFormatSource):
+ * inspector/front-end/SourceFile.js:
+ (WebInspector.RawSourceCode):
+ (WebInspector.RawSourceCode.prototype.get uiSourceCode):
+ (WebInspector.RawSourceCode.prototype.get rawSourceCode):
+ (WebInspector.RawSourceCode.prototype.rawLocationToUILocation):
+ (WebInspector.RawSourceCode.prototype.requestContent):
+ (WebInspector.RawSourceCode.prototype._saveSourceMapping):
+
2011-09-07 Julien Chaffraix <[email protected]>
offsetFromRoot optimization is disabled after r93837
Modified: trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js (94741 => 94742)
--- trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2011-09-08 01:38:22 UTC (rev 94741)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2011-09-08 03:00:31 UTC (rev 94742)
@@ -37,6 +37,8 @@
this._formatter = new WebInspector.ScriptFormatter();
this._rawSourceCode = {};
this._messages = [];
+ // FIXME: move this to RawSourceCode when it's not re-created in pretty-print mode.
+ this._sourceMappingListeners = [];
this._presentationCallFrames = [];
this._selectedCallFrameIndex = 0;
@@ -96,6 +98,16 @@
rawSourceCode.createSourceMappingIfNeeded(didCreateSourceMapping);
},
+ addSourceMappingListener: function(sourceURL, scriptId, listener)
+ {
+ this._sourceMappingListeners.push(listener);
+ },
+
+ removeSourceMappingListener: function(sourceURL, scriptId, listener)
+ {
+ // FIXME: implement this.
+ },
+
linkifyLocation: function(sourceURL, lineNumber, columnNumber, classes)
{
var linkText = WebInspector.formatLinkText(sourceURL, lineNumber);
@@ -120,7 +132,7 @@
this._scriptLocationToUILocation(sourceURL, null, lineNumber, columnNumber, didGetLocation.bind(this));
}
updateAnchor.call(this);
- rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, updateAnchor, this);
+ this.addSourceMappingListener(sourceURL, null, updateAnchor.bind(this));
return anchor;
},
@@ -143,25 +155,18 @@
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);
+ rawSourceCode = new WebInspector.RawSourceCode(rawSourceCodeId, script, this._formatter, this._formatSource);
this._rawSourceCode[rawSourceCodeId] = rawSourceCode;
- if (rawSourceCode.uiSourceCode)
- this._updateSourceMapping(rawSourceCode, null);
rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, this._sourceMappingUpdated, this);
},
_sourceMappingUpdated: function(event)
{
+ for (var i = 0; i < this._sourceMappingListeners.length; ++i)
+ this._sourceMappingListeners[i]();
+
var rawSourceCode = event.target;
var oldUISourceCode = event.data.oldUISourceCode;
- this._updateSourceMapping(rawSourceCode, oldUISourceCode);
- },
-
- _updateSourceMapping: function(rawSourceCode, oldUISourceCode)
- {
var uiSourceCode = rawSourceCode.uiSourceCode;
if (!oldUISourceCode)
@@ -176,7 +181,11 @@
var eventData = { uiSourceCode: uiSourceCode, oldUISourceCode: oldUISourceCode };
this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeReplaced, eventData);
}
+ this._restoreBreakpoints(uiSourceCode);
+ },
+ _restoreBreakpoints: function(uiSourceCode)
+ {
this._breakpointManager.uiSourceCodeAdded(uiSourceCode);
var breakpoints = this._breakpointManager.breakpointsForUISourceCode(uiSourceCode);
for (var lineNumber in breakpoints)
@@ -253,17 +262,23 @@
this._formatSource = formatSource;
this._breakpointManager.reset();
+ for (var id in this._rawSourceCode)
+ this._rawSourceCode[id].removeEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, this._sourceMappingUpdated, this);
+ this._rawSourceCode = {};
+ var messages = this._messages;
+ this._messages = [];
- for (var id in this._rawSourceCode) {
- this._rawSourceCode[id].messages = [];
- this._rawSourceCode[id].setFormatted(this._formatSource);
- }
+ var scripts = WebInspector.debuggerModel.scripts;
+ for (var id in scripts)
+ this._addScript(scripts[id]);
- var messages = this._messages;
- this._messages = [];
for (var i = 0; i < messages.length; ++i)
this._addConsoleMessage(messages[i]);
+ // FIXME: move this to RawSourceCode.
+ for (var i = 0; i < this._sourceMappingListeners.length; ++i)
+ this._sourceMappingListeners[i]();
+
if (WebInspector.debuggerModel.callFrames)
this._debuggerPaused();
},
@@ -431,13 +446,15 @@
_createRawSourceCodeId: function(sourceURL, scriptId)
{
- return sourceURL || scriptId;
+ var prefix = this._formatSource ? "deobfuscated:" : "";
+ return prefix + (sourceURL || scriptId);
},
_debuggerReset: function()
{
this._rawSourceCode = {};
this._messages = [];
+ this._sourceMappingListeners = [];
this._presentationCallFrames = [];
this._selectedCallFrameIndex = 0;
this._breakpointManager.debuggerReset();
Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (94741 => 94742)
--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2011-09-08 01:38:22 UTC (rev 94741)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2011-09-08 03:00:31 UTC (rev 94742)
@@ -1132,6 +1132,7 @@
_toggleFormatSource: function()
{
+ WebInspector.panels.scripts.reset();
this._toggleFormatSourceButton.toggled = !this._toggleFormatSourceButton.toggled;
this._presentationModel.setFormatSource(this._toggleFormatSourceButton.toggled);
},
Modified: trunk/Source/WebCore/inspector/front-end/SourceFile.js (94741 => 94742)
--- trunk/Source/WebCore/inspector/front-end/SourceFile.js 2011-09-08 01:38:22 UTC (rev 94741)
+++ trunk/Source/WebCore/inspector/front-end/SourceFile.js 2011-09-08 03:00:31 UTC (rev 94742)
@@ -35,15 +35,18 @@
* @constructor
* @extends {WebInspector.Object}
*/
-WebInspector.RawSourceCode = function(id, script, resource, formatter, formatted)
+WebInspector.RawSourceCode = function(id, script, formatter, formatted)
{
+ this._scripts = [script];
+ this._formatter = formatter;
+ this._formatted = formatted;
+
+ if (script.sourceURL)
+ this._resource = WebInspector.networkManager.inflightResourceForURL(script.sourceURL) || WebInspector.resourceForURL(script.sourceURL);
+
this.id = id;
this.url = ""
this.isContentScript = script.isContentScript;
- this._scripts = [script];
- this._formatter = formatter;
- this._formatted = formatted;
- this._resource = resource;
this.messages = [];
this._useTemporaryContent = this._resource && !this._resource.finished;
@@ -67,15 +70,14 @@
get uiSourceCode()
{
- return this._uiSourceCode;
+ // FIXME: extract UISourceCode from RawSourceCode (currently RawSourceCode implements methods from both interfaces).
+ return this;
},
- setFormatted: function(formatted)
+ get rawSourceCode()
{
- if (this._formatted === formatted)
- return;
- this._formatted = formatted;
- this._updateSourceMapping();
+ // FIXME: extract UISourceCode from RawSourceCode (currently RawSourceCode implements methods from both interfaces).
+ return this;
},
contentEdited: function()
@@ -92,7 +94,7 @@
rawLocationToUILocation: function(rawLocation)
{
var location = this._mapping ? this._mapping.originalToFormatted(rawLocation) : rawLocation;
- return new WebInspector.UILocation(this.uiSourceCode, location.lineNumber, location.columnNumber);
+ return new WebInspector.UILocation(this, location.lineNumber, location.columnNumber);
},
uiLocationToRawLocation: function(lineNumber, columnNumber)
@@ -118,6 +120,12 @@
return closestScript;
},
+ requestContent: function(callback)
+ {
+ // FIXME: remove this.
+ this._uiSourceCode.requestContent(callback);
+ },
+
createSourceMappingIfNeeded: function(callback)
{
// FIXME: remove createSourceMappingIfNeeded, client should listen to SourceMappingUpdated event instead.
@@ -176,7 +184,7 @@
_createSourceMapping: function(originalContentProvider, callback)
{
if (!this._formatted) {
- callback(originalContentProvider, null);
+ setTimeout(callback.bind(null, originalContentProvider, null), 0);
return;
}
@@ -194,7 +202,9 @@
_saveSourceMapping: function(contentProvider, mapping)
{
- var oldUISourceCode = this._uiSourceCode;
+ var oldUISourceCode;
+ if (this._uiSourceCode)
+ oldUISourceCode = this;
var uiSourceCodeId = (this._formatted ? "deobfuscated:" : "") + (this._scripts[0].sourceURL || this._scripts[0].scriptId);
this._uiSourceCode = new WebInspector.UISourceCode(uiSourceCodeId, this.url, this.isContentScript, this, contentProvider);
this._mapping = mapping;