Title: [179755] trunk/Source/WebInspectorUI
Revision
179755
Author
jonowe...@apple.com
Date
2015-02-06 13:33:26 -0800 (Fri, 06 Feb 2015)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (179754 => 179755)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-02-06 21:21:08 UTC (rev 179754)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-02-06 21:33:26 UTC (rev 179755)
@@ -1,3 +1,23 @@
+2015-02-06  Jono Wells  <jonowe...@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  <jonowe...@apple.com>
 
         Web Inspector: REGRESSION: Inline SourceMap resources show empty content when opened.

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js (179754 => 179755)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js	2015-02-06 21:21:08 UTC (rev 179754)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js	2015-02-06 21:33:26 UTC (rev 179755)
@@ -50,6 +50,7 @@
 
 WebInspector.CSSStyleManager.prototype = {
     constructor: WebInspector.CSSStyleManager,
+    __proto__: WebInspector.Object.prototype,
 
     // Public
 
@@ -252,9 +253,7 @@
                 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 @@
         styleSheet.__pendingChangeTimeout = setTimeout(applyStyleSheetChanges.bind(this), 500);
     }
 };
-
-WebInspector.CSSStyleManager.prototype.__proto__ = WebInspector.Object.prototype;

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js (179754 => 179755)


--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js	2015-02-06 21:21:08 UTC (rev 179754)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js	2015-02-06 21:33:26 UTC (rev 179755)
@@ -49,6 +49,7 @@
 
 WebInspector.CSSStyleSheet.prototype = {
     constructor: WebInspector.CSSStyleSheet,
+    __proto__: WebInspector.SourceCode.prototype,
 
     // Public
 
@@ -129,7 +130,7 @@
             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 @@
         return true;
     }
 };
-
-WebInspector.CSSStyleSheet.prototype.__proto__ = WebInspector.SourceCode.prototype;

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js (179754 => 179755)


--- trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js	2015-02-06 21:21:08 UTC (rev 179754)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js	2015-02-06 21:33:26 UTC (rev 179755)
@@ -683,7 +683,6 @@
             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);

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js (179754 => 179755)


--- trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js	2015-02-06 21:21:08 UTC (rev 179754)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js	2015-02-06 21:33:26 UTC (rev 179755)
@@ -175,6 +175,7 @@
 
     markContentAsStale: function()
     {
+        this._requestContentPromise = null;
         this._contentReceived = false;
     },
 
@@ -189,8 +190,8 @@
 
     _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;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to