Title: [250618] trunk/Source/WebInspectorUI
Revision
250618
Author
[email protected]
Date
2019-10-02 11:49:53 -0700 (Wed, 02 Oct 2019)

Log Message

Web Inspector: REGRESSION(r250149): changing CSS via the Styles details sidebar panel doesn't update the associated resource
https://bugs.webkit.org/show_bug.cgi?id=202446

Reviewed by Joseph Pecoraro.

When updating the text of a `WI.CSSProperty` (or the selector of a `WI.CSSRule`) is updated,
Web Inspector will update the backend style sheet, which will notify the `WI.CSSManager` of
the change, without ever going through the associated `WI.SourceCode`. `WI.CSSManager` then
updates the content of the `WI.SourceCode` to reflect these changes, but at that point the
`WI.SourceCode` hadn't yet "moved" it's `currentRevision` forward of it's `originalRevision`
which means it would get overridden the first time the `WI.SourceCode` updates itself.

Modify `WI.SourceCode` such that every path to get the `currentRevision` ensures that it is
"moved" forward before the `WI.SourceCodeRevision` value is returned.

* UserInterface/Models/SourceCode.js:
(WI.SourceCode.prototype.get currentRevision):
(WI.SourceCode.prototype.get content):
(WI.SourceCode.prototype.revisionContentDidChange):
(WI.SourceCode.prototype._initializeCurrentRevisionIfNeeded): Added.
(WI.SourceCode.prototype._processContent):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (250617 => 250618)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-10-02 18:30:04 UTC (rev 250617)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-10-02 18:49:53 UTC (rev 250618)
@@ -1,3 +1,27 @@
+2019-10-02  Devin Rousso  <[email protected]>
+
+        Web Inspector: REGRESSION(r250149): changing CSS via the Styles details sidebar panel doesn't update the associated resource
+        https://bugs.webkit.org/show_bug.cgi?id=202446
+
+        Reviewed by Joseph Pecoraro.
+
+        When updating the text of a `WI.CSSProperty` (or the selector of a `WI.CSSRule`) is updated,
+        Web Inspector will update the backend style sheet, which will notify the `WI.CSSManager` of
+        the change, without ever going through the associated `WI.SourceCode`. `WI.CSSManager` then
+        updates the content of the `WI.SourceCode` to reflect these changes, but at that point the
+        `WI.SourceCode` hadn't yet "moved" it's `currentRevision` forward of it's `originalRevision`
+        which means it would get overridden the first time the `WI.SourceCode` updates itself.
+
+        Modify `WI.SourceCode` such that every path to get the `currentRevision` ensures that it is
+        "moved" forward before the `WI.SourceCodeRevision` value is returned.
+
+        * UserInterface/Models/SourceCode.js:
+        (WI.SourceCode.prototype.get currentRevision):
+        (WI.SourceCode.prototype.get content):
+        (WI.SourceCode.prototype.revisionContentDidChange):
+        (WI.SourceCode.prototype._initializeCurrentRevisionIfNeeded): Added.
+        (WI.SourceCode.prototype._processContent):
+
 2019-10-01  Devin Rousso  <[email protected]>
 
         Web Inspector: Sources: clicking on a breakpoint changes the path components to not match the script's path

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js (250617 => 250618)


--- trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js	2019-10-02 18:30:04 UTC (rev 250617)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js	2019-10-02 18:49:53 UTC (rev 250618)
@@ -66,6 +66,7 @@
 
     get currentRevision()
     {
+        this._initializeCurrentRevisionIfNeeded();
         return this._currentRevision;
     }
 
@@ -86,7 +87,7 @@
 
     get content()
     {
-        return this._currentRevision.content;
+        return this.currentRevision.content;
     }
 
     get url()
@@ -180,7 +181,7 @@
         if (this._ignoreRevisionContentDidChangeEvent)
             return;
 
-        if (revision !== this._currentRevision)
+        if (revision !== this.currentRevision)
             return;
 
         this.handleCurrentRevisionContentChange();
@@ -220,6 +221,12 @@
 
     // Private
 
+    _initializeCurrentRevisionIfNeeded()
+    {
+        if (this._currentRevision === this._originalRevision)
+            this.currentRevision = this._originalRevision.copy();
+    }
+
     _processContent(parameters)
     {
         // Different backend APIs return one of `content, `body`, `text`, or `scriptSource`.
@@ -237,8 +244,7 @@
         revision.content = content || null;
         this._ignoreRevisionContentDidChangeEvent = false;
 
-        if (this._currentRevision === this._originalRevision)
-            this.currentRevision = this._originalRevision.copy();
+        this._initializeCurrentRevisionIfNeeded();
 
         // 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
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to