WebKit Bugzilla
Attachment 357422 Details for
Bug 192746
: Convert additional String::format clients to alternative approaches
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192746-20181216153316.patch (text/plain), 42.48 KB, created by
Darin Adler
on 2018-12-16 15:33:17 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Darin Adler
Created:
2018-12-16 15:33:17 PST
Size:
42.48 KB
patch
obsolete
>Subversion Revision: 239261 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 818ab2e41ae37ecab67181ca15124e40337945ee..218a6590bc88d5c880648a98dee4eb1296d5858b 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,14 @@ >+2018-12-16 Darin Adler <darin@apple.com> >+ >+ Convert additional String::format clients to alternative approaches >+ https://bugs.webkit.org/show_bug.cgi?id=192746 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * inspector/agents/InspectorConsoleAgent.cpp: >+ (Inspector::InspectorConsoleAgent::stopTiming): Use makeString >+ and FormattedNumber::fixedWidth. >+ > 2018-12-15 Yusuke Suzuki <yusukesuzuki@slowstart.org> > > Unreviewed, suppress warnings in Linux >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index ca0e856cd23f95af1f2ce81d9197641aa41cb742..0f209d9b70b6950c5bf4dc4e3688205b0bd018cf 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,21 @@ >+2018-12-16 Darin Adler <darin@apple.com> >+ >+ Convert additional String::format clients to alternative approaches >+ https://bugs.webkit.org/show_bug.cgi?id=192746 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/JSONValues.cpp: >+ (WTF::appendDoubleQuotedStringEscapedCharacter): Renamed from >+ escapeChar and reordered arguments to make sense as an append function. >+ (WTF::appendDoubleQuotedString): Renamed from doubleQuoteString, >+ reordered arguments to make sense as an append function, take a >+ StringView instead of a String, used early exit to make the code >+ a bit easier to read. Use the ASCIIHexDigit functions to construct >+ a hex number a nibble at a time rather than using String::format. >+ (WTF::JSONImpl::Value::writeJSON const): Update for name change. >+ (WTF::JSONImpl::ObjectBase::writeJSON const): Ditto. >+ > 2018-12-15 Darin Adler <darin@apple.com> > > Use warning-ignoring macros more consistently and simply >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 05949be24b6755555509935ddeb5f9f31f963327..b3ce3c12d0d9b189591afb31aa6750be08aed2a6 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,62 @@ >+2018-12-16 Darin Adler <darin@apple.com> >+ >+ Convert additional String::format clients to alternative approaches >+ https://bugs.webkit.org/show_bug.cgi?id=192746 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This round of conversions covers less-trivial cases such as floating >+ point numerals and hexadecimal. Not yet taking on pointer serialization >+ ("%p") or padding with spaces of zero digits, so call sites using those >+ have been left untouched. >+ >+ In some cases these new idioms are a bit clumsy, and we could follow up >+ with additional convenience functions to make them more elegant. >+ >+ * Modules/indexeddb/IDBKeyData.cpp: >+ (WebCore::IDBKeyData::loggingString const): Use more ASCIILiteral and >+ more appendLiteral for efficiency. Use upperNibbleToLowercaseASCIIHexDigit, >+ lowerNibbleToLowercaseASCIIHexDigit, and also makeString and FormattedNumber. >+ >+ * css/MediaQueryEvaluator.cpp: >+ (WebCore::aspectRatioValueAsString): Use makeString and FormattedNumber. >+ Doing it this way makes it a little clearer that we have an unpleasant >+ use of fixed 6-digit precision here. >+ >+ * html/FTPDirectoryDocument.cpp: >+ (WebCore::processFilesizeString): Use makeString and FormattedNumber. >+ * html/track/VTTCue.cpp: >+ (WebCore::VTTCueBox::applyCSSProperties): Ditto. >+ * page/CaptionUserPreferencesMediaAF.cpp: >+ (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const): Ditto. >+ * page/History.cpp: >+ (WebCore::History::stateObjectAdded): Ditto. >+ * page/cocoa/ResourceUsageOverlayCocoa.mm: >+ (WebCore::formatByteNumber): Ditto. >+ (WebCore::gcTimerString): Use String::number. >+ (WebCore::ResourceUsageOverlay::platformDraw): Use makeString and FormattedNumber. >+ >+ * page/scrolling/AxisScrollSnapOffsets.cpp: >+ (WebCore::snapOffsetsToString): Removed some unnecessary copying in the for loop, >+ use appendLiteral, and use appendFixedWidthNumber. >+ (WebCore::snapOffsetRangesToString): Ditto. >+ (WebCore::snapPortOrAreaToString): Use makeString and FormattedNumber. >+ >+ * platform/animation/TimingFunction.cpp: >+ (WebCore::TimingFunction::cssText const): Use makeString. >+ >+ * platform/cocoa/KeyEventCocoa.mm: >+ (WebCore::keyIdentifierForCharCode): Use makeString and the ASCIIHexDigit >+ functions. >+ * platform/graphics/Color.cpp: >+ (WebCore::Color::nameForRenderTreeAsText const): Ditto. >+ >+ * platform/mock/MockRealtimeVideoSource.cpp: >+ (WebCore::MockRealtimeVideoSource::drawText): Use makeString and FormattedNumber. >+ >+ * platform/text/PlatformLocale.cpp: >+ (WebCore::DateTimeStringBuilder::visitField): Use String::numberToStringFixedWidth. >+ > 2018-12-15 Yusuke Suzuki <yusukesuzuki@slowstart.org> > > Null pointer dereference in JSC::WriteBarrierBase() >diff --git a/Source/WebCore/PAL/ChangeLog b/Source/WebCore/PAL/ChangeLog >index d975a1638e1e83e69455a52886e9664862e7083a..584c796926b7950545d40e3a71fe6fdb7c6bc2c3 100644 >--- a/Source/WebCore/PAL/ChangeLog >+++ b/Source/WebCore/PAL/ChangeLog >@@ -1,3 +1,13 @@ >+2018-12-16 Darin Adler <darin@apple.com> >+ >+ Convert additional String::format clients to alternative approaches >+ https://bugs.webkit.org/show_bug.cgi?id=192746 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * pal/FileSizeFormatter.cpp: >+ (fileSizeDescription): Use makeString and FormattedNumber. >+ > 2018-12-15 Darin Adler <darin@apple.com> > > Use warning-ignoring macros more consistently and simply >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 18aa5c1152cee9cdaad5923a026c74478f92d6ba..73cb2e985409f11f668bed31d43bb3fee3c78538 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,18 @@ >+2018-12-16 Darin Adler <darin@apple.com> >+ >+ Convert additional String::format clients to alternative approaches >+ https://bugs.webkit.org/show_bug.cgi?id=192746 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UIProcess/Cocoa/ViewGestureController.cpp: >+ (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog): >+ Use makeString and FormattedNumber. >+ >+ * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: >+ (WebKit::LocalAuthenticator::getAssertion): Added a comment about an >+ incorrect format specifier and left this code as is for now. >+ > 2018-12-16 Adrian Perez de Castro <aperez@igalia.com> > > Unreviewed follow up after r239260 >diff --git a/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp >index 3fc5e992a950f2019f91648d0d1ae7d2736e42fc..8a874a767a8b37b883b724d62a1627ed6e7ad867 100644 >--- a/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp >+++ b/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp >@@ -164,7 +164,7 @@ void InspectorConsoleAgent::stopTiming(const String& title, Ref<ScriptCallStack> > m_times.remove(it); > > Seconds elapsed = MonotonicTime::now() - startTime; >- String message = title + String::format(": %.3fms", elapsed.milliseconds()); >+ String message = makeString(title, ": ", FormattedNumber::fixedWidth(elapsed.milliseconds(), 3), "ms"); > addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Timing, MessageLevel::Debug, message, WTFMove(callStack))); > } > >diff --git a/Source/WTF/wtf/JSONValues.cpp b/Source/WTF/wtf/JSONValues.cpp >index 64bee05a0790ab56054997f9e765c9aeb38bed1e..e4461cdf2bcf954b882a1d3d40519a5d5b1e1bb8 100644 >--- a/Source/WTF/wtf/JSONValues.cpp >+++ b/Source/WTF/wtf/JSONValues.cpp >@@ -446,38 +446,54 @@ RefPtr<JSON::Value> buildValue(const UChar* start, const UChar* end, const UChar > return result; > } > >-inline bool escapeChar(UChar c, StringBuilder& dst) >-{ >- switch (c) { >- case '\b': dst.appendLiteral("\\b"); break; >- case '\f': dst.appendLiteral("\\f"); break; >- case '\n': dst.appendLiteral("\\n"); break; >- case '\r': dst.appendLiteral("\\r"); break; >- case '\t': dst.appendLiteral("\\t"); break; >- case '\\': dst.appendLiteral("\\\\"); break; >- case '"': dst.appendLiteral("\\\""); break; >- default: >- return false; >+inline bool appendDoubleQuotedStringEscapedCharacter(StringBuilder& builder, UChar character) >+{ >+ switch (character) { >+ case '\b': >+ builder.appendLiteral("\\b"); >+ return true; >+ case '\f': >+ builder.appendLiteral("\\f"); >+ return true; >+ case '\n': >+ builder.appendLiteral("\\n"); >+ return true; >+ case '\r': >+ builder.appendLiteral("\\r"); >+ return true; >+ case '\t': >+ builder.appendLiteral("\\t"); >+ return true; >+ case '\\': >+ builder.appendLiteral("\\\\"); >+ return true; >+ case '"': >+ builder.appendLiteral("\\\""); >+ return true; > } >- return true; >+ return false; > } > >-inline void doubleQuoteString(const String& str, StringBuilder& dst) >+inline void appendDoubleQuotedString(StringBuilder& builder, StringView string) > { >- dst.append('"'); >- for (unsigned i = 0; i < str.length(); ++i) { >- UChar c = str[i]; >- if (!escapeChar(c, dst)) { >- if (c < 32 || c > 126 || c == '<' || c == '>') { >- // 1. Escaping <, > to prevent script execution. >- // 2. Technically, we could also pass through c > 126 as UTF8, but this >- // is also optional. It would also be a pain to implement here. >- dst.append(String::format("\\u%04X", c)); >- } else >- dst.append(c); >+ builder.append('"'); >+ for (UChar codeUnit : string.codeUnits()) { >+ if (appendDoubleQuotedStringEscapedCharacter(builder, codeUnit)) >+ continue; >+ if (codeUnit >= 32 && codeUnit < 127 && codeUnit != '<' && codeUnit != '>') { >+ builder.append(codeUnit); >+ continue; > } >+ // 1. We escape < and > to prevent script execution. >+ // 2. We could encode characters >= 127 as UTF-8 instead of \u escape sequences. >+ // FIXME: This is likely incorrect for surrogate pairs. >+ builder.appendLiteral("\\u"); >+ builder.append(upperNibbleToASCIIHexDigit(codeUnit >> 8)); >+ builder.append(lowerNibbleToASCIIHexDigit(codeUnit >> 8)); >+ builder.append(upperNibbleToASCIIHexDigit(codeUnit)); >+ builder.append(lowerNibbleToASCIIHexDigit(codeUnit)); > } >- dst.append('"'); >+ builder.append('"'); > } > > } // anonymous namespace >@@ -659,7 +675,7 @@ void Value::writeJSON(StringBuilder& output) const > output.appendLiteral("false"); > break; > case Type::String: >- doubleQuoteString(m_value.string, output); >+ appendDoubleQuotedString(output, m_value.string); > break; > case Type::Double: > case Type::Integer: { >@@ -786,7 +802,7 @@ void ObjectBase::writeJSON(StringBuilder& output) const > ASSERT(findResult != m_map.end()); > if (i) > output.append(','); >- doubleQuoteString(findResult->key, output); >+ appendDoubleQuotedString(output, findResult->key); > output.append(':'); > findResult->value->writeJSON(output); > } >diff --git a/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp b/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp >index 40fd3b1d8420e8eacafd1d4396b90d6eb40d0a2c..7bd2ac5202bdb1d295e616b70347b0fe60b7d55d 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp >@@ -30,6 +30,7 @@ > > #include "KeyedCoding.h" > #include <wtf/text/StringBuilder.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WebCore { > >@@ -315,13 +316,13 @@ int IDBKeyData::compare(const IDBKeyData& other) const > String IDBKeyData::loggingString() const > { > if (m_isNull) >- return "<null>"; >+ return "<null>"_s; > > String result; > > switch (m_type) { > case IndexedDB::KeyType::Invalid: >- return "<invalid>"; >+ return "<invalid>"_s; > case IndexedDB::KeyType::Array: { > StringBuilder builder; > builder.appendLiteral("<array> - { "); >@@ -337,21 +338,24 @@ String IDBKeyData::loggingString() const > } > case IndexedDB::KeyType::Binary: { > StringBuilder builder; >- builder.append("<binary> - "); >+ builder.appendLiteral("<binary> - "); > > auto* data = WTF::get<ThreadSafeDataBuffer>(m_value).data(); > if (!data) { >- builder.append("(null)"); >+ builder.appendLiteral("(null)"); > result = builder.toString(); > break; > } > > size_t i = 0; >- for (; i < 8 && i < data->size(); ++i) >- builder.append(String::format("%02x", data->at(i))); >+ for (; i < 8 && i < data->size(); ++i) { >+ uint8_t byte = data->at(i); >+ builder.append(upperNibbleToLowercaseASCIIHexDigit(byte)); >+ builder.append(lowerNibbleToLowercaseASCIIHexDigit(byte)); >+ } > > if (data->size() > 8) >- builder.append("..."); >+ builder.appendLiteral("..."); > > result = builder.toString(); > break; >@@ -360,13 +364,13 @@ String IDBKeyData::loggingString() const > result = "<string> - " + WTF::get<String>(m_value); > break; > case IndexedDB::KeyType::Date: >- return String::format("<date> - %f", WTF::get<double>(m_value)); >+ return makeString("<date> - ", FormattedNumber::fixedWidth(WTF::get<double>(m_value), 6)); > case IndexedDB::KeyType::Number: >- return String::format("<number> - %f", WTF::get<double>(m_value)); >+ return makeString("<number> - ", FormattedNumber::fixedWidth(WTF::get<double>(m_value), 6)); > case IndexedDB::KeyType::Max: >- return "<maximum>"; >+ return "<maximum>"_s; > case IndexedDB::KeyType::Min: >- return "<minimum>"; >+ return "<minimum>"_s; > } > > if (result.length() > 150) { >diff --git a/Source/WebCore/PAL/pal/FileSizeFormatter.cpp b/Source/WebCore/PAL/pal/FileSizeFormatter.cpp >index 4dd1d5f1de52e9f61ffc3094c9eed5b57c6ed451..5e077e0219d5d6fec319798022968fe26dcbb03e 100644 >--- a/Source/WebCore/PAL/pal/FileSizeFormatter.cpp >+++ b/Source/WebCore/PAL/pal/FileSizeFormatter.cpp >@@ -26,6 +26,8 @@ > #include "config.h" > #include "FileSizeFormatter.h" > >+#include <wtf/text/StringConcatenateNumbers.h> >+ > #if !PLATFORM(COCOA) > > #include <wtf/text/StringConcatenateNumbers.h> >@@ -37,10 +39,10 @@ String fileSizeDescription(uint64_t size) > if (size < 1000) > return makeString(size, " bytes"); > if (size < 1000000) >- return String::format("%.1f KB", size / 1000.); >+ return makeString(FormattedNumber::fixedWidth(size / 1000., 1), " KB"); // This should be lowercase k. > if (size < 1000000000) >- return String::format("%.1f MB", size / 1000000.); >- return String::format("%.1f GB", size / 1000000000.); >+ return makeString(FormattedNumber::fixedWidth(size / 1000000., 1), " MB"); >+ return makeString(FormattedNumber::fixedWidth(size / 1000000000., 1), " GB"); > } > > #endif >diff --git a/Source/WebCore/css/MediaQueryEvaluator.cpp b/Source/WebCore/css/MediaQueryEvaluator.cpp >index e959ae60cfa6744a78ab80a3c3b636b00e9f8884..54f79431c00e317488175d9b29df85f17d7df0fc 100644 >--- a/Source/WebCore/css/MediaQueryEvaluator.cpp >+++ b/Source/WebCore/css/MediaQueryEvaluator.cpp >@@ -50,6 +50,7 @@ > #include "StyleResolver.h" > #include "Theme.h" > #include <wtf/HashMap.h> >+#include <wtf/text/StringConcatenateNumbers.h> > #include <wtf/text/TextStream.h> > > #if ENABLE(3D_TRANSFORMS) >@@ -237,14 +238,16 @@ template<typename T, typename U> bool compareValue(T a, U b, MediaFeaturePrefix > } > > #if !LOG_DISABLED >+ > static String aspectRatioValueAsString(CSSValue* value) > { > if (!is<CSSAspectRatioValue>(value)) > return emptyString(); > > auto& aspectRatio = downcast<CSSAspectRatioValue>(*value); >- return String::format("%f/%f", aspectRatio.numeratorValue(), aspectRatio.denominatorValue()); >+ return makeString(FormattedNumber::fixedWidth(aspectRatio.numeratorValue(), 6), '/', FormattedNumber::fixedWidth(aspectRatio.denominatorValue(), 6)); > } >+ > #endif > > static bool compareAspectRatioValue(CSSValue* value, int width, int height, MediaFeaturePrefix op) >diff --git a/Source/WebCore/html/FTPDirectoryDocument.cpp b/Source/WebCore/html/FTPDirectoryDocument.cpp >index d7e2b75a453120b02d7c742d460f46a4dd59948e..7ffcbe39d5ff7ee7d9f6b77877f9b89b1b26ffd5 100644 >--- a/Source/WebCore/html/FTPDirectoryDocument.cpp >+++ b/Source/WebCore/html/FTPDirectoryDocument.cpp >@@ -41,6 +41,7 @@ > #include <wtf/GregorianDateTime.h> > #include <wtf/IsoMallocInlines.h> > #include <wtf/StdLibExtras.h> >+#include <wtf/text/StringConcatenateNumbers.h> > #include <wtf/unicode/CharacterNames.h> > > namespace WebCore { >@@ -167,12 +168,12 @@ static String processFilesizeString(const String& size, bool isDirectory) > return unknownFileSizeText(); > > if (bytes < 1000000) >- return String::format("%.2f KB", static_cast<float>(bytes)/1000); >+ return makeString(FormattedNumber::fixedWidth(bytes / 1000., 2), " KB"); > > if (bytes < 1000000000) >- return String::format("%.2f MB", static_cast<float>(bytes)/1000000); >+ return makeString(FormattedNumber::fixedWidth(bytes / 1000000., 2), " MB"); > >- return String::format("%.2f GB", static_cast<float>(bytes)/1000000000); >+ return makeString(FormattedNumber::fixedWidth(bytes / 1000000000., 2), " GB"); > } > > static bool wasLastDayOfMonth(int year, int month, int day) >diff --git a/Source/WebCore/html/track/VTTCue.cpp b/Source/WebCore/html/track/VTTCue.cpp >index 4ff13a01ae9c654275f2db19c0bee0daebbc9f96..2f0e5e3081dac75c561fe7a9cc65bade7fc45d36 100644 >--- a/Source/WebCore/html/track/VTTCue.cpp >+++ b/Source/WebCore/html/track/VTTCue.cpp >@@ -30,9 +30,9 @@ > */ > > #include "config.h" >+#include "VTTCue.h" > > #if ENABLE(VIDEO_TRACK) >-#include "VTTCue.h" > > #include "CSSPropertyNames.h" > #include "CSSValueKeywords.h" >@@ -55,6 +55,7 @@ > #include <wtf/IsoMallocInlines.h> > #include <wtf/MathExtras.h> > #include <wtf/text/StringBuilder.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WebCore { > >@@ -227,7 +228,7 @@ void VTTCueBox::applyCSSProperties(const IntSize& videoSize) > // maintaining the relative positions of the boxes in boxes to each > // other. > setInlineStyleProperty(CSSPropertyTransform, >- String::format("translate(-%.2f%%, -%.2f%%)", position.first, position.second)); >+ makeString("translate(", FormattedNumber::fixedWidth(-position.first, 2), "%, ", FormattedNumber::fixedWidth(-position.second, 2), "%)")); > > setInlineStyleProperty(CSSPropertyWhiteSpace, CSSValuePre); > } >diff --git a/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp b/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp >index b7923f7832226ed53f0c91f8deda85db9d63162c..ebd8e9e734ca58fda1673450f842ea56a02af700 100644 >--- a/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp >+++ b/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp >@@ -32,16 +32,12 @@ > #include "CaptionUserPreferencesMediaAF.h" > > #include "AudioTrackList.h" >-#if PLATFORM(WIN) >-#include <pal/spi/win/CoreTextSPIWin.h> >-#endif > #include "FloatConversion.h" > #include "HTMLMediaElement.h" > #include "LocalizedStrings.h" > #include "Logging.h" > #include "MediaControlElements.h" > #include "TextTrackList.h" >-#include <wtf/URL.h> > #include "UserStyleSheetTypes.h" > #include "VTTCue.h" > #include <algorithm> >@@ -49,19 +45,26 @@ > #include <wtf/NeverDestroyed.h> > #include <wtf/RetainPtr.h> > #include <wtf/SoftLinking.h> >+#include <wtf/URL.h> > #include <wtf/text/CString.h> > #include <wtf/text/StringBuilder.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > #if PLATFORM(IOS_FAMILY) > #import "WebCoreThreadRun.h" > #endif > >+#if PLATFORM(WIN) >+#include <pal/spi/win/CoreTextSPIWin.h> >+#endif >+ > #if COMPILER(MSVC) > // See https://msdn.microsoft.com/en-us/library/35bhkfb6.aspx > #pragma warning(disable: 4273) > #endif > > #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK) >+ > #include <CoreText/CoreText.h> > #include <MediaAccessibility/MediaAccessibility.h> > >@@ -83,18 +86,19 @@ > SOFT_LINK_AVF_FRAMEWORK(CoreMedia) > SOFT_LINK_AVF_FRAMEWORK_IMPORT_OPTIONAL(CoreMedia, MTEnableCaption2015Behavior, Boolean, ()) > >-#else >+#else // PLATFORM(WIN) > > SOFT_LINK_FRAMEWORK_OPTIONAL(MediaToolbox) > SOFT_LINK_OPTIONAL(MediaToolbox, MTEnableCaption2015Behavior, Boolean, (), ()) > >-#endif // PLATFORM(WIN) >+#endif // !PLATFORM(WIN) > > #endif // HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK) > > namespace WebCore { > > #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK) >+ > static void userCaptionPreferencesChangedNotificationCallback(CFNotificationCenterRef, void* observer, CFStringRef, const void *, CFDictionaryRef) > { > #if !PLATFORM(IOS_FAMILY) >@@ -105,6 +109,7 @@ static void userCaptionPreferencesChangedNotificationCallback(CFNotificationCent > }); > #endif > } >+ > #endif > > CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF(PageGroup& group) >@@ -346,7 +351,7 @@ String CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS() const > return emptyString(); > > StringBuilder builder; >- appendCSS(builder, CSSPropertyBorderRadius, String::format("%.02fpx", radius), behavior == kMACaptionAppearanceBehaviorUseValue); >+ appendCSS(builder, CSSPropertyBorderRadius, makeString(FormattedNumber::fixedWidth(radius, 2), "px"), behavior == kMACaptionAppearanceBehaviorUseValue); > return builder.toString(); > } > >diff --git a/Source/WebCore/page/History.cpp b/Source/WebCore/page/History.cpp >index fd1921d2374e931b85a91725d03b62c34554d5e5..93d4da4cd39ecb4d035764b6df67ed1208d1d692 100644 >--- a/Source/WebCore/page/History.cpp >+++ b/Source/WebCore/page/History.cpp >@@ -40,6 +40,7 @@ > #include "SecurityOrigin.h" > #include <wtf/CheckedArithmetic.h> > #include <wtf/MainThread.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WebCore { > >@@ -222,8 +223,8 @@ ExceptionOr<void> History::stateObjectAdded(RefPtr<SerializedScriptValue>&& data > > if (mainHistory.m_currentStateObjectTimeSpanObjectsAdded >= perStateObjectTimeSpanLimit) { > if (stateObjectType == StateObjectType::Replace) >- return Exception { SecurityError, String::format("Attempt to use history.replaceState() more than %u times per %f seconds", perStateObjectTimeSpanLimit, stateObjectTimeSpan.seconds()) }; >- return Exception { SecurityError, String::format("Attempt to use history.pushState() more than %u times per %f seconds", perStateObjectTimeSpanLimit, stateObjectTimeSpan.seconds()) }; >+ return Exception { SecurityError, makeString("Attempt to use history.replaceState() more than ", perStateObjectTimeSpanLimit, " times per ", FormattedNumber::fixedWidth(stateObjectTimeSpan.seconds(), 6), " seconds") }; >+ return Exception { SecurityError, makeString("Attempt to use history.pushState() more than ", perStateObjectTimeSpanLimit, " times per ", FormattedNumber::fixedWidth(stateObjectTimeSpan.seconds(), 6), " seconds") }; > } > > Checked<unsigned> titleSize = title.length(); >diff --git a/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm b/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm >index 0cb5c35327b1d297d048942a19faa500e6f74013..6bb1fbb7680ffc3a468d7992a064687b4f1bf120 100644 >--- a/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm >+++ b/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm >@@ -41,6 +41,7 @@ > #include <wtf/MathExtras.h> > #include <wtf/MemoryFootprint.h> > #include <wtf/NeverDestroyed.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > using WebCore::ResourceUsageOverlay; > @interface WebOverlayLayer : CALayer { >@@ -426,11 +427,11 @@ static void drawMemoryPie(CGContextRef context, FloatRect& rect, HistoricResourc > static String formatByteNumber(size_t number) > { > if (number >= 1024 * 1048576) >- return String::format("%.3f GB", static_cast<double>(number) / (1024 * 1048576)); >+ return makeString(FormattedNumber::fixedWidth(number / (1024. * 1048576), 3), " GB"); > if (number >= 1048576) >- return String::format("%.2f MB", static_cast<double>(number) / 1048576); >+ return makeString(FormattedNumber::fixedWidth(number / 1048576., 2), " MB"); > if (number >= 1024) >- return String::format("%.1f kB", static_cast<double>(number) / 1024); >+ return makeString(FormattedNumber::fixedWidth(number / 1024, 1), " kB"); > return String::number(number); > } > >@@ -438,7 +439,7 @@ static String gcTimerString(MonotonicTime timerFireDate, MonotonicTime now) > { > if (std::isnan(timerFireDate)) > return "[not scheduled]"_s; >- return String::format("%g", (timerFireDate - now).seconds()); >+ return String::number((timerFireDate - now).seconds()); > } > > void ResourceUsageOverlay::platformDraw(CGContextRef context) >@@ -457,7 +458,7 @@ void ResourceUsageOverlay::platformDraw(CGContextRef context) > CGContextClearRect(context, viewBounds); > > static CGColorRef colorForLabels = createColor(0.9, 0.9, 0.9, 1); >- showText(context, 10, 20, colorForLabels, String::format(" CPU: %g", data.cpu.last())); >+ showText(context, 10, 20, colorForLabels, makeString(" CPU: ", FormattedNumber::fixedPrecision(data.cpu.last()))); > showText(context, 10, 30, colorForLabels, " Footprint: " + formatByteNumber(memoryFootprint())); > showText(context, 10, 40, colorForLabels, " External: " + formatByteNumber(data.totalExternalSize.last())); > >diff --git a/Source/WebCore/page/scrolling/AxisScrollSnapOffsets.cpp b/Source/WebCore/page/scrolling/AxisScrollSnapOffsets.cpp >index 020753847a0d84171930e2e6f3e5e4d9d48c7af3..60379b582dd73714e76ff86e3da1fffd80b97450 100644 >--- a/Source/WebCore/page/scrolling/AxisScrollSnapOffsets.cpp >+++ b/Source/WebCore/page/scrolling/AxisScrollSnapOffsets.cpp >@@ -35,6 +35,7 @@ > #include "RenderView.h" > #include "ScrollableArea.h" > #include "StyleScrollSnapPoints.h" >+#include <wtf/text/StringConcatenateNumbers.h> > > #if ENABLE(CSS_SCROLL_SNAP) > >@@ -75,28 +76,38 @@ static LayoutUnit computeScrollSnapAlignOffset(const LayoutUnit& leftOrTop, cons > > static String snapOffsetsToString(const Vector<LayoutUnit>& snapOffsets) > { >- StringBuilder s; >- s.append("[ "); >- for (auto offset : snapOffsets) >- s.append(String::format("%.1f ", offset.toFloat())); >- >- s.append("]"); >- return s.toString(); >+ StringBuilder builder; >+ builder.appendLiteral("[ "); >+ for (auto& offset : snapOffsets) { >+ builder.appendFixedWidthNumber(offset.toFloat(), 1); >+ builder.append(' '); >+ } >+ builder.append(']'); >+ return builder.toString(); > } > > static String snapOffsetRangesToString(const Vector<ScrollOffsetRange<LayoutUnit>>& ranges) > { >- StringBuilder s; >- s.append("[ "); >- for (auto range : ranges) >- s.append(String::format("(%.1f, %.1f) ", range.start.toFloat(), range.end.toFloat())); >- s.append("]"); >- return s.toString(); >+ StringBuilder builder; >+ builder.appendLiteral("[ "); >+ for (auto& range : ranges) { >+ builder.append('('); >+ builder.appendFixedWidthNumber(range.start.toFloat(), 1); >+ builder.appendLiteral(", "); >+ builder.appendFixedWidthNumber(range.end.toFloat(), 1); >+ builder.appendLiteral(") "); >+ } >+ builder.append(']'); >+ return builder.toString(); > } > > static String snapPortOrAreaToString(const LayoutRect& rect) > { >- return String::format("{{%.1f, %.1f} {%.1f, %.1f}}", rect.x().toFloat(), rect.y().toFloat(), rect.width().toFloat(), rect.height().toFloat()); >+ return makeString("{{", >+ FormattedNumber::fixedWidth(rect.x(), 1), ", ", >+ FormattedNumber::fixedWidth(rect.y(), 1), "} {", >+ FormattedNumber::fixedWidth(rect.width(), 1), ", ", >+ FormattedNumber::fixedWidth(rect.height(), 1), "}}"); > } > > #endif >diff --git a/Source/WebCore/platform/animation/TimingFunction.cpp b/Source/WebCore/platform/animation/TimingFunction.cpp >index 9407342065fe9fc528d54574446376a1d4d7d7dc..48792c9b4c7ec25f3efc86eb59aad15e6ca0421c 100644 >--- a/Source/WebCore/platform/animation/TimingFunction.cpp >+++ b/Source/WebCore/platform/animation/TimingFunction.cpp >@@ -176,7 +176,7 @@ String TimingFunction::cssText() const > return "ease-out"; > if (function.x1() == 0.42 && !function.y1() && function.x2() == 0.58 && function.y2() == 1.0) > return "ease-in-out"; >- return String::format("cubic-bezier(%g, %g, %g, %g)", function.x1(), function.y1(), function.x2(), function.y2()); >+ return makeString("cubic-bezier(", function.x1(), ", ", function.y1(), ", ", function.x2(), ", ", function.y2(), ')'); > } > > if (m_type == TimingFunction::StepsFunction) { >diff --git a/Source/WebCore/platform/cocoa/KeyEventCocoa.mm b/Source/WebCore/platform/cocoa/KeyEventCocoa.mm >index 05c0a8ce708227c3f54b08c8761865382322c67d..d1012fe06be4cc5e3c22ff5ee3c71943b1cc802e 100644 >--- a/Source/WebCore/platform/cocoa/KeyEventCocoa.mm >+++ b/Source/WebCore/platform/cocoa/KeyEventCocoa.mm >@@ -496,7 +496,12 @@ String keyIdentifierForCharCode(unichar charCode) > // FIXME: We should use something other than the vendor-area Unicode values for the above keys. > // For now, just fall through to the default. > default: >- return String::format("U+%04X", toASCIIUpper(charCode)); >+ UChar codeUnit = toASCIIUpper(charCode); >+ return makeString("U+", >+ upperNibbleToASCIIHexDigit(codeUnit >> 8), >+ lowerNibbleToASCIIHexDigit(codeUnit >> 8), >+ upperNibbleToASCIIHexDigit(codeUnit), >+ lowerNibbleToASCIIHexDigit(codeUnit)); > } > } > >diff --git a/Source/WebCore/platform/graphics/Color.cpp b/Source/WebCore/platform/graphics/Color.cpp >index 8dbd36c54d65f5150170a78a55d1154ee5beaeb7..8b10a7269dace52a5df86c2ed4ce2b495eedef86 100644 >--- a/Source/WebCore/platform/graphics/Color.cpp >+++ b/Source/WebCore/platform/graphics/Color.cpp >@@ -391,9 +391,17 @@ String Color::cssText() const > String Color::nameForRenderTreeAsText() const > { > // FIXME: Handle ExtendedColors. >- if (alpha() < 0xFF) >- return String::format("#%02X%02X%02X%02X", red(), green(), blue(), alpha()); >- return String::format("#%02X%02X%02X", red(), green(), blue()); >+ if (alpha() < 0xFF) { >+ return makeString('#', >+ upperNibbleToASCIIHexDigit(red()), lowerNibbleToASCIIHexDigit(red()), >+ upperNibbleToASCIIHexDigit(green()), lowerNibbleToASCIIHexDigit(green()), >+ upperNibbleToASCIIHexDigit(blue()), lowerNibbleToASCIIHexDigit(blue()), >+ upperNibbleToASCIIHexDigit(alpha()), lowerNibbleToASCIIHexDigit(alpha())); >+ } >+ return makeString('#', >+ upperNibbleToASCIIHexDigit(red()), lowerNibbleToASCIIHexDigit(red()), >+ upperNibbleToASCIIHexDigit(green()), lowerNibbleToASCIIHexDigit(green()), >+ upperNibbleToASCIIHexDigit(blue()), lowerNibbleToASCIIHexDigit(blue())); > } > > Color Color::light() const >diff --git a/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp b/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp >index 4e7336e2c8121fc54f9e20d62723524b53abc0d2..0b3d08e3c810739ee021104d4e540b2abba5d32b 100644 >--- a/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp >+++ b/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp >@@ -358,11 +358,11 @@ void MockRealtimeVideoSource::drawText(GraphicsContext& context) > context.drawText(timeFont, TextRun((StringView(string))), timeLocation); > > FloatPoint statsLocation(captureSize.width() * .45, captureSize.height() * .75); >- string = String::format("Requested frame rate: %.1f fps", frameRate()); >+ string = makeString("Requested frame rate: ", FormattedNumber::fixedWidth(frameRate(), 1), " fps"); > context.drawText(statsFont, TextRun((StringView(string))), statsLocation); > > statsLocation.move(0, m_statsFontSize); >- string = String::format("Observed frame rate: %.1f fps", observedFrameRate()); >+ string = makeString("Observed frame rate: ", FormattedNumber::fixedWidth(observedFrameRate(), 1), " fps"); > context.drawText(statsFont, TextRun((StringView(string))), statsLocation); > > auto size = this->size(); >diff --git a/Source/WebCore/platform/text/PlatformLocale.cpp b/Source/WebCore/platform/text/PlatformLocale.cpp >index c9da2d6afaf5c6b94b6a8d525dc28a50f3c1bb8e..4d75ea0be29af4ed00f7bf618c5a2a97b7a0aa6e 100644 >--- a/Source/WebCore/platform/text/PlatformLocale.cpp >+++ b/Source/WebCore/platform/text/PlatformLocale.cpp >@@ -158,7 +158,7 @@ void DateTimeStringBuilder::visitField(DateTimeFormat::FieldType fieldType, int > appendNumber(m_date.second(), numberOfPatternCharacters); > else { > double second = m_date.second() + m_date.millisecond() / 1000.0; >- String zeroPaddedSecondString = zeroPadString(String::format("%.03f", second), numberOfPatternCharacters + 4); >+ String zeroPaddedSecondString = zeroPadString(String::numberToStringFixedWidth(second, 3), numberOfPatternCharacters + 4); > m_builder.append(m_localizer.convertToLocalizedNumber(zeroPaddedSecondString)); > } > return; >diff --git a/Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp b/Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp >index d4faa93e3d913caefc40ca17fe8ab4b933be66b5..d89f6d8dcfd17bd8e4b71944497b19432390a630 100644 >--- a/Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp >+++ b/Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp >@@ -36,6 +36,7 @@ > #import <wtf/MathExtras.h> > #import <wtf/NeverDestroyed.h> > #import <wtf/text/StringBuilder.h> >+#import <wtf/text/StringConcatenateNumbers.h> > > namespace WebKit { > using namespace WebCore; >@@ -366,7 +367,7 @@ void ViewGestureController::SnapshotRemovalTracker::watchdogTimerFired() > > void ViewGestureController::SnapshotRemovalTracker::startWatchdog(Seconds duration) > { >- log(String::format("(re)started watchdog timer for %.1f seconds", duration.seconds())); >+ log(makeString("(re)started watchdog timer for ", FormattedNumber::fixedWidth(duration.seconds(), 1), " seconds")); > m_watchdogTimer.startOneShot(duration); > } > >diff --git a/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm b/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm >index 85d81fc58d4fc8b47d44f586937819b1c9223f6f..8dde78601c9852884f7fe423d535dc2af459baf4 100644 >--- a/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm >+++ b/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm >@@ -472,6 +472,7 @@ void LocalAuthenticator::getAssertion() > > weakThis->continueGetAssertionAfterUserConsented(consent, context, credentialId, userhandle); > }; >+ // FIXME: I don't think that formatting with %s and passing an NSObject from a dictionary will work. > m_connection->getUserConsent( > String::format("Log into %s with %s.", requestData().requestOptions.rpId.utf8().data(), selectedCredentialAttributes[(id)kSecAttrApplicationTag]), > (__bridge SecAccessControlRef)selectedCredentialAttributes[(id)kSecAttrAccessControl], >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index e5b9339a7691ec3e4cbf2f957ec19ff5a0cbcec1..79373a49b35fd1332acbb061ca67398a4dc99b90 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,19 @@ >+2018-12-16 Darin Adler <darin@apple.com> >+ >+ Convert additional String::format clients to alternative approaches >+ https://bugs.webkit.org/show_bug.cgi?id=192746 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebKitTestRunner/TestController.cpp: >+ (WTR::originUserVisibleName): Use makeString and reduce the use of std::string >+ as an intermediate in code that ultimately constructs a WTF::String. >+ (WTR::userMediaOriginHash): Use makeString. >+ (WTR::TestController::didNavigateWithNavigationData): More of the same. >+ (WTR::TestController::didPerformClientRedirect): Ditto. >+ (WTR::TestController::didPerformServerRedirect): Ditto. >+ (WTR::TestController::didUpdateHistoryTitle): Ditto. >+ > 2018-12-16 Adrian Perez de Castro <aperez@igalia.com> > > Unreviewed build fix after r239253 >diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp >index a97ac9eeed5568befc42d2cb2193279ea302abec..479751ed41061f20e16b41025ea03eac37363229 100644 >--- a/Tools/WebKitTestRunner/TestController.cpp >+++ b/Tools/WebKitTestRunner/TestController.cpp >@@ -2263,17 +2263,18 @@ static String originUserVisibleName(WKSecurityOriginRef origin) > if (!origin) > return emptyString(); > >- std::string host = toSTD(adoptWK(WKSecurityOriginCopyHost(origin))).c_str(); >- std::string protocol = toSTD(adoptWK(WKSecurityOriginCopyProtocol(origin))).c_str(); >+ auto host = toWTFString(adoptWK(WKSecurityOriginCopyHost(origin))); >+ auto protocol = toWTFString(adoptWK(WKSecurityOriginCopyProtocol(origin))); > >- if (!host.length() || !protocol.length()) >+ if (host.isEmpty() || protocol.isEmpty()) > return emptyString(); > >- unsigned short port = WKSecurityOriginGetPort(origin); >- if (port) >- return String::format("%s://%s:%d", protocol.c_str(), host.c_str(), port); >+ if (auto port = WKSecurityOriginGetPort(origin)) { >+ // FIXME: Use static_cast<int> to work around makeString's limitation when formatting numbers that are the same type as UChar. >+ return makeString(protocol, "://", host, ':', static_cast<int>(port)); >+ } > >- return String::format("%s://%s", protocol.c_str(), host.c_str()); >+ return makeString(protocol, "://", host); > } > > static String userMediaOriginHash(WKSecurityOriginRef userMediaDocumentOrigin, WKSecurityOriginRef topLevelDocumentOrigin) >@@ -2284,7 +2285,7 @@ static String userMediaOriginHash(WKSecurityOriginRef userMediaDocumentOrigin, W > if (topLevelDocumentOriginString.isEmpty()) > return userMediaDocumentOriginString; > >- return String::format("%s-%s", userMediaDocumentOriginString.utf8().data(), topLevelDocumentOriginString.utf8().data()); >+ return makeString(userMediaDocumentOriginString, '-', topLevelDocumentOriginString); > } > > static String userMediaOriginHash(WKStringRef userMediaDocumentOriginString, WKStringRef topLevelDocumentOriginString) >@@ -2552,17 +2553,17 @@ void TestController::didNavigateWithNavigationData(WKNavigationDataRef navigatio > return; > > // URL >- WKRetainPtr<WKURLRef> urlWK = adoptWK(WKNavigationDataCopyURL(navigationData)); >- WKRetainPtr<WKStringRef> urlStringWK = adoptWK(WKURLCopyString(urlWK.get())); >+ auto url = adoptWK(WKNavigationDataCopyURL(navigationData)); >+ auto urlString = toWTFString(adoptWK(WKURLCopyString(url.get()))); > // Title >- WKRetainPtr<WKStringRef> titleWK = adoptWK(WKNavigationDataCopyTitle(navigationData)); >+ auto title = toWTFString(adoptWK(WKNavigationDataCopyTitle(navigationData))); > // HTTP method >- WKRetainPtr<WKURLRequestRef> requestWK = adoptWK(WKNavigationDataCopyOriginalRequest(navigationData)); >- WKRetainPtr<WKStringRef> methodWK = adoptWK(WKURLRequestCopyHTTPMethod(requestWK.get())); >+ auto request = adoptWK(WKNavigationDataCopyOriginalRequest(navigationData)); >+ auto method = toWTFString(adoptWK(WKURLRequestCopyHTTPMethod(request.get()))); > > // FIXME: Determine whether the navigation was successful / a client redirect rather than hard-coding the message here. >- m_currentInvocation->outputText(String::format("WebView navigated to url \"%s\" with title \"%s\" with HTTP equivalent method \"%s\". The navigation was successful and was not a client redirect.\n", >- toSTD(urlStringWK).c_str(), toSTD(titleWK).c_str(), toSTD(methodWK).c_str())); >+ m_currentInvocation->outputText(makeString("WebView navigated to url \"", urlString, "\" with title \"", title, "\" with HTTP equivalent method \"", method, >+ "\". The navigation was successful and was not a client redirect.\n")); > } > > void TestController::didPerformClientRedirect(WKContextRef, WKPageRef, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void* clientInfo) >@@ -2578,10 +2579,10 @@ void TestController::didPerformClientRedirect(WKURLRef sourceURL, WKURLRef desti > if (!m_shouldLogHistoryClientCallbacks) > return; > >- WKRetainPtr<WKStringRef> sourceStringWK = adoptWK(WKURLCopyString(sourceURL)); >- WKRetainPtr<WKStringRef> destinationStringWK = adoptWK(WKURLCopyString(destinationURL)); >+ auto source = toWTFString(adoptWK(WKURLCopyString(sourceURL))); >+ auto destination = toWTFString(adoptWK(WKURLCopyString(destinationURL))); > >- m_currentInvocation->outputText(String::format("WebView performed a client redirect from \"%s\" to \"%s\".\n", toSTD(sourceStringWK).c_str(), toSTD(destinationStringWK).c_str())); >+ m_currentInvocation->outputText(makeString("WebView performed a client redirect from \"", source, "\" to \"", destination, "\".\n")); > } > > void TestController::didPerformServerRedirect(WKContextRef, WKPageRef, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void* clientInfo) >@@ -2597,10 +2598,10 @@ void TestController::didPerformServerRedirect(WKURLRef sourceURL, WKURLRef desti > if (!m_shouldLogHistoryClientCallbacks) > return; > >- WKRetainPtr<WKStringRef> sourceStringWK = adoptWK(WKURLCopyString(sourceURL)); >- WKRetainPtr<WKStringRef> destinationStringWK = adoptWK(WKURLCopyString(destinationURL)); >+ auto source = toWTFString(adoptWK(WKURLCopyString(sourceURL))); >+ auto destination = toWTFString(adoptWK(WKURLCopyString(destinationURL))); > >- m_currentInvocation->outputText(String::format("WebView performed a server redirect from \"%s\" to \"%s\".\n", toSTD(sourceStringWK).c_str(), toSTD(destinationStringWK).c_str())); >+ m_currentInvocation->outputText(makeString("WebView performed a server redirect from \"", source, "\" to \"", destination, "\".\n")); > } > > void TestController::didUpdateHistoryTitle(WKContextRef, WKPageRef, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void* clientInfo) >@@ -2616,8 +2617,8 @@ void TestController::didUpdateHistoryTitle(WKStringRef title, WKURLRef URL, WKFr > if (!m_shouldLogHistoryClientCallbacks) > return; > >- WKRetainPtr<WKStringRef> urlStringWK(AdoptWK, WKURLCopyString(URL)); >- m_currentInvocation->outputText(String::format("WebView updated the title for history URL \"%s\" to \"%s\".\n", toSTD(urlStringWK).c_str(), toSTD(title).c_str())); >+ auto urlString = toWTFString(adoptWK(WKURLCopyString(URL))); >+ m_currentInvocation->outputText(makeString("WebView updated the title for history URL \"", urlString, "\" to \"", toWTFString(title), "\".\n")); > } > > void TestController::setNavigationGesturesEnabled(bool value)
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
Flags:
ap
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192746
:
357420
| 357422