<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>195146</bug_id>
          
          <creation_ts>2019-02-27 22:57:37 -0800</creation_ts>
          <short_desc>Web Inspector: View.removeSubview not removing the element properly when not parented</short_desc>
          <delta_ts>2019-02-28 16:49:33 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Inspector</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Joseph Pecoraro">joepeck</assigned_to>
          <cc>inspector-bugzilla-changes</cc>
    
    <cc>joepeck</cc>
    
    <cc>mattbaker</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1510821</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2019-02-27 22:57:37 -0800</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1510822</commentid>
    <comment_count>1</comment_count>
      <attachid>363193</attachid>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2019-02-27 22:58:43 -0800</bug_when>
    <thetext>Created attachment 363193
[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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1510856</commentid>
    <comment_count>2</comment_count>
      <attachid>363193</attachid>
    <who name="Matt Baker">mattbaker</who>
    <bug_when>2019-02-28 00:30:08 -0800</bug_when>
    <thetext>Comment on attachment 363193
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=363193&amp;action=review

&gt; Source/WebInspectorUI/ChangeLog:10
&gt; +        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&apos;s DOM element:

console.assert(!view.element.parentNode || this._element.contains(view.element.parentNode), &quot;Subview DOM element must be a descendant of the parent view element.&quot;);

This can balance the assertion at the top of View.removeSubview.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1510859</commentid>
    <comment_count>3</comment_count>
      <attachid>363193</attachid>
    <who name="Matt Baker">mattbaker</who>
    <bug_when>2019-02-28 00:35:11 -0800</bug_when>
    <thetext>Comment on attachment 363193
[PATCH] Proposed Fix

r=me

We should add a test to LayoutTests/inspector/view/basics.html:

suite.addTestCase({
    name: &quot;View.removeSubview.IndirectDescendant&quot;,
    test() {
        let parent = new WI.View;
        let middleElement = parent.element.appendChild(document.createElement(&quot;div&quot;));

        let child = new WI.View;
        middleElement.appendChild(child.element);

        parent.addSubview(child);
        parent.removeSubview(child);

        InspectorTest.expectFalse(child.element.parentNode, &quot;Removed view should not be in the DOM.&quot;);

        return true;
    }
});</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1511180</commentid>
    <comment_count>4</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2019-02-28 16:20:11 -0800</bug_when>
    <thetext>Great suggestions, taking both!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1511201</commentid>
    <comment_count>5</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2019-02-28 16:48:39 -0800</bug_when>
    <thetext>https://trac.webkit.org/r242241</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1511205</commentid>
    <comment_count>6</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2019-02-28 16:49:33 -0800</bug_when>
    <thetext>&lt;rdar://problem/48494372&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>363193</attachid>
            <date>2019-02-27 22:58:43 -0800</date>
            <delta_ts>2019-02-28 16:20:03 -0800</delta_ts>
            <desc>[PATCH] Proposed Fix</desc>
            <filename>view-1.patch</filename>
            <type>text/plain</type>
            <size>1297</size>
            <attacher name="Joseph Pecoraro">joepeck</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJJbnNwZWN0b3JVSS9DaGFuZ2VMb2cgYi9Tb3VyY2UvV2Vi
SW5zcGVjdG9yVUkvQ2hhbmdlTG9nCmluZGV4IDY2YzE1Yjg3NjdiLi45MDMxMjkzMTdkYSAxMDA2
NDQKLS0tIGEvU291cmNlL1dlYkluc3BlY3RvclVJL0NoYW5nZUxvZworKysgYi9Tb3VyY2UvV2Vi
SW5zcGVjdG9yVUkvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMTQgQEAKKzIwMTktMDItMjcgIEpvc2Vw
aCBQZWNvcmFybyAgPHBlY29yYXJvQGFwcGxlLmNvbT4KKworICAgICAgICBXZWIgSW5zcGVjdG9y
OiBWaWV3LnJlbW92ZVN1YnZpZXcgbm90IHJlbW92aW5nIHRoZSBlbGVtZW50IHByb3Blcmx5IHdo
ZW4gbm90IHBhcmVudGVkCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVn
LmNnaT9pZD0xOTUxNDYKKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KKwor
ICAg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uX2RpZE1vdmVUb1BhcmVudChudWxsKTsKICAgICB9Cg==
</data>
<flag name="review"
          id="379807"
          type_id="1"
          status="+"
          setter="mattbaker"
    />
          </attachment>
      

    </bug>

</bugzilla>