Changeset 247747 in webkit


Ignore:
Timestamp:
Jul 23, 2019 2:50:59 PM (5 years ago)
Author:
Nikita Vasilyev
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.

Location:
trunk/Source/WebInspectorUI
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r247715 r247747  
     12019-07-23  Nikita Vasilyev  <nvasilyev@apple.com>
     2
     3        Web Inspector: Display "Resource has no content" for about:blank iframes instead of an error
     4        https://bugs.webkit.org/show_bug.cgi?id=198029
     5
     6        Reviewed by Devin Rousso.
     7
     8        Display "about:blank" in the middle of the content view when selecting "about:blank" resources.
     9        Previoulsly, we showed a misleading "An error occurred trying to load the resource" error
     10        message.
     11
     12        * UserInterface/Models/CSSStyleSheet.js:
     13        (WI.CSSStyleSheet.prototype.requestContentFromBackend):
     14        * UserInterface/Models/Resource.js:
     15        (WI.Resource.prototype.requestContentFromBackend):
     16        * UserInterface/Models/Script.js:
     17        (WI.Script.prototype.requestContentFromBackend):
     18        * UserInterface/Models/SourceCode.js:
     19        (WI.SourceCode.generateSpecialContentForURL):
     20        (WI.SourceCode.prototype._processContent):
     21        (WI.SourceCode):
     22        * UserInterface/Views/ResourceContentView.js:
     23        (WI.ResourceContentView.prototype._contentAvailable):
     24
     25        * UserInterface/Views/SourceCodeTextEditor.js:
     26        (WI.SourceCodeTextEditor.prototype._contentAvailable):
     27        (WI.SourceCodeTextEditor.prototype._showMessage):
     28        * UserInterface/Views/TextResourceContentView.js:
     29        (WI.TextResourceContentView.prototype._contentDidPopulate):
     30        Display empty text editor when it has no content instead of "Resource has no content" message.
     31
    1322019-07-22  Devin Rousso  <drousso@apple.com>
    233
  • trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js

    r220119 r247747  
    191191    requestContentFromBackend()
    192192    {
     193        let specialContentPromise = WI.SourceCode.generateSpecialContentForURL(this._url);
     194        if (specialContentPromise)
     195            return specialContentPromise;
     196
    193197        if (!this._id) {
    194198            // There is no identifier to request content with. Reject the promise to cause the
  • trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js

    r245827 r247747  
    820820    requestContentFromBackend()
    821821    {
     822        let specialContentPromise = WI.SourceCode.generateSpecialContentForURL(this._url);
     823        if (specialContentPromise)
     824            return specialContentPromise;
     825
    822826        // If we have the requestIdentifier we can get the actual response for this specific resource.
    823827        // Otherwise the content will be cached resource data, which might not exist anymore.
  • trunk/Source/WebInspectorUI/UserInterface/Models/Script.js

    r244398 r247747  
    186186    requestContentFromBackend()
    187187    {
     188        let specialContentPromise = WI.SourceCode.generateSpecialContentForURL(this._url);
     189        if (specialContentPromise)
     190            return specialContentPromise;
     191
    188192        if (!this._id) {
    189193            // There is no identifier to request content with. Return false to cause the
  • trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js

    r223856 r247747  
    3838    }
    3939
     40    // Static
     41
     42    static generateSpecialContentForURL(url)
     43    {
     44        if (url === "about:blank") {
     45            return Promise.resolve({
     46                content: "",
     47                message: WI.unlocalizedString("about:blank")
     48            });
     49        }
     50        return null;
     51    }
     52
    4053    // Public
    4154
     
    198211        let content = rawContent;
    199212        let error = parameters.error;
     213        let message = parameters.message;
    200214        if (parameters.base64Encoded)
    201215            content = content ? decodeBase64ToBlob(content, this.mimeType) : "";
     
    213227        return Promise.resolve({
    214228            error,
     229            message,
    215230            sourceCode: this,
    216231            content,
  • trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js

    r236766 r247747  
    136136        }
    137137
     138        if (parameters.message) {
     139            this.showMessage(parameters.message);
     140            return;
     141        }
     142
    138143        // Content is ready to show, call the public method now.
    139144        console.assert(!this._hasContent());
  • trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js

    r247639 r247747  
    528528            return;
    529529
     530        if (parameters.message) {
     531            this._showMessage(parameters.message);
     532            return;
     533        }
     534
    530535        var sourceCode = parameters.sourceCode;
    531536        var content = sourceCode.content;
     
    549554
    550555        this.repeatReveal = false;
     556    }
     557
     558    _showMessage(message)
     559    {
     560        this.element.removeChildren();
     561        this.element.appendChild(WI.createMessageTextView(message));
    551562    }
    552563
  • trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js

    r246419 r247747  
    215215        this._codeCoverageButtonNavigationItem.enabled = this._textEditor.canShowCoverageHints();
    216216        this._codeCoverageButtonNavigationItem.activated = WI.settings.enableControlFlowProfiler.value;
    217 
    218         if (!this._textEditor.string)
    219             this.showGenericNoContentMessage();
    220217    }
    221218
Note: See TracChangeset for help on using the changeset viewer.