Title: [287338] trunk/Source/WebInspectorUI
- Revision
- 287338
- Author
- [email protected]
- Date
- 2021-12-21 17:39:27 -0800 (Tue, 21 Dec 2021)
Log Message
Web Inspector: Assertion Failed adding event listener in CSSPropertyNameCompletions.prototype._updateValuesWithLatestCSSVariablesIfNeeded
https://bugs.webkit.org/show_bug.cgi?id=234570
Reviewed by Devin Rousso.
Adding an event listener to listen for style changes every time we update the list of CSS variables isn't quite
correct because it means we may attempt to add the event listener multiple times. Instead, this should be done
in response to the InspectedNodeChanged event directly to avoid adding the event listener multiple time to the
same DOM node.
* UserInterface/Models/CSSPropertyNameCompletions.js:
(WI.CSSPropertyNameCompletions.prototype._updateValuesWithLatestCSSVariablesIfNeeded):
(WI.CSSPropertyNameCompletions.prototype._handleInspectedNodeChanged):
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (287337 => 287338)
--- trunk/Source/WebInspectorUI/ChangeLog 2021-12-22 00:14:33 UTC (rev 287337)
+++ trunk/Source/WebInspectorUI/ChangeLog 2021-12-22 01:39:27 UTC (rev 287338)
@@ -1,3 +1,19 @@
+2021-12-21 Patrick Angle <[email protected]>
+
+ Web Inspector: Assertion Failed adding event listener in CSSPropertyNameCompletions.prototype._updateValuesWithLatestCSSVariablesIfNeeded
+ https://bugs.webkit.org/show_bug.cgi?id=234570
+
+ Reviewed by Devin Rousso.
+
+ Adding an event listener to listen for style changes every time we update the list of CSS variables isn't quite
+ correct because it means we may attempt to add the event listener multiple times. Instead, this should be done
+ in response to the InspectedNodeChanged event directly to avoid adding the event listener multiple time to the
+ same DOM node.
+
+ * UserInterface/Models/CSSPropertyNameCompletions.js:
+ (WI.CSSPropertyNameCompletions.prototype._updateValuesWithLatestCSSVariablesIfNeeded):
+ (WI.CSSPropertyNameCompletions.prototype._handleInspectedNodeChanged):
+
2021-12-21 Michael Saboff <[email protected]>
Fix symlinks for alternate root framework locations
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSPropertyNameCompletions.js (287337 => 287338)
--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSPropertyNameCompletions.js 2021-12-22 00:14:33 UTC (rev 287337)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSPropertyNameCompletions.js 2021-12-22 01:39:27 UTC (rev 287338)
@@ -86,10 +86,7 @@
return;
}
- let nodeStyles = WI.cssManager.stylesForNode(WI.domManager.inspectedNode);
- nodeStyles.addEventListener(WI.DOMNodeStyles.Event.NeedsRefresh, this._handleNodesStylesNeedsRefresh, this);
-
- let values = Array.from(nodeStyles.allCSSVariables);
+ let values = Array.from(WI.cssManager.stylesForNode(WI.domManager.inspectedNode).allCSSVariables);
values.pushAll(this._cachedSortedPropertyNames);
this.replaceValues(values);
@@ -98,13 +95,12 @@
_handleInspectedNodeChanged(event)
{
- if (this._needsVariablesFromInspectedNode || !event.data.lastInspectedNode)
- return;
-
this._needsVariablesFromInspectedNode = true;
- let nodeStyles = WI.cssManager.stylesForNode(event.data.lastInspectedNode);
- nodeStyles.removeEventListener(WI.DOMNodeStyles.Event.NeedsRefresh, this._handleNodesStylesNeedsRefresh, this);
+ if (event.data.lastInspectedNode)
+ WI.cssManager.stylesForNode(event.data.lastInspectedNode).removeEventListener(WI.DOMNodeStyles.Event.NeedsRefresh, this._handleNodesStylesNeedsRefresh, this);
+
+ WI.cssManager.stylesForNode(WI.domManager.inspectedNode).addEventListener(WI.DOMNodeStyles.Event.NeedsRefresh, this._handleNodesStylesNeedsRefresh, this);
}
_handleNodesStylesNeedsRefresh(event)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes