Changeset 179755 in webkit


Ignore:
Timestamp:
Feb 6, 2015 1:33:26 PM (9 years ago)
Author:
jonowells@apple.com
Message:

Web Inspector: REGRESSION: CSS Resource appears as empty after editing it via Styles sidebar
https://bugs.webkit.org/show_bug.cgi?id=140586

Reviewed by Timothy Hatcher.

Update SourceCode#_processContent to properly handle the promise returned from CSSAgent so that the content
will properly update when a style has changed. Properly clear the existing _requestContentPromise on the
stylesheet so that the content will update correctly.

  • UserInterface/Controllers/CSSStyleManager.js: Drive-by style updates.

(WebInspector.CSSStyleManager.prototype._fetchInfoForAllStyleSheets):

  • UserInterface/Models/CSSStyleSheet.js: Drive-by inheritance style update.

(WebInspector.CSSStyleSheet.prototype.requestContentFromBackend): Remove unnecessary backend promise function call.

  • UserInterface/Models/Resource.js: Drive-by removal of unused variable.
  • UserInterface/Models/SourceCode.js:

(WebInspector.SourceCode.prototype.markContentAsStale): Clear _requestContentPromise.
(WebInspector.SourceCode.prototype._processContent): Handle parameters.text correctly.

Location:
trunk/Source/WebInspectorUI
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r179713 r179755  
     12015-02-06  Jono Wells  <jonowells@apple.com>
     2
     3        Web Inspector: REGRESSION: CSS Resource appears as empty after editing it via Styles sidebar
     4        https://bugs.webkit.org/show_bug.cgi?id=140586
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        Update SourceCode#_processContent to properly handle the promise returned from CSSAgent so that the content
     9        will properly update when a style has changed. Properly clear the existing _requestContentPromise on the
     10        stylesheet so that the content will update correctly.
     11
     12        * UserInterface/Controllers/CSSStyleManager.js: Drive-by style updates.
     13        (WebInspector.CSSStyleManager.prototype._fetchInfoForAllStyleSheets):
     14        * UserInterface/Models/CSSStyleSheet.js: Drive-by inheritance style update.
     15        (WebInspector.CSSStyleSheet.prototype.requestContentFromBackend): Remove unnecessary backend promise function call.
     16        * UserInterface/Models/Resource.js: Drive-by removal of unused variable.
     17        * UserInterface/Models/SourceCode.js:
     18        (WebInspector.SourceCode.prototype.markContentAsStale): Clear _requestContentPromise.
     19        (WebInspector.SourceCode.prototype._processContent): Handle `parameters.text` correctly.
     20
    1212015-02-04  Jono Wells  <jonowells@apple.com>
    222
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js

    r177791 r179755  
    5151WebInspector.CSSStyleManager.prototype = {
    5252    constructor: WebInspector.CSSStyleManager,
     53    __proto__: WebInspector.Object.prototype,
    5354
    5455    // Public
     
    253254            }
    254255
    255             for (var i = 0; i < styleSheets.length; ++i) {
    256                 var styleSheetInfo = styleSheets[i];
    257 
     256            for (var styleSheetInfo of styleSheets) {
    258257                // COMPATIBILITY (iOS 6): The info did not have 'frameId', so make parentFrame null in that case.
    259258                var parentFrame = "frameId" in styleSheetInfo ? WebInspector.frameResourceManager.frameForIdentifier(styleSheetInfo.frameId) : null;
     
    367366    }
    368367};
    369 
    370 WebInspector.CSSStyleManager.prototype.__proto__ = WebInspector.Object.prototype;
  • trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js

    r177791 r179755  
    5050WebInspector.CSSStyleSheet.prototype = {
    5151    constructor: WebInspector.CSSStyleSheet,
     52    __proto__: WebInspector.SourceCode.prototype,
    5253
    5354    // Public
     
    130131        }
    131132
    132         return CSSAgent.getStyleSheetText.promise(this._id);
     133        return CSSAgent.getStyleSheetText(this._id);
    133134    },
    134135
     
    145146    }
    146147};
    147 
    148 WebInspector.CSSStyleSheet.prototype.__proto__ = WebInspector.SourceCode.prototype;
  • trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js

    r179713 r179755  
    684684
    685685        if (!this._finishThenRequestContentPromise) {
    686             var listener = new WebInspector.EventListener(this, true);
    687686            this._finishThenRequestContentPromise = new Promise(function (resolve, reject) {
    688687                this.addEventListener(WebInspector.Resource.Event.LoadingDidFinish, resolve);
  • trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js

    r179713 r179755  
    176176    markContentAsStale: function()
    177177    {
     178        this._requestContentPromise = null;
    178179        this._contentReceived = false;
    179180    },
     
    190191    _processContent: function(parameters)
    191192    {
    192         // Different backend APIs return one of `content, `body`, or `scriptSource`.
    193         var content = parameters.content || parameters.body || parameters.scriptSource;
     193        // Different backend APIs return one of `content, `body`, `text`, or `scriptSource`.
     194        var content = parameters.content || parameters.body || parameters.text || parameters.scriptSource;
    194195        var error = parameters.error;
    195196        var base64Encoded = parameters.base64Encoded;
Note: See TracChangeset for help on using the changeset viewer.