Web Inspector: Sometimes CSS resources don't update after editing via Styles panel
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Aug 2015 05:51:38 +0000 (05:51 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Aug 2015 05:51:38 +0000 (05:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143244

Reviewed by Timothy Hatcher.

* UserInterface/Models/SourceCode.js:
(WebInspector.SourceCode.prototype._processContent):
This code is brittle and we should move off of putting the
possibly stale content in the Promise result.

* UserInterface/Views/ResourceContentView.js:
(WebInspector.ResourceContentView.prototype._contentAvailable):
* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype._contentAvailable):
* UserInterface/Models/Script.js:
(WebInspector.Script.prototype.requestScriptSyntaxTree):
Use the current source code's content.

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Models/Script.js
Source/WebInspectorUI/UserInterface/Models/SourceCode.js
Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js
Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js

index e92a34e..c42dde1 100644 (file)
@@ -1,5 +1,25 @@
 2015-08-12  Joseph Pecoraro  <pecoraro@apple.com>
 
+        Web Inspector: Sometimes CSS resources don't update after editing via Styles panel
+        https://bugs.webkit.org/show_bug.cgi?id=143244
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Models/SourceCode.js:
+        (WebInspector.SourceCode.prototype._processContent):
+        This code is brittle and we should move off of putting the
+        possibly stale content in the Promise result.
+
+        * UserInterface/Views/ResourceContentView.js:
+        (WebInspector.ResourceContentView.prototype._contentAvailable):
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        (WebInspector.SourceCodeTextEditor.prototype._contentAvailable):
+        * UserInterface/Models/Script.js:
+        (WebInspector.Script.prototype.requestScriptSyntaxTree):
+        Use the current source code's content.
+
+2015-08-12  Joseph Pecoraro  <pecoraro@apple.com>
+
         Web Inspector: Fix Poor Class Names
         https://bugs.webkit.org/show_bug.cgi?id=147958
 
index dc317aa..b6c84d3 100644 (file)
@@ -149,7 +149,7 @@ WebInspector.Script = class Script extends WebInspector.SourceCode
         }
 
         this.requestContent().then(function(parameters) {
-            makeSyntaxTreeAndCallCallback(parameters.content);
+            makeSyntaxTreeAndCallCallback(parameters.sourceCode.content);
         }).catch(function(error) {
             makeSyntaxTreeAndCallCallback(null);
         });
index 25a88aa..e624238 100644 (file)
@@ -189,7 +189,11 @@ WebInspector.SourceCode = class SourceCode extends WebInspector.Object
 
         this._ignoreRevisionContentDidChangeEvent = true;
         revision.content = content || null;
-        delete this._ignoreRevisionContentDidChangeEvent;
+        this._ignoreRevisionContentDidChangeEvent = false;
+
+        // FIXME: Returning the content in this promise is misleading. It may not be current content
+        // now, and it may become out-dated later on. We should drop content from this promise
+        // and require clients to ask for the current contents from the sourceCode in the result.
 
         return Promise.resolve({
             error,
index ed4a779..487bc66 100644 (file)
@@ -91,7 +91,8 @@ WebInspector.ResourceContentView = class ResourceContentView extends WebInspecto
 
         // Content is ready to show, call the public method now.
         console.assert(!this._hasContent());
-        this.contentAvailable(parameters.content, parameters.base64Encoded);
+        console.assert(parameters.sourceCode === this._resource);
+        this.contentAvailable(parameters.sourceCode.content, parameters.base64Encoded);
     }
 
     _contentError(error)
index 971bdb5..c1aeb7b 100644 (file)
@@ -451,7 +451,7 @@ WebInspector.SourceCodeTextEditor = class SourceCodeTextEditor extends WebInspec
             return;
 
         var sourceCode = parameters.sourceCode;
-        var content = parameters.content;
+        var content = sourceCode.content;
         var base64Encoded = parameters.base64Encoded;
 
         console.assert(sourceCode === this._sourceCode);