- Revision
- 110925
- Author
- [email protected]
- Date
- 2012-03-15 18:24:07 -0700 (Thu, 15 Mar 2012)
Log Message
REGRESSION(r103452): 100% CPU usage and 5s pause after clicking on a link in Yahoo Mail
https://bugs.webkit.org/show_bug.cgi?id=81141
Reviewed by Ojan Vafai.
Source/WebCore:
Revert the behavior change from r103452: don't fire DOMSubtreeModified
events when an attribute value merely changes. Still fire that event
when an attribute is added or removed from an element.
Though this contradicts the DOM3 spec, it matches legacy WebKit behavior,
and given that Mutation Events are deprecated, it seems unwise to make
any additions to WebKit's implementation of them.
Test: fast/dom/subtree-modified-attributes.html
* dom/Element.cpp:
(WebCore::Element::didAddAttribute): Renamed from didModifyAttribute.
(WebCore::Element::didModifyAttribute): Remove the call to dispatchSubtreeModifiedEvent.
(WebCore):
* dom/Element.h:
(Element):
* dom/ElementAttributeData.cpp:
(WebCore::ElementAttributeData::addAttribute): Call didAddAttribute instead of didModifyAttribute.
LayoutTests:
* fast/dom/subtree-modified-attributes-expected.txt: Added.
* fast/dom/subtree-modified-attributes.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (110924 => 110925)
--- trunk/LayoutTests/ChangeLog 2012-03-16 01:08:09 UTC (rev 110924)
+++ trunk/LayoutTests/ChangeLog 2012-03-16 01:24:07 UTC (rev 110925)
@@ -1,3 +1,13 @@
+2012-03-15 Adam Klein <[email protected]>
+
+ REGRESSION(r103452): 100% CPU usage and 5s pause after clicking on a link in Yahoo Mail
+ https://bugs.webkit.org/show_bug.cgi?id=81141
+
+ Reviewed by Ojan Vafai.
+
+ * fast/dom/subtree-modified-attributes-expected.txt: Added.
+ * fast/dom/subtree-modified-attributes.html: Added.
+
2012-03-15 Levi Weintraub <[email protected]>
Unreviewed gardening. Fixing Chromium expectations after we began falling back to the failing
Added: trunk/LayoutTests/fast/dom/subtree-modified-attributes-expected.txt (0 => 110925)
--- trunk/LayoutTests/fast/dom/subtree-modified-attributes-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/subtree-modified-attributes-expected.txt 2012-03-16 01:24:07 UTC (rev 110925)
@@ -0,0 +1,13 @@
+DOMSubtreeModified should fire when attributes are added or removed, but not modified (see bug 81141)
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS expected is true
+PASS expected is true
+PASS expected is true
+PASS expected is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/subtree-modified-attributes.html (0 => 110925)
--- trunk/LayoutTests/fast/dom/subtree-modified-attributes.html (rev 0)
+++ trunk/LayoutTests/fast/dom/subtree-modified-attributes.html 2012-03-16 01:24:07 UTC (rev 110925)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<body>
+<script src=""
+<script>
+description('DOMSubtreeModified should fire when attributes are added or removed, but not modified (see bug 81141)');
+
+var div = document.createElement('div');
+document.body.appendChild(div);
+var expected = false;
+div.addEventListener('DOMSubtreeModified', function(evt) {
+ shouldBeTrue('expected');
+});
+expected = true;
+div.setAttribute('foo', 'bar');
+expected = false;
+div.setAttribute('foo', 'baz');
+expected = true;
+div.removeAttribute('foo');
+
+var attr = document.createAttribute('bar');
+attr.value = 'foo';
+expected = true;
+div.setAttributeNode(attr);
+expected = false;
+attr.value = 'bar';
+expected = true;
+div.removeAttributeNode(attr);
+</script>
+<script src=""
+</body>
Modified: trunk/Source/WebCore/ChangeLog (110924 => 110925)
--- trunk/Source/WebCore/ChangeLog 2012-03-16 01:08:09 UTC (rev 110924)
+++ trunk/Source/WebCore/ChangeLog 2012-03-16 01:24:07 UTC (rev 110925)
@@ -1,3 +1,29 @@
+2012-03-15 Adam Klein <[email protected]>
+
+ REGRESSION(r103452): 100% CPU usage and 5s pause after clicking on a link in Yahoo Mail
+ https://bugs.webkit.org/show_bug.cgi?id=81141
+
+ Reviewed by Ojan Vafai.
+
+ Revert the behavior change from r103452: don't fire DOMSubtreeModified
+ events when an attribute value merely changes. Still fire that event
+ when an attribute is added or removed from an element.
+
+ Though this contradicts the DOM3 spec, it matches legacy WebKit behavior,
+ and given that Mutation Events are deprecated, it seems unwise to make
+ any additions to WebKit's implementation of them.
+
+ Test: fast/dom/subtree-modified-attributes.html
+
+ * dom/Element.cpp:
+ (WebCore::Element::didAddAttribute): Renamed from didModifyAttribute.
+ (WebCore::Element::didModifyAttribute): Remove the call to dispatchSubtreeModifiedEvent.
+ (WebCore):
+ * dom/Element.h:
+ (Element):
+ * dom/ElementAttributeData.cpp:
+ (WebCore::ElementAttributeData::addAttribute): Call didAddAttribute instead of didModifyAttribute.
+
2012-03-15 Dana Jansens <[email protected]>
[chromium] Move overdraw metrics into a templated class for both paint and draw metrics.
Modified: trunk/Source/WebCore/dom/Element.cpp (110924 => 110925)
--- trunk/Source/WebCore/dom/Element.cpp 2012-03-16 01:08:09 UTC (rev 110924)
+++ trunk/Source/WebCore/dom/Element.cpp 2012-03-16 01:24:07 UTC (rev 110925)
@@ -2005,14 +2005,20 @@
#endif
}
-void Element::didModifyAttribute(Attribute* attr)
+void Element::didAddAttribute(Attribute* attr)
{
attributeChanged(attr);
-
InspectorInstrumentation::didModifyDOMAttr(document(), this, attr->name().localName(), attr->value());
dispatchSubtreeModifiedEvent();
}
+void Element::didModifyAttribute(Attribute* attr)
+{
+ attributeChanged(attr);
+ InspectorInstrumentation::didModifyDOMAttr(document(), this, attr->name().localName(), attr->value());
+ // Do not dispatch a DOMSubtreeModified event here; see bug 81141.
+}
+
void Element::didRemoveAttribute(Attribute* attr)
{
if (attr->isNull())
Modified: trunk/Source/WebCore/dom/Element.h (110924 => 110925)
--- trunk/Source/WebCore/dom/Element.h 2012-03-16 01:08:09 UTC (rev 110924)
+++ trunk/Source/WebCore/dom/Element.h 2012-03-16 01:24:07 UTC (rev 110925)
@@ -295,6 +295,7 @@
void willModifyAttribute(const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue);
void willRemoveAttribute(const QualifiedName&, const AtomicString& value);
+ void didAddAttribute(Attribute*);
void didModifyAttribute(Attribute*);
void didRemoveAttribute(Attribute*);
Modified: trunk/Source/WebCore/dom/ElementAttributeData.cpp (110924 => 110925)
--- trunk/Source/WebCore/dom/ElementAttributeData.cpp 2012-03-16 01:08:09 UTC (rev 110924)
+++ trunk/Source/WebCore/dom/ElementAttributeData.cpp 2012-03-16 01:24:07 UTC (rev 110925)
@@ -105,7 +105,7 @@
attr->m_element = element;
if (element && inUpdateStyleAttribute == NotInUpdateStyleAttribute)
- element->didModifyAttribute(attribute.get());
+ element->didAddAttribute(attribute.get());
}
void ElementAttributeData::removeAttribute(size_t index, Element* element, EInUpdateStyleAttribute inUpdateStyleAttribute)