- Revision
- 247747
- Author
- [email protected]
- Date
- 2019-07-23 14:50:59 -0700 (Tue, 23 Jul 2019)
Log Message
Web Inspector: Display "Resource has no content" for about:blank iframes instead of an error
https://bugs.webkit.org/show_bug.cgi?id=198029
Reviewed by Devin Rousso.
Display "about:blank" in the middle of the content view when selecting "about:blank" resources.
Previoulsly, we showed a misleading "An error occurred trying to load the resource" error
message.
* UserInterface/Models/CSSStyleSheet.js:
(WI.CSSStyleSheet.prototype.requestContentFromBackend):
* UserInterface/Models/Resource.js:
(WI.Resource.prototype.requestContentFromBackend):
* UserInterface/Models/Script.js:
(WI.Script.prototype.requestContentFromBackend):
* UserInterface/Models/SourceCode.js:
(WI.SourceCode.generateSpecialContentForURL):
(WI.SourceCode.prototype._processContent):
(WI.SourceCode):
* UserInterface/Views/ResourceContentView.js:
(WI.ResourceContentView.prototype._contentAvailable):
* UserInterface/Views/SourceCodeTextEditor.js:
(WI.SourceCodeTextEditor.prototype._contentAvailable):
(WI.SourceCodeTextEditor.prototype._showMessage):
* UserInterface/Views/TextResourceContentView.js:
(WI.TextResourceContentView.prototype._contentDidPopulate):
Display empty text editor when it has no content instead of "Resource has no content" message.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (247746 => 247747)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-07-23 21:49:00 UTC (rev 247746)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-07-23 21:50:59 UTC (rev 247747)
@@ -1,3 +1,34 @@
+2019-07-23 Nikita Vasilyev <[email protected]>
+
+ Web Inspector: Display "Resource has no content" for about:blank iframes instead of an error
+ https://bugs.webkit.org/show_bug.cgi?id=198029
+
+ Reviewed by Devin Rousso.
+
+ Display "about:blank" in the middle of the content view when selecting "about:blank" resources.
+ Previoulsly, we showed a misleading "An error occurred trying to load the resource" error
+ message.
+
+ * UserInterface/Models/CSSStyleSheet.js:
+ (WI.CSSStyleSheet.prototype.requestContentFromBackend):
+ * UserInterface/Models/Resource.js:
+ (WI.Resource.prototype.requestContentFromBackend):
+ * UserInterface/Models/Script.js:
+ (WI.Script.prototype.requestContentFromBackend):
+ * UserInterface/Models/SourceCode.js:
+ (WI.SourceCode.generateSpecialContentForURL):
+ (WI.SourceCode.prototype._processContent):
+ (WI.SourceCode):
+ * UserInterface/Views/ResourceContentView.js:
+ (WI.ResourceContentView.prototype._contentAvailable):
+
+ * UserInterface/Views/SourceCodeTextEditor.js:
+ (WI.SourceCodeTextEditor.prototype._contentAvailable):
+ (WI.SourceCodeTextEditor.prototype._showMessage):
+ * UserInterface/Views/TextResourceContentView.js:
+ (WI.TextResourceContentView.prototype._contentDidPopulate):
+ Display empty text editor when it has no content instead of "Resource has no content" message.
+
2019-07-22 Devin Rousso <[email protected]>
Web Inspector: Uncaught Exception: Breakpoint at specified location already exists.
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js (247746 => 247747)
--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js 2019-07-23 21:49:00 UTC (rev 247746)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js 2019-07-23 21:50:59 UTC (rev 247747)
@@ -190,6 +190,10 @@
requestContentFromBackend()
{
+ let specialContentPromise = WI.SourceCode.generateSpecialContentForURL(this._url);
+ if (specialContentPromise)
+ return specialContentPromise;
+
if (!this._id) {
// There is no identifier to request content with. Reject the promise to cause the
// pending callbacks to get null content.
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js (247746 => 247747)
--- trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js 2019-07-23 21:49:00 UTC (rev 247746)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js 2019-07-23 21:50:59 UTC (rev 247747)
@@ -819,6 +819,10 @@
requestContentFromBackend()
{
+ let specialContentPromise = WI.SourceCode.generateSpecialContentForURL(this._url);
+ if (specialContentPromise)
+ return specialContentPromise;
+
// If we have the requestIdentifier we can get the actual response for this specific resource.
// Otherwise the content will be cached resource data, which might not exist anymore.
if (this._requestIdentifier)
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Script.js (247746 => 247747)
--- trunk/Source/WebInspectorUI/UserInterface/Models/Script.js 2019-07-23 21:49:00 UTC (rev 247746)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Script.js 2019-07-23 21:50:59 UTC (rev 247747)
@@ -185,6 +185,10 @@
requestContentFromBackend()
{
+ let specialContentPromise = WI.SourceCode.generateSpecialContentForURL(this._url);
+ if (specialContentPromise)
+ return specialContentPromise;
+
if (!this._id) {
// There is no identifier to request content with. Return false to cause the
// pending callbacks to get null content.
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js (247746 => 247747)
--- trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js 2019-07-23 21:49:00 UTC (rev 247746)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js 2019-07-23 21:50:59 UTC (rev 247747)
@@ -37,6 +37,19 @@
this._requestContentPromise = null;
}
+ // Static
+
+ static generateSpecialContentForURL(url)
+ {
+ if (url ="" "about:blank") {
+ return Promise.resolve({
+ content: "",
+ message: WI.unlocalizedString("about:blank")
+ });
+ }
+ return null;
+ }
+
// Public
get displayName()
@@ -197,6 +210,7 @@
let rawContent = parameters.content || parameters.body || parameters.text || parameters.scriptSource;
let content = rawContent;
let error = parameters.error;
+ let message = parameters.message;
if (parameters.base64Encoded)
content = content ? decodeBase64ToBlob(content, this.mimeType) : "";
@@ -212,6 +226,7 @@
return Promise.resolve({
error,
+ message,
sourceCode: this,
content,
rawContent,
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js (247746 => 247747)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js 2019-07-23 21:49:00 UTC (rev 247746)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js 2019-07-23 21:50:59 UTC (rev 247747)
@@ -135,6 +135,11 @@
return;
}
+ if (parameters.message) {
+ this.showMessage(parameters.message);
+ return;
+ }
+
// Content is ready to show, call the public method now.
console.assert(!this._hasContent());
console.assert(parameters.sourceCode === this._resource);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js (247746 => 247747)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js 2019-07-23 21:49:00 UTC (rev 247746)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js 2019-07-23 21:50:59 UTC (rev 247747)
@@ -527,6 +527,11 @@
if (parameters.error)
return;
+ if (parameters.message) {
+ this._showMessage(parameters.message);
+ return;
+ }
+
var sourceCode = parameters.sourceCode;
var content = sourceCode.content;
var base64Encoded = parameters.base64Encoded;
@@ -550,6 +555,12 @@
this.repeatReveal = false;
}
+ _showMessage(message)
+ {
+ this.element.removeChildren();
+ this.element.appendChild(WI.createMessageTextView(message));
+ }
+
_breakpointStatusDidChange(event)
{
this._updateBreakpointStatus(event.target);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js (247746 => 247747)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js 2019-07-23 21:49:00 UTC (rev 247746)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js 2019-07-23 21:50:59 UTC (rev 247747)
@@ -214,9 +214,6 @@
this._codeCoverageButtonNavigationItem.enabled = this._textEditor.canShowCoverageHints();
this._codeCoverageButtonNavigationItem.activated = WI.settings.enableControlFlowProfiler.value;
-
- if (!this._textEditor.string)
- this.showGenericNoContentMessage();
}
_togglePrettyPrint(event)