WebKit Bugzilla
Attachment 357404 Details for
Bug 192742
: Replace many uses of String::format with more type-safe alternatives
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192742-20181215121834.patch (text/plain), 70.99 KB, created by
Darin Adler
on 2018-12-15 12:18:35 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Darin Adler
Created:
2018-12-15 12:18:35 PST
Size:
70.99 KB
patch
obsolete
>Subversion Revision: 239251 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index a70463f46e3ced863f75393c2b2400eb1ea59850..7e6b36bd6645f34de959c7e0ad9c3c0c31df968b 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,25 @@ >+2018-12-15 Darin Adler <darin@apple.com> >+ >+ Replace many uses of String::format with more type-safe alternatives >+ https://bugs.webkit.org/show_bug.cgi?id=192742 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * inspector/InjectedScriptBase.cpp: >+ (Inspector::InjectedScriptBase::makeCall): Use makeString. >+ (Inspector::InjectedScriptBase::makeAsyncCall): Ditto. >+ * inspector/InspectorBackendDispatcher.cpp: >+ (Inspector::BackendDispatcher::getPropertyValue): Ditto. >+ * inspector/agents/InspectorConsoleAgent.cpp: >+ (Inspector::InspectorConsoleAgent::enable): Ditto. >+ * jsc.cpp: >+ (FunctionJSCStackFunctor::operator() const): Ditto. >+ >+ * runtime/IntlDateTimeFormat.cpp: >+ (JSC::IntlDateTimeFormat::initializeDateTimeFormat): Use string concatenation. >+ * runtime/IntlObject.cpp: >+ (JSC::canonicalizeLocaleList): Ditto. >+ > 2018-12-14 Darin Adler <darin@apple.com> > > LiteralParser has a bunch of uses of String::format with untrusted data >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 96bdb908771bef046154a82033a4d84a3b6d9395..90393c843a12b062341cba08dae05e244b826cdb 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,17 @@ >+2018-12-15 Darin Adler <darin@apple.com> >+ >+ Replace many uses of String::format with more type-safe alternatives >+ https://bugs.webkit.org/show_bug.cgi?id=192742 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/WorkQueue.cpp: >+ (WTF::WorkQueue::concurrentApply): Use makeString. >+ >+ * wtf/dtoa.cpp: >+ (WTF::dtoa): Use sprintf instead of String::format in the comments, >+ since these functions have nothing to do with WTF::String. >+ > 2018-12-14 Darin Adler <darin@apple.com> > > Verify size is valid in USE_SYSTEM_MALLOC version of tryAllocateZeroedVirtualPages >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index ed2d073c8795eb42d321460af2630fe0276ed52e..3a9c806cd15c66cbf8ad8ca225836093287c5e9f 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,119 @@ >+2018-12-15 Darin Adler <darin@apple.com> >+ >+ Replace many uses of String::format with more type-safe alternatives >+ https://bugs.webkit.org/show_bug.cgi?id=192742 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ A while back, String::format was more efficient than string concatenation, >+ but that is no longer true, and we should prefer String::number, makeString, >+ or concatenation with the "+" operator to String::format for new code. >+ >+ This is not as good for programmers who are fond of printf formatting >+ style, and in some cases it's a little harder to read the strings >+ interspersed with variables rather than a format string, but it's better >+ in a few ways: >+ >+ - more efficient (I didn't measure the difference, but it's definitely >+ slower to use String::Format which calls vsnprintf twice than to use >+ the WTF code) >+ - works in a type-safe way without a need to use a format specifier such >+ as "%" PRIu64 or "%tu" making it much easier to avoid problems due to >+ subtle differences between platforms >+ - allows us to use StringView in some cases to sidestep the need to >+ allocate temporary WTF::String objects >+ - does not require converting each WTF::String to a C string, allowing >+ us to remove many cases of ".utf8().data()" and similar expressions, >+ eliminating the allocation of temporary WTF::CString objects >+ >+ This patch covers a batch of easiest-to-convert call sites. >+ Later patches will allow us to deprecate or remove String::format. >+ >+ * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: >+ (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): Use makeString. >+ * Modules/indexeddb/shared/IDBCursorInfo.cpp: >+ (WebCore::IDBCursorInfo::loggingString const): Ditto. >+ * Modules/indexeddb/shared/IDBGetAllRecordsData.cpp: >+ (WebCore::IDBGetAllRecordsData::loggingString const): Ditto. >+ * Modules/indexeddb/shared/IDBGetRecordData.cpp: >+ (WebCore::IDBGetRecordData::loggingString const): Ditto. >+ * Modules/indexeddb/shared/IDBIndexInfo.cpp: >+ (WebCore::IDBIndexInfo::loggingString const): Ditto. >+ (WebCore::IDBIndexInfo::condensedLoggingString const): Ditto. >+ * Modules/indexeddb/shared/IDBIterateCursorData.cpp: >+ (WebCore::IDBIterateCursorData::loggingString const): Ditto. >+ * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp: >+ (WebCore::IDBObjectStoreInfo::condensedLoggingString const): Ditto. >+ * Modules/indexeddb/shared/IDBResourceIdentifier.cpp: >+ (WebCore::IDBResourceIdentifier::loggingString const): Ditto. >+ * Modules/webdatabase/Database.cpp: >+ (WebCore::formatErrorMessage): Ditto. >+ * Modules/webdatabase/SQLError.h: >+ (WebCore::SQLError::create): Ditto. >+ >+ * bindings/scripts/CodeGeneratorJS.pm: >+ (GenerateImplementation): Use makeString. >+ >+ * css/parser/CSSPropertyParserHelpers.cpp: >+ (WebCore::CSSPropertyParserHelpers::parseHexColor): Use String::number >+ and makeString. >+ >+ * html/HTMLSelectElement.cpp: >+ (WebCore::HTMLSelectElement::setLength): Use makeString. >+ * html/ImageDocument.cpp: >+ (WebCore::ImageDocument::imageUpdated): Ditto. >+ * html/parser/XSSAuditor.cpp: >+ (WebCore::XSSAuditor::init): Ditto. >+ * inspector/InspectorFrontendClientLocal.cpp: >+ (WebCore::InspectorFrontendClientLocal::setDockingUnavailable): Ditto. >+ (WebCore::InspectorFrontendClientLocal::setAttachedWindow): Ditto. >+ (WebCore::InspectorFrontendClientLocal::setDebuggingEnabled): Ditto. >+ (WebCore::InspectorFrontendClientLocal::setTimelineProfilingEnabled): Ditto. >+ (WebCore::InspectorFrontendClientLocal::showMainResourceForFrame): Ditto. >+ * inspector/agents/InspectorCSSAgent.cpp: Ditto. >+ * inspector/agents/InspectorIndexedDBAgent.cpp: Ditto. >+ * page/MemoryRelease.cpp: >+ (WebCore::logMemoryStatisticsAtTimeOfDeath): Ditto. >+ >+ * page/cocoa/ResourceUsageOverlayCocoa.mm: >+ (WebCore::formatByteNumber): Use String::number. >+ (WebCore::ResourceUsageOverlay::platformDraw): Use string concatenation. >+ >+ * page/cocoa/ResourceUsageThreadCocoa.mm: >+ (WebCore::logFootprintComparison): Use makeString. >+ * platform/animation/TimingFunction.cpp: >+ (WebCore::TimingFunction::cssText const): Ditto. >+ >+ * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm: >+ (WebCore::AVTrackPrivateAVFObjCImpl::id const): Use AtomicString::number. >+ * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h: >+ (WebCore::MediaSampleAVFObjC::MediaSampleAVFObjC): Ditto. >+ >+ * platform/graphics/ca/GraphicsLayerCA.cpp: >+ (WebCore::GraphicsLayerCA::setContentsToSolidColor): Use makeString. >+ (WebCore::GraphicsLayerCA::updateContentsImage): Ditto. >+ (WebCore::GraphicsLayerCA::updateContentsRects): Ditto. >+ (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): Ditto. >+ * platform/mock/MockRealtimeVideoSource.cpp: >+ (WebCore::MockRealtimeVideoSource::drawText): Ditto. >+ >+ * platform/mock/mediasource/MockSourceBufferPrivate.cpp: Use String::number. >+ >+ * platform/network/ParsedContentRange.cpp: >+ (WebCore::ParsedContentRange::headerValue const): Use makeString. >+ >+ * platform/network/cf/NetworkStorageSessionCFNet.cpp: Removed some unnecessary >+ compiler conditionals and reorganized the start/stop of namespaces. >+ (WebCore::NetworkStorageSession::switchToNewTestingSession): Use makeString. >+ >+ * platform/sql/SQLiteDatabase.cpp: >+ (WebCore::unauthorizedSQLFunction): Use makeString. >+ * rendering/RenderLayerCompositor.cpp: >+ (WebCore::RenderLayerCompositor::logLayerInfo): Ditto. >+ * workers/service/server/RegistrationDatabase.cpp: >+ (WebCore::RegistrationDatabase::ensureValidRecordsTable): Ditto. >+ (WebCore::RegistrationDatabase::importRecords): Ditto. >+ > 2018-12-14 Joseph Pecoraro <pecoraro@apple.com> > > Web Inspector: Avoid creating and evaluating in the InspectorOverlay page on iOS as it is unused >diff --git a/Source/WebCore/PAL/ChangeLog b/Source/WebCore/PAL/ChangeLog >index 53e50089fc5212ddbd1abb2a9613290886bce4d0..cf0388c620cdb01a99572f2cfc1ae8831ba39f13 100644 >--- a/Source/WebCore/PAL/ChangeLog >+++ b/Source/WebCore/PAL/ChangeLog >@@ -1,3 +1,13 @@ >+2018-12-15 Darin Adler <darin@apple.com> >+ >+ Replace many uses of String::format with more type-safe alternatives >+ https://bugs.webkit.org/show_bug.cgi?id=192742 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * pal/FileSizeFormatter.cpp: >+ (fileSizeDescription): Use makeString. >+ > 2018-12-11 Justin Michaud <justin_michaud@apple.com> > > Implement feature flag for CSS Typed OM >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index e888d8b0b2393c8f6493b158bcea84f5b5619353..338821d842783a99f2acb6a86d067a3a62baeb17 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,22 @@ >+2018-12-15 Darin Adler <darin@apple.com> >+ >+ Replace many uses of String::format with more type-safe alternatives >+ https://bugs.webkit.org/show_bug.cgi?id=192742 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Shared/WebMemorySampler.cpp: >+ (WebKit::WebMemorySampler::writeHeaders): Use makeString. >+ >+ * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: >+ (WebKit::LocalAuthenticator::makeCredential): Use string concatentation. >+ >+ * UIProcess/WebInspectorUtilities.cpp: >+ (WebKit::inspectorPageGroupIdentifierForPage): Use makeString. >+ * UIProcess/WebProcessPool.cpp: >+ (WebKit::WebProcessPool::processDidFinishLaunching): Ditto. >+ (WebKit::WebProcessPool::startMemorySampler): Ditto. >+ > 2018-12-14 Ryan Haddad <ryanhaddad@apple.com> > > Unreviewed, fix the build with recent SDKs. >diff --git a/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp b/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp >index e30c6014174c81383089b0bc05276957ff8a23ca..867e0b52d46becfeb6b6f63517bd27eb680db0ef 100644 >--- a/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp >+++ b/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp >@@ -40,7 +40,7 @@ > #include "NativeStdFunctionCell.h" > #include "ScriptFunctionCall.h" > #include <wtf/JSONValues.h> >-#include <wtf/text/WTFString.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace Inspector { > >@@ -91,7 +91,7 @@ Ref<JSON::Value> InjectedScriptBase::makeCall(Deprecated::ScriptFunctionCall& fu > > RefPtr<JSON::Value> resultJSONValue = toInspectorValue(*m_injectedScriptObject.scriptState(), resultJSValue); > if (!resultJSONValue) >- return JSON::Value::create(String::format("Object has too long reference chain (must not be longer than %d)", JSON::Value::maxDepth)); >+ return JSON::Value::create(makeString("Object has too long reference chain (must not be longer than ", JSON::Value::maxDepth, ')')); > > return resultJSONValue.releaseNonNull(); > } >@@ -122,7 +122,7 @@ void InjectedScriptBase::makeAsyncCall(Deprecated::ScriptFunctionCall& function, > if (auto resultJSONValue = toInspectorValue(*exec, exec->argument(0))) > checkAsyncCallResult(resultJSONValue, callback); > else >- checkAsyncCallResult(JSON::Value::create(String::format("Object has too long reference chain (must not be longer than %d)", JSON::Value::maxDepth)), callback); >+ checkAsyncCallResult(JSON::Value::create(makeString("Object has too long reference chain (must not be longer than ", JSON::Value::maxDepth, ')')), callback); > return JSC::JSValue::encode(JSC::jsUndefined()); > }); > } >diff --git a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp >index aa4eb4e3d9ebff006c4874457b53d60de416020a..7dfb6ce70a57bcdedacecb6689b7b625fe741a53 100644 >--- a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp >+++ b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp >@@ -291,19 +291,19 @@ T BackendDispatcher::getPropertyValue(JSON::Object* object, const String& name, > > if (!object) { > if (!out_optionalValueFound) >- reportProtocolError(BackendDispatcher::InvalidParams, String::format("'params' object must contain required parameter '%s' with type '%s'.", name.utf8().data(), typeName)); >+ reportProtocolError(BackendDispatcher::InvalidParams, makeString("'params' object must contain required parameter '", name, "' with type '", typeName, "'.")); > return result; > } > > auto findResult = object->find(name); > if (findResult == object->end()) { > if (!out_optionalValueFound) >- reportProtocolError(BackendDispatcher::InvalidParams, String::format("Parameter '%s' with type '%s' was not found.", name.utf8().data(), typeName)); >+ reportProtocolError(BackendDispatcher::InvalidParams, makeString("Parameter '", name, "' with type '", typeName, "' was not found.")); > return result; > } > > if (!asMethod(*findResult->value, result)) { >- reportProtocolError(BackendDispatcher::InvalidParams, String::format("Parameter '%s' has wrong type. It must be '%s'.", name.utf8().data(), typeName)); >+ reportProtocolError(BackendDispatcher::InvalidParams, makeString("Parameter '", name, "' has wrong type. It must be '", typeName, "'.")); > return result; > } > >diff --git a/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp >index 4cfed7c55f468db4eb1b50f50a824c3fdd7fea99..3fc5e992a950f2019f91648d0d1ae7d2736e42fc 100644 >--- a/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp >+++ b/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp >@@ -35,7 +35,7 @@ > #include "ScriptCallStack.h" > #include "ScriptCallStackFactory.h" > #include "ScriptObject.h" >-#include <wtf/text/WTFString.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace Inspector { > >@@ -79,7 +79,7 @@ void InspectorConsoleAgent::enable(ErrorString&) > m_enabled = true; > > if (m_expiredConsoleMessageCount) { >- ConsoleMessage expiredMessage(MessageSource::Other, MessageType::Log, MessageLevel::Warning, String::format("%d console messages are not shown.", m_expiredConsoleMessageCount)); >+ ConsoleMessage expiredMessage(MessageSource::Other, MessageType::Log, MessageLevel::Warning, makeString(m_expiredConsoleMessageCount, " console messages are not shown.")); > expiredMessage.addToFrontend(*m_frontendDispatcher, m_injectedScriptManager, false); > } > >diff --git a/Source/JavaScriptCore/jsc.cpp b/Source/JavaScriptCore/jsc.cpp >index a84cc23895eedda6d4a1fec541ac24080365ee3f..598f253db825792eaa2aa56aa5e3c6f977120650 100644 >--- a/Source/JavaScriptCore/jsc.cpp >+++ b/Source/JavaScriptCore/jsc.cpp >@@ -89,6 +89,7 @@ > #include <wtf/StringPrintStream.h> > #include <wtf/WallTime.h> > #include <wtf/text/StringBuilder.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > #if OS(WINDOWS) > #include <direct.h> >@@ -1164,7 +1165,7 @@ public: > > StackVisitor::Status operator()(StackVisitor& visitor) const > { >- m_trace.append(String::format(" %zu %s\n", visitor->index(), visitor->toString().utf8().data())); >+ m_trace.append(makeString(" ", visitor->index(), " ", visitor->toString(), '\n')); > return StackVisitor::Continue; > } > >diff --git a/Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp b/Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp >index ae3d680185300d4fb2c2a2207a73a3917de8f34a..1e8d9e3cb3c0261dcd58307358a0497b850463fc 100644 >--- a/Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp >+++ b/Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp >@@ -504,7 +504,7 @@ void IntlDateTimeFormat::initializeDateTimeFormat(ExecState& exec, JSValue local > RETURN_IF_EXCEPTION(scope, void()); > tz = canonicalizeTimeZoneName(originalTz); > if (tz.isNull()) { >- throwRangeError(&exec, scope, String::format("invalid time zone: %s", originalTz.utf8().data())); >+ throwRangeError(&exec, scope, "invalid time zone: " + originalTz); > return; > } > } else >diff --git a/Source/JavaScriptCore/runtime/IntlObject.cpp b/Source/JavaScriptCore/runtime/IntlObject.cpp >index 7a18b3dbd898063f543d97bb4d0a378f935c08f8..17960171f8b2818de6446e1932da0eccb0c720f8 100644 >--- a/Source/JavaScriptCore/runtime/IntlObject.cpp >+++ b/Source/JavaScriptCore/runtime/IntlObject.cpp >@@ -553,7 +553,7 @@ Vector<String> canonicalizeLocaleList(ExecState& state, JSValue locales) > > String canonicalizedTag = canonicalizeLanguageTag(tag->value(&state)); > if (canonicalizedTag.isNull()) { >- throwException(&state, scope, createRangeError(&state, String::format("invalid language tag: %s", tag->value(&state).utf8().data()))); >+ throwException(&state, scope, createRangeError(&state, "invalid language tag: " + tag->value(&state))); > return Vector<String>(); > } > >diff --git a/Source/WTF/wtf/WorkQueue.cpp b/Source/WTF/wtf/WorkQueue.cpp >index e40577c7660315fcc8be528120764b4823156aa7..7ab9f3af6c4acb5e62066381cb8e51cfdf4fedf3 100644 >--- a/Source/WTF/wtf/WorkQueue.cpp >+++ b/Source/WTF/wtf/WorkQueue.cpp >@@ -75,7 +75,7 @@ void WorkQueue::concurrentApply(size_t iterations, WTF::Function<void (size_t in > > m_workers.reserveInitialCapacity(threadCount); > for (unsigned i = 0; i < threadCount; ++i) { >- m_workers.append(Thread::create(String::format("ThreadPool Worker %u", i).utf8().data(), [this] { >+ m_workers.append(Thread::create(makeString("ThreadPool Worker ", i).utf8().data(), [this] { > threadBody(); > })); > } >diff --git a/Source/WTF/wtf/dtoa.cpp b/Source/WTF/wtf/dtoa.cpp >index 84655830e90fb7eb754ec7dd940b253eca5e4e52..683314ffd4e98a5fdc08586fc877881b2ab6cabf 100644 >--- a/Source/WTF/wtf/dtoa.cpp >+++ b/Source/WTF/wtf/dtoa.cpp >@@ -1272,7 +1272,7 @@ static inline const char* formatStringTruncatingTrailingZerosIfNeeded(NumberToSt > > const char* numberToFixedPrecisionString(double d, unsigned significantFigures, NumberToStringBuffer buffer, bool truncateTrailingZeros) > { >- // Mimic String::format("%.[precision]g", ...), but use dtoas rounding facilities. >+ // Mimic sprintf("%.[precision]g", ...), but use dtoas rounding facilities. > // "g": Signed value printed in f or e format, whichever is more compact for the given value and precision. > // The e format is used only when the exponent of the value is less than â4 or greater than or equal to the > // precision argument. Trailing zeros are truncated, and the decimal point appears only if one or more digits follow it. >@@ -1287,7 +1287,7 @@ const char* numberToFixedPrecisionString(double d, unsigned significantFigures, > > const char* numberToFixedWidthString(double d, unsigned decimalPlaces, NumberToStringBuffer buffer) > { >- // Mimic String::format("%.[precision]f", ...), but use dtoas rounding facilities. >+ // Mimic sprintf("%.[precision]f", ...), but use dtoas rounding facilities. > // "f": Signed value having the form [ â ]dddd.dddd, where dddd is one or more decimal digits. > // The number of digits before the decimal point depends on the magnitude of the number, and > // the number of digits after the decimal point depends on the requested precision. >diff --git a/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp b/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp >index a8a48067c0dc677de95b0f63555298d235295060..a2eeb524a9425ada1972b50a8c6a56b8ecb67f41 100644 >--- a/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp >+++ b/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp >@@ -55,6 +55,7 @@ > #include <JavaScriptCore/StrongInlines.h> > #include <JavaScriptCore/StructureInlines.h> > #include <wtf/NeverDestroyed.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WebCore { > using namespace JSC; >@@ -1844,7 +1845,7 @@ IDBError SQLiteIDBBackingStore::addRecord(const IDBResourceIdentifier& transacti > } > > // We don't already have a file for this blobURL, so commit our file as a unique filename >- String storedFilename = String::format("%" PRId64 ".blob", potentialFileNameInteger); >+ String storedFilename = makeString(potentialFileNameInteger, ".blob"); > { > auto* sql = cachedStatement(SQL::AddBlobFilename, "INSERT INTO BlobFiles VALUES (?, ?);"_s); > if (!sql >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.cpp b/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.cpp >index 0d3e3388f8f272b1dfc3556699a5bd88c9d46431..0e6d9cdeb1fe1b7d7909eec65c53e2836f244356 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.cpp >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.cpp >@@ -31,6 +31,7 @@ > #include "IDBDatabase.h" > #include "IDBTransaction.h" > #include "IndexedDB.h" >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WebCore { > >@@ -100,13 +101,15 @@ IDBCursorInfo IDBCursorInfo::isolatedCopy() const > } > > #if !LOG_DISABLED >+ > String IDBCursorInfo::loggingString() const > { > if (m_source == IndexedDB::CursorSource::Index) >- return String::format("<Crsr: %s Idx %" PRIu64 ", OS %" PRIu64 ", tx %s>", m_cursorIdentifier.loggingString().utf8().data(), m_sourceIdentifier, m_objectStoreIdentifier, m_transactionIdentifier.loggingString().utf8().data()); >+ return makeString("<Crsr: ", m_cursorIdentifier.loggingString(), " Idx ", m_sourceIdentifier, ", OS ", m_objectStoreIdentifier, ", tx ", m_transactionIdentifier.loggingString(), '>'); > >- return String::format("<Crsr: %s OS %" PRIu64 ", tx %s>", m_cursorIdentifier.loggingString().utf8().data(), m_objectStoreIdentifier, m_transactionIdentifier.loggingString().utf8().data()); >+ return makeString("<Crsr: ", m_cursorIdentifier.loggingString(), " OS ", m_objectStoreIdentifier, ", tx ", m_transactionIdentifier.loggingString(), '>'); > } >+ > #endif > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBGetAllRecordsData.cpp b/Source/WebCore/Modules/indexeddb/shared/IDBGetAllRecordsData.cpp >index 92b6b923dc8fe92871f7dbbd9e70435032a59d1b..c985d746687f24421ffea1b2d4288df6cd757793 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBGetAllRecordsData.cpp >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBGetAllRecordsData.cpp >@@ -38,12 +38,14 @@ IDBGetAllRecordsData IDBGetAllRecordsData::isolatedCopy() const > } > > #if !LOG_DISABLED >+ > String IDBGetAllRecordsData::loggingString() const > { > if (indexIdentifier) >- return String::format("<GetAllRecords: Idx %" PRIu64 ", OS %" PRIu64 ", %s, range %s>", indexIdentifier, objectStoreIdentifier, getAllType == IndexedDB::GetAllType::Keys ? "Keys" : "Values", keyRangeData.loggingString().utf8().data()); >- return String::format("<GetAllRecords: OS %" PRIu64 ", %s, range %s>", objectStoreIdentifier, getAllType == IndexedDB::GetAllType::Keys ? "Keys" : "Values", keyRangeData.loggingString().utf8().data()); >+ return makeString("<GetAllRecords: Idx ", indexIdentifier, ", OS ", objectStoreIdentifier, ", ", getAllType == IndexedDB::GetAllType::Keys ? "Keys" : "Values", ", range ", keyRangeData.loggingString(), '>'); >+ return makeString("<GetAllRecords: OS ", objectStoreIdentifier, ", ", getAllType == IndexedDB::GetAllType::Keys ? "Keys" : "Values", ", range ", keyRangeData.loggingString(), '>'); > } >+ > #endif > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBGetRecordData.cpp b/Source/WebCore/Modules/indexeddb/shared/IDBGetRecordData.cpp >index d789626047296ed3d18666cde38ddbedad7f8d78..46346dc34929bdccf0260646b0722fe55eec243a 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBGetRecordData.cpp >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBGetRecordData.cpp >@@ -38,10 +38,12 @@ IDBGetRecordData IDBGetRecordData::isolatedCopy() const > } > > #if !LOG_DISABLED >+ > String IDBGetRecordData::loggingString() const > { >- return String::format("<GetRecord: %s %s>", type == IDBGetRecordDataType::KeyOnly ? "KeyOnly" : "Key+Value", keyRangeData.loggingString().utf8().data()); >+ return makeString("<GetRecord: ", type == IDBGetRecordDataType::KeyOnly ? "KeyOnly" : "Key+Value", ' ', keyRangeData.loggingString(), '>'); > } >+ > #endif > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.cpp b/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.cpp >index 27290f4a4a54d8ded9bf4b771e9959789d64abb0..12c5e6f2b5c9c72a62cf20cbe074f944aecd77e2 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.cpp >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.cpp >@@ -28,6 +28,8 @@ > > #if ENABLE(INDEXED_DATABASE) > >+#include <wtf/text/StringConcatenateNumbers.h> >+ > namespace WebCore { > > IDBIndexInfo::IDBIndexInfo() >@@ -50,19 +52,20 @@ IDBIndexInfo IDBIndexInfo::isolatedCopy() const > } > > #if !LOG_DISABLED >+ > String IDBIndexInfo::loggingString(int indent) const > { > String indentString; > for (int i = 0; i < indent; ++i) > indentString.append(" "); >- >- return makeString(indentString, "Index: ", m_name, String::format(" (%" PRIu64 ") keyPath: %s\n", m_identifier, WebCore::loggingString(m_keyPath).utf8().data())); >+ return makeString(indentString, "Index: ", m_name, " (", m_identifier, ") keyPath: ", WebCore::loggingString(m_keyPath), '\n'); > } > > String IDBIndexInfo::condensedLoggingString() const > { >- return String::format("<Idx: %s (%" PRIu64 "), OS (%" PRIu64 ")>", m_name.utf8().data(), m_identifier, m_objectStoreIdentifier); >+ return makeString("<Idx: ", m_name, " (", m_identifier, "), OS (", m_objectStoreIdentifier, ")>"); > } >+ > #endif > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBIterateCursorData.cpp b/Source/WebCore/Modules/indexeddb/shared/IDBIterateCursorData.cpp >index faaeda9febe7404f46473349e01b030f95e79350..8a3b47045a102101a658485cd5bee6d3e18a8aa2 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBIterateCursorData.cpp >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBIterateCursorData.cpp >@@ -38,7 +38,7 @@ IDBIterateCursorData IDBIterateCursorData::isolatedCopy() const > #if !LOG_DISABLED > String IDBIterateCursorData::loggingString() const > { >- return String::format("<Itr8Crsr: key %s, primaryKey %s, count %u>", keyData.loggingString().utf8().data(), primaryKeyData.loggingString().utf8().data(), count); >+ return makeString("<Itr8Crsr: key ", keyData.loggingString(), ", primaryKey ", primaryKeyData.loggingString(), ", count ", count, '>'); > } > #endif > >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp b/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp >index b0075fe3782976a6c500d371a139987af681649a..ce663ce927c0e15dfbf810bf4f19b8ad0c6e66ba 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp >@@ -153,7 +153,7 @@ String IDBObjectStoreInfo::loggingString(int indent) const > > String IDBObjectStoreInfo::condensedLoggingString() const > { >- return String::format("<OS: %s (%" PRIu64 ")>", m_name.utf8().data(), m_identifier); >+ return makeString("<OS: ", m_name, " (", m_identifier, ")>"); > } > > #endif >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.cpp b/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.cpp >index d7e3f1742d30fdd45bbe5bfc8f1cef848782399f..4a2abcad0d89fa4b1be6e7db64d3979ddb279f26 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.cpp >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.cpp >@@ -98,11 +98,14 @@ bool IDBResourceIdentifier::isHashTableDeletedValue() const > } > > #if !LOG_DISABLED >+ > String IDBResourceIdentifier::loggingString() const > { >- return String::format("<%" PRIu64", %" PRIu64">", m_idbConnectionIdentifier, m_resourceNumber); >+ return makeString('<', m_idbConnectionIdentifier, ", ", m_resourceNumber, '>'); > } >+ > #endif >+ > } // namespace WebCore > > #endif // ENABLE(INDEXED_DATABASE) >diff --git a/Source/WebCore/Modules/webdatabase/Database.cpp b/Source/WebCore/Modules/webdatabase/Database.cpp >index ec9b05f9e6eee4693257d3b990f00bd6b73cf50a..873143c7c4396bce678497b7d19fbd5f9bf9a5ac 100644 >--- a/Source/WebCore/Modules/webdatabase/Database.cpp >+++ b/Source/WebCore/Modules/webdatabase/Database.cpp >@@ -107,7 +107,7 @@ static const char* fullyQualifiedInfoTableName() > > static String formatErrorMessage(const char* message, int sqliteErrorCode, const char* sqliteErrorMessage) > { >- return String::format("%s (%d %s)", message, sqliteErrorCode, sqliteErrorMessage); >+ return makeString(message, " (", sqliteErrorCode, ' ', sqliteErrorMessage, ')'); > } > > static bool setTextValueInDatabase(SQLiteDatabase& db, const String& query, const String& value) >diff --git a/Source/WebCore/Modules/webdatabase/SQLError.h b/Source/WebCore/Modules/webdatabase/SQLError.h >index 4e276ca78fc95d759cad30dead07ad6a178e7326..6b072bbb427a89bbff3aa04003a9fe71ed82927a 100644 >--- a/Source/WebCore/Modules/webdatabase/SQLError.h >+++ b/Source/WebCore/Modules/webdatabase/SQLError.h >@@ -29,7 +29,7 @@ > #pragma once > > #include <wtf/ThreadSafeRefCounted.h> >-#include <wtf/text/WTFString.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WebCore { > >@@ -38,11 +38,11 @@ public: > static Ref<SQLError> create(unsigned code, const String& message) { return adoptRef(*new SQLError(code, message)); } > static Ref<SQLError> create(unsigned code, const char* message, int sqliteCode) > { >- return create(code, String::format("%s (%d)", message, sqliteCode)); >+ return create(code, makeString(message, " (", sqliteCode, ')')); > } > static Ref<SQLError> create(unsigned code, const char* message, int sqliteCode, const char* sqliteMessage) > { >- return create(code, String::format("%s (%d %s)", message, sqliteCode, sqliteMessage)); >+ return create(code, makeString(message, " (", sqliteCode, ' ', sqliteMessage, ')')); > } > > unsigned code() const { return m_code; } >diff --git a/Source/WebCore/PAL/pal/FileSizeFormatter.cpp b/Source/WebCore/PAL/pal/FileSizeFormatter.cpp >index 6af65127b4ad8393c54fa0a20509651dc6448e64..c82dec86ecedd44d3c709e5390f5a4b4d88dedb7 100644 >--- a/Source/WebCore/PAL/pal/FileSizeFormatter.cpp >+++ b/Source/WebCore/PAL/pal/FileSizeFormatter.cpp >@@ -33,7 +33,7 @@ String fileSizeDescription(uint64_t size) > // FIXME: These strings should be localized, but that would require bringing LocalizedStrings into PAL. > // See <https://bugs.webkit.org/show_bug.cgi?id=179019> for more details. > if (size < 1000) >- return String::format("%tu bytes", size); >+ return makeString(size, " bytes"); > if (size < 1000000) > return String::format("%.1f KB", size / 1000.); > if (size < 1000000000) >diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >index 122c50f1fd16e538bb4478d11cd9d3d487f4ce7a..a93453aaff446b2a270fd85a980512fee29f7736 100644 >--- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >+++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >@@ -4557,7 +4557,7 @@ sub GenerateImplementation > push(@implContent, " auto* thisObject = jsCast<${className}*>(cell);\n"); > push(@implContent, " builder.setWrappedObjectForCell(cell, &thisObject->wrapped());\n"); > push(@implContent, " if (thisObject->scriptExecutionContext())\n"); >- push(@implContent, " builder.setLabelForCell(cell, String::format(\"url %s\", thisObject->scriptExecutionContext()->url().string().utf8().data()));\n"); >+ push(@implContent, " builder.setLabelForCell(cell, \"url \" + thisObject->scriptExecutionContext()->url().string());\n"); > push(@implContent, " Base::heapSnapshot(cell, builder);\n"); > push(@implContent, "}\n\n"); > } >diff --git a/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp b/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp >index ae94864ce13b93d286814730b4d81b0f23193fe7..6c1668ca472cf85ba890440d99aa75fe81a80c94 100644 >--- a/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp >+++ b/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp >@@ -43,6 +43,7 @@ > #include "CSSValuePool.h" > #include "Pair.h" > #include "StyleColor.h" >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WebCore { > >@@ -641,9 +642,9 @@ static Color parseHexColor(CSSParserTokenRange& range, bool acceptQuirkyColors) > || token.numericValue() < 0. || token.numericValue() >= 1000000.) > return Color(); > if (token.type() == NumberToken) // e.g. 112233 >- color = String::format("%d", static_cast<int>(token.numericValue())); >+ color = String::number(static_cast<int>(token.numericValue())); > else // e.g. 0001FF >- color = String::number(static_cast<int>(token.numericValue())) + token.value().toString(); >+ color = makeString(static_cast<int>(token.numericValue()), token.value().toString()); > while (color.length() < 6) > color = "0" + color; > } else if (token.type() == IdentToken) { // e.g. FF0000 >diff --git a/Source/WebCore/html/HTMLSelectElement.cpp b/Source/WebCore/html/HTMLSelectElement.cpp >index 7a23342a8cd9fe461d1bef94997673eabc639510..c1740b77477cf23cb86406bd4d654264e91a1c3f 100644 >--- a/Source/WebCore/html/HTMLSelectElement.cpp >+++ b/Source/WebCore/html/HTMLSelectElement.cpp >@@ -55,6 +55,7 @@ > #include "Settings.h" > #include "SpatialNavigation.h" > #include <wtf/IsoMallocInlines.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WebCore { > >@@ -458,7 +459,7 @@ ExceptionOr<void> HTMLSelectElement::setItem(unsigned index, HTMLOptionElement* > ExceptionOr<void> HTMLSelectElement::setLength(unsigned newLength) > { > if (newLength > length() && newLength > maxSelectItems) { >- document().addConsoleMessage(MessageSource::Other, MessageLevel::Warning, String::format("Blocked attempt to expand the option list to %u items. The maximum number of items allowed is %u.", newLength, maxSelectItems)); >+ document().addConsoleMessage(MessageSource::Other, MessageLevel::Warning, makeString("Blocked attempt to expand the option list to ", newLength, " items. The maximum number of items allowed is ", maxSelectItems, '.')); > return { }; > } > >diff --git a/Source/WebCore/html/ImageDocument.cpp b/Source/WebCore/html/ImageDocument.cpp >index 8ecca709c10d1d3637fbd53ec3990bdc87be26af..f4292232e9dc22d729ab5950896ab8688380a2f8 100644 >--- a/Source/WebCore/html/ImageDocument.cpp >+++ b/Source/WebCore/html/ImageDocument.cpp >@@ -49,6 +49,7 @@ > #include "RenderElement.h" > #include "Settings.h" > #include <wtf/IsoMallocInlines.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WebCore { > >@@ -273,7 +274,7 @@ void ImageDocument::imageUpdated() > #if PLATFORM(IOS_FAMILY) > FloatSize screenSize = page()->chrome().screenSize(); > if (imageSize.width() > screenSize.width()) >- processViewport(String::format("width=%u,viewport-fit=cover", static_cast<unsigned>(imageSize.width().toInt())), ViewportArguments::ImageDocument); >+ processViewport(makeString("width=", imageSize.width().toInt(), ",viewport-fit=cover"), ViewportArguments::ImageDocument); > > if (page()) > page()->chrome().client().imageOrMediaDocumentSizeChanged(IntSize(imageSize.width(), imageSize.height())); >diff --git a/Source/WebCore/html/parser/XSSAuditor.cpp b/Source/WebCore/html/parser/XSSAuditor.cpp >index d635747c1f0632ae345d65dd1a5e530fee70adec..844e262324b3de49e63f6d10705e7bc0bbd0f2bd 100644 >--- a/Source/WebCore/html/parser/XSSAuditor.cpp >+++ b/Source/WebCore/html/parser/XSSAuditor.cpp >@@ -45,7 +45,7 @@ > #include <wtf/ASCIICType.h> > #include <wtf/MainThread.h> > #include <wtf/NeverDestroyed.h> >-#include <wtf/text/StringView.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WebCore { > >@@ -332,7 +332,7 @@ void XSSAuditor::init(Document* document, XSSAuditorDelegate* auditorDelegate) > } > } > if (m_xssProtection == XSSProtectionDisposition::Invalid) { >- document->addConsoleMessage(MessageSource::Security, MessageLevel::Error, "Error parsing header X-XSS-Protection: " + headerValue + ": " + errorDetails + " at character position " + String::format("%u", errorPosition) + ". The default protections will be applied."); >+ document->addConsoleMessage(MessageSource::Security, MessageLevel::Error, makeString("Error parsing header X-XSS-Protection: ", headerValue, ": ", errorDetails, " at character position ", errorPosition, ". The default protections will be applied.")); > m_xssProtection = XSSProtectionDisposition::Enabled; > } > >diff --git a/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp b/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp >index 8e1c4829dff5beac1d6fc03209cebfd0c4505774..7c8189ad6b9901f378c29205a78fef77c9dc1390 100644 >--- a/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp >+++ b/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp >@@ -205,7 +205,7 @@ bool InspectorFrontendClientLocal::canAttachWindow() > > void InspectorFrontendClientLocal::setDockingUnavailable(bool unavailable) > { >- evaluateOnLoad(String::format("[\"setDockingUnavailable\", %s]", unavailable ? "true" : "false")); >+ evaluateOnLoad(makeString("[\"setDockingUnavailable\", ", unavailable ? "true" : "false", ']')); > } > > void InspectorFrontendClientLocal::changeAttachedWindowHeight(unsigned height) >@@ -270,7 +270,7 @@ void InspectorFrontendClientLocal::setAttachedWindow(DockSide dockSide) > > m_dockSide = dockSide; > >- evaluateOnLoad(String::format("[\"setDockSide\", \"%s\"]", side)); >+ evaluateOnLoad(makeString("[\"setDockSide\", \"", side, "\"]")); > } > > void InspectorFrontendClientLocal::restoreAttachedWindowHeight() >@@ -294,7 +294,7 @@ bool InspectorFrontendClientLocal::isDebuggingEnabled() > > void InspectorFrontendClientLocal::setDebuggingEnabled(bool enabled) > { >- evaluateOnLoad(String::format("[\"setDebuggingEnabled\", %s]", enabled ? "true" : "false")); >+ evaluateOnLoad(makeString("[\"setDebuggingEnabled\", ", enabled ? "true" : "false", ']')); > } > > bool InspectorFrontendClientLocal::isTimelineProfilingEnabled() >@@ -306,7 +306,7 @@ bool InspectorFrontendClientLocal::isTimelineProfilingEnabled() > > void InspectorFrontendClientLocal::setTimelineProfilingEnabled(bool enabled) > { >- evaluateOnLoad(String::format("[\"setTimelineProfilingEnabled\", %s]", enabled ? "true" : "false")); >+ evaluateOnLoad(makeString("[\"setTimelineProfilingEnabled\", ", enabled ? "true" : "false", ']')); > } > > bool InspectorFrontendClientLocal::isProfilingJavaScript() >@@ -339,7 +339,7 @@ void InspectorFrontendClientLocal::showResources() > void InspectorFrontendClientLocal::showMainResourceForFrame(Frame* frame) > { > String frameId = m_inspectedPageController->pageAgent()->frameId(frame); >- evaluateOnLoad(String::format("[\"showMainResourceForFrame\", \"%s\"]", frameId.ascii().data())); >+ evaluateOnLoad(makeString("[\"showMainResourceForFrame\", \"", frameId, "\"]")); > } > > unsigned InspectorFrontendClientLocal::constrainedAttachedWindowHeight(unsigned preferredHeight, unsigned totalWindowHeight) >diff --git a/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp b/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp >index 5a3a4b2b8a5c1da724e89f43ab4c88dc6f0ce48b..34d8403b821feeae3b415dd9b0abba6fe0a3775b 100644 >--- a/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp >+++ b/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp >@@ -157,7 +157,7 @@ private: > > String mergeId() final > { >- return String::format("SetStyleSheetText %s", m_styleSheet->id().utf8().data()); >+ return "SetStyleSheetText " + m_styleSheet->id(); > } > > void merge(std::unique_ptr<Action> action) override >@@ -198,7 +198,7 @@ public: > String mergeId() override > { > ASSERT(m_styleSheet->id() == m_cssId.styleSheetId()); >- return String::format("SetStyleText %s:%u", m_styleSheet->id().utf8().data(), m_cssId.ordinal()); >+ return makeString("SetStyleText ", m_styleSheet->id(), ':', m_cssId.ordinal()); > } > > void merge(std::unique_ptr<Action> action) override >diff --git a/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp b/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp >index ae3acafd090b0ac15c7efd6feb89594648d89950..8064affe6a7403a323db0eaf847ac72f0ec02ad7 100644 >--- a/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp >+++ b/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp >@@ -68,6 +68,7 @@ > #include <wtf/JSONValues.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/Vector.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > using JSON::ArrayOf; > using Inspector::Protocol::IndexedDB::DatabaseWithObjectStores; >@@ -711,7 +712,7 @@ public: > auto result = idbObjectStore->clear(*exec); > ASSERT(!result.hasException()); > if (result.hasException()) { >- m_requestCallback->sendFailure(String::format("Could not clear object store '%s': %d", m_objectStoreName.utf8().data(), result.releaseException().code())); >+ m_requestCallback->sendFailure(makeString("Could not clear object store '", m_objectStoreName, "': ", static_cast<int>(result.releaseException().code()))); > return; > } > idbRequest = result.releaseReturnValue(); >diff --git a/Source/WebCore/page/MemoryRelease.cpp b/Source/WebCore/page/MemoryRelease.cpp >index 08f04a46dcbcfd422d3983fb0a3b55f3837a093b..1f5f63308433eea0eec18b497567d963d11ce299 100644 >--- a/Source/WebCore/page/MemoryRelease.cpp >+++ b/Source/WebCore/page/MemoryRelease.cpp >@@ -169,7 +169,7 @@ void logMemoryStatisticsAtTimeOfDeath() > continue; > String tagName = displayNameForVMTag(i); > if (!tagName) >- tagName = String::format("Tag %u", i); >+ tagName = makeString("Tag ", i); > RELEASE_LOG(MemoryPressure, "%16s: %lu MB", tagName.latin1().data(), dirty / MB); > } > #endif >diff --git a/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm b/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm >index e03e06f51b625588202c0628a6cae0a0754f2d9d..0cb5c35327b1d297d048942a19faa500e6f74013 100644 >--- a/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm >+++ b/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm >@@ -431,7 +431,7 @@ static String formatByteNumber(size_t number) > return String::format("%.2f MB", static_cast<double>(number) / 1048576); > if (number >= 1024) > return String::format("%.1f kB", static_cast<double>(number) / 1024); >- return String::format("%lu", number); >+ return String::number(number); > } > > static String gcTimerString(MonotonicTime timerFireDate, MonotonicTime now) >@@ -469,9 +469,9 @@ void ResourceUsageOverlay::platformDraw(CGContextRef context) > > String label = String::format("% 11s: %s", category.name.ascii().data(), formatByteNumber(dirty).ascii().data()); > if (external) >- label = label + String::format(" + %s", formatByteNumber(external).ascii().data()); >+ label = label + makeString(" + ", formatByteNumber(external)); > if (reclaimable) >- label = label + String::format(" [%s]", formatByteNumber(reclaimable).ascii().data()); >+ label = label + makeString(" [", formatByteNumber(reclaimable), ']'); > > // FIXME: Show size/capacity of GC heap. > showText(context, 10, y, category.color.get(), label); >@@ -480,8 +480,8 @@ void ResourceUsageOverlay::platformDraw(CGContextRef context) > y -= 5; > > MonotonicTime now = MonotonicTime::now(); >- showText(context, 10, y + 10, colorForLabels, String::format(" Eden GC: %s", gcTimerString(data.timeOfNextEdenCollection, now).ascii().data())); >- showText(context, 10, y + 20, colorForLabels, String::format(" Full GC: %s", gcTimerString(data.timeOfNextFullCollection, now).ascii().data())); >+ showText(context, 10, y + 10, colorForLabels, " Eden GC: " + gcTimerString(data.timeOfNextEdenCollection, now)); >+ showText(context, 10, y + 20, colorForLabels, " Full GC: " + gcTimerString(data.timeOfNextFullCollection, now)); > > drawCpuHistory(context, viewBounds.size.width - 70, 0, viewBounds.size.height, data.cpu); > drawGCHistory(context, viewBounds.size.width - 140, 0, viewBounds.size.height, data.gcHeapSize, data.categories[MemoryCategory::GCHeap].dirtySize); >diff --git a/Source/WebCore/page/cocoa/ResourceUsageThreadCocoa.mm b/Source/WebCore/page/cocoa/ResourceUsageThreadCocoa.mm >index efd836afd68d32394fe54727449d68db9f43d486..035e603c20357289583b38baccd7503a96656ec4 100644 >--- a/Source/WebCore/page/cocoa/ResourceUsageThreadCocoa.mm >+++ b/Source/WebCore/page/cocoa/ResourceUsageThreadCocoa.mm >@@ -35,6 +35,7 @@ > #include <mach/vm_statistics.h> > #include <pal/spi/cocoa/MachVMSPI.h> > #include <wtf/MachSendRight.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WebCore { > >@@ -62,7 +63,7 @@ void logFootprintComparison(const std::array<TagInfo, 256>& before, const std::a > continue; > String tagName = displayNameForVMTag(i); > if (!tagName) >- tagName = String::format("Tag %u", i); >+ tagName = makeString("Tag ", i); > WTFLogAlways(" %02X %16s %10ld %10ld %10ld", > i, > tagName.ascii().data(), >diff --git a/Source/WebCore/platform/animation/TimingFunction.cpp b/Source/WebCore/platform/animation/TimingFunction.cpp >index cfd0b36027939d4b86afd6fe7e873e04fb86ff65..9407342065fe9fc528d54574446376a1d4d7d7dc 100644 >--- a/Source/WebCore/platform/animation/TimingFunction.cpp >+++ b/Source/WebCore/platform/animation/TimingFunction.cpp >@@ -30,6 +30,7 @@ > #include "SpringSolver.h" > #include "StyleProperties.h" > #include "UnitBezier.h" >+#include <wtf/text/StringConcatenateNumbers.h> > #include <wtf/text/TextStream.h> > > namespace WebCore { >@@ -181,7 +182,7 @@ String TimingFunction::cssText() const > if (m_type == TimingFunction::StepsFunction) { > auto& function = downcast<StepsTimingFunction>(*this); > if (!function.stepAtStart()) >- return String::format("steps(%d)", function.numberOfSteps()); >+ return makeString("steps(", function.numberOfSteps(), ')'); > } > > TextStream stream; >diff --git a/Source/WebCore/platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm b/Source/WebCore/platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm >index 6e48fdaf1859070a26934bcb606fe5a40cfbde2c..eb6988840a1307157831fe38aab23f0e85a8be74 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm >@@ -180,7 +180,7 @@ int AVTrackPrivateAVFObjCImpl::index() const > AtomicString AVTrackPrivateAVFObjCImpl::id() const > { > if (m_assetTrack) >- return String::format("%d", [m_assetTrack trackID]); >+ return AtomicString::number([m_assetTrack trackID]); > if (m_mediaSelectionOption) > return [[m_mediaSelectionOption->avMediaSelectionOption() optionID] stringValue]; > ASSERT_NOT_REACHED(); >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h b/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h >index 60ee96f402433622f5854126ffb239510698ce31..966ccd5569f9e06b6f9a581997aa7b389d1dd230 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h >@@ -84,7 +84,7 @@ protected: > } > MediaSampleAVFObjC(CMSampleBufferRef sample, int trackID) > : m_sample(sample) >- , m_id(String::format("%d", trackID)) >+ , m_id(AtomicString::number(trackID)) > { > } > MediaSampleAVFObjC(CMSampleBufferRef sample, VideoRotation rotation, bool mirrored) >diff --git a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp >index d351274fd304615d9bee36b249ffc9164be24577..c55f5ff8d00cba445428b141301a24f9b72d7385 100644 >--- a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp >+++ b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp >@@ -52,8 +52,8 @@ > #include <wtf/NeverDestroyed.h> > #include <wtf/SetForScope.h> > #include <wtf/SystemTracing.h> >+#include <wtf/text/StringConcatenateNumbers.h> > #include <wtf/text/TextStream.h> >-#include <wtf/text/WTFString.h> > > #if PLATFORM(IOS_FAMILY) > #include "SystemMemory.h" >@@ -1101,7 +1101,7 @@ void GraphicsLayerCA::setContentsToSolidColor(const Color& color) > m_contentsLayerPurpose = ContentsLayerPurpose::BackgroundColor; > m_contentsLayer = createPlatformCALayer(PlatformCALayer::LayerTypeLayer, this); > #if ENABLE(TREE_DEBUGGING) >- m_contentsLayer->setName(String::format("contents color %llu", m_contentsLayer->layerID())); >+ m_contentsLayer->setName(makeString("contents color ", m_contentsLayer->layerID())); > #else > m_contentsLayer->setName("contents color"); > #endif >@@ -2555,7 +2555,7 @@ void GraphicsLayerCA::updateContentsImage() > if (!m_contentsLayer.get()) { > m_contentsLayer = createPlatformCALayer(PlatformCALayer::LayerTypeLayer, this); > #if ENABLE(TREE_DEBUGGING) >- m_contentsLayer->setName(String::format("contents image %llu", m_contentsLayer->layerID())); >+ m_contentsLayer->setName(makeString("contents image ", m_contentsLayer->layerID())); > #else > m_contentsLayer->setName("contents image"); > #endif >@@ -2661,7 +2661,7 @@ void GraphicsLayerCA::updateContentsRects() > m_contentsClippingLayer = createPlatformCALayer(PlatformCALayer::LayerTypeLayer, this); > m_contentsClippingLayer->setAnchorPoint(FloatPoint()); > #if ENABLE(TREE_DEBUGGING) >- m_contentsClippingLayer->setName(String::format("contents clipping %llu", m_contentsClippingLayer->layerID())); >+ m_contentsClippingLayer->setName(makeString("contents clipping ", m_contentsClippingLayer->layerID())); > #else > m_contentsClippingLayer->setName("contents clipping"); > #endif >@@ -3145,7 +3145,7 @@ bool GraphicsLayerCA::appendToUncommittedAnimations(const KeyframeValueList& val > for (int internalFilterPropertyIndex = 0; internalFilterPropertyIndex < numAnimatedProperties; ++internalFilterPropertyIndex) { > bool valuesOK; > RefPtr<PlatformCAAnimation> caAnimation; >- String keyPath = String::format("filters.filter_%d.%s", animationIndex, PlatformCAFilters::animatedFilterPropertyName(filterOp, internalFilterPropertyIndex)); >+ String keyPath = makeString("filters.filter_", animationIndex, '.', PlatformCAFilters::animatedFilterPropertyName(filterOp, internalFilterPropertyIndex)); > > if (isKeyframe) { > caAnimation = createKeyframeAnimation(animation, keyPath, false); >@@ -3903,7 +3903,7 @@ RefPtr<PlatformCALayer> GraphicsLayerCA::findOrMakeClone(CloneID cloneID, Platfo > } else { > resultLayer = cloneLayer(sourceLayer, cloneLevel); > #if ENABLE(TREE_DEBUGGING) >- resultLayer->setName(String::format("clone %d of %llu", cloneID[0U], sourceLayer->layerID())); >+ resultLayer->setName(makeString("clone ", cloneID[0U], " of ", sourceLayer->layerID())); > #else > resultLayer->setName("clone of " + m_name); > #endif >diff --git a/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp b/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp >index d948d561ba6d2d4d7f4ab8a05e864dff8d60422f..4e7336e2c8121fc54f9e20d62723524b53abc0d2 100644 >--- a/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp >+++ b/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp >@@ -44,7 +44,7 @@ > #include "RealtimeMediaSourceSettings.h" > #include <math.h> > #include <wtf/UUID.h> >-#include <wtf/text/StringView.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WebCore { > >@@ -367,12 +367,12 @@ void MockRealtimeVideoSource::drawText(GraphicsContext& context) > > auto size = this->size(); > statsLocation.move(0, m_statsFontSize); >- string = String::format("Size: %u x %u", size.width(), size.height()); >+ string = makeString("Size: ", size.width(), " x ", size.height()); > context.drawText(statsFont, TextRun((StringView(string))), statsLocation); > > if (mockCamera()) { > statsLocation.move(0, m_statsFontSize); >- string = String::format("Preset size: %u x %u", captureSize.width(), captureSize.height()); >+ string = makeString("Preset size: ", captureSize.width(), " x ", captureSize.height()); > context.drawText(statsFont, TextRun((StringView(string))), statsLocation); > > const char* camera; >@@ -393,7 +393,7 @@ void MockRealtimeVideoSource::drawText(GraphicsContext& context) > camera = "Unknown"; > break; > } >- string = String::format("Camera: %s", camera); >+ string = makeString("Camera: ", camera); > statsLocation.move(0, m_statsFontSize); > context.drawText(statsFont, TextRun((StringView(string))), statsLocation); > } else if (!name().isNull()) { >diff --git a/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp b/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp >index 2a8b24bd2f921e1c1f350022277a83387ec37afe..ad87aa77a112f65827bf2e9270b533a0d93c5bdf 100644 >--- a/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp >+++ b/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp >@@ -49,7 +49,7 @@ public: > private: > MockMediaSample(const MockSampleBox& box) > : m_box(box) >- , m_id(String::format("%d", box.trackID())) >+ , m_id(String::number(box.trackID())) > { > } > >diff --git a/Source/WebCore/platform/network/ParsedContentRange.cpp b/Source/WebCore/platform/network/ParsedContentRange.cpp >index 00b90c4853e8e20bb4e92857af0e17e9150df425..a3d4f044059dfd9a57b31929db8f112c15f62113 100644 >--- a/Source/WebCore/platform/network/ParsedContentRange.cpp >+++ b/Source/WebCore/platform/network/ParsedContentRange.cpp >@@ -27,7 +27,7 @@ > #include "ParsedContentRange.h" > > #include <wtf/StdLibExtras.h> >-#include <wtf/text/WTFString.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WebCore { > >@@ -127,8 +127,8 @@ String ParsedContentRange::headerValue() const > if (!m_isValid) > return String(); > if (m_instanceLength == UnknownLength) >- return String::format("bytes %" PRId64 "-%" PRId64 "/*", m_firstBytePosition, m_lastBytePosition); >- return String::format("bytes %" PRId64 "-%" PRId64 "/%" PRId64, m_firstBytePosition, m_lastBytePosition, m_instanceLength); >+ return makeString("bytes ", m_firstBytePosition, '-', m_lastBytePosition, "/*"); >+ return makeString("bytes ", m_firstBytePosition, '-', m_lastBytePosition, '/', m_instanceLength); > } > > } >diff --git a/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp b/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp >index 1ccab43c7a8cb8a730a5ad62315514f8f073ad40..5226f855b6bfa6c5eb93e9289a923d0ed2c782d5 100644 >--- a/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp >+++ b/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp >@@ -30,12 +30,15 @@ > #include <wtf/NeverDestroyed.h> > #include <wtf/ProcessID.h> > #include <wtf/ProcessPrivilege.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > #if PLATFORM(COCOA) > #include "PublicSuffix.h" > #include "ResourceRequest.h" > #endif >+ > #if USE(CFURLCONNECTION) >+ > #include "Cookie.h" > #include "CookieRequestHeaderFieldProxy.h" > #include "CookiesStrategy.h" >@@ -47,7 +50,6 @@ > #include <wtf/SoftLinking.h> > #include <wtf/URL.h> > #include <wtf/cf/TypeCastsCF.h> >-#include <wtf/text/WTFString.h> > > enum { > CFHTTPCookieStorageAcceptPolicyExclusivelyFromMainDocumentDomain = 3 >@@ -61,18 +63,15 @@ struct CFTypeTrait<ClassName##Ref> { \ > static inline CFTypeID typeID() { return ClassName##GetTypeID(); } \ > }; > >-#if COMPILER(CLANG) > ALLOW_DEPRECATED_DECLARATIONS_BEGIN >-#endif > DECLARE_CF_TYPE_TRAIT(CFHTTPCookie); >-#if COMPILER(CLANG) > ALLOW_DEPRECATED_DECLARATIONS_END >-#endif > > #undef DECLARE_CF_TYPE_TRAIT >+ > } // namespace WTF > >-#endif >+#endif // USE(CFURLCONNECTION) > > namespace WebCore { > >@@ -132,6 +131,7 @@ static std::unique_ptr<NetworkStorageSession>& defaultNetworkStorageSession() > } > > #if !PLATFORM(COCOA) >+ > static CFURLStorageSessionRef createPrivateStorageSession(CFStringRef identifier, CFURLStorageSessionRef defaultStorageSession) > { > const void* sessionPropertyKeys[] = { _kCFURLStorageSessionIsPrivate }; >@@ -165,12 +165,13 @@ static CFURLStorageSessionRef createPrivateStorageSession(CFStringRef identifier > > return storageSession; > } >+ > #endif > > void NetworkStorageSession::switchToNewTestingSession() > { > // Session name should be short enough for shared memory region name to be under the limit, otehrwise sandbox rules won't work (see <rdar://problem/13642852>). >- String sessionName = String::format("WebKit Test-%u", static_cast<uint32_t>(getCurrentProcessID())); >+ String sessionName = makeString("WebKit Test-", getCurrentProcessID()); > > RetainPtr<CFURLStorageSessionRef> session; > #if PLATFORM(COCOA) >@@ -255,18 +256,16 @@ void NetworkStorageSession::setStorageAccessAPIEnabled(bool enabled) > } > > #if !PLATFORM(COCOA) >+ > void NetworkStorageSession::setCookies(const Vector<Cookie>&, const URL&, const URL&) > { > // FIXME: Implement this. <https://webkit.org/b/156298> > } >-#endif > >-} // namespace WebCore >+#endif > > #if USE(CFURLCONNECTION) > >-namespace WebCore { >- > static const CFStringRef s_setCookieKeyCF = CFSTR("Set-Cookie"); > static const CFStringRef s_cookieCF = CFSTR("Cookie"); > static const CFStringRef s_createdCF = CFSTR("Created"); >@@ -518,6 +517,6 @@ void NetworkStorageSession::deleteAllCookiesModifiedSince(WallTime) > { > } > >-} // namespace WebCore >- > #endif // USE(CFURLCONNECTION) >+ >+} // namespace WebCore >diff --git a/Source/WebCore/platform/sql/SQLiteDatabase.cpp b/Source/WebCore/platform/sql/SQLiteDatabase.cpp >index 663e0bc0b8567083aa97ef8115a5468c517e96c5..d7bc6132b42686de49e58da284d667d97ab73694 100644 >--- a/Source/WebCore/platform/sql/SQLiteDatabase.cpp >+++ b/Source/WebCore/platform/sql/SQLiteDatabase.cpp >@@ -46,8 +46,7 @@ static const char notOpenErrorMessage[] = "database is not open"; > static void unauthorizedSQLFunction(sqlite3_context *context, int, sqlite3_value **) > { > const char* functionName = (const char*)sqlite3_user_data(context); >- String errorMessage = String::format("Function %s is unauthorized", functionName); >- sqlite3_result_error(context, errorMessage.utf8().data(), -1); >+ sqlite3_result_error(context, makeString("Function ", functionName, " is unauthorized").utf8().data(), -1); > } > > static void initializeSQLiteIfNecessary() >diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp >index ac2e03603d09f8829b06bcf0d4df28ab64f87e18..7f9174326db03445503ca81568bc8607542a7306 100644 >--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp >+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp >@@ -1301,7 +1301,7 @@ void RenderLayerCompositor::logLayerInfo(const RenderLayer& layer, const char* p > backing->backingStoreMemoryEstimate() / 1024)); > > if (!layer.renderer().style().hasAutoZIndex()) >- logString.append(String::format(" z-index: %d", layer.renderer().style().zIndex())); >+ logString.append(makeString(" z-index: ", layer.renderer().style().zIndex())); > > logString.appendLiteral(" ("); > logString.append(logReasonsForCompositing(layer)); >diff --git a/Source/WebCore/workers/service/server/RegistrationDatabase.cpp b/Source/WebCore/workers/service/server/RegistrationDatabase.cpp >index 770c9d60b8cf8ddfa2a2f97d56d57ab4ec5e49ba..a4cb2534262332dad1c55fcffc66d1b8194da02b 100644 >--- a/Source/WebCore/workers/service/server/RegistrationDatabase.cpp >+++ b/Source/WebCore/workers/service/server/RegistrationDatabase.cpp >@@ -45,6 +45,7 @@ > #include <wtf/persistence/PersistentCoders.h> > #include <wtf/persistence/PersistentDecoder.h> > #include <wtf/persistence/PersistentEncoder.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WebCore { > >@@ -201,7 +202,7 @@ String RegistrationDatabase::ensureValidRecordsTable() > // If there is no Records table at all, create it and then bail. > if (sqliteResult == SQLITE_DONE) { > if (!m_database->executeCommand(recordsTableSchema())) >- return String::format("Could not create Records table in database (%i) - %s", m_database->lastError(), m_database->lastErrorMsg()); >+ return makeString("Could not create Records table in database (", m_database->lastError(), ") - ", m_database->lastErrorMsg()); > return { }; > } > >@@ -358,7 +359,7 @@ String RegistrationDatabase::importRecords() > > SQLiteStatement sql(*m_database, "SELECT * FROM Records;"_s); > if (sql.prepare() != SQLITE_OK) >- return String::format("Failed to prepare statement to retrieve registrations from records table (%i) - %s", m_database->lastError(), m_database->lastErrorMsg()); >+ return makeString("Failed to prepare statement to retrieve registrations from records table (", m_database->lastError(), ") - ", m_database->lastErrorMsg()); > > int result = sql.step(); > >@@ -408,7 +409,7 @@ String RegistrationDatabase::importRecords() > } > > if (result != SQLITE_DONE) >- return String::format("Failed to import at least one registration from records table (%i) - %s", m_database->lastError(), m_database->lastErrorMsg()); >+ return makeString("Failed to import at least one registration from records table (", m_database->lastError(), ") - ", m_database->lastErrorMsg()); > > return { }; > } >diff --git a/Source/WebKit/Shared/WebMemorySampler.cpp b/Source/WebKit/Shared/WebMemorySampler.cpp >index 2b85200dec9278c74dbaf62ae5330d9f8d37dc07..87e6eeb3a9431e5c5727fa525b71fd756ebceaa1 100644 >--- a/Source/WebKit/Shared/WebMemorySampler.cpp >+++ b/Source/WebKit/Shared/WebMemorySampler.cpp >@@ -32,6 +32,7 @@ > #include <wtf/ProcessID.h> > #include <wtf/text/CString.h> > #include <wtf/text/StringBuilder.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WebKit { > using namespace WebCore; >@@ -142,7 +143,7 @@ void WebMemorySampler::initializeSandboxedLogFile(SandboxExtension::Handle&& sam > > void WebMemorySampler::writeHeaders() > { >- String processDetails = String::format("Process: %s Pid: %d\n", processName().utf8().data(), getCurrentProcessID()); >+ String processDetails = makeString("Process: ", processName(), " Pid: ", getCurrentProcessID(), '\n'); > > CString utf8String = processDetails.utf8(); > FileSystem::writeToFile(m_sampleLogFile, utf8String.data(), utf8String.length()); >diff --git a/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm b/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm >index 0257c0d8a6bb229049f314be01dc9498d71825f4..85d81fc58d4fc8b47d44f586937819b1c9223f6f 100644 >--- a/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm >+++ b/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm >@@ -191,7 +191,7 @@ void LocalAuthenticator::makeCredential() > weakThis->continueMakeCredentialAfterUserConsented(consent); > }; > m_connection->getUserConsent( >- String::format("Allow %s to create a public key credential for %s", requestData().creationOptions.rp.id.utf8().data(), requestData().creationOptions.user.name.utf8().data()), >+ "Allow " + requestData().creationOptions.rp.id + " to create a public key credential for " + requestData().creationOptions.user.name, > WTFMove(callback)); > #endif // !PLATFORM(IOS_FAMILY) > } >diff --git a/Source/WebKit/UIProcess/WebInspectorUtilities.cpp b/Source/WebKit/UIProcess/WebInspectorUtilities.cpp >index c5db401ee1c61958942d6a3b30cf30f13fa6b806..3b49ce034a9aab0323db14b33608deba64ffbf98 100644 >--- a/Source/WebKit/UIProcess/WebInspectorUtilities.cpp >+++ b/Source/WebKit/UIProcess/WebInspectorUtilities.cpp >@@ -33,6 +33,7 @@ > #include "WebProcessProxy.h" > #include <wtf/HashMap.h> > #include <wtf/NeverDestroyed.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WebKit { > >@@ -57,7 +58,7 @@ unsigned inspectorLevelForPage(WebPageProxy* page) > > String inspectorPageGroupIdentifierForPage(WebPageProxy* page) > { >- return String::format("__WebInspectorPageGroupLevel%u__", inspectorLevelForPage(page)); >+ return makeString("__WebInspectorPageGroupLevel", inspectorLevelForPage(page), "__"); > } > > void trackInspectorPage(WebPageProxy* page) >diff --git a/Source/WebKit/UIProcess/WebProcessPool.cpp b/Source/WebKit/UIProcess/WebProcessPool.cpp >index c8f805e8984b32352f925707c7ab5d436f1a50ee..e973c98b30f01bb0ad1d04ac24ae1a00eab65894 100644 >--- a/Source/WebKit/UIProcess/WebProcessPool.cpp >+++ b/Source/WebKit/UIProcess/WebProcessPool.cpp >@@ -41,9 +41,6 @@ > #include "DownloadProxyMessages.h" > #include "GamepadData.h" > #include "HighPerformanceGraphicsUsageSampler.h" >-#if ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER) >-#include "LegacyCustomProtocolManagerMessages.h" >-#endif > #include "LogInitialization.h" > #include "Logging.h" > #include "NetworkProcessCreationParameters.h" >@@ -97,6 +94,11 @@ > #include <wtf/URLParser.h> > #include <wtf/WallTime.h> > #include <wtf/text/StringBuilder.h> >+#include <wtf/text/StringConcatenateNumbers.h> >+ >+#if ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER) >+#include "LegacyCustomProtocolManagerMessages.h" >+#endif > > #if ENABLE(SERVICE_CONTROLS) > #include "ServicesController.h" >@@ -1017,7 +1019,7 @@ void WebProcessPool::processDidFinishLaunching(WebProcessProxy* process) > if (m_memorySamplerEnabled) { > SandboxExtension::Handle sampleLogSandboxHandle; > WallTime now = WallTime::now(); >- String sampleLogFilePath = String::format("WebProcess%llupid%d", static_cast<unsigned long long>(now.secondsSinceEpoch().seconds()), process->processIdentifier()); >+ String sampleLogFilePath = makeString("WebProcess", static_cast<unsigned long long>(now.secondsSinceEpoch().seconds()), "pid", process->processIdentifier()); > sampleLogFilePath = SandboxExtension::createHandleForTemporaryFile(sampleLogFilePath, SandboxExtension::Type::ReadWrite, sampleLogSandboxHandle); > > process->send(Messages::WebProcess::StartMemorySampler(sampleLogSandboxHandle, sampleLogFilePath, m_memorySamplerInterval), 0); >@@ -1574,7 +1576,7 @@ void WebProcessPool::startMemorySampler(const double interval) > // For WebProcess > SandboxExtension::Handle sampleLogSandboxHandle; > WallTime now = WallTime::now(); >- String sampleLogFilePath = String::format("WebProcess%llu", static_cast<unsigned long long>(now.secondsSinceEpoch().seconds())); >+ String sampleLogFilePath = makeString("WebProcess", static_cast<unsigned long long>(now.secondsSinceEpoch().seconds())); > sampleLogFilePath = SandboxExtension::createHandleForTemporaryFile(sampleLogFilePath, SandboxExtension::Type::ReadWrite, sampleLogSandboxHandle); > > sendToAllProcesses(Messages::WebProcess::StartMemorySampler(sampleLogSandboxHandle, sampleLogFilePath, interval)); >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index a2a299f4b7305e40996fc64fdf680a0dad3f9bde..ab167b91ff69a29ead20b3943de0820fb4e3e4bb 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,16 @@ >+2018-12-15 Darin Adler <darin@apple.com> >+ >+ Replace many uses of String::format with more type-safe alternatives >+ https://bugs.webkit.org/show_bug.cgi?id=192742 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp: >+ (WTR::cacheTestRunnerCallback): Use makeString. >+ * WebKitTestRunner/TestController.cpp: >+ (WTR::TestController::didReceiveAuthenticationChallenge): Use makeString. >+ (WTR::TestController::downloadDidFail): Use an ASCIILiteral via the _s syntax. >+ > 2018-12-14 Alexey Proskuryakov <ap@apple.com> > > Add a style checker rule for Xcode version macros use >diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >index 22579e8918559b8e328f41836f70d15711760892..8822f15d0a5e7f91a3bba47fdbed0eadf0282a2c 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >@@ -55,6 +55,7 @@ > #include <wtf/StdLibExtras.h> > #include <wtf/text/CString.h> > #include <wtf/text/StringBuilder.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WTR { > >@@ -813,7 +814,7 @@ static void cacheTestRunnerCallback(unsigned index, JSValueRef callback) > return; > > if (callbackMap().contains(index)) { >- InjectedBundle::singleton().outputText(String::format("FAIL: Tried to install a second TestRunner callback for the same event (id %d)\n\n", index)); >+ InjectedBundle::singleton().outputText(makeString("FAIL: Tried to install a second TestRunner callback for the same event (id ", index, ")\n\n")); > return; > } > >diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp >index 0850558130bc5b76285afb8245a7fb8fe43c1f05..a97ac9eeed5568befc42d2cb2193279ea302abec 100644 >--- a/Tools/WebKitTestRunner/TestController.cpp >+++ b/Tools/WebKitTestRunner/TestController.cpp >@@ -78,7 +78,7 @@ > #include <wtf/SetForScope.h> > #include <wtf/UUID.h> > #include <wtf/text/CString.h> >-#include <wtf/text/WTFString.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > #if PLATFORM(COCOA) > #include <WebKit/WKContextPrivateMac.h> >@@ -2061,11 +2061,11 @@ void TestController::didReceiveAuthenticationChallenge(WKPageRef page, WKAuthent > > std::string host = toSTD(adoptWK(WKProtectionSpaceCopyHost(protectionSpace)).get()); > int port = WKProtectionSpaceGetPort(protectionSpace); >- String message = String::format("%s:%d - didReceiveAuthenticationChallenge - %s - ", host.c_str(), port, toString(authenticationScheme)); >+ String message = makeString(host.c_str(), ':', port, " - didReceiveAuthenticationChallenge - ", toString(authenticationScheme), " - "); > if (!m_handlesAuthenticationChallenges) > message.append("Simulating cancelled authentication sheet\n"); > else >- message.append(String::format("Responding with %s:%s\n", m_authenticationUsername.utf8().data(), m_authenticationPassword.utf8().data())); >+ message.append("Responding with " + m_authenticationUsername + ":" + m_authenticationPassword + "\n"); > m_currentInvocation->outputText(message); > > if (!m_handlesAuthenticationChallenges) { >@@ -2163,8 +2163,7 @@ void TestController::downloadDidReceiveServerRedirectToURL(WKContextRef, WKDownl > void TestController::downloadDidFail(WKContextRef, WKDownloadRef, WKErrorRef error) > { > if (m_shouldLogDownloadCallbacks) { >- String message = String::format("Download failed.\n"); >- m_currentInvocation->outputText(message); >+ m_currentInvocation->outputText("Download failed.\n"_s); > > WKRetainPtr<WKStringRef> errorDomain = adoptWK(WKErrorCopyDomain(error)); > WKRetainPtr<WKStringRef> errorDescription = adoptWK(WKErrorCopyLocalizedDescription(error));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192742
:
357404
|
357406
|
360243
|
360311