Title: [242241] trunk
- Revision
- 242241
- Author
- joep...@webkit.org
- Date
- 2019-02-28 16:48:01 -0800 (Thu, 28 Feb 2019)
Log Message
Web Inspector: View.removeSubview not removing the element properly when not parented
https://bugs.webkit.org/show_bug.cgi?id=195146
Reviewed by Matt Baker.
Source/WebInspectorUI:
* UserInterface/Views/View.js:
(WI.View.prototype.removeSubview):
Since the element may not be a direct child, just use Element.prototype.remove.
LayoutTests:
* inspector/view/basics-expected.txt:
* inspector/view/basics.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (242240 => 242241)
--- trunk/LayoutTests/ChangeLog 2019-03-01 00:04:51 UTC (rev 242240)
+++ trunk/LayoutTests/ChangeLog 2019-03-01 00:48:01 UTC (rev 242241)
@@ -1,3 +1,13 @@
+2019-02-28 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: View.removeSubview not removing the element properly when not parented
+ https://bugs.webkit.org/show_bug.cgi?id=195146
+
+ Reviewed by Matt Baker.
+
+ * inspector/view/basics-expected.txt:
+ * inspector/view/basics.html:
+
2019-02-28 Myles C. Maxfield <mmaxfi...@apple.com>
Use-after-move in RenderCombineText::combineTextIfNeeded()
Modified: trunk/LayoutTests/inspector/view/basics-expected.txt (242240 => 242241)
--- trunk/LayoutTests/inspector/view/basics-expected.txt 2019-03-01 00:04:51 UTC (rev 242240)
+++ trunk/LayoutTests/inspector/view/basics-expected.txt 2019-03-01 00:48:01 UTC (rev 242241)
@@ -31,6 +31,9 @@
PASS: Removed view should not be included in the parent's subviews.
PASS: Removing a nonexistent view should have no effect.
+-- Running test case: View.removeSubview.IndirectDescendant
+PASS: Removed view should not be in the DOM.
+
-- Running test case: View.insertSubviewBefore
PASS: Inserting a view before `null` should append the view.
PASS: child2 should be inserted before dhild1.
Modified: trunk/LayoutTests/inspector/view/basics.html (242240 => 242241)
--- trunk/LayoutTests/inspector/view/basics.html 2019-03-01 00:04:51 UTC (rev 242240)
+++ trunk/LayoutTests/inspector/view/basics.html 2019-03-01 00:48:01 UTC (rev 242241)
@@ -82,6 +82,24 @@
});
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;
+ }
+ });
+
+ suite.addTestCase({
name: "View.insertSubviewBefore",
test() {
let parent = new WI.View;
Modified: trunk/Source/WebInspectorUI/ChangeLog (242240 => 242241)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-03-01 00:04:51 UTC (rev 242240)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-03-01 00:48:01 UTC (rev 242241)
@@ -1,3 +1,14 @@
+2019-02-28 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: View.removeSubview not removing the element properly when not parented
+ https://bugs.webkit.org/show_bug.cgi?id=195146
+
+ Reviewed by Matt Baker.
+
+ * UserInterface/Views/View.js:
+ (WI.View.prototype.removeSubview):
+ Since the element may not be a direct child, just use Element.prototype.remove.
+
2019-02-28 Matt Baker <mattba...@apple.com>
Web Inspector: Debugger: disabled breakpoint color is too dark
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/View.js (242240 => 242241)
--- trunk/Source/WebInspectorUI/UserInterface/Views/View.js 2019-03-01 00:04:51 UTC (rev 242240)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/View.js 2019-03-01 00:48:01 UTC (rev 242241)
@@ -108,6 +108,7 @@
this._subviews.insertAtIndex(view, beforeIndex);
+ console.assert(!view.element.parentNode || this._element.contains(view.element.parentNode), "Subview DOM element must be a descendant of the parent view element.");
if (!view.element.parentNode)
this._element.insertBefore(view.element, referenceView ? referenceView.element : null);
@@ -126,7 +127,7 @@
}
this._subviews.splice(index, 1);
- this._element.removeChild(view.element);
+ view.element.remove();
view._didMoveToParent(null);
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes