Title: [178948] trunk/Source/WebCore
Revision
178948
Author
benja...@webkit.org
Date
2015-01-22 14:17:32 -0800 (Thu, 22 Jan 2015)

Log Message

When extending the fallback transitions with their closure, we are modifying the Set while iterating it
https://bugs.webkit.org/show_bug.cgi?id=140785

Reviewed by Andreas Kling.

* contentextensions/NFAToDFA.cpp:
(WebCore::ContentExtensions::populateTransitions):
Make that in two steps: accumulate the fallback transitions then add the closure
of every element.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (178947 => 178948)


--- trunk/Source/WebCore/ChangeLog	2015-01-22 22:16:48 UTC (rev 178947)
+++ trunk/Source/WebCore/ChangeLog	2015-01-22 22:17:32 UTC (rev 178948)
@@ -1,3 +1,15 @@
+2015-01-22  Benjamin Poulain  <benja...@webkit.org>
+
+        When extending the fallback transitions with their closure, we are modifying the Set while iterating it
+        https://bugs.webkit.org/show_bug.cgi?id=140785
+
+        Reviewed by Andreas Kling.
+
+        * contentextensions/NFAToDFA.cpp:
+        (WebCore::ContentExtensions::populateTransitions):
+        Make that in two steps: accumulate the fallback transitions then add the closure
+        of every element.
+
 2015-01-21  Antti Koivisto  <an...@apple.com>
 
         Rename SimpleFontData to Font

Modified: trunk/Source/WebCore/contentextensions/NFAToDFA.cpp (178947 => 178948)


--- trunk/Source/WebCore/contentextensions/NFAToDFA.cpp	2015-01-22 22:16:48 UTC (rev 178947)
+++ trunk/Source/WebCore/contentextensions/NFAToDFA.cpp	2015-01-22 22:17:32 UTC (rev 178948)
@@ -300,15 +300,19 @@
         ASSERT(set.isEmpty());
 #endif
 
+    Vector<unsigned, 8> allFallbackTransitions;
     const unsigned* buffer = sourceNodeSet.buffer();
     for (unsigned i = 0; i < sourceNodeSet.m_size; ++i) {
         unsigned nodeId = buffer[i];
         const NFANode& nfaSourceNode = graph[nodeId];
-        if (!nfaSourceNode.transitionsOnAnyCharacter.isEmpty())
-            setFallbackTransition.add(nfaSourceNode.transitionsOnAnyCharacter.begin(), nfaSourceNode.transitionsOnAnyCharacter.end());
+        for (unsigned targetTransition : nfaSourceNode.transitionsOnAnyCharacter)
+            allFallbackTransitions.append(targetTransition);
     }
-    for (unsigned targetNodeId : setFallbackTransition)
-        extendSetWithClosure(nfaNodeclosures, targetNodeId, setFallbackTransition);
+    for (unsigned targetNodeId : allFallbackTransitions) {
+        auto addResult = setFallbackTransition.add(targetNodeId);
+        if (addResult.isNewEntry)
+            extendSetWithClosure(nfaNodeclosures, targetNodeId, setFallbackTransition);
+    }
 
     for (unsigned i = 0; i < sourceNodeSet.m_size; ++i) {
         unsigned nodeId = buffer[i];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to