Title: [90013] trunk
Revision
90013
Author
[email protected]
Date
2011-06-29 06:47:00 -0700 (Wed, 29 Jun 2011)

Log Message

2011-06-29  Pavel Feldman  <[email protected]>

        Reviewed by Yury Semikhatsky.

        Web Inspector: tab crash after deleting trailing quote when editing attribute
        https://bugs.webkit.org/show_bug.cgi?id=63544

        * inspector/elements/set-attribute-expected.txt:
        * inspector/elements/set-attribute.html:
2011-06-29  Pavel Feldman  <[email protected]>

        Reviewed by Yury Semikhatsky.

        Web Inspector: tab crash after deleting trailing quote when editing attribute
        https://bugs.webkit.org/show_bug.cgi?id=63544

        * inspector/InspectorDOMAgent.cpp:
        (WebCore::InspectorDOMAgent::setAttributesText):
        * inspector/front-end/ElementsTreeOutline.js:
        (WebInspector.ElementsTreeElement.prototype._attributeEditingCommitted.moveToNextAttributeIfNeeded):
        (WebInspector.ElementsTreeElement.prototype._attributeEditingCommitted):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (90012 => 90013)


--- trunk/LayoutTests/ChangeLog	2011-06-29 13:42:54 UTC (rev 90012)
+++ trunk/LayoutTests/ChangeLog	2011-06-29 13:47:00 UTC (rev 90013)
@@ -1,3 +1,13 @@
+2011-06-29  Pavel Feldman  <[email protected]>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: tab crash after deleting trailing quote when editing attribute
+        https://bugs.webkit.org/show_bug.cgi?id=63544
+
+        * inspector/elements/set-attribute-expected.txt:
+        * inspector/elements/set-attribute.html:
+
 2011-06-29  Philippe Normand  <[email protected]>
 
         Unreviewed, remove erroneous test name from GTK Skipped list.

Modified: trunk/LayoutTests/inspector/elements/set-attribute-expected.txt (90012 => 90013)


--- trunk/LayoutTests/inspector/elements/set-attribute-expected.txt	2011-06-29 13:42:54 UTC (rev 90012)
+++ trunk/LayoutTests/inspector/elements/set-attribute-expected.txt	2011-06-29 13:47:00 UTC (rev 90013)
@@ -25,3 +25,8 @@
 === Remove attribute as text ===
   <div id="node" foo2="baz2"></div>
 
+Running: testSetMalformedAttributeText
+Error: Could not parse value as attributes.
+=== Set malformed attribute as text ===
+  <div id="node" foo2="baz2"></div>
+

Modified: trunk/LayoutTests/inspector/elements/set-attribute.html (90012 => 90013)


--- trunk/LayoutTests/inspector/elements/set-attribute.html	2011-06-29 13:42:54 UTC (rev 90012)
+++ trunk/LayoutTests/inspector/elements/set-attribute.html	2011-06-29 13:47:00 UTC (rev 90013)
@@ -96,6 +96,19 @@
             }
             WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModified, callback);
             targetNode.setAttribute("foo3", "");
+        },
+
+        function testSetMalformedAttributeText(next)
+        {
+            function callback(error)
+            {
+                InspectorTest.addResult("Error: " + error.data[0]);
+                WebInspector.domAgent.removeEventListener(WebInspector.DOMAgent.Events.AttrModified, callback);
+                InspectorTest.addResult("=== Set malformed attribute as text ===");
+                InspectorTest.dumpElementsTree(targetNode);
+                next();
+            }
+            targetNode.setAttribute("foo2", "foo2='missingquote", callback);
         }
     ]);
 }

Modified: trunk/Source/WebCore/ChangeLog (90012 => 90013)


--- trunk/Source/WebCore/ChangeLog	2011-06-29 13:42:54 UTC (rev 90012)
+++ trunk/Source/WebCore/ChangeLog	2011-06-29 13:47:00 UTC (rev 90013)
@@ -1,3 +1,16 @@
+2011-06-29  Pavel Feldman  <[email protected]>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: tab crash after deleting trailing quote when editing attribute
+        https://bugs.webkit.org/show_bug.cgi?id=63544
+
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::setAttributesText):
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeElement.prototype._attributeEditingCommitted.moveToNextAttributeIfNeeded):
+        (WebInspector.ElementsTreeElement.prototype._attributeEditingCommitted):
+
 2011-06-29  Vsevolod Vlasov  <[email protected]>
 
         Reviewed by Pavel Feldman.

Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (90012 => 90013)


--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2011-06-29 13:42:54 UTC (rev 90012)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2011-06-29 13:47:00 UTC (rev 90013)
@@ -603,7 +603,13 @@
         return;
     }
 
-    const NamedNodeMap* attrMap = toHTMLElement(parsedElement->firstChild())->attributes(true);
+    Node* child = parsedElement->firstChild();
+    if (!child) {
+        *errorString = "Could not parse value as attributes.";
+        return;
+    }
+
+    const NamedNodeMap* attrMap = toHTMLElement(child)->attributes(true);
     if (!attrMap && name) {
         element->removeAttribute(*name, ec);
         if (ec)

Modified: trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js (90012 => 90013)


--- trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2011-06-29 13:42:54 UTC (rev 90012)
+++ trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2011-06-29 13:47:00 UTC (rev 90013)
@@ -1061,6 +1061,12 @@
 
         function moveToNextAttributeIfNeeded(error)
         {
+            if (error)
+                this._editingCancelled(element, attributeName);
+
+            if (!moveDirection)
+                return;
+
             WebInspector.panels.elements.updateModifiedNodes();
 
             // Search for the attribute's position, and then decide where to move to.
@@ -1102,7 +1108,7 @@
             }
         }
 
-        this.representedObject.setAttribute(attributeName, newText, moveDirection ? moveToNextAttributeIfNeeded.bind(this) : undefined);
+        this.representedObject.setAttribute(attributeName, newText, moveToNextAttributeIfNeeded.bind(this));
     },
 
     _tagNameEditingCommitted: function(element, newText, oldText, tagName, moveDirection)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to