Skip to content
Permalink
Browse files
Web Inspector: Computed Panel: Assertion Failed: Cannot remove view w…
…hich isn't a subview. ComputedStyleSection

https://bugs.webkit.org/show_bug.cgi?id=240644

Reviewed by Patrick Angle.

The root cause for this failed assertion is an accumulation of orphaned `WI.ComputedStyleSection` view instances in
`WI.ComputedStyleDetailsPanel._detailsSectionByStyleSectionMap`.

When `WI.ComputedStyleDetailsPanel.layout()` is called to reflect the latest selected node's variables, the previous `WI.ComputedStyleSection` view instance for ungrouped
variables is accidentally kept around. When attempting to remove this view on the next `layout()` run, this orphaned instance has no
host node that belongs to the parent view so the assertion fails. The issue gets progressively worse on each `layout()` run by accumulating more orphans.

* Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js: (WI.ComputedStyleDetailsPanel.prototype.layout):

Canonical link: https://commits.webkit.org/250763@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294506 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
rcaliman-apple committed May 19, 2022
1 parent 79f119a commit b9ebfa7329012d42bc4991098d81b51b81e6519c
Showing 1 changed file with 3 additions and 5 deletions.
@@ -215,13 +215,11 @@ WI.ComputedStyleDetailsPanel = class ComputedStyleDetailsPanel extends WI.StyleD
this.element.appendChild(styleSection.element);
this.removeSubview(styleSection);
styleSection.element.remove();
this._detailsSectionByStyleSectionMap.delete(styleSection);

// The top-level details section for variables needs to be preserved because it's the host of nested details sections for variables groups.
if (detailsSection === this._variablesSection)
continue;

detailsSection.element.remove();
this._detailsSectionByStyleSectionMap.delete(styleSection);
if (detailsSection !== this._variablesSection)
detailsSection.element.remove();
}

this._variablesStyleSectionForGroupTypeMap.clear();

0 comments on commit b9ebfa7

Please sign in to comment.