Title: [214915] trunk
Revision
214915
Author
[email protected]
Date
2017-04-04 17:05:27 -0700 (Tue, 04 Apr 2017)

Log Message

Do not assert when CharacterData representing an Attr fires events
https://bugs.webkit.org/show_bug.cgi?id=170454
<rdar://problem/30979320>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Make the NoEventDispatchAssertion in CharacterData::notifyParentAfterChange conditional
since Attr elements should be allowed to fire events.

Tests: fast/dom/no-assert-for-malformed-js-url-attribute.html

* dom/CharacterData.cpp:
(WebCore::CharacterData::notifyParentAfterChange):

LayoutTests:

* fast/dom/no-assert-for-malformed-js-url-attribute-expected.txt: Added.
* fast/dom/no-assert-for-malformed-js-url-attribute.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (214914 => 214915)


--- trunk/LayoutTests/ChangeLog	2017-04-04 23:38:33 UTC (rev 214914)
+++ trunk/LayoutTests/ChangeLog	2017-04-05 00:05:27 UTC (rev 214915)
@@ -1,3 +1,14 @@
+2017-04-04  Brent Fulgham  <[email protected]>
+
+        Do not assert when CharacterData representing an Attr fires events
+        https://bugs.webkit.org/show_bug.cgi?id=170454
+        <rdar://problem/30979320>
+
+        Reviewed by Ryosuke Niwa.
+
+        * fast/dom/no-assert-for-malformed-js-url-attribute-expected.txt: Added.
+        * fast/dom/no-assert-for-malformed-js-url-attribute.html: Added.
+
 2017-04-04  Youenn Fablet  <[email protected]>
 
         LayoutTest webrtc/libwebrtc/descriptionGetters.html is a flaky failure

Added: trunk/LayoutTests/fast/dom/no-assert-for-malformed-js-url-attribute-expected.txt (0 => 214915)


--- trunk/LayoutTests/fast/dom/no-assert-for-malformed-js-url-attribute-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/no-assert-for-malformed-js-url-attribute-expected.txt	2017-04-05 00:05:27 UTC (rev 214915)
@@ -0,0 +1,10 @@
+CONSOLE MESSAGE: line 1: SyntaxError: Unexpected identifier 'orem'
+This tests that we do not assert when a malformed JS URL is passed to the 'src' attribute of an iframe. The test passes if it does not ASSERT.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+  

Added: trunk/LayoutTests/fast/dom/no-assert-for-malformed-js-url-attribute.html (0 => 214915)


--- trunk/LayoutTests/fast/dom/no-assert-for-malformed-js-url-attribute.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/no-assert-for-malformed-js-url-attribute.html	2017-04-05 00:05:27 UTC (rev 214915)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+description("This tests that we do not assert when a malformed JS URL is passed to the 'src' attribute of an iframe. The test passes if it does not ASSERT.");
+
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+function runTest()
+{
+    var testFrame1 = document.getElementById('testFrame1');
+    testFrame1.getAttributeNode("src").firstChild.appendData("missingFunction(this) orem ipsum dosolorem");
+
+    var testFrame2 = document.getElementById('testFrame2');
+    testFrame2.getAttributeNode("src").firstChild.appendData("_javascript_:missingFunction(this) orem ipsum dosolorem");
+}
+</script>
+</head>
+<body _onload_="runTest()">
+    <iframe id='testFrame1' src=''></iframe>
+    <iframe id='testFrame2' src=''></iframe>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (214914 => 214915)


--- trunk/Source/WebCore/ChangeLog	2017-04-04 23:38:33 UTC (rev 214914)
+++ trunk/Source/WebCore/ChangeLog	2017-04-05 00:05:27 UTC (rev 214915)
@@ -1,3 +1,19 @@
+2017-04-04  Brent Fulgham  <[email protected]>
+
+        Do not assert when CharacterData representing an Attr fires events
+        https://bugs.webkit.org/show_bug.cgi?id=170454
+        <rdar://problem/30979320>
+
+        Reviewed by Ryosuke Niwa.
+
+        Make the NoEventDispatchAssertion in CharacterData::notifyParentAfterChange conditional
+        since Attr elements should be allowed to fire events.
+
+        Tests: fast/dom/no-assert-for-malformed-js-url-attribute.html
+
+        * dom/CharacterData.cpp:
+        (WebCore::CharacterData::notifyParentAfterChange):
+
 2017-04-04  Youenn Fablet  <[email protected]>
 
         LayoutTest webrtc/libwebrtc/descriptionGetters.html is a flaky failure

Modified: trunk/Source/WebCore/dom/CharacterData.cpp (214914 => 214915)


--- trunk/Source/WebCore/dom/CharacterData.cpp	2017-04-04 23:38:33 UTC (rev 214914)
+++ trunk/Source/WebCore/dom/CharacterData.cpp	2017-04-05 00:05:27 UTC (rev 214915)
@@ -22,6 +22,7 @@
 #include "config.h"
 #include "CharacterData.h"
 
+#include "Attr.h"
 #include "ElementTraversal.h"
 #include "EventNames.h"
 #include "ExceptionCode.h"
@@ -208,7 +209,9 @@
 
 void CharacterData::notifyParentAfterChange(ContainerNode::ChildChangeSource source)
 {
-    NoEventDispatchAssertion assertNoEventDispatch;
+#if !ASSERT_DISABLED
+    auto assertNoEventDispatch = std::make_unique<NoEventDispatchAssertion>();
+#endif
 
     document().incDOMTreeVersion();
 
@@ -221,6 +224,13 @@
         ElementTraversal::nextSibling(*this),
         source
     };
+
+#if !ASSERT_DISABLED
+    // Attribute CharacterData is expected to fire events.
+    if (is<Attr>(*parentNode()))
+        assertNoEventDispatch = nullptr;
+#endif
+
     parentNode()->childrenChanged(change);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to