Title: [215787] trunk
- Revision
- 215787
- Author
- bfulg...@apple.com
- Date
- 2017-04-25 19:26:05 -0700 (Tue, 25 Apr 2017)
Log Message
Relax the event firing ASSERT for Attr changes
https://bugs.webkit.org/show_bug.cgi?id=171236
<rdar://problem/30516349>
Reviewed by Dean Jackson.
Source/WebCore:
The assertions added in Bug 167318 were overly strict, and trigger for valid behavior.
Relax the assertion preventing event dispatch for the case of Attr elements at the
end of childrenChanged.
Test: fast/dom/HTMLLinkElement/event-while-removing-attribute.html
* dom/Attr.cpp:
(WebCore::Attr::childrenChanged):
LayoutTests:
* fast/dom/HTMLLinkElement/event-while-removing-attribute-expected.txt: Added.
* fast/dom/HTMLLinkElement/event-while-removing-attribute.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (215786 => 215787)
--- trunk/LayoutTests/ChangeLog 2017-04-26 02:16:26 UTC (rev 215786)
+++ trunk/LayoutTests/ChangeLog 2017-04-26 02:26:05 UTC (rev 215787)
@@ -1,3 +1,14 @@
+2017-04-25 Brent Fulgham <bfulg...@apple.com>
+
+ Relax the event firing ASSERT for Attr changes
+ https://bugs.webkit.org/show_bug.cgi?id=171236
+ <rdar://problem/30516349>
+
+ Reviewed by Dean Jackson.
+
+ * fast/dom/HTMLLinkElement/event-while-removing-attribute-expected.txt: Added.
+ * fast/dom/HTMLLinkElement/event-while-removing-attribute.html: Added.
+
2017-04-25 Dean Jackson <d...@apple.com>
REGRESSION (r214129): fast/media/mq-prefers-reduced-motion.html fails
Added: trunk/LayoutTests/fast/dom/HTMLLinkElement/event-while-removing-attribute-expected.txt (0 => 215787)
--- trunk/LayoutTests/fast/dom/HTMLLinkElement/event-while-removing-attribute-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLLinkElement/event-while-removing-attribute-expected.txt 2017-04-26 02:26:05 UTC (rev 215787)
@@ -0,0 +1,14 @@
+Check that we do not Debug ASSERT when modifying attribute data for a link.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Before load event handled for original link element.
+PASS Before load event handled for original link element.
+PASS Before load event handled for original link element.
+PASS Before load event handled for original link element.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS Test did not generate a Debug ASSERT.
+
Added: trunk/LayoutTests/fast/dom/HTMLLinkElement/event-while-removing-attribute.html (0 => 215787)
--- trunk/LayoutTests/fast/dom/HTMLLinkElement/event-while-removing-attribute.html (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLLinkElement/event-while-removing-attribute.html 2017-04-26 02:26:05 UTC (rev 215787)
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+description("Check that we do not Debug ASSERT when modifying attribute data for a link.");
+
+function testOriginalBeforeLoad()
+{
+ testPassed("Before load event handled for original link element.");
+}
+
+</script>
+<link id="link" type="text/css" rel="stylesheet" href="" _onbeforeload_="testOriginalBeforeLoad()"/>
+<script>
+function testBeforeLoad()
+{
+ testPassed("Before load event handled.");
+}
+
+function test()
+{
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ var origLink = document.getElementById('link');
+
+ var relAttr = origLink.getAttributeNode('rel');
+ var textNode = relAttr.childNodes[0];
+
+ var newTextNode = document.createTextNode("author");
+
+ relAttr.replaceChild(newTextNode, textNode);
+
+ setTimeout(step2, 0);
+}
+
+function step2()
+{
+ testPassed("Test did not generate a Debug ASSERT.");
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+</script>
+</head>
+<body _onload_="test()">
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (215786 => 215787)
--- trunk/Source/WebCore/ChangeLog 2017-04-26 02:16:26 UTC (rev 215786)
+++ trunk/Source/WebCore/ChangeLog 2017-04-26 02:26:05 UTC (rev 215787)
@@ -1,3 +1,20 @@
+2017-04-25 Brent Fulgham <bfulg...@apple.com>
+
+ Relax the event firing ASSERT for Attr changes
+ https://bugs.webkit.org/show_bug.cgi?id=171236
+ <rdar://problem/30516349>
+
+ Reviewed by Dean Jackson.
+
+ The assertions added in Bug 167318 were overly strict, and trigger for valid behavior.
+ Relax the assertion preventing event dispatch for the case of Attr elements at the
+ end of childrenChanged.
+
+ Test: fast/dom/HTMLLinkElement/event-while-removing-attribute.html
+
+ * dom/Attr.cpp:
+ (WebCore::Attr::childrenChanged):
+
2017-04-25 John Wilander <wilan...@apple.com>
Resource Load Statistics: Introduce shorter time-to-live for cookie partition whitelisting
Modified: trunk/Source/WebCore/dom/Attr.cpp (215786 => 215787)
--- trunk/Source/WebCore/dom/Attr.cpp 2017-04-26 02:16:26 UTC (rev 215786)
+++ trunk/Source/WebCore/dom/Attr.cpp 2017-04-26 02:26:05 UTC (rev 215787)
@@ -26,6 +26,7 @@
#include "AttributeChangeInvalidation.h"
#include "Event.h"
#include "ExceptionCode.h"
+#include "NoEventDispatchAssertion.h"
#include "ScopedEventQueue.h"
#include "StyleProperties.h"
#include "StyledElement.h"
@@ -167,8 +168,10 @@
} else
m_standaloneValue = newValue;
- if (m_element)
+ if (m_element) {
+ NoEventDispatchAssertion::DisableAssertionsInScope allowedScope;
m_element->attributeChanged(qualifiedName(), oldValue, newValue);
+ }
}
CSSStyleDeclaration* Attr::style()
Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (215786 => 215787)
--- trunk/Source/WebCore/dom/ContainerNode.cpp 2017-04-26 02:16:26 UTC (rev 215786)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp 2017-04-26 02:26:05 UTC (rev 215787)
@@ -69,8 +69,9 @@
ChildNodesLazySnapshot* ChildNodesLazySnapshot::latestSnapshot;
-#ifndef NDEBUG
+#if !ASSERT_DISABLED
unsigned NoEventDispatchAssertion::s_count = 0;
+unsigned NoEventDispatchAssertion::DisableAssertionsInScope::s_existingCount = 0;
NoEventDispatchAssertion::EventAllowedScope* NoEventDispatchAssertion::EventAllowedScope::s_currentScope = nullptr;
#endif
Modified: trunk/Source/WebCore/dom/NoEventDispatchAssertion.h (215786 => 215787)
--- trunk/Source/WebCore/dom/NoEventDispatchAssertion.h 2017-04-26 02:16:26 UTC (rev 215786)
+++ trunk/Source/WebCore/dom/NoEventDispatchAssertion.h 2017-04-26 02:26:05 UTC (rev 215787)
@@ -108,6 +108,32 @@
#endif
#if !ASSERT_DISABLED
+ class DisableAssertionsInScope {
+ public:
+ DisableAssertionsInScope()
+ {
+ if (!isMainThread())
+ return;
+ s_existingCount = s_count;
+ s_count = 0;
+ }
+
+ ~DisableAssertionsInScope()
+ {
+ s_count = s_existingCount;
+ s_existingCount = 0;
+ }
+ private:
+ WEBCORE_EXPORT static unsigned s_existingCount;
+ };
+#else
+ class DisableAssertionsInScope {
+ public:
+ DisableAssertionsInScope() { }
+ };
+#endif
+
+#if !ASSERT_DISABLED
private:
WEBCORE_EXPORT static unsigned s_count;
#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes