Diff
Modified: trunk/LayoutTests/ChangeLog (94561 => 94562)
--- trunk/LayoutTests/ChangeLog 2011-09-06 11:15:29 UTC (rev 94561)
+++ trunk/LayoutTests/ChangeLog 2011-09-06 11:58:10 UTC (rev 94562)
@@ -1,3 +1,17 @@
+2011-09-06 Sheriff Bot <[email protected]>
+
+ Unreviewed, rolling out r94560.
+ http://trac.webkit.org/changeset/94560
+ https://bugs.webkit.org/show_bug.cgi?id=67636
+
+ It made inspector/debugger/script-formatter.html flakey
+ (Requested by Ossy on #webkit).
+
+ * inspector/debugger/content-providers-expected.txt:
+ * inspector/debugger/content-providers.html:
+ * inspector/debugger/scripts-panel.html:
+ * inspector/debugger/source-frame-count.html:
+
2011-09-05 Pavel Podivilov <[email protected]>
Web Inspector: re-implement RawSourceCode.
Modified: trunk/LayoutTests/inspector/debugger/content-providers-expected.txt (94561 => 94562)
--- trunk/LayoutTests/inspector/debugger/content-providers-expected.txt 2011-09-06 11:15:29 UTC (rev 94561)
+++ trunk/LayoutTests/inspector/debugger/content-providers-expected.txt 2011-09-06 11:58:10 UTC (rev 94562)
@@ -21,3 +21,5 @@
Running: testResourceContentProvider
Request resource content.
+Running: testFormattedContentProvider
+
Modified: trunk/LayoutTests/inspector/debugger/content-providers.html (94561 => 94562)
--- trunk/LayoutTests/inspector/debugger/content-providers.html 2011-09-06 11:15:29 UTC (rev 94561)
+++ trunk/LayoutTests/inspector/debugger/content-providers.html 2011-09-06 11:58:10 UTC (rev 94562)
@@ -69,6 +69,28 @@
next();
}
contentProvider.requestContent(didRequestContent);
+ },
+
+ function testFormattedContentProvider(next)
+ {
+ var mapping = {};
+ var formatter = {
+ formatContent: function(mimeType, content, callback)
+ {
+ setTimeout(callback.bind(null, "<formatted> " + content, mapping), 0);
+ }
+ };
+ var resource = { type: WebInspector.Resource.Type.Document, requestContent: function(callback) { callback("<resource content>"); } };
+ var contentProvider = new WebInspector.ResourceContentProvider(resource);
+ var formattedContentProvider = new WebInspector.FormattedContentProvider(contentProvider, formatter);
+ function didRequestContent(mimeType, content)
+ {
+ InspectorTest.assertEquals("text/html", mimeType);
+ InspectorTest.assertEquals("<formatted> <resource content>", content);
+ InspectorTest.assertEquals(mapping, formattedContentProvider.mapping);
+ next();
+ }
+ formattedContentProvider.requestContent(didRequestContent);
}
]);
};
Modified: trunk/LayoutTests/inspector/debugger/scripts-panel.html (94561 => 94562)
--- trunk/LayoutTests/inspector/debugger/scripts-panel.html 2011-09-06 11:15:29 UTC (rev 94561)
+++ trunk/LayoutTests/inspector/debugger/scripts-panel.html 2011-09-06 11:58:10 UTC (rev 94562)
@@ -10,7 +10,6 @@
{
var model = new WebInspector.Object();
model.breakpointsForUISourceCode = function() { return []; };
- model.messagesForUISourceCode = function() { return []; };
return model;
}
function addUISouceCode(model, url)
@@ -162,7 +161,7 @@
addUISouceCode(model, "foo.js");
var uiSourceCode = addUISouceCode(model, "bar.js");
- panel._uiSourceCodeReplaced({ data: { oldUISourceCode: uiSourceCode, uiSourceCode: uiSourceCode }});
+ panel._uiSourceCodeReplaced({ data: { oldSourceCode: uiSourceCode, sourceCode: uiSourceCode }});
showSourceFrame(panel, "bar.js");
next();
}
Modified: trunk/LayoutTests/inspector/debugger/source-frame-count.html (94561 => 94562)
--- trunk/LayoutTests/inspector/debugger/source-frame-count.html 2011-09-06 11:15:29 UTC (rev 94561)
+++ trunk/LayoutTests/inspector/debugger/source-frame-count.html 2011-09-06 11:58:10 UTC (rev 94562)
@@ -31,13 +31,8 @@
function didReload()
{
- InspectorTest.showScriptSource("source-frame-count.html", didShowScriptSourceAgain);
- }
-
- function didShowScriptSourceAgain()
- {
InspectorTest.assertTrue(select[select.selectedIndex].text.indexOf("source-frame-count.html") !== -1);
- // There should be maximum 2 source frames: first one is the first shown, second one is the last viewed ("source-frame-count.html").
+ // There should be maximum 2 source frames: first one is the first shown, second one is the last viewed ("scripts-panel.html").
InspectorTest.assertEquals(true, sourceFrameCount <= 2, "too many source frames created after page reload");
next();
}
Modified: trunk/Source/WebCore/ChangeLog (94561 => 94562)
--- trunk/Source/WebCore/ChangeLog 2011-09-06 11:15:29 UTC (rev 94561)
+++ trunk/Source/WebCore/ChangeLog 2011-09-06 11:58:10 UTC (rev 94562)
@@ -1,3 +1,45 @@
+2011-09-06 Sheriff Bot <[email protected]>
+
+ Unreviewed, rolling out r94560.
+ http://trac.webkit.org/changeset/94560
+ https://bugs.webkit.org/show_bug.cgi?id=67636
+
+ It made inspector/debugger/script-formatter.html flakey
+ (Requested by Ossy on #webkit).
+
+ * inspector/front-end/BreakpointManager.js:
+ (WebInspector.BreakpointManager.prototype.set reset):
+ * inspector/front-end/DebuggerPresentationModel.js:
+ (WebInspector.DebuggerPresentationModel.prototype._addScript.didCreateSourceMapping):
+ (WebInspector.DebuggerPresentationModel.prototype._addScript):
+ (WebInspector.DebuggerPresentationModel.prototype._uiSourceCodeReplaced):
+ (WebInspector.DebuggerPresentationModel.prototype.setFormatSource):
+ (WebInspector.DebuggerPresentationModel.prototype._addConsoleMessage.didGetUILocation):
+ (WebInspector.DebuggerPresentationModel.prototype._addConsoleMessage):
+ (WebInspector.PresenationCallFrame.prototype.select):
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel.prototype._uiSourceCodeReplaced):
+ (WebInspector.ScriptsPanel.prototype._sourceFrameLoaded):
+ * inspector/front-end/SourceFile.js:
+ (WebInspector.RawSourceCode):
+ (WebInspector.RawSourceCode.prototype.addScript):
+ (WebInspector.RawSourceCode.prototype.contentEdited):
+ (WebInspector.RawSourceCode.prototype.requestContent):
+ (WebInspector.RawSourceCode.prototype.createSourceMappingIfNeeded.didRequestContent):
+ (WebInspector.RawSourceCode.prototype.createSourceMappingIfNeeded):
+ (WebInspector.RawSourceCode.prototype._setContentProvider):
+ (WebInspector.RawSourceCode.prototype.forceLoadContent):
+ (WebInspector.RawSourceCode.prototype._reload):
+ (WebInspector.RawSourceCode.prototype._requestContent):
+ (WebInspector.RawSourceCode.prototype._loadResourceContent):
+ (WebInspector.RawSourceCode.prototype._loadScriptContent):
+ (WebInspector.RawSourceCode.prototype._loadAndConcatenateScriptsContent):
+ (WebInspector.RawSourceCode.prototype._didRequestContent):
+ (WebInspector.RawSourceCode.prototype._hasPendingResource):
+ (WebInspector.FormattedContentProvider):
+ (WebInspector.FormattedContentProvider.prototype.requestContent.didRequestContent.didFormatContent):
+ (WebInspector.FormattedContentProvider.prototype.requestContent):
+
2011-09-06 Antti Koivisto <[email protected]>
https://bugs.webkit.org/show_bug.cgi?id=67480
Modified: trunk/Source/WebCore/inspector/front-end/BreakpointManager.js (94561 => 94562)
--- trunk/Source/WebCore/inspector/front-end/BreakpointManager.js 2011-09-06 11:15:29 UTC (rev 94561)
+++ trunk/Source/WebCore/inspector/front-end/BreakpointManager.js 2011-09-06 11:58:10 UTC (rev 94562)
@@ -214,6 +214,7 @@
{
function resetBreakpoint(breakpoint)
{
+ delete breakpoint.uiSourceCode;
this._removeBreakpointFromDebugger(breakpoint);
}
this._forEachBreakpoint(resetBreakpoint.bind(this));
Modified: trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js (94561 => 94562)
--- trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2011-09-06 11:15:29 UTC (rev 94561)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2011-09-06 11:58:10 UTC (rev 94562)
@@ -157,39 +157,27 @@
rawSourceCode = new WebInspector.RawSourceCode(rawSourceCodeId, script, this._formatter, this._formatSource);
this._rawSourceCode[rawSourceCodeId] = rawSourceCode;
- rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, this._sourceMappingUpdated, this);
- },
+ rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.UISourceCodeReplaced, this._uiSourceCodeReplaced, this);
- _sourceMappingUpdated: function(event)
- {
- for (var i = 0; i < this._sourceMappingListeners.length; ++i)
- this._sourceMappingListeners[i]();
+ function didCreateSourceMapping()
+ {
+ this._breakpointManager.uiSourceCodeAdded(rawSourceCode.uiSourceCode);
+ var breakpoints = this._breakpointManager.breakpointsForUISourceCode(rawSourceCode.uiSourceCode);
+ for (var lineNumber in breakpoints)
+ this._breakpointAdded(breakpoints[lineNumber]);
+ }
+ // FIXME: force source formatting if needed. This will go away once formatting
+ // is fully encapsulated in RawSourceCode class.
+ rawSourceCode.createSourceMappingIfNeeded(didCreateSourceMapping.bind(this));
- var rawSourceCode = event.target;
- var oldUISourceCode = event.data.oldUISourceCode;
var uiSourceCode = rawSourceCode.uiSourceCode;
-
- if (!oldUISourceCode)
- this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeAdded, uiSourceCode);
- else {
- var breakpoints = this._breakpointManager.breakpointsForUISourceCode(oldUISourceCode);
- for (var lineNumber in breakpoints) {
- var breakpoint = breakpoints[lineNumber];
- this._breakpointRemoved(breakpoint);
- delete breakpoint.uiSourceCode;
- }
- var eventData = { uiSourceCode: uiSourceCode, oldUISourceCode: oldUISourceCode };
- this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeReplaced, eventData);
- }
- this._restoreBreakpoints(uiSourceCode);
+ this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeAdded, uiSourceCode);
},
- _restoreBreakpoints: function(uiSourceCode)
+ _uiSourceCodeReplaced: function(event)
{
- this._breakpointManager.uiSourceCodeAdded(uiSourceCode);
- var breakpoints = this._breakpointManager.breakpointsForUISourceCode(uiSourceCode);
- for (var lineNumber in breakpoints)
- this._breakpointAdded(breakpoints[lineNumber]);
+ // FIXME: restore breakpoints in new source code (currently we just recreate everything when switching to pretty-print mode).
+ this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeReplaced, event.data);
},
canEditScriptSource: function(uiSourceCode)
@@ -262,8 +250,6 @@
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 = [];
@@ -304,7 +290,7 @@
presentationMessage.uiSourceCode = uiSourceCode;
presentationMessage.lineNumber = lineNumber;
presentationMessage.originalMessage = message;
- rawSourceCode.messages.push(presentationMessage);
+ uiSourceCode.messages.push(presentationMessage);
this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.ConsoleMessageAdded, presentationMessage);
}
// FIXME(62725): stack trace line/column numbers are one-based.
@@ -339,12 +325,6 @@
return breakpointsList;
},
- messagesForUISourceCode: function(uiSourceCode)
- {
- var rawSourceCode = uiSourceCode.rawSourceCode;
- return rawSourceCode.messages;
- },
-
setBreakpoint: function(uiSourceCode, lineNumber, condition, enabled)
{
this._breakpointManager.setBreakpoint(uiSourceCode, lineNumber, condition, enabled);
@@ -515,7 +495,7 @@
select: function()
{
if (this._uiSourceCode)
- this._uiSourceCode.rawSourceCode.forceUpdateSourceMapping();
+ this._uiSourceCode.forceLoadContent(this._script);
},
evaluate: function(code, objectGroup, includeCommandLineAPI, returnByValue, callback)
Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (94561 => 94562)
--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2011-09-06 11:15:29 UTC (rev 94561)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2011-09-06 11:58:10 UTC (rev 94562)
@@ -671,13 +671,11 @@
_uiSourceCodeReplaced: function(event)
{
- var oldUISourceCode = event.data.oldUISourceCode;
- var uiSourceCode = event.data.uiSourceCode;
+ var oldUISourceCode = event.data.oldSourceCode;
+ var uiSourceCode = event.data.sourceCode;
// Re-bind file select option from old source file to new one.
var option = oldUISourceCode._option;
- if (!option)
- return;
delete oldUISourceCode._option;
option._uiSourceCode = uiSourceCode;
uiSourceCode._option = option;
@@ -693,7 +691,7 @@
var sourceFrame = event.target;
var uiSourceCode = sourceFrame._uiSourceCode;
- var messages = this._presentationModel.messagesForUISourceCode(uiSourceCode);
+ var messages = uiSourceCode.messages;
for (var i = 0; i < messages.length; ++i) {
var message = messages[i];
sourceFrame.addMessageToSource(message.lineNumber, message.originalMessage);
Modified: trunk/Source/WebCore/inspector/front-end/SourceFile.js (94561 => 94562)
--- trunk/Source/WebCore/inspector/front-end/SourceFile.js 2011-09-06 11:15:29 UTC (rev 94561)
+++ trunk/Source/WebCore/inspector/front-end/SourceFile.js 2011-09-06 11:58:10 UTC (rev 94562)
@@ -43,29 +43,25 @@
if (script.sourceURL)
this._resource = WebInspector.networkManager.inflightResourceForURL(script.sourceURL) || WebInspector.resourceForURL(script.sourceURL);
+ this._requestContentCallbacks = [];
this.id = id;
this.url = ""
this.isContentScript = script.isContentScript;
this.messages = [];
- this._useTemporaryContent = this._resource && !this._resource.finished;
- this._hasNewScripts = true;
- if (!this._useTemporaryContent)
- this._updateSourceMapping();
- else if (this._resource)
- this._resource.addEventListener("finished", this._resourceFinished.bind(this));
+ if (this._hasPendingResource())
+ this._resource.addEventListener("finished", this._reload.bind(this));
}
WebInspector.RawSourceCode.Events = {
- SourceMappingUpdated: "source-mapping-updated"
+ UISourceCodeReplaced: "ui-source-code-replaced"
}
WebInspector.RawSourceCode.prototype = {
addScript: function(script)
{
this._scripts.push(script);
- this._hasNewScripts = true;
},
get uiSourceCode()
@@ -82,15 +78,9 @@
contentEdited: function()
{
- this._updateSourceMapping();
+ this._reload();
},
- _resourceFinished: function()
- {
- this._useTemporaryContent = false;
- this._updateSourceMapping();
- },
-
rawLocationToUILocation: function(rawLocation)
{
var location = this._mapping ? this._mapping.originalToFormatted(rawLocation) : rawLocation;
@@ -122,93 +112,126 @@
requestContent: function(callback)
{
- // FIXME: remove this.
- this._uiSourceCode.requestContent(callback);
+ if (this._contentLoaded) {
+ callback(this._mimeType, this._content);
+ return;
+ }
+
+ this._requestContentCallbacks.push(callback);
+ this._requestContent();
},
createSourceMappingIfNeeded: function(callback)
{
- // FIXME: remove createSourceMappingIfNeeded, client should listen to SourceMappingUpdated event instead.
- if (this._uiSourceCode && !this._updatingSourceMapping) {
+ if (!this._formatted) {
callback();
return;
}
- function sourceMappingUpdated()
+ function didRequestContent()
{
- this.removeEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, sourceMappingUpdated, this);
callback();
}
- this.addEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, sourceMappingUpdated, this);
+ // Force content formatting to obtain the mapping.
+ this.requestContent(didRequestContent.bind(this));
},
- forceUpdateSourceMapping: function(script)
+ _setContentProvider: function(contentProvider)
{
- if (!this._useTemporaryContent || !this._hasNewScripts)
- return;
- this._hasNewScripts = false;
- this._updateSourceMapping();
+ if (this._formatted)
+ this._contentProvider = new WebInspector.FormattedContentProvider(contentProvider, this._formatter);
+ else
+ this._contentProvider = contentProvider;
},
- _updateSourceMapping: function()
+ forceLoadContent: function(script)
{
- if (this._updatingSourceMapping) {
- this._updateNeeded = true;
+ if (!this._hasPendingResource())
return;
- }
- this._updatingSourceMapping = true;
- this._updateNeeded = false;
- var originalContentProvider = this._createContentProvider();
- this._createSourceMapping(originalContentProvider, didCreateSourceMapping.bind(this));
+ if (!this._concatenatedScripts)
+ this._concatenatedScripts = {};
+ if (this._concatenatedScripts[script.scriptId])
+ return;
+ for (var i = 0; i < this._scripts.length; ++i)
+ this._concatenatedScripts[this._scripts[i].scriptId] = true;
- function didCreateSourceMapping(contentProvider, mapping)
- {
- this._updatingSourceMapping = false;
- if (!this._updateNeeded)
- this._saveSourceMapping(contentProvider, mapping);
- else
- this._updateSourceMapping();
+ this._reload();
+
+ if (!this._contentRequested) {
+ this._contentRequested = true;
+ this._loadAndConcatenateScriptsContent();
}
},
- _createContentProvider: function()
+ _reload: function()
{
+ if (this._contentLoaded) {
+ this._contentLoaded = false;
+ // FIXME: create another UISourceCode instance here, UISourceCode should be immutable.
+ this.dispatchEventToListeners(WebInspector.RawSourceCode.Events.UISourceCodeReplaced, { oldSourceCode: this, sourceCode: this });
+ } else if (this._contentRequested)
+ this._reloadContent = true;
+ else if (this._requestContentCallbacks.length)
+ this._requestContent();
+ },
+
+ _requestContent: function()
+ {
+ if (this._contentRequested)
+ return;
+
+ this._contentRequested = true;
if (this._resource && this._resource.finished)
- return new WebInspector.ResourceContentProvider(this._resource);
+ this._loadResourceContent(this._resource);
+ else if (!this._resource)
+ this._loadScriptContent();
+ else if (this._concatenatedScripts)
+ this._loadAndConcatenateScriptsContent();
+ else
+ this._contentRequested = false;
+ },
+
+ _loadResourceContent: function(resource)
+ {
+ this._setContentProvider(new WebInspector.ResourceContentProvider(resource));
+ this._contentProvider.requestContent(this._didRequestContent.bind(this));
+ },
+
+ _loadScriptContent: function()
+ {
+ this._setContentProvider(new WebInspector.ScriptContentProvider(this._scripts[0]));
+ this._contentProvider.requestContent(this._didRequestContent.bind(this));
+ },
+
+ _loadAndConcatenateScriptsContent: function()
+ {
if (this._scripts.length === 1 && !this._scripts[0].lineOffset && !this._scripts[0].columnOffset)
- return new WebInspector.ScriptContentProvider(this._scripts[0]);
- return new WebInspector.ConcatenatedScriptsContentProvider(this._scripts);
+ this._setContentProvider(new WebInspector.ScriptContentProvider(this._scripts[0]));
+ else
+ this._setContentProvider(new WebInspector.ConcatenatedScriptsContentProvider(this._scripts));
+ this._contentProvider.requestContent(this._didRequestContent.bind(this));
},
- _createSourceMapping: function(originalContentProvider, callback)
+ _didRequestContent: function(mimeType, content)
{
- if (!this._formatted) {
- setTimeout(callback.bind(null, originalContentProvider, null), 0);
- return;
- }
+ this._contentLoaded = true;
+ this._contentRequested = false;
+ this._mimeType = mimeType;
+ this._content = content;
+ this._mapping = this._contentProvider.mapping;
- function didRequestContent(mimeType, content)
- {
- function didFormatContent(formattedContent, mapping)
- {
- var contentProvider = new WebInspector.StaticContentProvider(mimeType, formattedContent)
- callback(contentProvider, mapping);
- }
- this._formatter.formatContent(mimeType, content, didFormatContent.bind(this));
- }
- originalContentProvider.requestContent(didRequestContent.bind(this));
+ for (var i = 0; i < this._requestContentCallbacks.length; ++i)
+ this._requestContentCallbacks[i](mimeType, content);
+ this._requestContentCallbacks = [];
+
+ if (this._reloadContent)
+ this._reload();
},
- _saveSourceMapping: function(contentProvider, mapping)
+ _hasPendingResource: function()
{
- 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;
- this.dispatchEventToListeners(WebInspector.RawSourceCode.Events.SourceMappingUpdated, { oldUISourceCode: oldUISourceCode });
+ return this._resource && !this._resource.finished;
}
}
@@ -341,17 +364,26 @@
WebInspector.ResourceContentProvider.prototype.__proto__ = WebInspector.ContentProvider.prototype;
-WebInspector.StaticContentProvider = function(mimeType, content)
+WebInspector.FormattedContentProvider = function(contentProvider, formatter)
{
- this._mimeType = mimeType;
- this._content = content;
+ this._contentProvider = contentProvider;
+ this._formatter = formatter;
};
-WebInspector.StaticContentProvider.prototype = {
+WebInspector.FormattedContentProvider.prototype = {
requestContent: function(callback)
{
- callback(this._mimeType, this._content);
+ function didRequestContent(mimeType, content)
+ {
+ function didFormatContent(formattedContent, mapping)
+ {
+ this.mapping = mapping;
+ callback(mimeType, formattedContent);
+ }
+ this._formatter.formatContent(mimeType, content, didFormatContent.bind(this));
+ }
+ this._contentProvider.requestContent(didRequestContent.bind(this));
}
}
-WebInspector.StaticContentProvider.prototype.__proto__ = WebInspector.ContentProvider.prototype;
+WebInspector.FormattedContentProvider.prototype.__proto__ = WebInspector.ContentProvider.prototype;