<?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>122572</bug_id>
          
          <creation_ts>2013-10-09 13:46:57 -0700</creation_ts>
          <short_desc>AX: Crash at WebCore::accessibleNameForNode when visiting Facebook</short_desc>
          <delta_ts>2013-10-10 06:41:21 -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>Accessibility</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>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="chris fleizach">cfleizach</reporter>
          <assigned_to name="chris fleizach">cfleizach</assigned_to>
          <cc>aboxhall</cc>
    
    <cc>apinheiro</cc>
    
    <cc>commit-queue</cc>
    
    <cc>dmazzoni</cc>
    
    <cc>jdiggs</cc>
    
    <cc>mario</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>938057</commentid>
    <comment_count>0</comment_count>
    <who name="chris fleizach">cfleizach</who>
    <bug_when>2013-10-09 13:46:57 -0700</bug_when>
    <thetext>&gt;  1 com.apple.WebCore              0x10bdb025f WebCore::accessibleNameForNode(WebCore::Node*) + 0x12f (AccessibilityNodeObject.cpp:1806)
   2 com.apple.WebCore              0x10bdb00e0 WebCore::AccessibilityNodeObject::accessibilityDescriptionForElements(WTF::Vector&lt;WebCore::Element*, 0ul, WTF::CrashOnOverflow&gt;&amp;) const + 0x80 (AccessibilityNodeObject.cpp:1825)
   3 com.apple.WebCore              0x10bdb0579 WebCore::AccessibilityNodeObject::ariaLabeledByAttribute() const + 0x49 (AccessibilityNodeObject.cpp:1877)
   4 com.apple.WebCore              0x10bdae4f3 WebCore::AccessibilityNodeObject::ariaLabeledByText(WTF::Vector&lt;WebCore::AccessibilityText, 0ul, WTF::CrashOnOverflow&gt;&amp;) const + 0x43 (AccessibilityNodeObject.cpp:1379)
   5 com.apple.WebCore              0x10bdadf25 WebCore::AccessibilityNodeObject::alternativeText(WTF::Vector&lt;WebCore::AccessibilityText, 0ul, WTF::CrashOnOverflow&gt;&amp;) const + 0xb5 (AccessibilityNodeObject.cpp:1236)
   6 com.apple.WebCore              0x10bdaed03 WebCore::AccessibilityNodeObject::accessibilityText(WTF::Vector&lt;WebCore::AccessibilityText, 0ul, WTF::CrashOnOverflow&gt;&amp;) + 0x43 (AccessibilityNodeObject.cpp:1368)
   7 com.apple.WebCore              0x10d7725fd -[WebAccessibilityObjectWrapperBase accessibilityDescription] + 0xbd (WebAccessibilityObjectWrapperBase.mm:198)
   8 com.apple.WebCore              0x10d77d195 -[WebAccessibilityObjectWrapper accessibilityAttributeValue:] + 0x1625 (WebAccessibilityObjectWrapperMac.mm:2177)
   9 com.apple.AppKit               0x7fff8884feb1 -[NSObject(NSAccessibilityInternal) _accessibilityValueForAttribute:clientError:] + 0xf2
  10 com.apple.AppKit               0x7fff88853f7d 


&lt;rdar://problem/15189506&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>938058</commentid>
    <comment_count>1</comment_count>
    <who name="chris fleizach">cfleizach</who>
    <bug_when>2013-10-09 13:47:32 -0700</bug_when>
    <thetext>Looks like they&apos;re probably doing something like

&lt;button aria-labeledby=&quot;item&quot;&gt;

&lt;div id=&quot;item&quot; style=&quot;display:none&quot;&gt;data&lt;/div&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>938082</commentid>
    <comment_count>2</comment_count>
      <attachid>213818</attachid>
    <who name="chris fleizach">cfleizach</who>
    <bug_when>2013-10-09 14:42:37 -0700</bug_when>
    <thetext>Created attachment 213818
patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>938262</commentid>
    <comment_count>3</comment_count>
      <attachid>213818</attachid>
    <who name="Mario Sanchez Prada">mario</who>
    <bug_when>2013-10-10 03:29:29 -0700</bug_when>
    <thetext>Comment on attachment 213818
patch

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

&gt; Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1814
&gt; -    String text = node-&gt;document().axObjectCache()-&gt;getOrCreate(node)-&gt;textUnderElement();
&gt; +    // If the node can be turned into an AX object, we can use standard name computation rules.
&gt; +    // If however, the node cannot (because there&apos;s no renderer e.g.) fallback to using the basic text underneath.
&gt; +    AccessibilityObject* axObject = node-&gt;document().axObjectCache()-&gt;getOrCreate(node);
&gt; +    String text;
&gt; +    if (axObject)
&gt; +        text = axObject-&gt;textUnderElement();
&gt; +    else if (node-&gt;isElementNode())
&gt; +        text = toElement(node)-&gt;innerText();
&gt; +    

I wonder if we could fix this issue in a different way, by making AXObjectCache::getOrCreate(Node* node) able to handle this kind of situation, creating a AccessibilityNodeObject that wraps that not rendered node inside.

What do you think?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>938303</commentid>
    <comment_count>4</comment_count>
    <who name="chris fleizach">cfleizach</who>
    <bug_when>2013-10-10 05:56:54 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; (From update of attachment 213818 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=213818&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1814
&gt; &gt; -    String text = node-&gt;document().axObjectCache()-&gt;getOrCreate(node)-&gt;textUnderElement();
&gt; &gt; +    // If the node can be turned into an AX object, we can use standard name computation rules.
&gt; &gt; +    // If however, the node cannot (because there&apos;s no renderer e.g.) fallback to using the basic text underneath.
&gt; &gt; +    AccessibilityObject* axObject = node-&gt;document().axObjectCache()-&gt;getOrCreate(node);
&gt; &gt; +    String text;
&gt; &gt; +    if (axObject)
&gt; &gt; +        text = axObject-&gt;textUnderElement();
&gt; &gt; +    else if (node-&gt;isElementNode())
&gt; &gt; +        text = toElement(node)-&gt;innerText();
&gt; &gt; +    
&gt; 
&gt; I wonder if we could fix this issue in a different way, by making AXObjectCache::getOrCreate(Node* node) able to handle this kind of situation, creating a AccessibilityNodeObject that wraps that not rendered node inside.
&gt; 
&gt; What do you think?

Certainly getOrCreate could return an object, but there&apos;s a bit of code to ensure we only return a AXNode based object under certain conditions (either in a canvas or aria-hidden=false). Hard for me to say if there&apos;s any negative consequence of doing that. It might allow more elements into the tree than we would like...

For example, we definitely don&apos;t want to add objects that are just hidden to the tree, as in &lt;div style=&quot;display:none;&quot;&gt; sub tree here &lt;/div&gt;

So it could be done, but I am less sure of the consequences of doing that right now.

Thoughts</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>938306</commentid>
    <comment_count>5</comment_count>
      <attachid>213818</attachid>
    <who name="Mario Sanchez Prada">mario</who>
    <bug_when>2013-10-10 06:04:39 -0700</bug_when>
    <thetext>Comment on attachment 213818
patch

(In reply to comment #4)
&gt; &gt; I wonder if we could fix this issue in a different way, by making
&gt; &gt; AXObjectCache::getOrCreate(Node* node) able to handle this kind of situation,
&gt; &gt; creating a AccessibilityNodeObject that wraps that not rendered node inside.
&gt; &gt; 
&gt; &gt; What do you think?
&gt; 
&gt; Certainly getOrCreate could return an object, but there&apos;s a bit of code
&gt; to ensure we only return a AXNode based object under certain conditions
&gt; (either in a canvas or aria-hidden=false). Hard for me to say if there&apos;s
&gt; any negative consequence of doing that. It might allow more elements
&gt; into the tree than we would like...
&gt; 
Yes, I&apos;ve seen that code and it&apos;s not clear to me either. That&apos;s why I ask.

&gt; For example, we definitely don&apos;t want to add objects that are just hidden
&gt; to the tree, as in &lt;div style=&quot;display:none;&quot;&gt; sub tree here &lt;/div&gt;
&gt; 
Agreed.

&gt; So it could be done, but I am less sure of the consequences of doing that
&gt; right now.
&gt; 
Fair enough. Let&apos;s give this a try then :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>938317</commentid>
    <comment_count>6</comment_count>
      <attachid>213818</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2013-10-10 06:41:19 -0700</bug_when>
    <thetext>Comment on attachment 213818
patch

Clearing flags on attachment: 213818

Committed r157221: &lt;http://trac.webkit.org/changeset/157221&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>938318</commentid>
    <comment_count>7</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2013-10-10 06:41:21 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>213818</attachid>
            <date>2013-10-09 14:42:37 -0700</date>
            <delta_ts>2013-10-10 06:41:19 -0700</delta_ts>
            <desc>patch</desc>
            <filename>patch</filename>
            <type>text/plain</type>
            <size>4226</size>
            <attacher name="chris fleizach">cfleizach</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDE1NzE4NSkKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDE3IEBACisyMDEzLTEwLTA5ICBDaHJpcyBG
bGVpemFjaCAgPGNmbGVpemFjaEBhcHBsZS5jb20+CisKKyAgICAgICAgQVg6IENyYXNoIGF0IFdl
YkNvcmU6OmFjY2Vzc2lib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