Web Inspector: REGRESSION: CSS Resource appears as empty after editing it via Styles...
authorjonowells@apple.com <jonowells@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Feb 2015 21:33:26 +0000 (21:33 +0000)
committerjonowells@apple.com <jonowells@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Feb 2015 21:33:26 +0000 (21:33 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179755 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js
Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js
Source/WebInspectorUI/UserInterface/Models/Resource.js
Source/WebInspectorUI/UserInterface/Models/SourceCode.js

index 067a6ab..73fe954 100644 (file)
@@ -1,3 +1,23 @@
+2015-02-06  Jono Wells  <jonowells@apple.com>
+
+        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.
+
 2015-02-04  Jono Wells  <jonowells@apple.com>
 
         Web Inspector: REGRESSION: Inline SourceMap resources show empty content when opened.
index 9e1c88b..7eeae35 100644 (file)
@@ -50,6 +50,7 @@ WebInspector.CSSStyleManager.ForceablePseudoClasses = ["active", "focus", "hover
 
 WebInspector.CSSStyleManager.prototype = {
     constructor: WebInspector.CSSStyleManager,
+    __proto__: WebInspector.Object.prototype,
 
     // Public
 
@@ -252,9 +253,7 @@ WebInspector.CSSStyleManager.prototype = {
                 return;
             }
 
-            for (var i = 0; i < styleSheets.length; ++i) {
-                var styleSheetInfo = styleSheets[i];
-
+            for (var styleSheetInfo of styleSheets) {
                 // COMPATIBILITY (iOS 6): The info did not have 'frameId', so make parentFrame null in that case.
                 var parentFrame = "frameId" in styleSheetInfo ? WebInspector.frameResourceManager.frameForIdentifier(styleSheetInfo.frameId) : null;
 
@@ -366,5 +365,3 @@ WebInspector.CSSStyleManager.prototype = {
         styleSheet.__pendingChangeTimeout = setTimeout(applyStyleSheetChanges.bind(this), 500);
     }
 };
-
-WebInspector.CSSStyleManager.prototype.__proto__ = WebInspector.Object.prototype;
index cddfa7f..41eb86a 100644 (file)
@@ -49,6 +49,7 @@ WebInspector.CSSStyleSheet.Event = {
 
 WebInspector.CSSStyleSheet.prototype = {
     constructor: WebInspector.CSSStyleSheet,
+    __proto__: WebInspector.SourceCode.prototype,
 
     // Public
 
@@ -129,7 +130,7 @@ WebInspector.CSSStyleSheet.prototype = {
             return Promise.reject(new Error("There is no identifier to request content with."));
         }
 
-        return CSSAgent.getStyleSheetText.promise(this._id);
+        return CSSAgent.getStyleSheetText(this._id);
     },
 
     noteContentDidChange: function()
@@ -144,5 +145,3 @@ WebInspector.CSSStyleSheet.prototype = {
         return true;
     }
 };
-
-WebInspector.CSSStyleSheet.prototype.__proto__ = WebInspector.SourceCode.prototype;
index bf22ba2..2db9446 100644 (file)
@@ -683,7 +683,6 @@ WebInspector.Resource.prototype = {
             return Promise.resolve({error: WebInspector.UIString("An error occurred trying to load the resource.")});
 
         if (!this._finishThenRequestContentPromise) {
-            var listener = new WebInspector.EventListener(this, true);
             this._finishThenRequestContentPromise = new Promise(function (resolve, reject) {
                 this.addEventListener(WebInspector.Resource.Event.LoadingDidFinish, resolve);
                 this.addEventListener(WebInspector.Resource.Event.LoadingDidFail, reject);
index f12d987..41aa88c 100644 (file)
@@ -175,6 +175,7 @@ WebInspector.SourceCode.prototype = {
 
     markContentAsStale: function()
     {
+        this._requestContentPromise = null;
         this._contentReceived = false;
     },
 
@@ -189,8 +190,8 @@ WebInspector.SourceCode.prototype = {
 
     _processContent: function(parameters)
     {
-        // Different backend APIs return one of `content, `body`, or `scriptSource`.
-        var content = parameters.content || parameters.body || parameters.scriptSource;
+        // Different backend APIs return one of `content, `body`, `text`, or `scriptSource`.
+        var content = parameters.content || parameters.body || parameters.text || parameters.scriptSource;
         var error = parameters.error;
         var base64Encoded = parameters.base64Encoded;