Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (276309 => 276310)
--- trunk/Source/WebInspectorUI/ChangeLog 2021-04-20 17:13:18 UTC (rev 276309)
+++ trunk/Source/WebInspectorUI/ChangeLog 2021-04-20 17:17:24 UTC (rev 276310)
@@ -1,3 +1,17 @@
+2021-04-20 Razvan Caliman <[email protected]>
+
+ Web Inspector: Tree Outlines: `ondetach` can be called without `onattach` ever being called
+ https://bugs.webkit.org/show_bug.cgi?id=224652
+ <rdar://problem/76746385>
+
+ Reviewed by Devin Rousso.
+
+ Ensure `TreeElement.ondetach()` cannot be called if the conditions
+ for previously calling `TreeElement.onattach()` have not been met.
+
+ * UserInterface/Views/TreeElement.js:
+ (WI.TreeElement.prototype._detach):
+
2021-04-19 Patrick Angle <[email protected]>
REGRESSION (r268691 && r270134): Web Inspector: Clicking on go-to arrow in Computed panel no longer works
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/AuditTreeElement.js (276309 => 276310)
--- trunk/Source/WebInspectorUI/UserInterface/Views/AuditTreeElement.js 2021-04-20 17:13:18 UTC (rev 276309)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/AuditTreeElement.js 2021-04-20 17:17:24 UTC (rev 276310)
@@ -97,8 +97,6 @@
ondetach()
{
- // FIXME: <https://webkit.org/b/224652> (Web Inspector: Tree Outlines: `ondetach` can be called without `onattach` ever being called)
-
if (this.representedObject instanceof WI.AuditTestBase) {
this.representedObject.removeEventListener(WI.AuditTestBase.Event.DisabledChanged, this._handleTestDisabledChanged, this);
this.representedObject.removeEventListener(WI.AuditTestBase.Event.ResultChanged, this._handleTestResultChanged, this);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BootstrapScriptTreeElement.js (276309 => 276310)
--- trunk/Source/WebInspectorUI/UserInterface/Views/BootstrapScriptTreeElement.js 2021-04-20 17:13:18 UTC (rev 276309)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BootstrapScriptTreeElement.js 2021-04-20 17:17:24 UTC (rev 276310)
@@ -52,8 +52,6 @@
ondetach()
{
- // FIXME: <https://webkit.org/b/224652> (Web Inspector: Tree Outlines: `ondetach` can be called without `onattach` ever being called)
-
WI.NetworkManager.removeEventListener(WI.NetworkManager.Event.BootstrapScriptEnabledChanged, this._handleNetworkManagerBootstrapScriptEnabledChanged, this);
super.ondetach();
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js (276309 => 276310)
--- trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js 2021-04-20 17:13:18 UTC (rev 276309)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js 2021-04-20 17:17:24 UTC (rev 276310)
@@ -111,8 +111,6 @@
ondetach()
{
- // FIXME: <https://webkit.org/b/224652> (Web Inspector: Tree Outlines: `ondetach` can be called without `onattach` ever being called)
-
super.ondetach();
this._breakpoint.removeEventListener(WI.Breakpoint.Event.DisabledStateDidChange, this.updateStatus, this);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js (276309 => 276310)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js 2021-04-20 17:13:18 UTC (rev 276309)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js 2021-04-20 17:17:24 UTC (rev 276310)
@@ -455,8 +455,6 @@
ondetach()
{
- // FIXME: <https://webkit.org/b/224652> (Web Inspector: Tree Outlines: `ondetach` can be called without `onattach` ever being called)
-
if (this.representedObject.layoutContextType === WI.DOMNode.LayoutContextType.Grid) {
WI.overlayManager.removeEventListener(WI.OverlayManager.Event.GridOverlayShown, this._updateGridBadgeStatus, this);
WI.overlayManager.removeEventListener(WI.OverlayManager.Event.GridOverlayHidden, this._updateGridBadgeStatus, this);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js (276309 => 276310)
--- trunk/Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js 2021-04-20 17:13:18 UTC (rev 276309)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js 2021-04-20 17:17:24 UTC (rev 276310)
@@ -121,13 +121,9 @@
ondetach()
{
- // FIXME: <https://webkit.org/b/224652> (Web Inspector: Tree Outlines: `ondetach` can be called without `onattach` ever being called)
+ WI.cssManager.removeEventListener(WI.CSSManager.Event.StyleSheetAdded, this._styleSheetAdded, this);
+ WI.cssManager.removeEventListener(WI.CSSManager.Event.StyleSheetRemoved, this._styleSheetRemoved, this);
- if (this.listItemElement) {
- WI.cssManager.removeEventListener(WI.CSSManager.Event.StyleSheetAdded, this._styleSheetAdded, this);
- WI.cssManager.removeEventListener(WI.CSSManager.Event.StyleSheetRemoved, this._styleSheetRemoved, this);
- }
-
super.ondetach();
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/_javascript_BreakpointTreeElement.js (276309 => 276310)
--- trunk/Source/WebInspectorUI/UserInterface/Views/_javascript_BreakpointTreeElement.js 2021-04-20 17:13:18 UTC (rev 276309)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/_javascript_BreakpointTreeElement.js 2021-04-20 17:17:24 UTC (rev 276310)
@@ -59,8 +59,6 @@
ondetach()
{
- // FIXME: <https://webkit.org/b/224652> (Web Inspector: Tree Outlines: `ondetach` can be called without `onattach` ever being called)
-
if (!this.breakpoint.special)
this.breakpoint.removeEventListener(WI._javascript_Breakpoint.Event.LocationDidChange, this._breakpointLocationDidChange, this);
this.breakpoint.removeEventListener(WI._javascript_Breakpoint.Event.ResolvedStateDidChange, this.updateStatus, this);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LocalResourceOverrideTreeElement.js (276309 => 276310)
--- trunk/Source/WebInspectorUI/UserInterface/Views/LocalResourceOverrideTreeElement.js 2021-04-20 17:13:18 UTC (rev 276309)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LocalResourceOverrideTreeElement.js 2021-04-20 17:17:24 UTC (rev 276310)
@@ -56,8 +56,6 @@
ondetach()
{
- // FIXME: <https://webkit.org/b/224652> (Web Inspector: Tree Outlines: `ondetach` can be called without `onattach` ever being called)
-
this._localResourceOverride.removeEventListener(WI.LocalResourceOverride.Event.DisabledChanged, this._handleLocalResourceOverrideDisabledChanged, this);
WI.Frame.removeEventListener(WI.Frame.Event.MainResourceDidChange, this._handleFrameMainResourceDidChange, this);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ShaderProgramTreeElement.js (276309 => 276310)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ShaderProgramTreeElement.js 2021-04-20 17:13:18 UTC (rev 276309)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ShaderProgramTreeElement.js 2021-04-20 17:17:24 UTC (rev 276310)
@@ -60,8 +60,6 @@
ondetach()
{
- // FIXME: <https://webkit.org/b/224652> (Web Inspector: Tree Outlines: `ondetach` can be called without `onattach` ever being called)
-
// FIXME: add support for disabling/highlighting WebGPU shader pipelines.
let contextType = this.representedObject.canvas.contextType;
if (contextType === WI.Canvas.ContextType.WebGL || contextType === WI.Canvas.ContextType.WebGL2)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TreeElement.js (276309 => 276310)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TreeElement.js 2021-04-20 17:13:18 UTC (rev 276309)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TreeElement.js 2021-04-20 17:17:24 UTC (rev 276310)
@@ -248,8 +248,8 @@
_attach()
{
if (!this._listItemNode || this.parent._shouldRefreshChildren) {
- if (this._listItemNode && this._listItemNode.parentNode)
- this._listItemNode.parentNode.removeChild(this._listItemNode);
+ if (this.parent._shouldRefreshChildren)
+ this._detach();
this._listItemNode = this.treeOutline._childrenListNode.ownerDocument.createElement("li");
this._listItemNode.treeElement = this;
@@ -290,8 +290,7 @@
_detach()
{
- // FIXME: <https://webkit.org/b/224652> (Web Inspector: Tree Outlines: `ondetach` can be called without `onattach` ever being called)
- if (this.ondetach)
+ if (this.ondetach && this._listItemNode)
this.ondetach(this);
if (this._listItemNode && this._listItemNode.parentNode)
this._listItemNode.parentNode.removeChild(this._listItemNode);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/WebSocketResourceTreeElement.js (276309 => 276310)
--- trunk/Source/WebInspectorUI/UserInterface/Views/WebSocketResourceTreeElement.js 2021-04-20 17:13:18 UTC (rev 276309)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/WebSocketResourceTreeElement.js 2021-04-20 17:17:24 UTC (rev 276310)
@@ -38,11 +38,9 @@
ondetach()
{
- // FIXME: <https://webkit.org/b/224652> (Web Inspector: Tree Outlines: `ondetach` can be called without `onattach` ever being called)
+ this.resource.removeEventListener(WI.WebSocketResource.Event.ReadyStateChanged, this._updateConnectionStatus, this);
super.ondetach();
-
- this.resource.removeEventListener(WI.WebSocketResource.Event.ReadyStateChanged, this._updateConnectionStatus, this);
}
populateContextMenu(contextMenu, event)