Diff
Modified: trunk/Source/WebKit/ChangeLog (284967 => 284968)
--- trunk/Source/WebKit/ChangeLog 2021-10-28 00:31:45 UTC (rev 284967)
+++ trunk/Source/WebKit/ChangeLog 2021-10-28 01:44:20 UTC (rev 284968)
@@ -1,3 +1,48 @@
+2021-10-27 David Kilzer <[email protected]>
+
+ [WebKit] Enable -Wformat=2 warnings
+ <https://webkit.org/b/232360>
+ <rdar://problem/84571460>
+
+ Reviewed by Darin Adler.
+
+ With one exception noted below, this patch changes calls from
+ WEB_UI_STRING() to WEB_UI_NSSTRING(), which includes the proper
+ compiler attribute to be used with +[NSString stringWithFormat:].
+ This fixes the -Wformat-nonliteral warnings that occurred after
+ adding -Wformat=2.
+
+ * Configurations/Base.xcconfig:
+ (WARNING_CFLAGS):
+ - Add -Wformat=2 switch, which includes -Wformat-nonliteral.
+
+ * GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm:
+ (WebKit::GPUConnectionToWebProcess::setCaptureAttributionString):
+ * GPUProcess/mac/GPUProcessMac.mm:
+ (WebKit::GPUProcess::initializeProcessName):
+ * NetworkProcess/mac/NetworkProcessMac.mm:
+ (WebKit::NetworkProcess::initializeProcessName):
+ * PluginProcess/mac/PluginProcessMac.mm:
+ (WebKit::PluginProcess::initializeProcessName):
+ * UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm:
+ (WebKit::WebInspectorUIProxy::updateInspectorWindowTitle const):
+ * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+ (WebKit::experimentalFeatureEnabled):
+ - Change `format` to be a constant NSString pointer to fix the
+ -Wformat-nonliteral warnings.
+ * UIProcess/ios/WKActionSheetAssistant.mm:
+ (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]):
+ * UIProcess/ios/WKPDFPageNumberIndicator.mm:
+ (-[WKPDFPageNumberIndicator _updateLabel]):
+ * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
+ (-[WKFullScreenViewController _showPhishingAlert]):
+ * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
+ (-[WKDataListSuggestionsController showSuggestionsDropdown:]):
+ * WebAuthnProcess/mac/WebAuthnProcessMac.mm:
+ (WebKit::WebAuthnProcess::initializeProcessName):
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::WebProcess::updateProcessName):
+
2021-10-27 Aditya Keerthi <[email protected]>
REGRESSION (iOS 15): Touch events are not fired during quick successive taps
Modified: trunk/Source/WebKit/Configurations/Base.xcconfig (284967 => 284968)
--- trunk/Source/WebKit/Configurations/Base.xcconfig 2021-10-28 00:31:45 UTC (rev 284967)
+++ trunk/Source/WebKit/Configurations/Base.xcconfig 2021-10-28 01:44:20 UTC (rev 284968)
@@ -86,7 +86,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OTHER_MIGFLAGS = -F$(BUILT_PRODUCTS_DIR);
PREBINDING = NO;
-WARNING_CFLAGS = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wconditional-uninitialized -Wextra-tokens -Wformat-security -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare -Wimplicit-fallthrough -Wvla -Wliteral-conversion -Wthread-safety;
+WARNING_CFLAGS = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wconditional-uninitialized -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare -Wimplicit-fallthrough -Wvla -Wliteral-conversion -Wthread-safety;
SWIFT_VERSION = 5.0;
Modified: trunk/Source/WebKit/GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm (284967 => 284968)
--- trunk/Source/WebKit/GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm 2021-10-28 00:31:45 UTC (rev 284967)
+++ trunk/Source/WebKit/GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm 2021-10-28 01:44:20 UTC (rev 284968)
@@ -60,7 +60,7 @@
if (!visibleName)
visibleName = gpuProcess().applicationVisibleName();
- RetainPtr<NSString> formatString = [NSString stringWithFormat:WEB_UI_STRING("“%@” in “%%@”", "The domain and application using the camera and/or microphone. The first argument is domain, the second is the application name (iOS only)."), visibleName];
+ RetainPtr<NSString> formatString = [NSString stringWithFormat:WEB_UI_NSSTRING(@"“%@” in “%%@”", "The domain and application using the camera and/or microphone. The first argument is domain, the second is the application name (iOS only)."), visibleName];
[PAL::getSTDynamicActivityAttributionPublisherClass() setCurrentAttributionStringWithFormat:formatString.get() auditToken:auditToken.value()];
#endif
Modified: trunk/Source/WebKit/GPUProcess/mac/GPUProcessMac.mm (284967 => 284968)
--- trunk/Source/WebKit/GPUProcess/mac/GPUProcessMac.mm 2021-10-28 00:31:45 UTC (rev 284967)
+++ trunk/Source/WebKit/GPUProcess/mac/GPUProcessMac.mm 2021-10-28 01:44:20 UTC (rev 284968)
@@ -61,7 +61,7 @@
void GPUProcess::initializeProcessName(const AuxiliaryProcessInitializationParameters& parameters)
{
#if !PLATFORM(MACCATALYST)
- NSString *applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ Graphics and Media", "visible name of the GPU process. The argument is the application name."), (NSString *)parameters.uiProcessName];
+ NSString *applicationName = [NSString stringWithFormat:WEB_UI_NSSTRING(@"%@ Graphics and Media", "visible name of the GPU process. The argument is the application name."), (NSString *)parameters.uiProcessName];
_LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), _kLSDisplayNameKey, (CFStringRef)applicationName, nullptr);
#endif
}
Modified: trunk/Source/WebKit/NetworkProcess/mac/NetworkProcessMac.mm (284967 => 284968)
--- trunk/Source/WebKit/NetworkProcess/mac/NetworkProcessMac.mm 2021-10-28 00:31:45 UTC (rev 284967)
+++ trunk/Source/WebKit/NetworkProcess/mac/NetworkProcessMac.mm 2021-10-28 01:44:20 UTC (rev 284968)
@@ -63,7 +63,7 @@
void NetworkProcess::initializeProcessName(const AuxiliaryProcessInitializationParameters& parameters)
{
#if !PLATFORM(MACCATALYST)
- NSString *applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ Networking", "visible name of the network process. The argument is the application name."), (NSString *)parameters.uiProcessName];
+ NSString *applicationName = [NSString stringWithFormat:WEB_UI_NSSTRING(@"%@ Networking", "visible name of the network process. The argument is the application name."), (NSString *)parameters.uiProcessName];
_LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), _kLSDisplayNameKey, (CFStringRef)applicationName, nullptr);
#endif
}
Modified: trunk/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm (284967 => 284968)
--- trunk/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm 2021-10-28 00:31:45 UTC (rev 284967)
+++ trunk/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm 2021-10-28 01:44:20 UTC (rev 284968)
@@ -428,7 +428,7 @@
void PluginProcess::initializeProcessName(const AuxiliaryProcessInitializationParameters& parameters)
{
- NSString *applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ (%@ Internet plug-in)", "visible name of the plug-in host process. The first argument is the plug-in name and the second argument is the application name."), [[(NSString *)m_pluginPath lastPathComponent] stringByDeletingPathExtension], (NSString *)parameters.uiProcessName];
+ NSString *applicationName = [NSString stringWithFormat:WEB_UI_NSSTRING(@"%@ (%@ Internet plug-in)", "visible name of the plug-in host process. The first argument is the plug-in name and the second argument is the application name."), [[(NSString *)m_pluginPath lastPathComponent] stringByDeletingPathExtension], (NSString *)parameters.uiProcessName];
_LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), _kLSDisplayNameKey, (CFStringRef)applicationName, nullptr);
if (!m_pluginBundleIdentifier.isEmpty())
_LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), kLSPlugInBundleIdentifierKey, m_pluginBundleIdentifier.createCFString().get(), nullptr);
Modified: trunk/Source/WebKit/UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm (284967 => 284968)
--- trunk/Source/WebKit/UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm 2021-10-28 00:31:45 UTC (rev 284967)
+++ trunk/Source/WebKit/UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm 2021-10-28 01:44:20 UTC (rev 284968)
@@ -247,10 +247,10 @@
unsigned level = inspectionLevel();
if (level > 1) {
- NSString *debugTitle = [NSString stringWithFormat:WEB_UI_STRING("Web Inspector [%d] — %@", "Web Inspector window title when inspecting Web Inspector"), level, (NSString *)m_urlString];
+ NSString *debugTitle = [NSString stringWithFormat:WEB_UI_NSSTRING(@"Web Inspector [%d] — %@", "Web Inspector window title when inspecting Web Inspector"), level, (NSString *)m_urlString];
[m_inspectorWindow setTitle:debugTitle];
} else {
- NSString *title = [NSString stringWithFormat:WEB_UI_STRING("Web Inspector — %@", "Web Inspector window title"), (NSString *)m_urlString];
+ NSString *title = [NSString stringWithFormat:WEB_UI_NSSTRING(@"Web Inspector — %@", "Web Inspector window title"), (NSString *)m_urlString];
[m_inspectorWindow setTitle:title];
}
}
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (284967 => 284968)
--- trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2021-10-28 00:31:45 UTC (rev 284967)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2021-10-28 01:44:20 UTC (rev 284968)
@@ -95,11 +95,12 @@
static bool experimentalFeatureEnabled(const String& key)
{
#if PLATFORM(MAC)
- NSString *format = @"Experimental%@";
+ constexpr NSString *format = @"Experimental%@";
#else
- NSString *format = @"WebKitExperimental%@";
+ constexpr NSString *format = @"WebKitExperimental%@";
#endif
- return [[NSUserDefaults standardUserDefaults] boolForKey:[NSString stringWithFormat:format, static_cast<NSString *>(key)]];
+ auto defaultsKey = adoptNS([[NSString alloc] initWithFormat:format, static_cast<NSString *>(key)]);
+ return [[NSUserDefaults standardUserDefaults] boolForKey:defaultsKey.get()];
}
void WebsiteDataStore::platformSetNetworkParameters(WebsiteDataStoreParameters& parameters)
Modified: trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm (284967 => 284968)
--- trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm 2021-10-28 00:31:45 UTC (rev 284967)
+++ trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm 2021-10-28 01:44:20 UTC (rev 284968)
@@ -502,7 +502,7 @@
if (!externalApplicationName)
return YES;
- NSString *openInExternalApplicationTitle = [NSString stringWithFormat:WEB_UI_STRING("Open in “%@”", "Title for Open in External Application Link action button"), externalApplicationName];
+ NSString *openInExternalApplicationTitle = [NSString stringWithFormat:WEB_UI_NSSTRING(@"Open in “%@”", "Title for Open in External Application Link action button"), externalApplicationName];
_WKElementAction *openInExternalApplicationAction = [_WKElementAction _elementActionWithType:_WKElementActionTypeOpenInExternalApplication title:openInExternalApplicationTitle actionHandler:^(_WKActivatedElementInfo *) {
#if HAVE(APP_LINKS_WITH_ISENABLED)
appLink.enabled = YES;
Modified: trunk/Source/WebKit/UIProcess/ios/WKPDFPageNumberIndicator.mm (284967 => 284968)
--- trunk/Source/WebKit/UIProcess/ios/WKPDFPageNumberIndicator.mm 2021-10-28 00:31:45 UTC (rev 284967)
+++ trunk/Source/WebKit/UIProcess/ios/WKPDFPageNumberIndicator.mm 2021-10-28 01:44:20 UTC (rev 284968)
@@ -160,7 +160,7 @@
- (void)_updateLabel
{
- [_label setText:[NSString localizedStringWithFormat:WEB_UI_STRING("%d of %d", "Label for PDF page number indicator."), _currentPageNumber, _pageCount]];
+ [_label setText:[NSString localizedStringWithFormat:WEB_UI_NSSTRING(@"%d of %d", "Label for PDF page number indicator."), _currentPageNumber, _pageCount]];
[self sizeToFit];
if (!_pageCount || !_currentPageNumber)
Modified: trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm (284967 => 284968)
--- trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm 2021-10-28 00:31:45 UTC (rev 284967)
+++ trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm 2021-10-28 01:44:20 UTC (rev 284968)
@@ -524,7 +524,7 @@
{
ASSERT(_valid);
NSString *alertTitle = WEB_UI_STRING("It looks like you are typing while in full screen", "Full Screen Deceptive Website Warning Sheet Title");
- NSString *alertMessage = [NSString stringWithFormat:WEB_UI_STRING("Typing is not allowed in full screen websites. “%@” may be showing a fake keyboard to trick you into disclosing personal or financial information.", "Full Screen Deceptive Website Warning Sheet Content Text"), (NSString *)self.location];
+ NSString *alertMessage = [NSString stringWithFormat:WEB_UI_NSSTRING(@"Typing is not allowed in full screen websites. “%@” may be showing a fake keyboard to trick you into disclosing personal or financial information.", "Full Screen Deceptive Website Warning Sheet Content Text"), (NSString *)self.location];
UIAlertController* alert = [UIAlertController alertControllerWithTitle:alertTitle message:alertMessage preferredStyle:UIAlertControllerStyleAlert];
if (auto page = [self._webView _page]) {
Modified: trunk/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm (284967 => 284968)
--- trunk/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm 2021-10-28 00:31:45 UTC (rev 284967)
+++ trunk/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm 2021-10-28 01:44:20 UTC (rev 284968)
@@ -463,7 +463,7 @@
// Notify accessibility clients of datalist becoming visible.
NSString *currentSelectedString = [self currentSelectedString];
- NSString *info = [NSString stringWithFormat:WEB_UI_STRING("Suggestions list visible, %@", "Accessibility announcement that the suggestions list became visible. The format argument is for the first option in the list."), currentSelectedString];
+ NSString *info = [NSString stringWithFormat:WEB_UI_NSSTRING(@"Suggestions list visible, %@", "Accessibility announcement that the suggestions list became visible. The format argument is for the first option in the list."), currentSelectedString];
[self notifyAccessibilityClients:info];
}
Modified: trunk/Source/WebKit/WebAuthnProcess/mac/WebAuthnProcessMac.mm (284967 => 284968)
--- trunk/Source/WebKit/WebAuthnProcess/mac/WebAuthnProcessMac.mm 2021-10-28 00:31:45 UTC (rev 284967)
+++ trunk/Source/WebKit/WebAuthnProcess/mac/WebAuthnProcessMac.mm 2021-10-28 01:44:20 UTC (rev 284968)
@@ -36,6 +36,7 @@
#import <pal/spi/mac/HIServicesSPI.h>
#import <sysexits.h>
#import <wtf/MemoryPressureHandler.h>
+#import <wtf/cocoa/TypeCastsCocoa.h>
#import <wtf/text/WTFString.h>
namespace WebKit {
@@ -52,8 +53,8 @@
void WebAuthnProcess::initializeProcessName(const AuxiliaryProcessInitializationParameters& parameters)
{
- NSString *applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ Web Authentication", "visible name of the WebAuthn process. The argument is the application name."), (NSString *)parameters.uiProcessName];
- _LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), _kLSDisplayNameKey, (CFStringRef)applicationName, nullptr);
+ NSString *applicationName = [NSString stringWithFormat:WEB_UI_NSSTRING(@"%@ Web Authentication", "visible name of the WebAuthn process. The argument is the application name."), (NSString *)parameters.uiProcessName];
+ _LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), _kLSDisplayNameKey, bridge_cast(applicationName), nullptr);
}
void WebAuthnProcess::initializeSandbox(const AuxiliaryProcessInitializationParameters& parameters, SandboxInitializationParameters& sandboxParameters)
Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (284967 => 284968)
--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2021-10-28 00:31:45 UTC (rev 284967)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2021-10-28 01:44:20 UTC (rev 284968)
@@ -496,19 +496,19 @@
RetainPtr<NSString> applicationName;
switch (m_processType) {
case ProcessType::Inspector:
- applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ Web Inspector", "Visible name of Web Inspector's web process. The argument is the application name."), (NSString *)m_uiProcessName];
+ applicationName = [NSString stringWithFormat:WEB_UI_NSSTRING(@"%@ Web Inspector", "Visible name of Web Inspector's web process. The argument is the application name."), (NSString *)m_uiProcessName];
break;
case ProcessType::ServiceWorker:
- applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ Service Worker (%@)", "Visible name of Service Worker process. The argument is the application name."), (NSString *)m_uiProcessName, (NSString *)m_registrableDomain.string()];
+ applicationName = [NSString stringWithFormat:WEB_UI_NSSTRING(@"%@ Service Worker (%@)", "Visible name of Service Worker process. The argument is the application name."), (NSString *)m_uiProcessName, (NSString *)m_registrableDomain.string()];
break;
case ProcessType::PrewarmedWebContent:
- applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ Web Content (Prewarmed)", "Visible name of the web process. The argument is the application name."), (NSString *)m_uiProcessName];
+ applicationName = [NSString stringWithFormat:WEB_UI_NSSTRING(@"%@ Web Content (Prewarmed)", "Visible name of the web process. The argument is the application name."), (NSString *)m_uiProcessName];
break;
case ProcessType::CachedWebContent:
- applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ Web Content (Cached)", "Visible name of the web process. The argument is the application name."), (NSString *)m_uiProcessName];
+ applicationName = [NSString stringWithFormat:WEB_UI_NSSTRING(@"%@ Web Content (Cached)", "Visible name of the web process. The argument is the application name."), (NSString *)m_uiProcessName];
break;
case ProcessType::WebContent:
- applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ Web Content", "Visible name of the web process. The argument is the application name."), (NSString *)m_uiProcessName];
+ applicationName = [NSString stringWithFormat:WEB_UI_NSSTRING(@"%@ Web Content", "Visible name of the web process. The argument is the application name."), (NSString *)m_uiProcessName];
break;
}