WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
195146
Web Inspector: View.removeSubview not removing the element properly when not parented
https://bugs.webkit.org/show_bug.cgi?id=195146
Summary
Web Inspector: View.removeSubview not removing the element properly when not ...
Joseph Pecoraro
Reported
2019-02-27 22:57:37 PST
View.removeSubview not removing the element properly when not parented I addressed a review comment incompletely... I updated the assertion appropriately but not the code.
Attachments
[PATCH] Proposed Fix
(1.27 KB, patch)
2019-02-27 22:58 PST
,
Joseph Pecoraro
mattbaker
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Joseph Pecoraro
Comment 1
2019-02-27 22:58:43 PST
Created
attachment 363193
[details]
[PATCH] Proposed Fix Would only be possible right now debugging Worker Threads in CPU Timeline View. 1. Reload maps.google.com a few times with CPU timeline view
Matt Baker
Comment 2
2019-02-28 00:30:08 PST
Comment on
attachment 363193
[details]
[PATCH] Proposed Fix View in context:
https://bugs.webkit.org/attachment.cgi?id=363193&action=review
> Source/WebInspectorUI/ChangeLog:10 > + Since the element may not be a direct child, just use Element.prototype.remove.
Nice fix! I think we should add an assertion around View.js:110, before we try to insert the child view's DOM element: console.assert(!view.element.parentNode || this._element.contains(view.element.parentNode), "Subview DOM element must be a descendant of the parent view element."); This can balance the assertion at the top of View.removeSubview.
Matt Baker
Comment 3
2019-02-28 00:35:11 PST
Comment on
attachment 363193
[details]
[PATCH] Proposed Fix r=me We should add a test to LayoutTests/inspector/view/basics.html: suite.addTestCase({ name: "View.removeSubview.IndirectDescendant", test() { let parent = new WI.View; let middleElement = parent.element.appendChild(document.createElement("div")); let child = new WI.View; middleElement.appendChild(child.element); parent.addSubview(child); parent.removeSubview(child); InspectorTest.expectFalse(child.element.parentNode, "Removed view should not be in the DOM."); return true; } });
Joseph Pecoraro
Comment 4
2019-02-28 16:20:11 PST
Great suggestions, taking both!
Joseph Pecoraro
Comment 5
2019-02-28 16:48:39 PST
https://trac.webkit.org/r242241
Radar WebKit Bug Importer
Comment 6
2019-02-28 16:49:33 PST
<
rdar://problem/48494372
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug