Title: [90018] branches/chromium/782
- Revision
- 90018
- Author
- [email protected]
- Date
- 2011-06-29 08:17:24 -0700 (Wed, 29 Jun 2011)
Log Message
Merge 90013 - 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):
[email protected]
BUG=87895
Review URL: http://codereview.chromium.org/7280007
Modified Paths
Diff
Modified: branches/chromium/782/LayoutTests/inspector/elements/set-attribute.html (90017 => 90018)
--- branches/chromium/782/LayoutTests/inspector/elements/set-attribute.html 2011-06-29 14:38:06 UTC (rev 90017)
+++ branches/chromium/782/LayoutTests/inspector/elements/set-attribute.html 2011-06-29 15:17:24 UTC (rev 90018)
@@ -52,6 +52,19 @@
next();
}
InspectorTest.evaluateInPage("removeAttribute('name')", callback);
+ },
+
+ 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: branches/chromium/782/Source/WebCore/inspector/InspectorDOMAgent.cpp (90017 => 90018)
--- branches/chromium/782/Source/WebCore/inspector/InspectorDOMAgent.cpp 2011-06-29 14:38:06 UTC (rev 90017)
+++ branches/chromium/782/Source/WebCore/inspector/InspectorDOMAgent.cpp 2011-06-29 15:17:24 UTC (rev 90018)
@@ -589,7 +589,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) {
element->removeAttribute(name, ec);
if (ec)
Modified: branches/chromium/782/Source/WebCore/inspector/front-end/ElementsTreeOutline.js (90017 => 90018)
--- branches/chromium/782/Source/WebCore/inspector/front-end/ElementsTreeOutline.js 2011-06-29 14:38:06 UTC (rev 90017)
+++ branches/chromium/782/Source/WebCore/inspector/front-end/ElementsTreeOutline.js 2011-06-29 15:17:24 UTC (rev 90018)
@@ -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