<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[166295] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/166295">166295</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-03-26 08:18:30 -0700 (Wed, 26 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: AXI: crash when inspecting &quot;bar&quot; text node in getAccessibilityPropertiesForNode layout test
https://bugs.webkit.org/show_bug.cgi?id=130290

Patch by James Craig &lt;jcraig@apple.com&gt; on 2014-03-26
Reviewed by Timothy Hatcher.

Source/WebCore:

Test: inspector-protocol/dom/getAccessibilityPropertiesForNode.html

Fixing regression from <a href="http://trac.webkit.org/projects/webkit/changeset/165590">r165590</a>. http://webkit.org/b/129779
Verify isElementNode to avoid calling toElement on document or text nodes.

* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):

LayoutTests:

Updating test to include properties for document node.

* inspector-protocol/dom/getAccessibilityPropertiesForNode-expected.txt:
* inspector-protocol/dom/getAccessibilityPropertiesForNode.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocoldomgetAccessibilityPropertiesForNodeexpectedtxt">trunk/LayoutTests/inspector-protocol/dom/getAccessibilityPropertiesForNode-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocoldomgetAccessibilityPropertiesForNodehtml">trunk/LayoutTests/inspector-protocol/dom/getAccessibilityPropertiesForNode.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorDOMAgentcpp">trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (166294 => 166295)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-03-26 15:12:48 UTC (rev 166294)
+++ trunk/LayoutTests/ChangeLog        2014-03-26 15:18:30 UTC (rev 166295)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-03-26  James Craig  &lt;jcraig@apple.com&gt;
+
+        Web Inspector: AXI: crash when inspecting &quot;bar&quot; text node in getAccessibilityPropertiesForNode layout test
+        https://bugs.webkit.org/show_bug.cgi?id=130290
+
+        Reviewed by Timothy Hatcher.
+
+        Updating test to include properties for document node.
+
+        * inspector-protocol/dom/getAccessibilityPropertiesForNode-expected.txt:
+        * inspector-protocol/dom/getAccessibilityPropertiesForNode.html:
+
</ins><span class="cx"> 2014-03-26  Manuel Rego Casasnovas  &lt;rego@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Grid Layout] Prevent issues with checkLayout() in grid items
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocoldomgetAccessibilityPropertiesForNodeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector-protocol/dom/getAccessibilityPropertiesForNode-expected.txt (166294 => 166295)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/dom/getAccessibilityPropertiesForNode-expected.txt        2014-03-26 15:12:48 UTC (rev 166294)
+++ trunk/LayoutTests/inspector-protocol/dom/getAccessibilityPropertiesForNode-expected.txt        2014-03-26 15:18:30 UTC (rev 166295)
</span><span class="lines">@@ -1,5 +1,12 @@
</span><span class="cx"> Checking Web Inspector protocol for the Accessibility Node Inspector.
</span><span class="cx"> 
</span><ins>+#document
+    exists: true
+    label: 
+    role: 
+    childNodeIds.length: 19
+
+
</ins><span class="cx"> Total elements to be tested: 57.
</span><span class="cx"> 
</span><span class="cx"> &lt;li role=&quot;treeitem&quot; aria-expanded=&quot;undefined&quot;&gt;expanded&lt;/li&gt;
</span><span class="lines">@@ -446,5 +453,3 @@
</span><span class="cx">     label: 
</span><span class="cx">     role: 
</span><span class="cx"> 
</span><del>-
-
</del></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocoldomgetAccessibilityPropertiesForNodehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector-protocol/dom/getAccessibilityPropertiesForNode.html (166294 => 166295)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/dom/getAccessibilityPropertiesForNode.html        2014-03-26 15:12:48 UTC (rev 166294)
+++ trunk/LayoutTests/inspector-protocol/dom/getAccessibilityPropertiesForNode.html        2014-03-26 15:18:30 UTC (rev 166295)
</span><span class="lines">@@ -113,43 +113,56 @@
</span><span class="cx"> function test() {
</span><span class="cx"> 
</span><span class="cx">     var examples = [];
</span><ins>+    var documentNodeId = null;
</ins><span class="cx"> 
</span><del>-    function loop() {
-        if (examples.length) {
-            InspectorTest.sendCommand(&quot;DOM.getOuterHTML&quot;, {&quot;nodeId&quot;: examples[examples.length-1]}, onGotOuterHTML);
-        } else {
-            InspectorTest.log(&quot;\n&quot;);
-            InspectorTest.sendCommand(&quot;Runtime.evaluate&quot;, {&quot;expression&quot;: &quot;cleanup()&quot;}, function(){
-                InspectorTest.completeTest();
-            });
-        }
-    };
-
</del><span class="cx">     function onGotDocument(response) {
</span><span class="cx">         InspectorTest.checkForError(response);
</span><del>-        InspectorTest.sendCommand(&quot;DOM.querySelectorAll&quot;, {&quot;nodeId&quot;: response.result.root.nodeId, &quot;selector&quot;: &quot;.ex&quot;}, onQuerySelectorAll);
</del><ins>+        documentNodeId = response.result.root.nodeId;
+        InspectorTest.sendCommand(&quot;DOM.getAccessibilityPropertiesForNode&quot;, {&quot;nodeId&quot;: documentNodeId}, onGotAccessibilityPropertiesForDocumentNode);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    function onQuerySelectorAll(response) {
</del><ins>+    function onGotAccessibilityPropertiesForDocumentNode(response) {
</ins><span class="cx">         InspectorTest.checkForError(response);
</span><ins>+        InspectorTest.log(&quot;#document&quot;);
+        logAccessibilityProperties(response.result.properties);
+        InspectorTest.log(&quot;\n&quot;);
+        InspectorTest.sendCommand(&quot;DOM.querySelectorAll&quot;, {&quot;nodeId&quot;: documentNodeId, &quot;selector&quot;: &quot;.ex&quot;}, onGotQuerySelectorAll);
+    }
+
+    function onGotQuerySelectorAll(response) {
+        InspectorTest.checkForError(response);
</ins><span class="cx">         examples = response.result.nodeIds;
</span><span class="cx">         InspectorTest.log(&quot;Total elements to be tested: &quot; + examples.length + &quot;.&quot;);
</span><span class="cx">         loop();
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    function loop() {
+        if (examples.length) {
+            InspectorTest.sendCommand(&quot;DOM.getOuterHTML&quot;, {&quot;nodeId&quot;: examples[examples.length-1]}, onGotOuterHTML);
+        } else {
+            finishTest();
+        }
+    }
+
</ins><span class="cx">     function onGotOuterHTML(response) {
</span><span class="cx">         InspectorTest.checkForError(response);
</span><span class="cx">         var outerHTML = response.result.outerHTML;
</span><span class="cx">         outerHTML = outerHTML.replace(/ class=&quot;ex&quot;/g, &quot;&quot;); // remove any duplicated, unnecessary class attributes
</span><span class="cx">         outerHTML = outerHTML.replace(/;base64,.*?&quot;/, &quot;...\&quot;&quot;); // suppress full data URIs in output
</span><span class="cx">         InspectorTest.log(&quot;\n&quot; + outerHTML);
</span><del>-        InspectorTest.sendCommand(&quot;DOM.getAccessibilityPropertiesForNode&quot;, {&quot;nodeId&quot;: examples[examples.length-1]}, onGotAXProps);
</del><ins>+        InspectorTest.sendCommand(&quot;DOM.getAccessibilityPropertiesForNode&quot;, {&quot;nodeId&quot;: examples[examples.length-1]}, onGotAccessibilityProperties);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    function onGotAXProps(response) {
</del><ins>+    function onGotAccessibilityProperties(response) {
</ins><span class="cx">         InspectorTest.checkForError(response);
</span><del>-        for (var key in response.result.properties) {
-            var value = response.result.properties[key];
</del><ins>+        logAccessibilityProperties(response.result.properties);
+        examples.pop();
+        loop();
+    }
+
+    function logAccessibilityProperties(properties) {
+        for (var key in properties) {
+            var value = properties[key];
</ins><span class="cx">             switch (key){
</span><span class="cx">             case &quot;nodeId&quot;:
</span><span class="cx">                 continue;
</span><span class="lines">@@ -169,10 +182,16 @@
</span><span class="cx">                 InspectorTest.log(&quot;    &quot; + key + &quot;: &quot; + value);
</span><span class="cx">             }
</span><span class="cx">         }
</span><del>-        examples.pop();
-        loop();
</del><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    function finishTest() {
+        InspectorTest.sendCommand(&quot;Runtime.evaluate&quot;, {&quot;expression&quot;: &quot;cleanup()&quot;}, function(){
+            InspectorTest.completeTest();
+        });
+    }
+
+
+
</ins><span class="cx">     InspectorTest.sendCommand(&quot;DOM.getDocument&quot;, {}, onGotDocument);
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (166294 => 166295)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-03-26 15:12:48 UTC (rev 166294)
+++ trunk/Source/WebCore/ChangeLog        2014-03-26 15:18:30 UTC (rev 166295)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-03-26  James Craig  &lt;jcraig@apple.com&gt;
+
+        Web Inspector: AXI: crash when inspecting &quot;bar&quot; text node in getAccessibilityPropertiesForNode layout test
+        https://bugs.webkit.org/show_bug.cgi?id=130290
+
+        Reviewed by Timothy Hatcher.
+
+        Test: inspector-protocol/dom/getAccessibilityPropertiesForNode.html
+
+        Fixing regression from r165590. http://webkit.org/b/129779
+        Verify isElementNode to avoid calling toElement on document or text nodes.
+
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
+
</ins><span class="cx"> 2014-03-25  Sergio Villar Senin  &lt;svillar@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Replace DEPRECATED_DEFINE_STATIC_LOCAL by static NeverDestroyed&lt;T&gt; in editing/
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorDOMAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (166294 => 166295)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp        2014-03-26 15:12:48 UTC (rev 166294)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp        2014-03-26 15:18:30 UTC (rev 166295)
</span><span class="lines">@@ -1504,9 +1504,11 @@
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx">             
</span><del>-            supportsFocused = toElement(node)-&gt;isFocusable();
-            if (supportsFocused)
-                focused = axObject-&gt;isFocused();
</del><ins>+            if (node-&gt;isElementNode()) {
+                supportsFocused = toElement(node)-&gt;isFocusable();
+                if (supportsFocused)
+                    focused = axObject-&gt;isFocused();
+            }
</ins><span class="cx"> 
</span><span class="cx">             ignored = axObject-&gt;accessibilityIsIgnored();
</span><span class="cx">             ignoredByDefault = axObject-&gt;accessibilityIsIgnoredByDefault();
</span></span></pre>
</div>
</div>

</body>
</html>