Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (292878 => 292879)
--- trunk/Source/_javascript_Core/ChangeLog 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/_javascript_Core/ChangeLog 2022-04-14 17:55:19 UTC (rev 292879)
@@ -1,3 +1,20 @@
+2022-04-14 Chris Dumez <[email protected]>
+
+ Drop inefficient String::append() overloads
+ https://bugs.webkit.org/show_bug.cgi?id=239289
+
+ Reviewed by Sam Weinig.
+
+ * heap/HeapSnapshotBuilder.cpp:
+ (JSC::HeapSnapshotBuilder::json):
+ * runtime/IntlObject.cpp:
+ (JSC::resolveLocale):
+ * runtime/TemporalObject.cpp:
+ (JSC::ellipsizeAt):
+ * tools/FunctionOverrides.cpp:
+ (JSC::initializeOverrideInfo):
+ (JSC::parseClause):
+
2022-04-14 Justin Michaud <[email protected]>
[PGO] We should be able to build WebKit to collect PGO profiles easily
Modified: trunk/Source/_javascript_Core/heap/HeapSnapshotBuilder.cpp (292878 => 292879)
--- trunk/Source/_javascript_Core/heap/HeapSnapshotBuilder.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/_javascript_Core/heap/HeapSnapshotBuilder.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -390,15 +390,15 @@
flags |= static_cast<unsigned>(NodeFlags::Internal);
if (m_snapshotType == SnapshotType::GCDebuggingSnapshot) {
- String nodeLabel;
+ StringBuilder nodeLabel;
auto it = m_cellLabels.find(node.cell);
if (it != m_cellLabels.end())
- nodeLabel = it->value;
+ nodeLabel.append(it->value);
if (nodeLabel.isEmpty()) {
if (auto* object = jsDynamicCast<JSObject*>(vm, node.cell)) {
if (auto* function = jsDynamicCast<JSFunction*>(vm, object))
- nodeLabel = function->calculatedDisplayName(vm);
+ nodeLabel.append(function->calculatedDisplayName(vm));
}
}
@@ -410,7 +410,7 @@
}
if (!nodeLabel.isEmpty() && m_snapshotType == SnapshotType::GCDebuggingSnapshot) {
- auto result = labelIndexes.add(nodeLabel, nextLabelIndex);
+ auto result = labelIndexes.add(nodeLabel.toString(), nextLabelIndex);
if (result.isNewEntry)
nextLabelIndex++;
labelIndex = result.iterator->value;
Modified: trunk/Source/_javascript_Core/runtime/IntlObject.cpp (292878 => 292879)
--- trunk/Source/_javascript_Core/runtime/IntlObject.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/_javascript_Core/runtime/IntlObject.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -917,7 +917,8 @@
ResolvedLocale resolved;
resolved.dataLocale = foundLocale;
- String supportedExtension = "-u"_s;
+ StringBuilder supportedExtension;
+ supportedExtension.append("-u"_s);
for (RelevantExtensionKey key : relevantExtensionKeys) {
ASCIILiteral keyString = relevantExtensionKeyString(key);
Vector<String> keyLocaleData = localeData(foundLocale, key);
@@ -957,7 +958,7 @@
if (supportedExtension.length() > 2) {
StringView foundLocaleView(foundLocale);
- foundLocale = makeString(foundLocaleView.left(matcherResult.extensionIndex), supportedExtension, foundLocaleView.substring(matcherResult.extensionIndex));
+ foundLocale = makeString(foundLocaleView.left(matcherResult.extensionIndex), supportedExtension.toString(), foundLocaleView.substring(matcherResult.extensionIndex));
}
resolved.locale = WTFMove(foundLocale);
Modified: trunk/Source/_javascript_Core/runtime/TemporalObject.cpp (292878 => 292879)
--- trunk/Source/_javascript_Core/runtime/TemporalObject.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/_javascript_Core/runtime/TemporalObject.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -151,12 +151,9 @@
// For use in error messages where a string value is potentially unbounded
WTF::String ellipsizeAt(unsigned maxLength, const WTF::String& string)
{
- WTF::String copy { string };
- if (string.length() > maxLength) {
- copy.truncate(maxLength - 1);
- copy.append(horizontalEllipsis);
- }
- return copy;
+ if (string.length() <= maxLength)
+ return string;
+ return makeString(StringView(string).left(maxLength - 1), horizontalEllipsis);
}
PropertyName temporalUnitPluralPropertyName(VM& vm, TemporalUnit unit)
Modified: trunk/Source/_javascript_Core/tools/FunctionOverrides.cpp (292878 => 292879)
--- trunk/Source/_javascript_Core/tools/FunctionOverrides.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/_javascript_Core/tools/FunctionOverrides.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -135,21 +135,19 @@
unsigned headerLength = origBraceStart - origFunctionStart;
String origHeader = origProviderStr.substring(origFunctionStart, headerLength);
- String newProviderStr;
- newProviderStr.append(origHeader);
- newProviderStr.append(newBody);
+ String newProviderString = makeString(origHeader, newBody);
auto overridden = "<overridden>"_s;
URL url({ }, overridden);
- Ref<SourceProvider> newProvider = StringSourceProvider::create(newProviderStr, SourceOrigin { url }, overridden);
+ Ref<SourceProvider> newProvider = StringSourceProvider::create(newProviderString, SourceOrigin { url }, overridden);
info.firstLine = 1;
info.lineCount = 1; // Faking it. This doesn't really matter for now.
info.startColumn = 1;
info.endColumn = 1; // Faking it. This doesn't really matter for now.
- info.parametersStartOffset = newProviderStr.find('(');
- info.typeProfilingStartOffset = newProviderStr.find('{');
- info.typeProfilingEndOffset = newProviderStr.length() - 1;
+ info.parametersStartOffset = newProviderString.find('(');
+ info.typeProfilingStartOffset = newProviderString.find('{');
+ info.typeProfilingEndOffset = newProviderString.length() - 1;
info.sourceCode =
SourceCode(WTFMove(newProvider), info.parametersStartOffset, info.typeProfilingEndOffset + 1, 1, 1);
@@ -225,11 +223,7 @@
if (hasDisallowedCharacters(delimiterStart, delimiterLength))
FAIL_WITH_ERROR(SYNTAX_ERROR, ("Delimiter '", delimiter, "' cannot have '{', '}', or whitespace:\n", line, "\n"));
- String terminatorString;
- terminatorString.append('}');
- terminatorString.append(delimiter);
-
- CString terminatorCString = terminatorString.ascii();
+ CString terminatorCString = makeString('}', delimiter).ascii();
const char* terminator = terminatorCString.data();
line = delimiterEnd; // Start from the {.
Modified: trunk/Source/WTF/ChangeLog (292878 => 292879)
--- trunk/Source/WTF/ChangeLog 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WTF/ChangeLog 2022-04-14 17:55:19 UTC (rev 292879)
@@ -1,3 +1,18 @@
+2022-04-14 Chris Dumez <[email protected]>
+
+ Drop inefficient String::append() overloads
+ https://bugs.webkit.org/show_bug.cgi?id=239289
+
+ Reviewed by Sam Weinig.
+
+ * wtf/Assertions.cpp:
+ * wtf/text/StringBuilder.h:
+ (WTF::StringBuilder::append):
+ * wtf/text/WTFString.cpp:
+ (WTF::String::insert):
+ (WTF::String::append):
+ * wtf/text/WTFString.h:
+
2022-04-14 Justin Michaud <[email protected]>
[PGO] We should be able to build WebKit to collect PGO profiles easily
Modified: trunk/Source/WTF/wtf/Assertions.cpp (292878 => 292879)
--- trunk/Source/WTF/wtf/Assertions.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WTF/wtf/Assertions.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -466,7 +466,7 @@
ALLOW_NONLITERAL_FORMAT_END
if (!loggingString.endsWith('\n'))
- loggingString.append('\n');
+ loggingString = makeString(loggingString, '\n');
loggingAccumulator().accumulate(loggingString);
Modified: trunk/Source/WTF/wtf/text/StringBuilder.h (292878 => 292879)
--- trunk/Source/WTF/wtf/text/StringBuilder.h 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WTF/wtf/text/StringBuilder.h 2022-04-14 17:55:19 UTC (rev 292879)
@@ -61,6 +61,7 @@
void append(const AtomString& string) { append(string.string()); }
void append(const String&);
void append(StringView);
+ void append(ASCIILiteral);
void append(UChar);
void append(LChar);
void append(char character) { append(static_cast<LChar>(character)); }
@@ -221,6 +222,11 @@
appendCharacters(string.characters16(), string.length());
}
+inline void StringBuilder::append(ASCIILiteral string)
+{
+ appendCharacters(string.characters8(), string.length());
+}
+
inline void StringBuilder::appendSubstring(const String& string, unsigned offset, unsigned length)
{
append(StringView { string }.substring(offset, length));
Modified: trunk/Source/WTF/wtf/text/WTFString.cpp (292878 => 292879)
--- trunk/Source/WTF/wtf/text/WTFString.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WTF/wtf/text/WTFString.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -73,80 +73,6 @@
m_impl = StringImpl::create(reinterpret_cast<const LChar*>(nullTerminatedString));
}
-void String::append(const String& otherString)
-{
- // FIXME: This is extremely inefficient. So much so that we might want to take this out of String's API.
-
- if (!m_impl) {
- m_impl = otherString.m_impl;
- return;
- }
-
- if (otherString.isEmpty())
- return;
-
- auto length = m_impl->length();
- auto otherLength = otherString.m_impl->length();
- if (otherLength > MaxLength - length)
- CRASH();
-
- if (m_impl->is8Bit() && otherString.m_impl->is8Bit()) {
- LChar* data;
- auto newImpl = StringImpl::createUninitialized(length + otherLength, data);
- StringImpl::copyCharacters(data, m_impl->characters8(), length);
- StringImpl::copyCharacters(data + length, otherString.m_impl->characters8(), otherLength);
- m_impl = WTFMove(newImpl);
- return;
- }
- UChar* data;
- auto newImpl = StringImpl::createUninitialized(length + otherLength, data);
- StringView(*m_impl).getCharactersWithUpconvert(data);
- StringView(*otherString.m_impl).getCharactersWithUpconvert(data + length);
- m_impl = WTFMove(newImpl);
-}
-
-void String::append(LChar character)
-{
- // FIXME: This is extremely inefficient. So much so that we might want to take this out of String's API.
-
- if (!m_impl) {
- m_impl = StringImpl::create(&character, 1);
- return;
- }
- if (!is8Bit()) {
- append(static_cast<UChar>(character));
- return;
- }
- if (m_impl->length() >= MaxLength)
- CRASH();
- LChar* data;
- auto newImpl = StringImpl::createUninitialized(m_impl->length() + 1, data);
- StringImpl::copyCharacters(data, m_impl->characters8(), m_impl->length());
- data[m_impl->length()] = character;
- m_impl = WTFMove(newImpl);
-}
-
-void String::append(UChar character)
-{
- // FIXME: This is extremely inefficient. So much so that we might want to take this out of String's API.
-
- if (!m_impl) {
- m_impl = StringImpl::create(&character, 1);
- return;
- }
- if (isLatin1(character) && is8Bit()) {
- append(static_cast<LChar>(character));
- return;
- }
- if (m_impl->length() >= MaxLength)
- CRASH();
- UChar* data;
- auto newImpl = StringImpl::createUninitialized(m_impl->length() + 1, data);
- StringView(*m_impl).getCharactersWithUpconvert(data);
- data[m_impl->length()] = character;
- m_impl = WTFMove(newImpl);
-}
-
int codePointCompare(const String& a, const String& b)
{
return codePointCompare(a.impl(), b.impl());
@@ -167,7 +93,10 @@
}
if (position >= length()) {
- append(string);
+ if (string.is8Bit())
+ append(string.characters8(), string.length());
+ else
+ append(string.characters16(), string.length());
return;
}
@@ -244,7 +173,7 @@
return;
unsigned strLength = m_impl->length();
-
+
ASSERT(charactersToAppend);
if (lengthToAppend > MaxLength - strLength)
CRASH();
Modified: trunk/Source/WTF/wtf/text/WTFString.h (292878 => 292879)
--- trunk/Source/WTF/wtf/text/WTFString.h 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WTF/wtf/text/WTFString.h 2022-04-14 17:55:19 UTC (rev 292879)
@@ -190,12 +190,6 @@
bool endsWith(char character) const { return endsWith(static_cast<UChar>(character)); }
bool hasInfixEndingAt(StringView suffix, unsigned end) const;
- WTF_EXPORT_PRIVATE void append(const String&);
- WTF_EXPORT_PRIVATE void append(LChar);
- void append(char character) { append(static_cast<LChar>(character)); };
- WTF_EXPORT_PRIVATE void append(UChar);
- WTF_EXPORT_PRIVATE void append(const LChar*, unsigned length);
- WTF_EXPORT_PRIVATE void append(const UChar*, unsigned length);
WTF_EXPORT_PRIVATE void insert(const String&, unsigned position);
String& replace(UChar target, UChar replacement);
@@ -340,6 +334,10 @@
private:
template<typename CharacterType> void removeInternal(const CharacterType*, unsigned, unsigned);
+ // FIXME: Only used by insert(), we should consider dropping them.
+ void append(const LChar*, unsigned length);
+ void append(const UChar*, unsigned length);
+
template<bool allowEmptyEntries> void splitInternal(UChar separator, const SplitFunctor&) const;
template<bool allowEmptyEntries> Vector<String> splitInternal(UChar separator) const;
template<bool allowEmptyEntries> Vector<String> splitInternal(StringView separator) const;
Modified: trunk/Source/WebCore/ChangeLog (292878 => 292879)
--- trunk/Source/WebCore/ChangeLog 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/ChangeLog 2022-04-14 17:55:19 UTC (rev 292879)
@@ -1,3 +1,59 @@
+2022-04-14 Chris Dumez <[email protected]>
+
+ Drop inefficient String::append() overloads
+ https://bugs.webkit.org/show_bug.cgi?id=239289
+
+ Reviewed by Sam Weinig.
+
+ * Modules/indexeddb/IDBKeyData.cpp:
+ (WebCore::IDBKeyData::loggingString const):
+ * Modules/indexeddb/IDBKeyRangeData.cpp:
+ (WebCore::IDBKeyRangeData::loggingString const):
+ * Modules/indexeddb/shared/IDBIndexInfo.cpp:
+ (WebCore::IDBIndexInfo::loggingString const):
+ * Modules/websockets/WebSocketHandshake.cpp:
+ (WebCore::trimInputSample):
+ * accessibility/isolatedtree/AXIsolatedObject.cpp:
+ (WebCore::AXIsolatedObject::initializeAttributeData):
+ * dom/CharacterData.cpp:
+ (WebCore::CharacterData::parserAppendData):
+ * dom/Text.cpp:
+ (WebCore::appendTextRepresentation):
+ * dom/ViewportArguments.cpp:
+ (WebCore::viewportErrorMessage):
+ * editing/markup.cpp:
+ (WebCore::fillContainerFromString):
+ * html/FTPDirectoryDocument.cpp:
+ (WebCore::FTPDirectoryDocumentParser::parseAndAppendOneLine):
+ (WebCore::FTPDirectoryDocumentParser::append):
+ (WebCore::FTPDirectoryDocumentParser::finish):
+ * html/canvas/WebGLRenderingContextBase.cpp:
+ (WebCore::WebGLRenderingContextBase::getActiveUniform):
+ * html/track/WebVTTParser.cpp:
+ (WebCore::WebVTTParser::checkAndStoreStyleSheet):
+ * html/track/WebVTTParser.h:
+ * inspector/InspectorOverlay.cpp:
+ (WebCore::truncateWithEllipsis):
+ * inspector/InspectorOverlayLabel.cpp:
+ (WebCore::InspectorOverlayLabel::draw):
+ * inspector/agents/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::buildObjectForNode):
+ * page/scrolling/ScrollingStateTree.cpp:
+ (WebCore::ScrollingStateTree::scrollingStateTreeAsText const):
+ * platform/graphics/HEVCUtilities.cpp:
+ (WebCore::createHEVCCodecParametersString):
+ * platform/network/HTTPParsers.cpp:
+ (WebCore::trimInputSample):
+ * platform/network/curl/CurlCacheEntry.cpp:
+ (WebCore::CurlCacheEntry::CurlCacheEntry):
+ (WebCore::CurlCacheEntry::saveResponseHeaders):
+ * platform/network/curl/CurlCacheManager.cpp:
+ (WebCore::CurlCacheManager::setCacheDirectory):
+ * platform/network/curl/CurlContext.cpp:
+ (WebCore::CurlHandle::addExtraNetworkLoadMetrics):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
+
2022-04-14 Gabriel Nava Marino <[email protected]>
ScriptDisallowedScope::isEventAllowedInMainThread assert failure when activating AudioSession
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp (292878 => 292879)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -371,10 +371,8 @@
return "<minimum>"_s;
}
- if (result.length() > 150) {
- result.truncate(147);
- result.append("..."_s);
- }
+ if (result.length() > 150)
+ result = makeString(StringView(result).left(147), "..."_s);
return result;
}
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.cpp (292878 => 292879)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -111,10 +111,8 @@
String IDBKeyRangeData::loggingString() const
{
auto result = makeString(lowerOpen ? "( " : "[ ", lowerKey.loggingString(), ", ", upperKey.loggingString(), upperOpen ? " )" : " ]");
- if (result.length() > 400) {
- result.truncate(397);
- result.append("..."_s);
- }
+ if (result.length() > 400)
+ result = makeString(StringView(result).left(397), "..."_s);
return result;
}
Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.cpp (292878 => 292879)
--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -59,10 +59,10 @@
String IDBIndexInfo::loggingString(int indent) const
{
- String indentString;
+ StringBuilder indentString;
for (int i = 0; i < indent; ++i)
indentString.append(' ');
- return makeString(indentString, "Index: ", m_name, " (", m_identifier, ") keyPath: ", WebCore::loggingString(m_keyPath), '\n');
+ return makeString(indentString.toString(), "Index: ", m_name, " (", m_identifier, ") keyPath: ", WebCore::loggingString(m_keyPath), '\n');
}
String IDBIndexInfo::condensedLoggingString() const
Modified: trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp (292878 => 292879)
--- trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -83,13 +83,12 @@
return host;
}
-static const size_t maxInputSampleSize = 128;
-static String trimInputSample(const uint8_t* p, size_t len)
+static constexpr size_t maxInputSampleSize = 128;
+static String trimInputSample(const uint8_t* p, size_t length)
{
- String s = String(p, std::min<size_t>(len, maxInputSampleSize));
- if (len > maxInputSampleSize)
- s.append(horizontalEllipsis);
- return s;
+ if (length <= maxInputSampleSize)
+ return String(p, length);
+ return makeString(StringView(p, length).left(maxInputSampleSize), horizontalEllipsis);
}
static String generateSecWebSocketKey()
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (292878 => 292879)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -355,12 +355,12 @@
Vector<String> classList;
object.classList(classList);
- String combinedClassList;
+ StringBuilder combinedClassList;
for (auto it = classList.begin(), end = classList.end(); it != end; ++it) {
combinedClassList.append(*it);
- combinedClassList.append(" "_s);
+ combinedClassList.append(' ');
}
- setProperty(AXPropertyName::ClassList, combinedClassList);
+ setProperty(AXPropertyName::ClassList, combinedClassList.toString());
setProperty(AXPropertyName::ColorValue, object.colorValue());
Modified: trunk/Source/WebCore/dom/CharacterData.cpp (292878 => 292879)
--- trunk/Source/WebCore/dom/CharacterData.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/dom/CharacterData.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -113,10 +113,7 @@
styleInvalidation.emplace(*parent, childChange);
String oldData = m_data;
- if (string.is8Bit())
- m_data.append(string.characters8() + offset, characterLengthLimit);
- else
- m_data.append(string.characters16() + offset, characterLengthLimit);
+ m_data = makeString(m_data, StringView(string).substring(offset, characterLengthLimit));
ASSERT(!renderer() || is<Text>(*this));
if (auto text = dynamicDowncast<Text>(*this))
Modified: trunk/Source/WebCore/dom/Text.cpp (292878 => 292879)
--- trunk/Source/WebCore/dom/Text.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/dom/Text.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -231,13 +231,11 @@
value.replaceWithLiteral('\\', "\\\\");
value.replaceWithLiteral('\n', "\\n");
- const size_t maxDumpLength = 30;
- if (value.length() > maxDumpLength) {
- value.truncate(maxDumpLength - 10);
- value.append("..."_s);
- }
-
- builder.append(" \"", value, '\"');
+ constexpr size_t maxDumpLength = 30;
+ if (value.length() > maxDumpLength)
+ builder.append(" \"", StringView(value).left(maxDumpLength - 10), "...\"");
+ else
+ builder.append(" \"", value, '\"');
}
String Text::description() const
Modified: trunk/Source/WebCore/dom/ViewportArguments.cpp (292878 => 292879)
--- trunk/Source/WebCore/dom/ViewportArguments.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/dom/ViewportArguments.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -433,7 +433,7 @@
message.replace("%replacement2", replacement2);
if ((errorCode == UnrecognizedViewportArgumentValueError || errorCode == TruncatedViewportArgumentValueError) && replacement1.contains(';'))
- message.append(" Note that ';' is not a separator in viewport values. The list should be comma-separated."_s);
+ message = makeString(message, " Note that ';' is not a separator in viewport values. The list should be comma-separated."_s);
return message;
}
Modified: trunk/Source/WebCore/editing/markup.cpp (292878 => 292879)
--- trunk/Source/WebCore/editing/markup.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/editing/markup.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -1103,7 +1103,7 @@
ASSERT(string.find('\n') == notFound);
Vector<String> tabList = string.splitAllowingEmptyEntries('\t');
- String tabText = emptyString();
+ StringBuilder tabText;
bool first = true;
size_t numEntries = tabList.size();
for (size_t i = 0; i < numEntries; ++i) {
@@ -1112,8 +1112,8 @@
// append the non-tab textual part
if (!s.isEmpty()) {
if (!tabText.isEmpty()) {
- paragraph.appendChild(createTabSpanElement(document, tabText));
- tabText = emptyString();
+ paragraph.appendChild(createTabSpanElement(document, tabText.toString()));
+ tabText.clear();
}
Ref<Node> textNode = document.createTextNode(stringWithRebalancedWhitespace(s, first, i + 1 == numEntries));
paragraph.appendChild(textNode);
@@ -1124,7 +1124,7 @@
if (i + 1 != numEntries)
tabText.append('\t');
else if (!tabText.isEmpty())
- paragraph.appendChild(createTabSpanElement(document, tabText));
+ paragraph.appendChild(createTabSpanElement(document, tabText.toString()));
first = false;
}
Modified: trunk/Source/WebCore/html/FTPDirectoryDocument.cpp (292878 => 292879)
--- trunk/Source/WebCore/html/FTPDirectoryDocument.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/html/FTPDirectoryDocument.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -93,7 +93,7 @@
int m_size { 254 };
UChar* m_buffer;
UChar* m_dest;
- String m_carryOver;
+ StringBuilder m_carryOver;
ListState m_listState;
};
@@ -262,14 +262,15 @@
if (typeResult == FTPMiscEntry || typeResult == FTPJunkEntry)
return;
- String filename(result.filename, result.filenameLength);
+ String filename;
if (result.type == FTPDirectoryEntry) {
- filename.append('/');
+ filename = makeString(StringView { result.filename, result.filenameLength }, '/');
// We have no interest in linking to "current directory"
if (filename == "./")
return;
- }
+ } else
+ filename = String(result.filename, result.filenameLength);
LOG(FTP, "Appending entry - %s, %s", filename.ascii().data(), result.fileSize.ascii().data());
@@ -388,10 +389,10 @@
while (cursor < m_dest) {
if (*cursor == '\n') {
- m_carryOver.append(String(start, cursor - start));
- LOG(FTP, "%s", m_carryOver.ascii().data());
- parseAndAppendOneLine(m_carryOver);
- m_carryOver = String();
+ m_carryOver.append(StringView(start, cursor - start));
+ LOG(FTP, "%s", m_carryOver.toString().ascii().data());
+ parseAndAppendOneLine(m_carryOver.toString());
+ m_carryOver.clear();
start = ++cursor;
} else
@@ -400,7 +401,7 @@
// Copy the partial line we have left to the carryover buffer
if (cursor - start > 1)
- m_carryOver.append(String(start, cursor - start - 1));
+ m_carryOver.append(StringView(start, cursor - start - 1));
}
void FTPDirectoryDocumentParser::finish()
@@ -407,8 +408,8 @@
{
// Possible the last line in the listing had no newline, so try to parse it now
if (!m_carryOver.isEmpty()) {
- parseAndAppendOneLine(m_carryOver);
- m_carryOver = String();
+ parseAndAppendOneLine(m_carryOver.toString());
+ m_carryOver.clear();
}
m_tableElement = nullptr;
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (292878 => 292879)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -3074,7 +3074,7 @@
// FIXME: Do we still need this for the ANGLE backend?
if (!isGLES2Compliant())
if (info.size > 1 && !info.name.endsWith("[0]"))
- info.name.append("[0]"_s);
+ info.name = makeString(info.name, "[0]"_s);
LOG(WebGL, "Returning active uniform %d: %s", index, info.name.utf8().data());
Modified: trunk/Source/WebCore/html/track/WebVTTParser.cpp (292878 => 292879)
--- trunk/Source/WebCore/html/track/WebVTTParser.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/html/track/WebVTTParser.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -362,7 +362,8 @@
if (!line.isEmpty() && !line.contains("-->"))
return false;
- auto styleSheetText = WTFMove(m_currentSourceStyleSheet);
+ auto styleSheetText = m_currentSourceStyleSheet.toString();
+ m_currentSourceStyleSheet.clear();
// WebVTTMode disallows non-data URLs.
auto contents = StyleSheetContents::create(CSSParserContext(WebVTTMode));
Modified: trunk/Source/WebCore/html/track/WebVTTParser.h (292878 => 292879)
--- trunk/Source/WebCore/html/track/WebVTTParser.h 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/html/track/WebVTTParser.h 2022-04-14 17:55:19 UTC (rev 292879)
@@ -192,7 +192,7 @@
String m_previousLine;
String m_currentSettings;
RefPtr<VTTRegion> m_currentRegion;
- String m_currentSourceStyleSheet;
+ StringBuilder m_currentSourceStyleSheet;
WebVTTParserClient& m_client;
Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (292878 => 292879)
--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -97,10 +97,8 @@
static void truncateWithEllipsis(String& string, size_t length)
{
- if (string.length() > length) {
- string.truncate(length);
- string.append(ellipsis);
- }
+ if (string.length() > length)
+ string = makeString(StringView(string).left(length), ellipsis);
}
static FloatPoint localPointToRootPoint(const FrameView* view, const FloatPoint& point)
Modified: trunk/Source/WebCore/inspector/InspectorOverlayLabel.cpp (292878 => 292879)
--- trunk/Source/WebCore/inspector/InspectorOverlayLabel.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/inspector/InspectorOverlayLabel.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -234,8 +234,9 @@
auto textRun = TextRun(text);
float textWidth = font.width(textRun);
+ // FIXME: This looks very inefficient.
if (maximumLineWidth && currentLineWidth + textWidth + (labelPadding * 2) > maximumLineWidth) {
- text.append(ellipsis);
+ text = makeString(text, ellipsis);
while (currentLineWidth + textWidth + (labelPadding * 2) > maximumLineWidth && text.length() > 1) {
// Remove the second from last character (the character before the ellipsis) and remeasure.
text.remove(text.length() - 2);
Modified: trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp (292878 => 292879)
--- trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -1772,10 +1772,8 @@
case Node::COMMENT_NODE:
case Node::CDATA_SECTION_NODE:
nodeValue = node->nodeValue();
- if (nodeValue.length() > maxTextSize) {
- nodeValue = nodeValue.left(maxTextSize);
- nodeValue.append(ellipsisUChar);
- }
+ if (nodeValue.length() > maxTextSize)
+ nodeValue = makeString(StringView(nodeValue).left(maxTextSize), ellipsisUChar);
break;
case Node::ATTRIBUTE_NODE:
localName = node->localName();
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp (292878 => 292879)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -381,10 +381,11 @@
if (!rootStateNode())
return emptyString();
- auto stateTreeAsString = rootStateNode()->scrollingStateTreeAsText(behavior);
+ StringBuilder stateTreeAsString;
+ stateTreeAsString.append(rootStateNode()->scrollingStateTreeAsText(behavior));
if (!m_unparentedNodes.isEmpty())
- stateTreeAsString.append(makeString("\nunparented node count: ", m_unparentedNodes.size()));
- return stateTreeAsString;
+ stateTreeAsString.append("\nunparented node count: ", m_unparentedNodes.size());
+ return stateTreeAsString.toString();
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/HEVCUtilities.cpp (292878 => 292879)
--- trunk/Source/WebCore/platform/graphics/HEVCUtilities.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/platform/graphics/HEVCUtilities.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -202,13 +202,6 @@
String createHEVCCodecParametersString(const HEVCParameters& parameters)
{
- // The format of the 'hevc' codec string is specified in ISO/IEC 14496-15:2014, Annex E.3.
- char profileSpaceCharacter = 'A' + parameters.generalProfileSpace - 1;
-
- String profileSpaceString;
- if (parameters.generalProfileSpace)
- profileSpaceString.append(profileSpaceCharacter);
-
// For the second parameter, from ISO/IEC 14496-15:2014, Annex E.3.
// * the 32 bits of the general_profile_compatibility_flags, but in reverse bit order, i.e. with
// general_profile_compatibility_flag[ 31 ] as the most significant bit, followed by, general_profile_compatibility_flag[ 30 ],
@@ -226,16 +219,16 @@
compatibilityFlags.append(hex(parameters.generalConstraintIndicatorFlags[i], 2));
}
- return makeString(parameters.codec == HEVCParameters::Codec::Hev1 ? "hev1" : "hvc1"
- , '.'
- , profileSpaceString
- , parameters.generalProfileIDC
- , '.'
- , compatFlagParameter
- , '.'
- , parameters.generalTierFlag ? 'H' : 'L'
- , parameters.generalLevelIDC
- , compatibilityFlags.toString());
+ StringBuilder resultBuilder;
+ resultBuilder.append(parameters.codec == HEVCParameters::Codec::Hev1 ? "hev1" : "hvc1", '.');
+ if (parameters.generalProfileSpace) {
+ // The format of the 'hevc' codec string is specified in ISO/IEC 14496-15:2014, Annex E.3.
+ char profileSpaceCharacter = 'A' + parameters.generalProfileSpace - 1;
+ resultBuilder.append(profileSpaceCharacter);
+ }
+ resultBuilder.append(parameters.generalProfileIDC, '.', compatFlagParameter, '.', parameters.generalTierFlag ? 'H' : 'L', parameters.generalLevelIDC);
+ resultBuilder.append(compatibilityFlags);
+ return resultBuilder.toString();
}
std::optional<HEVCParameters> parseHEVCDecoderConfigurationRecord(FourCC codecCode, const SharedBuffer& buffer)
Modified: trunk/Source/WebCore/platform/network/HTTPParsers.cpp (292878 => 292879)
--- trunk/Source/WebCore/platform/network/HTTPParsers.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/platform/network/HTTPParsers.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -311,10 +311,9 @@
template<typename CharType>
static String trimInputSample(CharType* p, size_t length)
{
- String s = String(p, std::min<size_t>(length, maxInputSampleSize));
- if (length > maxInputSampleSize)
- s.append(horizontalEllipsis);
- return s;
+ if (length <= maxInputSampleSize)
+ return String(p, length);
+ return makeString(StringView(p, length).left(maxInputSampleSize), horizontalEllipsis);
}
std::optional<WallTime> parseHTTPDate(const String& value)
Modified: trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.cpp (292878 => 292879)
--- trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -49,9 +49,7 @@
namespace WebCore {
CurlCacheEntry::CurlCacheEntry(const String& url, ResourceHandle* job, const String& cacheDir)
- : m_headerFilename(cacheDir)
- , m_contentFilename(cacheDir)
- , m_contentFile(FileSystem::invalidPlatformFileHandle)
+ : m_contentFile(FileSystem::invalidPlatformFileHandle)
, m_entrySize(0)
, m_expireDate(WallTime::fromRawSeconds(-1))
, m_headerParsed(false)
@@ -60,11 +58,8 @@
{
generateBaseFilename(url.latin1());
- m_headerFilename.append(m_basename);
- m_headerFilename.append(".header"_s);
-
- m_contentFilename.append(m_basename);
- m_contentFilename.append(".content"_s);
+ m_headerFilename = makeString(cacheDir, m_basename, ".header"_s);
+ m_contentFilename = makeString(cacheDir, m_basename, ".content"_s);
}
CurlCacheEntry::~CurlCacheEntry()
@@ -138,12 +133,8 @@
HTTPHeaderMap::const_iterator it = response.httpHeaderFields().begin();
HTTPHeaderMap::const_iterator end = response.httpHeaderFields().end();
while (it != end) {
- String headerField = it->key;
- headerField.append(": "_s);
- headerField.append(it->value);
- headerField.append("\n"_s);
- CString headerFieldLatin1 = headerField.latin1();
- FileSystem::writeToFile(headerFile, headerFieldLatin1.data(), headerFieldLatin1.length());
+ auto headerField = makeString(it->key, ": ", it->value, '\n').latin1();
+ FileSystem::writeToFile(headerFile, headerField.data(), headerField.length());
m_cachedResponse.setHTTPHeaderField(it->key, it->value);
++it;
}
Modified: trunk/Source/WebCore/platform/network/curl/CurlCacheManager.cpp (292878 => 292879)
--- trunk/Source/WebCore/platform/network/curl/CurlCacheManager.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/platform/network/curl/CurlCacheManager.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -85,7 +85,7 @@
}
}
- m_cacheDir.append("/"_s);
+ m_cacheDir = makeString(m_cacheDir, '/');
m_disabled = false;
loadIndex();
Modified: trunk/Source/WebCore/platform/network/curl/CurlContext.cpp (292878 => 292879)
--- trunk/Source/WebCore/platform/network/curl/CurlContext.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/platform/network/curl/CurlContext.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -39,6 +39,7 @@
#include <wtf/MainThread.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenateNumbers.h>
#if OS(WINDOWS)
#include "WebCoreBundleWin.h"
@@ -890,11 +891,8 @@
additionalMetrics->requestBodyBytesSent = requestBodySize;
additionalMetrics->responseHeaderBytesReceived = responseHeaderSize;
- if (ip) {
- additionalMetrics->remoteAddress = String::fromLatin1(ip);
- if (port)
- additionalMetrics->remoteAddress.append(":" + String::number(port));
- }
+ if (ip)
+ additionalMetrics->remoteAddress = port ? makeString(ip, ':', port) : String::fromLatin1(ip);
if (m_tlsConnectionInfo) {
additionalMetrics->tlsProtocol = m_tlsConnectionInfo->protocol;
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (292878 => 292879)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -515,10 +515,8 @@
{
String layerName = m_owningLayer.name();
const unsigned maxLayerNameLength = 100;
- if (layerName.length() > maxLayerNameLength) {
- layerName.truncate(maxLayerNameLength);
- layerName.append("..."_s);
- }
+ if (layerName.length() > maxLayerNameLength)
+ layerName = makeString(StringView(layerName).left(maxLayerNameLength), "..."_s);
m_graphicsLayer = createGraphicsLayer(layerName, m_isFrameLayerWithTiledBacking ? GraphicsLayer::Type::PageTiledBacking : GraphicsLayer::Type::Normal);
if (m_isFrameLayerWithTiledBacking) {
Modified: trunk/Source/WebKit/ChangeLog (292878 => 292879)
--- trunk/Source/WebKit/ChangeLog 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebKit/ChangeLog 2022-04-14 17:55:19 UTC (rev 292879)
@@ -1,3 +1,15 @@
+2022-04-14 Chris Dumez <[email protected]>
+
+ Drop inefficient String::append() overloads
+ https://bugs.webkit.org/show_bug.cgi?id=239289
+
+ Reviewed by Sam Weinig.
+
+ * Shared/mac/AuxiliaryProcessMac.mm:
+ (WebKit::populateSandboxInitializationParameters):
+ * WebProcess/Plugins/PDF/PDFPlugin.mm:
+ (WebKit::PDFPlugin::setSuggestedFilename):
+
2022-04-14 Justin Michaud <[email protected]>
[PGO] We should be able to build WebKit to collect PGO profiles easily
Modified: trunk/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm (292878 => 292879)
--- trunk/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm 2022-04-14 17:55:19 UTC (rev 292879)
@@ -703,10 +703,9 @@
}
sandboxParameters.addPathParameter("HOME_DIR", pwd.pw_dir);
- String path = String::fromUTF8(pwd.pw_dir);
- path.append("/Library"_s);
+ String path = FileSystem::pathByAppendingComponent(String::fromUTF8(pwd.pw_dir), "Library"_s);
sandboxParameters.addPathParameter("HOME_LIBRARY_DIR", FileSystem::fileSystemRepresentation(path).data());
- path.append("/Preferences"_s);
+ path = FileSystem::pathByAppendingComponent(path, "/Preferences"_s);
sandboxParameters.addPathParameter("HOME_LIBRARY_PREFERENCES_DIR", FileSystem::fileSystemRepresentation(path).data());
#if CPU(X86_64)
Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm (292878 => 292879)
--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm 2022-04-14 17:55:19 UTC (rev 292879)
@@ -1691,7 +1691,7 @@
m_suggestedFilename = suggestedFilenameWithMIMEType(nil, "application/pdf"_s);
if (!m_suggestedFilename.endsWithIgnoringASCIICase(".pdf"))
- m_suggestedFilename.append(".pdf"_s);
+ m_suggestedFilename = makeString(m_suggestedFilename, ".pdf"_s);
}
void PDFPlugin::streamDidReceiveResponse(uint64_t streamID, const URL&, uint32_t, uint32_t, const String& mimeType, const String&, const String& suggestedFilename)
Modified: trunk/Source/WebKitLegacy/win/ChangeLog (292878 => 292879)
--- trunk/Source/WebKitLegacy/win/ChangeLog 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebKitLegacy/win/ChangeLog 2022-04-14 17:55:19 UTC (rev 292879)
@@ -1,3 +1,13 @@
+2022-04-14 Chris Dumez <[email protected]>
+
+ Drop inefficient String::append() overloads
+ https://bugs.webkit.org/show_bug.cgi?id=239289
+
+ Reviewed by Sam Weinig.
+
+ * WebDownload.cpp:
+ (WebDownload::bundlePathForTargetPath):
+
2022-04-07 Chris Dumez <[email protected]>
Drop unused EditorClient::getAutoCorrectSuggestionForMisspelledWord()
Modified: trunk/Source/WebKitLegacy/win/WebDownload.cpp (292878 => 292879)
--- trunk/Source/WebKitLegacy/win/WebDownload.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Source/WebKitLegacy/win/WebDownload.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -140,10 +140,7 @@
if (bundle.isEmpty())
return E_INVALIDARG;
- if (bundle[bundle.length()-1] == '/')
- bundle.truncate(1);
-
- bundle.append(DownloadBundle::fileExtension());
+ bundle = bundle[bundle.length() - 1] == '/' ? makeString(StringView(bundle).left(bundle.length() - 1), DownloadBundle::fileExtension()) : makeString(bundle, DownloadBundle::fileExtension());
*bundlePath = BString(bundle).release();
if (!*bundlePath)
return E_FAIL;
Modified: trunk/Tools/ChangeLog (292878 => 292879)
--- trunk/Tools/ChangeLog 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Tools/ChangeLog 2022-04-14 17:55:19 UTC (rev 292879)
@@ -1,3 +1,19 @@
+2022-04-14 Chris Dumez <[email protected]>
+
+ Drop inefficient String::append() overloads
+ https://bugs.webkit.org/show_bug.cgi?id=239289
+
+ Reviewed by Sam Weinig.
+
+ * TestWebKitAPI/Tests/WTF/FileSystem.cpp:
+ (TestWebKitAPI::TEST_F):
+ * TestWebKitAPI/Tests/WTF/StringBuilder.cpp:
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:
+ (TestWebKitAPI::TEST_F):
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::didReceiveAuthenticationChallenge):
+
2022-04-14 John Cunningham <[email protected]>
Replace PaintCompositedResultsToMediaSample with PaintCompositedResultsToVideoFrame in generate-gpup-webgl
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp (292878 => 292879)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -485,9 +485,7 @@
EXPECT_EQ(FileSystem::fileType(subFolderPath), FileSystem::FileType::Directory);
EXPECT_TRUE(FileSystem::deleteNonEmptyDirectory(tempEmptyFolderPath()));
EXPECT_FALSE(FileSystem::fileExists(subFolderPath));
- String invalidFolderPath;
- invalidFolderPath.append('\0');
- invalidFolderPath.append('a');
+ String invalidFolderPath = makeString('\0', 'a');
EXPECT_FALSE(FileSystem::makeAllDirectories(invalidFolderPath));
EXPECT_FALSE(FileSystem::makeAllDirectories(emptyString()));
}
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/StringBuilder.cpp (292878 => 292879)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/StringBuilder.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/StringBuilder.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -209,9 +209,9 @@
// Changing the original result of toString() should not affect the content of the StringBuilder.
String string1 = builder.toString();
EXPECT_EQ(String("0123456789abcdefghijklmnopqrstuvwxyzABC"_s), string1);
- string1.append("DEF"_s);
+ string1.replace('0', 'a');
EXPECT_EQ(String("0123456789abcdefghijklmnopqrstuvwxyzABC"_s), builder.toString());
- EXPECT_EQ(String("0123456789abcdefghijklmnopqrstuvwxyzABCDEF"_s), string1);
+ EXPECT_EQ(String("a123456789abcdefghijklmnopqrstuvwxyzABC"_s), string1);
// Resizing the StringBuilder should not affect the original result of toString().
string1 = builder.toString();
@@ -251,9 +251,9 @@
EXPECT_EQ(capacity, builder.capacity());
EXPECT_EQ(string1.characters8(), builder.characters8());
EXPECT_EQ(String("0123456789abcdefghijklmnopqrstuvwxyzABC"_s), string1);
- string1.append("DEF"_s);
+ string1.replace('0', 'a');
EXPECT_EQ(String("0123456789abcdefghijklmnopqrstuvwxyzABC"_s), builder.toStringPreserveCapacity());
- EXPECT_EQ(String("0123456789abcdefghijklmnopqrstuvwxyzABCDEF"_s), string1);
+ EXPECT_EQ(String("a123456789abcdefghijklmnopqrstuvwxyzABC"_s), string1);
// Resizing the StringBuilder should not affect the original result of toStringPreserveCapacity().
capacity = builder.capacity();
Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp (292878 => 292879)
--- trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -1507,10 +1507,8 @@
rules.append("["_s);
for (unsigned i = 0; i < 149999; ++i)
rules.append("{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"a\"}},"_s);
- String rules150000 = rules.toString();
- String rules150001 = rules.toString();
- rules150000.append("{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"a\"}}]"_s);
- rules150001.append("{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"a\"}},{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"a\"}}]"_s);
+ String rules150000 = makeString(rules.toString(), "{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"a\"}}]"_s);
+ String rules150001 = makeString(rules.toString(), "{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"a\"}},{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"a\"}}]"_s);
checkCompilerError(WTFMove(rules150000), { });
checkCompilerError(WTFMove(rules150001), ContentExtensionError::JSONTooManyRules);
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (292878 => 292879)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2022-04-14 17:46:32 UTC (rev 292878)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2022-04-14 17:55:19 UTC (rev 292879)
@@ -2236,12 +2236,13 @@
auto host = toWTFString(adoptWK(WKProtectionSpaceCopyHost(protectionSpace)).get());
int port = WKProtectionSpaceGetPort(protectionSpace);
- String message = makeString(host, ':', port, " - didReceiveAuthenticationChallenge - ", toString(authenticationScheme), " - ");
+ StringBuilder message;
+ message.append(host, ':', port, " - didReceiveAuthenticationChallenge - ", toString(authenticationScheme), " - ");
if (!m_handlesAuthenticationChallenges)
message.append("Simulating cancelled authentication sheet\n"_s);
else
message.append("Responding with " + m_authenticationUsername + ":" + m_authenticationPassword + "\n");
- m_currentInvocation->outputText(message);
+ m_currentInvocation->outputText(message.toString());
if (!m_handlesAuthenticationChallenges) {
WKAuthenticationDecisionListenerUseCredential(decisionListener, 0);