Title: [183863] trunk/Source/WebInspectorUI
- Revision
- 183863
- Author
- commit-qu...@webkit.org
- Date
- 2015-05-06 00:06:54 -0700 (Wed, 06 May 2015)
Log Message
Web Inspector: SourceCodeTextEditor shows "undefined" instead of resource content when pausing during resource load
https://bugs.webkit.org/show_bug.cgi?id=144662
Patch by Joseph Pecoraro <pecor...@apple.com> on 2015-05-06
Reviewed by Timothy Hatcher.
* UserInterface/Protocol/InspectorBackend.js:
(InspectorBackend.Command.prototype.promise):
Start standardizing on rejecting Promises with Error objects.
* UserInterface/Views/ResourceContentView.js:
(WebInspector.ResourceContentView):
(WebInspector.ResourceContentView.prototype._protocolError):
When there is a protocol error, show a nice UI string for the error.
(WebInspector.ResourceContentView.prototype._contentAvailable):
(WebInspector.ResourceContentView.prototype._contentError):
(WebInspector.ResourceContentView.prototype._hasContent):
Whenever we hit an error case in ResourceContentView, check to make sure
that a subclass hasn't already populated the content view with content.
This can happen when a TextResourceContentView populates a Resource with
Script content while paused, because the Resource content would be
unavailable. We check that content has loaded by checking that the
indeterminate spinner is no longer showing.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (183862 => 183863)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-05-06 07:02:36 UTC (rev 183862)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-05-06 07:06:54 UTC (rev 183863)
@@ -1,3 +1,29 @@
+2015-05-06 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: SourceCodeTextEditor shows "undefined" instead of resource content when pausing during resource load
+ https://bugs.webkit.org/show_bug.cgi?id=144662
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Protocol/InspectorBackend.js:
+ (InspectorBackend.Command.prototype.promise):
+ Start standardizing on rejecting Promises with Error objects.
+
+ * UserInterface/Views/ResourceContentView.js:
+ (WebInspector.ResourceContentView):
+ (WebInspector.ResourceContentView.prototype._protocolError):
+ When there is a protocol error, show a nice UI string for the error.
+
+ (WebInspector.ResourceContentView.prototype._contentAvailable):
+ (WebInspector.ResourceContentView.prototype._contentError):
+ (WebInspector.ResourceContentView.prototype._hasContent):
+ Whenever we hit an error case in ResourceContentView, check to make sure
+ that a subclass hasn't already populated the content view with content.
+ This can happen when a TextResourceContentView populates a Resource with
+ Script content while paused, because the Resource content would be
+ unavailable. We check that content has loaded by checking that the
+ indeterminate spinner is no longer showing.
+
2015-05-05 Andres Gomez <ago...@igalia.com>
[GTK] Web Inspector: Further optimize SVG images
Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js (183862 => 183863)
--- trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js 2015-05-06 07:02:36 UTC (rev 183862)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js 2015-05-06 07:06:54 UTC (rev 183863)
@@ -433,7 +433,7 @@
var promiseArguments = Array.from(arguments);
return new Promise(function(resolve, reject) {
function convertToPromiseCallback(error, payload) {
- return error ? reject(error) : resolve(payload);
+ return error ? reject(new Error(error)) : resolve(payload);
}
// FIXME: this should be indicated by invoking the command differently, rather
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js (183862 => 183863)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js 2015-05-06 07:02:36 UTC (rev 183862)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js 2015-05-06 07:06:54 UTC (rev 183863)
@@ -42,7 +42,7 @@
this.element.addEventListener("click", this._mouseWasClicked.bind(this), false);
// Request content last so the spinner will always be removed in case the content is immediately available.
- resource.requestContent().then(this._contentAvailable.bind(this)).catch(this._contentError.bind(this));
+ resource.requestContent().then(this._contentAvailable.bind(this)).catch(this._protocolError.bind(this));
if (!this.managesOwnIssues) {
WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.IssueWasAdded, this._issueWasAdded, this);
@@ -87,24 +87,34 @@
_contentAvailable: function(parameters)
{
if (parameters.error) {
- this._contentError({ message: parameters.error });
+ this._contentError(parameters.error);
return;
}
// Content is ready to show, call the public method now.
+ console.assert(!this._hasContent());
this.contentAvailable(parameters.content, parameters.base64Encoded);
},
_contentError: function(error)
{
- // Don't show an error message if there is already an error message showing (like one added by addIssue.)
- if (this.element.querySelector(".message-text-view.error"))
+ if (this._hasContent())
return;
this.element.removeChildren();
- this.element.appendChild(WebInspector.createMessageTextView(error.message, true));
+ this.element.appendChild(WebInspector.createMessageTextView(error, true));
},
+ _protocolError: function(error)
+ {
+ this._contentError(WebInspector.UIString("An error occurred trying to load the resource."));
+ },
+
+ _hasContent: function()
+ {
+ return !this.element.querySelector(WebInspector.IndeterminateProgressSpinner.StyleClassName);
+ },
+
_issueWasAdded: function(event)
{
console.assert(!this.managesOwnIssues);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes