<?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>83539</bug_id>
          
          <creation_ts>2012-04-09 19:11:46 -0700</creation_ts>
          <short_desc>Web Inspector: ASSERT attempting to unbind null contentDocument</short_desc>
          <delta_ts>2012-04-09 21:42:39 -0700</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 (Deprecated)</component>
          <version>528+ (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></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>apavlov</cc>
    
    <cc>bweinstein</cc>
    
    <cc>joepeck</cc>
    
    <cc>keishi</cc>
    
    <cc>loislo</cc>
    
    <cc>pfeldman</cc>
    
    <cc>pmuellr</cc>
    
    <cc>rik</cc>
    
    <cc>timothy</cc>
    
    <cc>webkit.review.bot</cc>
    
    <cc>yurys</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>598888</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2012-04-09 19:11:46 -0700</bug_when>
    <thetext>ASSERT:

    ASSERTION FAILED: !HashTranslator::equal(KeyTraits::emptyValue(), key)
    1   0x3b3c89b void WTF::HashTable&lt;WTF::RefPtr&lt;WebCore::Node&gt;, std::__1::pair&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int&gt;, WTF::PairFirstExtractor&lt;std::__1::pair&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int&gt; &gt;, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::PairHashTraits&lt;WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;, WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt; &gt;::checkKey&lt;WTF::HashMapTranslator&lt;WTF::PairHashTraits&lt;WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt; &gt;, WebCore::Node*&gt;(WebCore::Node* const&amp;)
    2   0x3b3c387 std::__1::pair&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int&gt;* WTF::HashTable&lt;WTF::RefPtr&lt;WebCore::Node&gt;, std::__1::pair&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int&gt;, WTF::PairFirstExtractor&lt;std::__1::pair&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int&gt; &gt;, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::PairHashTraits&lt;WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;, WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt; &gt;::lookup&lt;WTF::HashMapTranslator&lt;WTF::PairHashTraits&lt;WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt; &gt;, WebCore::Node*&gt;(WebCore::Node* const&amp;)
    3   0x3b413c4 WTF::HashMap&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;::inlineGet(WebCore::Node*) const
    4   0x3b2e6b4 WTF::HashMap&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;::get(WebCore::Node*) const
    5   0x3b231c1 WebCore::InspectorDOMAgent::unbind(WebCore::Node*, WTF::HashMap&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;*)
    6   0x3b23268 WebCore::InspectorDOMAgent::unbind(WebCore::Node*, WTF::HashMap&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;*)
    7   0x3b2337c WebCore::InspectorDOMAgent::unbind(WebCore::Node*, WTF::HashMap&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;*)
    8   0x3b2337c WebCore::InspectorDOMAgent::unbind(WebCore::Node*, WTF::HashMap&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;*)
    9   0x3b2337c WebCore::InspectorDOMAgent::unbind(WebCore::Node*, WTF::HashMap&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;*)
    10  0x3b23268 WebCore::InspectorDOMAgent::unbind(WebCore::Node*, WTF::HashMap&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;*)
    11  0x3b2337c WebCore::InspectorDOMAgent::unbind(WebCore::Node*, WTF::HashMap&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;*)
    12  0x3b2337c WebCore::InspectorDOMAgent::unbind(WebCore::Node*, WTF::HashMap&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;*)
    13  0x3b2337c WebCore::InspectorDOMAgent::unbind(WebCore::Node*, WTF::HashMap&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;*)
    14  0x3b2337c WebCore::InspectorDOMAgent::unbind(WebCore::Node*, WTF::HashMap&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;*)
    15  0x3b2337c WebCore::InspectorDOMAgent::unbind(WebCore::Node*, WTF::HashMap&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;*)
    16  0x3b2337c WebCore::InspectorDOMAgent::unbind(WebCore::Node*, WTF::HashMap&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;*)
    17  0x3b2337c WebCore::InspectorDOMAgent::unbind(WebCore::Node*, WTF::HashMap&lt;WTF::RefPtr&lt;WebCore::Node&gt;, int, WTF::PtrHash&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;WTF::RefPtr&lt;WebCore::Node&gt; &gt;, WTF::HashTraits&lt;int&gt; &gt;*)
    18  0x3b2cc6f WebCore::InspectorDOMAgent::didRemoveDOMNode(WebCore::Node*)
    19  0x3b68a7c WebCore::InspectorInstrumentation::didRemoveDOMNodeImpl(WebCore::InstrumentingAgents*, WebCore::Node*)
    20  0x3252d73 WebCore::InspectorInstrumentation::willRemoveDOMNode(WebCore::Document*, WebCore::Node*)
    21  0x324f9f9 WebCore::dispatchChildRemovalEvents(WebCore::Node*)
    22  0x324cde1 WebCore::willRemoveChild(WebCore::Node*)
    23  0x324a3ab WebCore::ContainerNode::removeChild(WebCore::Node*, int&amp;)
    24  0x4407db1 WebCore::Node::removeChild(WebCore::Node*, int&amp;)
    25  0x35cfda2 WebCore::DOMEditor::RemoveChildAction::redo(int&amp;)
    26  0x35cfc52 WebCore::DOMEditor::RemoveChildAction::perform(int&amp;)
    27  0x3b66d1c WebCore::InspectorHistory::perform(WTF::PassOwnPtr&lt;WebCore::InspectorHistory::Action&gt;, int&amp;)
    28  0x35cb24c WebCore::DOMEditor::removeChild(WebCore::Node*, WebCore::Node*, int&amp;)
    29  0x35cc087 WebCore::DOMEditor::removeChild(WebCore::Node*, WebCore::Node*, WTF::String*)
    30  0x3b26bb2 WebCore::InspectorDOMAgent::removeNode(WTF::String*, int)
    31  0x3b26c26 non-virtual thunk to WebCore::InspectorDOMAgent::removeNode(WTF::String*, int)

InspectorDOMAgent::unbind:

    ...
    if (node-&gt;isFrameOwnerElement()) {
        const HTMLFrameOwnerElement* frameOwner = static_cast&lt;const HTMLFrameOwnerElement*&gt;(node);
        if (m_domListener)
            m_domListener-&gt;didRemoveDocument(frameOwner-&gt;contentDocument());
        unbind(frameOwner-&gt;contentDocument(), nodesMap);
    }
    ...

I was unable to reproduce this, but its clear that contentDocument can be null so when we&apos;re trying
to unbind it we should avoid this if its null. Note that the bind side does null check:

   ...
   Document* doc = frameOwner-&gt;contentDocument();
   if (doc)
       value-&gt;setContentDocument(buildObjectForNode(doc, 0, nodesMap));
   ...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>598890</commentid>
    <comment_count>1</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2012-04-09 19:12:38 -0700</bug_when>
    <thetext>&lt;rdar://problem/11215264&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>598896</commentid>
    <comment_count>2</comment_count>
      <attachid>136374</attachid>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2012-04-09 19:16:03 -0700</bug_when>
    <thetext>Created attachment 136374
[PATCH] Proposed Fix

I was unable to reproduce this so I couldn&apos;t create a test case. =(

In the fix we still call didRemoveDocument because that handles null
and does other work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>598918</commentid>
    <comment_count>3</comment_count>
      <attachid>136374</attachid>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2012-04-09 19:41:35 -0700</bug_when>
    <thetext>Comment on attachment 136374
[PATCH] Proposed Fix

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

&gt; Source/WebCore/inspector/InspectorDOMAgent.cpp:338
&gt; +            m_domListener-&gt;didRemoveDocument(contentDocument);

Is it safe to pass a null contenDocument to didRemoveDocument?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>598929</commentid>
    <comment_count>4</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2012-04-09 19:56:04 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; (From update of attachment 136374 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=136374&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/inspector/InspectorDOMAgent.cpp:338
&gt; &gt; +            m_domListener-&gt;didRemoveDocument(contentDocument);
&gt; 
&gt; Is it safe to pass a null contenDocument to didRemoveDocument?

Yep, and I think its preferred since that does other work we might want:

    void InspectorCSSAgent::didRemoveDocument(Document* document)
    {
        if (document)
            m_documentToInspectorStyleSheet.remove(document);
        clearPseudoState(false);
    }</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>598989</commentid>
    <comment_count>5</comment_count>
      <attachid>136374</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-04-09 21:42:35 -0700</bug_when>
    <thetext>Comment on attachment 136374
[PATCH] Proposed Fix

Clearing flags on attachment: 136374

Committed r113675: &lt;http://trac.webkit.org/changeset/113675&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>598990</commentid>
    <comment_count>6</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-04-09 21:42:39 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>136374</attachid>
            <date>2012-04-09 19:16:03 -0700</date>
            <delta_ts>2012-04-09 21:42:34 -0700</delta_ts>
            <desc>[PATCH] Proposed Fix</desc>
            <filename>take1.patch</filename>
            <type>text/plain</type>
            <size>1665</size>
            <attacher name="Joseph Pecoraro">joepeck</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZyBiL1NvdXJjZS9XZWJDb3JlL0No
YW5nZUxvZwppbmRleCAxNzRlZDg4Li45NDYyZjVjIDEwMDY0NAotLS0gYS9Tb3VyY2UvV2ViQ29y
ZS9DaGFuZ2VMb2cKKysrIGIvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMTUg
QEAKKzIwMTItMDQtMDkgIEpvc2VwaCBQZWNvcmFybyAgPHBlY29yYXJvQGFwcGxlLmNvbT4KKwor
ICAgICAgICA8aHR0cDovL3dlYmtpdC5vcmcvYi84MzUzOT4gV2ViIEluc3BlY3RvcjogQVNTRVJU
IGF0dGVtcHRpbmcgdG8gdW5iaW5kIG51bGwgY29udGVudERvY3VtZW50CisKKyAgICAgICAgQXZv
aWQgY2FsbGluZyB1bmJpbmQgd2l0aCBhIG51bGwgb2JqZWN0LiBUaGUgSFRNTEZyYW1lT3duZXJF
bGVtZW50J3MKKyAgICAgICAgY29udGVudERvY3VtZW50IGNhbiBiZSBudWxsLgorCisgICAgICAg
IFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgICogaW5zcGVjdG9yL0luc3Bl
Y3RvckRPTUFnZW50LmNwcDoKKyAgICAgICAgKFdlYkNvcmU6Okluc3BlY3RvckRPTUFnZW50Ojp1
bmJpbmQpOgorCiAyMDEyLTA0LTA1ICBKb3NlcGggUGVjb3Jhcm8gIDxwZWNvcmFyb0BhcHBsZS5j
b20+C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ub2Rlc01hcCk7CisgICAgICAgICAgICBtX2RvbUxpc3RlbmVyLT5kaWRSZW1vdmVE
b2N1bWVudChjb250ZW50RG9jdW1lbnQpOworICAgICAgICBpZiAoY29udGVudERvY3VtZW50KQor
ICAgICAgICAgICAgdW5iaW5kKGNvbnRlbnREb2N1bWVudCwgbm9kZXNNYXApOwogICAgIH0KIAog
ICAgIGlmIChub2RlLT5pc0VsZW1lbnROb2RlKCkgJiYgdG9FbGVtZW50KG5vZGUpLT5oYXNTaGFk
b3dSb290KCkpIHsK
</data>

          </attachment>
      

    </bug>

</bugzilla>