Title: [232265] trunk
Revision
232265
Author
[email protected]
Date
2018-05-29 11:10:50 -0700 (Tue, 29 May 2018)

Log Message

Don't assert on m_actionsStart when setting actions on DFA nodes
https://bugs.webkit.org/show_bug.cgi?id=185979
<rdar://problem/39669458>

Patch by Tadeu Zagallo <[email protected]> on 2018-05-29
Reviewed by Geoffrey Garen.

DFANode::setActions is called immediately after the node is created, and once again to set
the actions of catch-all regular expressions (.*) on the root node. That works because
m_actionsStart is initially 0, since the root was the first node to be created, but may fail
after minimizing the DFA, when the root may no longer be the first node, and therefore
m_actionsStart would not be 0, even if there are no actions attached to that node.

Source/WebCore:

Test: http/tests/contentextensions/root-actions.html

* contentextensions/DFANode.h:

LayoutTests:

* http/tests/contentextensions/root-actions-expected.txt: Added.
* http/tests/contentextensions/root-actions.html: Added.
* http/tests/contentextensions/root-actions.html.json: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (232264 => 232265)


--- trunk/LayoutTests/ChangeLog	2018-05-29 17:56:47 UTC (rev 232264)
+++ trunk/LayoutTests/ChangeLog	2018-05-29 18:10:50 UTC (rev 232265)
@@ -1,3 +1,21 @@
+2018-05-29  Tadeu Zagallo  <[email protected]>
+
+        Don't assert on m_actionsStart when setting actions on DFA nodes
+        https://bugs.webkit.org/show_bug.cgi?id=185979
+        <rdar://problem/39669458>
+
+        Reviewed by Geoffrey Garen.
+
+        DFANode::setActions is called immediately after the node is created, and once again to set
+        the actions of catch-all regular expressions (.*) on the root node. That works because
+        m_actionsStart is initially 0, since the root was the first node to be created, but may fail
+        after minimizing the DFA, when the root may no longer be the first node, and therefore
+        m_actionsStart would not be 0, even if there are no actions attached to that node.
+
+        * http/tests/contentextensions/root-actions-expected.txt: Added.
+        * http/tests/contentextensions/root-actions.html: Added.
+        * http/tests/contentextensions/root-actions.html.json: Added.
+
 2018-05-29  Nan Wang  <[email protected]>
 
         AX: setValue on contenteditable should preserve whitespace

Added: trunk/LayoutTests/http/tests/contentextensions/root-actions-expected.txt (0 => 232265)


--- trunk/LayoutTests/http/tests/contentextensions/root-actions-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/root-actions-expected.txt	2018-05-29 18:10:50 UTC (rev 232265)
@@ -0,0 +1,3 @@
+Test that root actions combined with DFA minimizing don't crash in Debug
+
+See https://bugs.webkit.org/show_bug.cgi?id=185979

Added: trunk/LayoutTests/http/tests/contentextensions/root-actions.html (0 => 232265)


--- trunk/LayoutTests/http/tests/contentextensions/root-actions.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/root-actions.html	2018-05-29 18:10:50 UTC (rev 232265)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+    </script>
+</head>
+<body>
+    <p>Test that root actions combined with DFA minimizing don't crash in Debug</p>
+    <p>See https://bugs.webkit.org/show_bug.cgi?id=185979</p>
+</body>
+</html>

Added: trunk/LayoutTests/http/tests/contentextensions/root-actions.html.json (0 => 232265)


--- trunk/LayoutTests/http/tests/contentextensions/root-actions.html.json	                        (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/root-actions.html.json	2018-05-29 18:10:50 UTC (rev 232265)
@@ -0,0 +1,38 @@
+[
+    {
+        "action": {
+            "type": "block"
+        },
+        "trigger": {
+            "url-filter": "www\\.example\\.com/cookie\\.js",
+            "url-filter-is-case-sensitive": true
+        }
+    },
+    {
+        "action": {
+            "type": "block"
+        },
+        "trigger": {
+            "url-filter": "\\.morecookies",
+            "url-filter-is-case-sensitive": true
+        }
+    },
+    {
+        "action": {
+            "type": "block"
+        },
+        "trigger": {
+            "url-filter": "/cookie\\.js",
+            "url-filter-is-case-sensitive": true
+        }
+    },
+    {
+        "action": {
+            "type": "block-cookies"
+        },
+        "trigger": {
+            "url-filter": ".*",
+            "url-filter-is-case-sensitive": true
+        }
+    }
+]

Modified: trunk/Source/WebCore/ChangeLog (232264 => 232265)


--- trunk/Source/WebCore/ChangeLog	2018-05-29 17:56:47 UTC (rev 232264)
+++ trunk/Source/WebCore/ChangeLog	2018-05-29 18:10:50 UTC (rev 232265)
@@ -1,3 +1,21 @@
+2018-05-29  Tadeu Zagallo  <[email protected]>
+
+        Don't assert on m_actionsStart when setting actions on DFA nodes
+        https://bugs.webkit.org/show_bug.cgi?id=185979
+        <rdar://problem/39669458>
+
+        Reviewed by Geoffrey Garen.
+
+        DFANode::setActions is called immediately after the node is created, and once again to set
+        the actions of catch-all regular expressions (.*) on the root node. That works because
+        m_actionsStart is initially 0, since the root was the first node to be created, but may fail
+        after minimizing the DFA, when the root may no longer be the first node, and therefore
+        m_actionsStart would not be 0, even if there are no actions attached to that node.
+
+        Test: http/tests/contentextensions/root-actions.html
+
+        * contentextensions/DFANode.h:
+
 2018-05-29  Nan Wang  <[email protected]>
 
         AX: setValue on contenteditable should preserve whitespace

Modified: trunk/Source/WebCore/contentextensions/DFANode.h (232264 => 232265)


--- trunk/Source/WebCore/contentextensions/DFANode.h	2018-05-29 17:56:47 UTC (rev 232264)
+++ trunk/Source/WebCore/contentextensions/DFANode.h	2018-05-29 18:10:50 UTC (rev 232265)
@@ -145,7 +145,6 @@
 
     void setActions(uint32_t start, uint16_t length)
     {
-        ASSERT(!m_actionsStart);
         ASSERT(!m_actionsLength);
         m_actionsStart = start;
         m_actionsLength = length;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to