Title: [216381] releases/WebKitGTK/webkit-2.16
Revision
216381
Author
carlo...@webkit.org
Date
2017-05-08 04:01:17 -0700 (Mon, 08 May 2017)

Log Message

Merge r215787 - 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: releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog (216380 => 216381)


--- releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog	2017-05-08 10:57:51 UTC (rev 216380)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog	2017-05-08 11:01:17 UTC (rev 216381)
@@ -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  Chris Dumez  <cdu...@apple.com>
 
         Content-Disposition header filename is ignored when 'download' attribute is specified in HTML

Added: releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/HTMLLinkElement/event-while-removing-attribute-expected.txt (0 => 216381)


--- releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/HTMLLinkElement/event-while-removing-attribute-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/HTMLLinkElement/event-while-removing-attribute-expected.txt	2017-05-08 11:01:17 UTC (rev 216381)
@@ -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: releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/HTMLLinkElement/event-while-removing-attribute.html (0 => 216381)


--- releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/HTMLLinkElement/event-while-removing-attribute.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/fast/dom/HTMLLinkElement/event-while-removing-attribute.html	2017-05-08 11:01:17 UTC (rev 216381)
@@ -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: releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog (216380 => 216381)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog	2017-05-08 10:57:51 UTC (rev 216380)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog	2017-05-08 11:01:17 UTC (rev 216381)
@@ -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  Chris Dumez  <cdu...@apple.com>
 
         Content-Disposition header filename is ignored when 'download' attribute is specified in HTML

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/Attr.cpp (216380 => 216381)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/Attr.cpp	2017-05-08 10:57:51 UTC (rev 216380)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/Attr.cpp	2017-05-08 11:01:17 UTC (rev 216381)
@@ -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: releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/ContainerNode.cpp (216380 => 216381)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/ContainerNode.cpp	2017-05-08 10:57:51 UTC (rev 216380)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/ContainerNode.cpp	2017-05-08 11:01:17 UTC (rev 216381)
@@ -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: releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/NoEventDispatchAssertion.h (216380 => 216381)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/NoEventDispatchAssertion.h	2017-05-08 10:57:51 UTC (rev 216380)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/dom/NoEventDispatchAssertion.h	2017-05-08 11:01:17 UTC (rev 216381)
@@ -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

Reply via email to