Title: [294531] trunk/Source
Revision
294531
Author
simon.fra...@apple.com
Date
2022-05-19 22:49:27 -0700 (Thu, 19 May 2022)

Log Message

ASSERT(status == U_ZERO_ERROR) under SearchBuffer::search() when typing in the url bar in the iOS simulator
https://bugs.webkit.org/show_bug.cgi?id=240699
<rdar://92182174>

Reviewed by Tim Horton.

Replace `status == U_ZERO_ERROR` tests with `U_SUCCESS(status)`.

* Source/WebCore/PAL/pal/text/TextCodecICU.cpp:
(PAL::ErrorCallbackSetter::ErrorCallbackSetter):
(PAL::ErrorCallbackSetter::~ErrorCallbackSetter):
* Source/WebKit/UIProcess/Cocoa/ModalContainerControlClassifier.mm:
(WebKit::SpoofChecker::checker):
* Source/WebCore/editing/TextIterator.cpp:
(WebCore::createSearcher):
(WebCore::SearchBuffer::SearchBuffer):
(WebCore::SearchBuffer::~SearchBuffer):
(WebCore::SearchBuffer::search):

Canonical link: https://commits.webkit.org/250786@main

Modified Paths

Diff

Modified: trunk/Source/WebCore/PAL/pal/text/TextCodecICU.cpp (294530 => 294531)


--- trunk/Source/WebCore/PAL/pal/text/TextCodecICU.cpp	2022-05-20 05:27:37 UTC (rev 294530)
+++ trunk/Source/WebCore/PAL/pal/text/TextCodecICU.cpp	2022-05-20 05:49:27 UTC (rev 294531)
@@ -208,7 +208,7 @@
         if (m_shouldStopOnEncodingErrors) {
             UErrorCode err = U_ZERO_ERROR;
             ucnv_setToUCallBack(&m_converter, UCNV_TO_U_CALLBACK_SUBSTITUTE, UCNV_SUB_STOP_ON_ILLEGAL, &m_savedAction, &m_savedContext, &err);
-            ASSERT(err == U_ZERO_ERROR);
+            ASSERT(U_SUCCESS(err));
         }
     }
     ~ErrorCallbackSetter()
@@ -220,7 +220,7 @@
             ucnv_setToUCallBack(&m_converter, m_savedAction, m_savedContext, &oldAction, &oldContext, &err);
             ASSERT(oldAction == UCNV_TO_U_CALLBACK_SUBSTITUTE);
             ASSERT(!strcmp(static_cast<const char*>(oldContext), UCNV_SUB_STOP_ON_ILLEGAL));
-            ASSERT(err == U_ZERO_ERROR);
+            ASSERT(U_SUCCESS(err));
         }
     }
 

Modified: trunk/Source/WebCore/editing/TextIterator.cpp (294530 => 294531)


--- trunk/Source/WebCore/editing/TextIterator.cpp	2022-05-20 05:27:37 UTC (rev 294530)
+++ trunk/Source/WebCore/editing/TextIterator.cpp	2022-05-20 05:49:27 UTC (rev 294531)
@@ -1658,7 +1658,7 @@
     UErrorCode status = U_ZERO_ERROR;
     auto searchCollatorName = makeString(currentSearchLocaleID(), "@collation=search");
     UStringSearch* searcher = usearch_open(&newlineCharacter, 1, &newlineCharacter, 1, searchCollatorName.utf8().data(), 0, &status);
-    ASSERT(status == U_ZERO_ERROR || status == U_USING_FALLBACK_WARNING || status == U_USING_DEFAULT_WARNING);
+    ASSERT(U_SUCCESS(status) || status == U_USING_FALLBACK_WARNING || status == U_USING_DEFAULT_WARNING);
     return searcher;
 }
 
@@ -1965,10 +1965,10 @@
 
     UErrorCode status = U_ZERO_ERROR;
     usearch_setAttribute(searcher, USEARCH_ELEMENT_COMPARISON, comparator, &status);
-    ASSERT(status == U_ZERO_ERROR);
+    ASSERT(U_SUCCESS(status));
 
     usearch_setPattern(searcher, m_targetCharacters, targetLength, &status);
-    ASSERT(status == U_ZERO_ERROR);
+    ASSERT(U_SUCCESS(status));
 
     // The kana workaround requires a normalized copy of the target string.
     if (m_targetRequiresKanaWorkaround)
@@ -1980,9 +1980,9 @@
     // Leave the static object pointing to a valid string.
     UErrorCode status = U_ZERO_ERROR;
     usearch_setPattern(WebCore::searcher(), &newlineCharacter, 1, &status);
-    ASSERT(status == U_ZERO_ERROR);
+    ASSERT(U_SUCCESS(status));
     usearch_setText(WebCore::searcher(), &newlineCharacter, 1, &status);
-    ASSERT(status == U_ZERO_ERROR);
+    ASSERT(U_SUCCESS(status));
 
     unlockSearcher();
 }
@@ -2190,10 +2190,10 @@
 
     UErrorCode status = U_ZERO_ERROR;
     usearch_setText(searcher, m_buffer.data(), size, &status);
-    ASSERT(status == U_ZERO_ERROR);
+    ASSERT(U_SUCCESS(status));
 
     usearch_setOffset(searcher, m_prefixLength, &status);
-    ASSERT(status == U_ZERO_ERROR);
+    ASSERT(U_SUCCESS(status));
 
     int matchStart = usearch_next(searcher, &status);
     ASSERT(U_SUCCESS(status));
@@ -2231,7 +2231,7 @@
         || (m_options.contains(AtWordStarts) && !isWordStartMatch(matchStart, matchedLength))
         || (m_options.contains(AtWordEnds) && !isWordEndMatch(matchStart, matchedLength))) {
         matchStart = usearch_next(searcher, &status);
-        ASSERT(status == U_ZERO_ERROR);
+        ASSERT(U_SUCCESS(status));
         goto nextMatch;
     }
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/ModalContainerControlClassifier.mm (294530 => 294531)


--- trunk/Source/WebKit/UIProcess/Cocoa/ModalContainerControlClassifier.mm	2022-05-20 05:27:37 UTC (rev 294530)
+++ trunk/Source/WebKit/UIProcess/Cocoa/ModalContainerControlClassifier.mm	2022-05-20 05:49:27 UTC (rev 294531)
@@ -99,7 +99,7 @@
 private:
     USpoofChecker* checker()
     {
-        if (!m_checker && m_status == U_ZERO_ERROR)
+        if (!m_checker && U_SUCCESS(m_status))
             m_checker = uspoof_open(&m_status);
         return m_checker;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to