Changeset 209074 in webkit


Ignore:
Timestamp:
Nov 29, 2016 9:18:03 AM (7 years ago)
Author:
Darin Adler
Message:

REGRESSION (r209058): API test StringBuilderTest.Equal crashing
https://bugs.webkit.org/show_bug.cgi?id=165142

  • wtf/text/StringBuilder.h: Added an overload of the equal function just

for the case where the arguments are StringBuilder, String. This is needed
because of the peculiar behavior of is8Bit in String, different from any of
our other string classes. I think we should consider changing String::is8Bit
to return true for null strings. We could then remove this overload and
probably remove other checks for null and zero length elsewhere that are
also needed only to avoid calling is8Bit on a null String.

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r209070 r209074  
     12016-11-29  Darin Adler  <darin@apple.com>
     2
     3        REGRESSION (r209058): API test StringBuilderTest.Equal crashing
     4        https://bugs.webkit.org/show_bug.cgi?id=165142
     5
     6        * wtf/text/StringBuilder.h: Added an overload of the equal function just
     7        for the case where the arguments are StringBuilder, String. This is needed
     8        because of the peculiar behavior of is8Bit in String, different from any of
     9        our other string classes. I think we should consider changing String::is8Bit
     10        to return true for null strings. We could then remove this overload and
     11        probably remove other checks for null and zero length elsewhere that are
     12        also needed only to avoid calling is8Bit on a null String.
     13
    1142016-11-29  Wenson Hsieh  <wenson_hsieh@apple.com>
    215
  • trunk/Source/WTF/wtf/text/StringBuilder.h

    r209058 r209074  
    301301
    302302template<typename StringType> bool equal(const StringBuilder&, const StringType&);
     303bool equal(const StringBuilder&, const String&); // Only needed because is8Bit dereferences nullptr when the string is null.
    303304template<typename CharacterType> bool equal(const StringBuilder&, const CharacterType*, unsigned length);
    304305
     
    326327}
    327328
     329inline bool equal(const StringBuilder& a, const String& b)
     330{
     331    return !b.isNull() && equalCommon(a, b);
     332}
     333
    328334inline bool operator==(const StringBuilder& a, const StringBuilder& b) { return equal(a, b); }
    329335inline bool operator!=(const StringBuilder& a, const StringBuilder& b) { return !equal(a, b); }
Note: See TracChangeset for help on using the changeset viewer.