Title: [234943] trunk
Revision
234943
Author
commit-qu...@webkit.org
Date
2018-08-16 11:21:52 -0700 (Thu, 16 Aug 2018)

Log Message

Re-introduce assertion removed in r234890
https://bugs.webkit.org/show_bug.cgi?id=188611

Patch by Alex Christensen <achristen...@webkit.org> on 2018-08-16
Reviewed by Geoffrey Garen.

Source/WebCore:

The assertion was failing because Vector<String>::operator== was using memcmp,
which failed to consider different instances of equal Strings equal.  Added an
API test and this assertion, which now succeeds.

* contentextensions/ContentExtensionCompiler.cpp:
(WebCore::ContentExtensions::compileRuleList):

Source/WTF:

* wtf/text/WTFString.h:

Tools:

* TestWebKitAPI/Tests/WTF/Vector.cpp:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (234942 => 234943)


--- trunk/Source/WTF/ChangeLog	2018-08-16 18:19:19 UTC (rev 234942)
+++ trunk/Source/WTF/ChangeLog	2018-08-16 18:21:52 UTC (rev 234943)
@@ -1,3 +1,12 @@
+2018-08-16  Alex Christensen  <achristen...@webkit.org>
+
+        Re-introduce assertion removed in r234890
+        https://bugs.webkit.org/show_bug.cgi?id=188611
+
+        Reviewed by Geoffrey Garen.
+
+        * wtf/text/WTFString.h:
+
 2018-08-16  Antti Koivisto  <an...@apple.com>
 
         Use OptionSet for ActivityState::Flags

Modified: trunk/Source/WTF/wtf/text/WTFString.h (234942 => 234943)


--- trunk/Source/WTF/wtf/text/WTFString.h	2018-08-16 18:19:19 UTC (rev 234942)
+++ trunk/Source/WTF/wtf/text/WTFString.h	2018-08-16 18:21:52 UTC (rev 234943)
@@ -427,7 +427,10 @@
 
 template<typename> struct DefaultHash;
 template<> struct DefaultHash<String> { using Hash = StringHash; };
-template<> struct VectorTraits<String> : SimpleClassVectorTraits { };
+template<> struct VectorTraits<String> : VectorTraitsBase<false, void> {
+    static const bool canInitializeWithMemset = true;
+    static const bool canMoveWithMemcpy = true;
+};
 
 template<> struct IntegerToStringConversionTrait<String> {
     using ReturnType = String;

Modified: trunk/Source/WebCore/ChangeLog (234942 => 234943)


--- trunk/Source/WebCore/ChangeLog	2018-08-16 18:19:19 UTC (rev 234942)
+++ trunk/Source/WebCore/ChangeLog	2018-08-16 18:21:52 UTC (rev 234943)
@@ -1,3 +1,17 @@
+2018-08-16  Alex Christensen  <achristen...@webkit.org>
+
+        Re-introduce assertion removed in r234890
+        https://bugs.webkit.org/show_bug.cgi?id=188611
+
+        Reviewed by Geoffrey Garen.
+
+        The assertion was failing because Vector<String>::operator== was using memcmp,
+        which failed to consider different instances of equal Strings equal.  Added an
+        API test and this assertion, which now succeeds.
+
+        * contentextensions/ContentExtensionCompiler.cpp:
+        (WebCore::ContentExtensions::compileRuleList):
+
 2018-08-15  Jer Noble  <jer.no...@apple.com>
 
         Add Experimental Feature support for SourceBuffer.changeType()

Modified: trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp (234942 => 234943)


--- trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp	2018-08-16 18:19:19 UTC (rev 234942)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp	2018-08-16 18:21:52 UTC (rev 234943)
@@ -285,6 +285,12 @@
 
 std::error_code compileRuleList(ContentExtensionCompilationClient& client, String&& ruleJSON, Vector<ContentExtensionRule>&& parsedRuleList)
 {
+#if !ASSERT_DISABLED
+    callOnMainThread([ruleJSON = ruleJSON.isolatedCopy(), parsedRuleList = parsedRuleList.isolatedCopy()] {
+        ASSERT(parseRuleList(ruleJSON) == parsedRuleList);
+    });
+#endif
+
     bool domainConditionSeen = false;
     bool topURLConditionSeen = false;
     for (const auto& rule : parsedRuleList) {

Modified: trunk/Tools/ChangeLog (234942 => 234943)


--- trunk/Tools/ChangeLog	2018-08-16 18:19:19 UTC (rev 234942)
+++ trunk/Tools/ChangeLog	2018-08-16 18:21:52 UTC (rev 234943)
@@ -1,3 +1,13 @@
+2018-08-16  Alex Christensen  <achristen...@webkit.org>
+
+        Re-introduce assertion removed in r234890
+        https://bugs.webkit.org/show_bug.cgi?id=188611
+
+        Reviewed by Geoffrey Garen.
+
+        * TestWebKitAPI/Tests/WTF/Vector.cpp:
+        (TestWebKitAPI::TEST):
+
 2018-08-16  Jer Noble  <jer.no...@apple.com>
 
         Add Experimental Feature support for SourceBuffer.changeType()

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/Vector.cpp (234942 => 234943)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/Vector.cpp	2018-08-16 18:19:19 UTC (rev 234942)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Vector.cpp	2018-08-16 18:21:52 UTC (rev 234943)
@@ -888,4 +888,11 @@
     EXPECT_FLOAT_EQ(9, valuesVector[2]);
 }
 
+TEST(WTF_Vector, StringComparison)
+{
+    Vector<String> a = {{ "a" }};
+    Vector<String> b = {{ "a" }};
+    EXPECT_TRUE(a == b);
+}
+    
 } // namespace TestWebKitAPI
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to