Bug 240644

Summary: Web Inspector: Computed Panel: Assertion Failed: Cannot remove view which isn't a subview. ComputedStyleSection
Product: WebKit Reporter: Razvan Caliman <rcaliman>
Component: Web InspectorAssignee: Razvan Caliman <rcaliman>
Status: RESOLVED FIXED    
Severity: Normal CC: inspector-bugzilla-changes, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   

Description Razvan Caliman 2022-05-19 05:55:27 PDT
```
[Error] Assertion Failed: Cannot remove view which isn't a subview.
ComputedStyleSection {_listeners: Multimap, _element: <div class="computed-style-section">, _parentView: null, _subviews: [], _dirty: false, …}
	removeSubview (View.js:127)
	layout (ComputedStyleDetailsPanel.js:216)
	_layoutSubtree (View.js:308)
	_layoutSubtree (View.js:319)
	_layoutSubtree (View.js:319)
	_visitViewTreeForLayout (View.js:378)
```

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

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 even though its host DOM node was removed. 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 is hit. The issue gets progressively worse on each `layout()` run by accumulating more orphans.
Comment 1 Radar WebKit Bug Importer 2022-05-19 05:55:53 PDT
<rdar://problem/93571902>
Comment 2 Razvan Caliman 2022-05-19 08:12:24 PDT
Pull request: https://github.com/WebKit/WebKit/pull/782
Comment 3 EWS 2022-05-19 14:50:45 PDT
Committed r294506 (250763@main): <https://commits.webkit.org/250763@main>

Reviewed commits have been landed. Closing PR #782 and removing active labels.