WebKit Bugzilla
Attachment 370299 Details for
Bug 198066
: Remove unnecessary duplicate selector invocations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
[PATCH] Proposed Fix
dup-2.patch (text/plain), 69.20 KB, created by
Joseph Pecoraro
on 2019-05-20 22:34:09 PDT
(
hide
)
Description:
[PATCH] Proposed Fix
Filename:
MIME Type:
Creator:
Joseph Pecoraro
Created:
2019-05-20 22:34:09 PDT
Size:
69.20 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 1dc6f1f7d3d..f2495df16fc 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2019-05-20 Joseph Pecoraro <pecoraro@apple.com> >+ >+ Remove unnecessary duplicate selector invocations >+ https://bugs.webkit.org/show_bug.cgi?id=198066 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: >+ (WebCore::GameControllerGamepadProvider::stopMonitoringGamepads): >+ * platform/mac/ScrollbarThemeMac.mm: >+ (+[WebScrollbarPrefsObserver registerAsObserver]): >+ * platform/mediastream/mac/AVCaptureDeviceManager.mm: >+ (WebCore::AVCaptureDeviceManager::registerForDeviceNotifications): >+ > 2019-05-20 Ross Kirsling <ross.kirsling@sony.com> > > Make lossy LayoutUnit constructors explicit >diff --git a/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm b/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm >index f720cfd3343..26857716cf0 100644 >--- a/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm >+++ b/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm >@@ -130,8 +130,9 @@ void GameControllerGamepadProvider::stopMonitoringGamepads(GamepadProviderClient > if (!m_connectObserver || !m_clients.isEmpty()) > return; > >- [[NSNotificationCenter defaultCenter] removeObserver:m_connectObserver.get()]; >- [[NSNotificationCenter defaultCenter] removeObserver:m_disconnectObserver.get()]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center removeObserver:m_connectObserver.get()]; >+ [center removeObserver:m_disconnectObserver.get()]; > } > > unsigned GameControllerGamepadProvider::indexForNewlyConnectedDevice() >diff --git a/Source/WebCore/platform/mac/ScrollbarThemeMac.mm b/Source/WebCore/platform/mac/ScrollbarThemeMac.mm >index b5d926a1b57..9a7a3cb75aa 100644 >--- a/Source/WebCore/platform/mac/ScrollbarThemeMac.mm >+++ b/Source/WebCore/platform/mac/ScrollbarThemeMac.mm >@@ -112,8 +112,9 @@ + (void)behaviorPrefsChanged:(NSNotification *)unusedNotification > > + (void)registerAsObserver > { >- [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(appearancePrefsChanged:) name:@"AppleAquaScrollBarVariantChanged" object:nil suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately]; >- [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(behaviorPrefsChanged:) name:@"AppleNoRedisplayAppearancePreferenceChanged" object:nil suspensionBehavior:NSNotificationSuspensionBehaviorCoalesce]; >+ NSDistributedNotificationCenter *distributedCenter = [NSDistributedNotificationCenter defaultCenter]; >+ [distributedCenter addObserver:self selector:@selector(appearancePrefsChanged:) name:@"AppleAquaScrollBarVariantChanged" object:nil suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately]; >+ [distributedCenter addObserver:self selector:@selector(behaviorPrefsChanged:) name:@"AppleNoRedisplayAppearancePreferenceChanged" object:nil suspensionBehavior:NSNotificationSuspensionBehaviorCoalesce]; > [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(behaviorPrefsChanged:) name:NSPreferredScrollerStyleDidChangeNotification object:nil]; > } > >diff --git a/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm b/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm >index 1c42e20d93b..1cde6854b81 100644 >--- a/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm >+++ b/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm >@@ -184,8 +184,9 @@ AVCaptureDeviceManager::~AVCaptureDeviceManager() > > void AVCaptureDeviceManager::registerForDeviceNotifications() > { >- [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get() selector:@selector(deviceConnectedDidChange:) name:AVCaptureDeviceWasConnectedNotification object:nil]; >- [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get() selector:@selector(deviceConnectedDidChange:) name:AVCaptureDeviceWasDisconnectedNotification object:nil]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center addObserver:m_objcObserver.get() selector:@selector(deviceConnectedDidChange:) name:AVCaptureDeviceWasConnectedNotification object:nil]; >+ [center addObserver:m_objcObserver.get() selector:@selector(deviceConnectedDidChange:) name:AVCaptureDeviceWasDisconnectedNotification object:nil]; > } > > } // namespace WebCore >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 6b5da8d6657..56c95f32def 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,37 @@ >+2019-05-20 Joseph Pecoraro <pecoraro@apple.com> >+ >+ Remove unnecessary duplicate selector invocations >+ https://bugs.webkit.org/show_bug.cgi?id=198066 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * PluginProcess/mac/PluginProcessMac.mm: >+ (WebKit::initializeCocoaOverrides): >+ * UIProcess/ApplicationStateTracker.mm: >+ * UIProcess/Cocoa/DownloadProxyMapCocoa.mm: >+ (WebKit::DownloadProxyMap::platformCreate): >+ (WebKit::DownloadProxyMap::platformDestroy): >+ * UIProcess/Cocoa/WebProcessPoolCocoa.mm: >+ (WebKit::WebProcessPool::platformInitializeWebProcess): >+ (WebKit::WebProcessPool::registerNotificationObservers): >+ (WebKit::WebProcessPool::unregisterNotificationObservers): >+ * UIProcess/Cocoa/WebViewImpl.mm: >+ (-[WKWindowVisibilityObserver startObserving:]): >+ (-[WKWindowVisibilityObserver stopObserving:]): >+ (WebKit::WebViewImpl::updateTextTouchBar): >+ * UIProcess/ios/ProcessAssertionIOS.mm: >+ (-[WKProcessAssertionBackgroundTaskManager init]): >+ * UIProcess/ios/WKContentView.mm: >+ (-[WKContentView _commonInitializationWithProcessPool:configuration:]): >+ * UIProcess/ios/forms/WKDatePickerViewController.mm: >+ (-[WKDatePickerViewController viewWillAppear:]): >+ * UIProcess/mac/TextCheckerMac.mm: >+ (WebKit::mutableState): >+ (WebKit::TextChecker::setTestingMode): >+ (WebKit::TextChecker::isContinuousSpellCheckingAllowed): >+ * UIProcess/mac/WebInspectorProxyMac.mm: >+ (WebKit::WebInspectorProxy::attachmentViewDidChange): >+ > 2019-05-20 Ross Kirsling <ross.kirsling@sony.com> > > Make lossy LayoutUnit constructors explicit >diff --git a/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm b/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm >index bd3ab080bcc..7ca04859c39 100644 >--- a/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm >+++ b/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm >@@ -317,15 +317,15 @@ static void initializeCocoaOverrides() > Method runModalForWindowMethod = class_getInstanceMethod(objc_getClass("NSApplication"), @selector(runModalForWindow:)); > NSApplication_RunModalForWindow = method_setImplementation(runModalForWindowMethod, reinterpret_cast<IMP>(replacedRunModalForWindow)); > >- NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; > > // Track when any Cocoa window is about to be be shown. >- id orderOnScreenObserver = [defaultCenter addObserverForName:NSWindowWillOrderOnScreenNotification >+ id orderOnScreenObserver = [center addObserverForName:NSWindowWillOrderOnScreenNotification > object:nil > queue:nil > usingBlock:^(NSNotification *notification) { fullscreenWindowTracker().windowShown([notification object]); }]; > // Track when any Cocoa window is about to be hidden. >- id orderOffScreenObserver = [defaultCenter addObserverForName:NSWindowWillOrderOffScreenNotification >+ id orderOffScreenObserver = [center addObserverForName:NSWindowWillOrderOffScreenNotification > object:nil > queue:nil > usingBlock:^(NSNotification *notification) { fullscreenWindowTracker().windowHidden([notification object]); }]; >diff --git a/Source/WebKit/UIProcess/ApplicationStateTracker.mm b/Source/WebKit/UIProcess/ApplicationStateTracker.mm >index a23d4bf8bf1..20a06073b5b 100644 >--- a/Source/WebKit/UIProcess/ApplicationStateTracker.mm >+++ b/Source/WebKit/UIProcess/ApplicationStateTracker.mm >@@ -89,12 +89,12 @@ ApplicationStateTracker::ApplicationStateTracker(UIView *view, SEL didEnterBackg > UIWindow *window = [m_view.get() window]; > ASSERT(window); > >- NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; > UIApplication *application = [UIApplication sharedApplication]; > > auto weakThis = makeWeakPtr(*this); > >- m_didFinishSnapshottingAfterEnteringBackgroundObserver = [notificationCenter addObserverForName:@"_UIApplicationDidFinishSuspensionSnapshotNotification" object:application queue:nil usingBlock:[weakThis](NSNotification *) { >+ m_didFinishSnapshottingAfterEnteringBackgroundObserver = [center addObserverForName:@"_UIApplicationDidFinishSuspensionSnapshotNotification" object:application queue:nil usingBlock:[weakThis](NSNotification *) { > auto applicationStateTracker = weakThis.get(); > if (!applicationStateTracker) > return; >@@ -106,17 +106,17 @@ ApplicationStateTracker::ApplicationStateTracker(UIView *view, SEL didEnterBackg > m_isInBackground = application.applicationState == UIApplicationStateBackground; > > #if HAVE(UISCENE) >- m_didEnterBackgroundObserver = [notificationCenter addObserverForName:UISceneDidEnterBackgroundNotification object:window.windowScene queue:nil usingBlock:[this](NSNotification *) { >+ m_didEnterBackgroundObserver = [center addObserverForName:UISceneDidEnterBackgroundNotification object:window.windowScene queue:nil usingBlock:[this](NSNotification *) { > #else >- m_didEnterBackgroundObserver = [notificationCenter addObserverForName:UIApplicationDidEnterBackgroundNotification object:application queue:nil usingBlock:[this](NSNotification *) { >+ m_didEnterBackgroundObserver = [center addObserverForName:UIApplicationDidEnterBackgroundNotification object:application queue:nil usingBlock:[this](NSNotification *) { > #endif > applicationDidEnterBackground(); > }]; > > #if HAVE(UISCENE) >- m_willEnterForegroundObserver = [notificationCenter addObserverForName:UISceneWillEnterForegroundNotification object:window.windowScene queue:nil usingBlock:[this](NSNotification *) { >+ m_willEnterForegroundObserver = [center addObserverForName:UISceneWillEnterForegroundNotification object:window.windowScene queue:nil usingBlock:[this](NSNotification *) { > #else >- m_willEnterForegroundObserver = [notificationCenter addObserverForName:UIApplicationWillEnterForegroundNotification object:application queue:nil usingBlock:[this](NSNotification *) { >+ m_willEnterForegroundObserver = [center addObserverForName:UIApplicationWillEnterForegroundNotification object:application queue:nil usingBlock:[this](NSNotification *) { > #endif > applicationWillEnterForeground(); > }]; >@@ -150,10 +150,10 @@ ApplicationStateTracker::ApplicationStateTracker(UIView *view, SEL didEnterBackg > if ([serviceViewController._hostApplicationBundleIdentifier isEqualToString:@"com.apple.ios.StoreKitUIService"]) > m_isInBackground = false; > >- m_didEnterBackgroundObserver = [notificationCenter addObserverForName:@"_UIViewServiceHostDidEnterBackgroundNotification" object:serviceViewController queue:nil usingBlock:[this](NSNotification *) { >+ m_didEnterBackgroundObserver = [center addObserverForName:@"_UIViewServiceHostDidEnterBackgroundNotification" object:serviceViewController queue:nil usingBlock:[this](NSNotification *) { > applicationDidEnterBackground(); > }]; >- m_willEnterForegroundObserver = [notificationCenter addObserverForName:@"_UIViewServiceHostWillEnterForegroundNotification" object:serviceViewController queue:nil usingBlock:[this](NSNotification *) { >+ m_willEnterForegroundObserver = [center addObserverForName:@"_UIViewServiceHostWillEnterForegroundNotification" object:serviceViewController queue:nil usingBlock:[this](NSNotification *) { > applicationWillEnterForeground(); > }]; > >@@ -195,10 +195,10 @@ ApplicationStateTracker::~ApplicationStateTracker() > return; > } > >- NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; >- [notificationCenter removeObserver:m_didEnterBackgroundObserver]; >- [notificationCenter removeObserver:m_didFinishSnapshottingAfterEnteringBackgroundObserver]; >- [notificationCenter removeObserver:m_willEnterForegroundObserver]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center removeObserver:m_didEnterBackgroundObserver]; >+ [center removeObserver:m_didFinishSnapshottingAfterEnteringBackgroundObserver]; >+ [center removeObserver:m_willEnterForegroundObserver]; > } > > void ApplicationStateTracker::applicationDidEnterBackground() >diff --git a/Source/WebKit/UIProcess/Cocoa/DownloadProxyMapCocoa.mm b/Source/WebKit/UIProcess/Cocoa/DownloadProxyMapCocoa.mm >index ac91cd6b217..9059faf53c7 100644 >--- a/Source/WebKit/UIProcess/Cocoa/DownloadProxyMapCocoa.mm >+++ b/Source/WebKit/UIProcess/Cocoa/DownloadProxyMapCocoa.mm >@@ -35,12 +35,13 @@ namespace WebKit { > void DownloadProxyMap::platformCreate() > { > #if PLATFORM(IOS_FAMILY) >- m_backgroundObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidEnterBackgroundNotification object:[UIApplication sharedApplication] queue:nil usingBlock:makeBlockPtr([weakThis = makeWeakPtr(*this)](NSNotification *) { >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ m_backgroundObserver = [center addObserverForName:UIApplicationDidEnterBackgroundNotification object:[UIApplication sharedApplication] queue:nil usingBlock:makeBlockPtr([weakThis = makeWeakPtr(*this)](NSNotification *) { > if (!weakThis) > return; > weakThis->applicationDidEnterBackground(); > }).get()]; >- m_foregroundObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillEnterForegroundNotification object:[UIApplication sharedApplication] queue:nil usingBlock:makeBlockPtr([weakThis = makeWeakPtr(*this)](NSNotification *) { >+ m_foregroundObserver = [center addObserverForName:UIApplicationWillEnterForegroundNotification object:[UIApplication sharedApplication] queue:nil usingBlock:makeBlockPtr([weakThis = makeWeakPtr(*this)](NSNotification *) { > if (!weakThis) > return; > weakThis->applicationWillEnterForeground(); >@@ -51,8 +52,9 @@ void DownloadProxyMap::platformCreate() > void DownloadProxyMap::platformDestroy() > { > #if PLATFORM(IOS_FAMILY) >- [[NSNotificationCenter defaultCenter] removeObserver:m_backgroundObserver.get()]; >- [[NSNotificationCenter defaultCenter] removeObserver:m_foregroundObserver.get()]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center removeObserver:m_backgroundObserver.get()]; >+ [center removeObserver:m_foregroundObserver.get()]; > #endif > } > >diff --git a/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm b/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm >index 807632ff57c..c18f888b79b 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm >+++ b/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm >@@ -239,8 +239,8 @@ void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters& > #endif > > #if !LOG_DISABLED || !RELEASE_LOG_DISABLED >- parameters.webCoreLoggingChannels = [[NSUserDefaults standardUserDefaults] stringForKey:@"WebCoreLogging"]; >- parameters.webKitLoggingChannels = [[NSUserDefaults standardUserDefaults] stringForKey:@"WebKit2Logging"]; >+ parameters.webCoreLoggingChannels = [defaults stringForKey:@"WebCoreLogging"]; >+ parameters.webKitLoggingChannels = [defaults stringForKey:@"WebKit2Logging"]; > #endif > > // FIXME: Remove this and related parameter when <rdar://problem/29448368> is fixed. >@@ -406,26 +406,27 @@ void WebProcessPool::registerNotificationObservers() > { > #if !PLATFORM(IOS_FAMILY) > // Listen for enhanced accessibility changes and propagate them to the WebProcess. >- m_enhancedAccessibilityObserver = [[NSNotificationCenter defaultCenter] addObserverForName:WebKitApplicationDidChangeAccessibilityEnhancedUserInterfaceNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *note) { >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ m_enhancedAccessibilityObserver = [center addObserverForName:WebKitApplicationDidChangeAccessibilityEnhancedUserInterfaceNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *note) { > setEnhancedAccessibility([[[note userInfo] objectForKey:@"AXEnhancedUserInterface"] boolValue]); > }]; > >- m_automaticTextReplacementNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSSpellCheckerDidChangeAutomaticTextReplacementNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { >+ m_automaticTextReplacementNotificationObserver = [center addObserverForName:NSSpellCheckerDidChangeAutomaticTextReplacementNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { > TextChecker::didChangeAutomaticTextReplacementEnabled(); > textCheckerStateChanged(); > }]; > >- m_automaticSpellingCorrectionNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSSpellCheckerDidChangeAutomaticSpellingCorrectionNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { >+ m_automaticSpellingCorrectionNotificationObserver = [center addObserverForName:NSSpellCheckerDidChangeAutomaticSpellingCorrectionNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { > TextChecker::didChangeAutomaticSpellingCorrectionEnabled(); > textCheckerStateChanged(); > }]; > >- m_automaticQuoteSubstitutionNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSSpellCheckerDidChangeAutomaticQuoteSubstitutionNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { >+ m_automaticQuoteSubstitutionNotificationObserver = [center addObserverForName:NSSpellCheckerDidChangeAutomaticQuoteSubstitutionNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { > TextChecker::didChangeAutomaticQuoteSubstitutionEnabled(); > textCheckerStateChanged(); > }]; > >- m_automaticDashSubstitutionNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSSpellCheckerDidChangeAutomaticDashSubstitutionNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { >+ m_automaticDashSubstitutionNotificationObserver = [center addObserverForName:NSSpellCheckerDidChangeAutomaticDashSubstitutionNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { > TextChecker::didChangeAutomaticDashSubstitutionEnabled(); > textCheckerStateChanged(); > }]; >@@ -435,22 +436,22 @@ void WebProcessPool::registerNotificationObservers() > }]; > > #if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) >- m_scrollerStyleNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSPreferredScrollerStyleDidChangeNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { >+ m_scrollerStyleNotificationObserver = [center addObserverForName:NSPreferredScrollerStyleDidChangeNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { > auto scrollbarStyle = [NSScroller preferredScrollerStyle]; > sendToAllProcesses(Messages::WebProcess::ScrollerStylePreferenceChanged(scrollbarStyle)); > }]; > #endif > >- m_activationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSApplicationDidBecomeActiveNotification object:NSApp queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { >+ m_activationObserver = [center addObserverForName:NSApplicationDidBecomeActiveNotification object:NSApp queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { > setApplicationIsActive(true); > }]; > >- m_deactivationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSApplicationDidResignActiveNotification object:NSApp queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { >+ m_deactivationObserver = [center addObserverForName:NSApplicationDidResignActiveNotification object:NSApp queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { > setApplicationIsActive(false); > }]; > #elif PLATFORM(IOS) > CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, backlightLevelDidChangeCallback, static_cast<CFStringRef>(UIBacklightLevelChangedNotification), nullptr, CFNotificationSuspensionBehaviorCoalesce); >- m_accessibilityEnabledObserver = [[NSNotificationCenter defaultCenter] addObserverForName:(__bridge id)kAXSApplicationAccessibilityEnabledNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *) { >+ m_accessibilityEnabledObserver = [center addObserverForName:(__bridge id)kAXSApplicationAccessibilityEnabledNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *) { > for (size_t i = 0; i < m_processes.size(); ++i) > m_processes[i]->unblockAccessibilityServerIfNeeded(); > }]; >@@ -460,20 +461,21 @@ void WebProcessPool::registerNotificationObservers() > void WebProcessPool::unregisterNotificationObservers() > { > #if !PLATFORM(IOS_FAMILY) >- [[NSNotificationCenter defaultCenter] removeObserver:m_enhancedAccessibilityObserver.get()]; >- [[NSNotificationCenter defaultCenter] removeObserver:m_automaticTextReplacementNotificationObserver.get()]; >- [[NSNotificationCenter defaultCenter] removeObserver:m_automaticSpellingCorrectionNotificationObserver.get()]; >- [[NSNotificationCenter defaultCenter] removeObserver:m_automaticQuoteSubstitutionNotificationObserver.get()]; >- [[NSNotificationCenter defaultCenter] removeObserver:m_automaticDashSubstitutionNotificationObserver.get()]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center removeObserver:m_enhancedAccessibilityObserver.get()]; >+ [center removeObserver:m_automaticTextReplacementNotificationObserver.get()]; >+ [center removeObserver:m_automaticSpellingCorrectionNotificationObserver.get()]; >+ [center removeObserver:m_automaticQuoteSubstitutionNotificationObserver.get()]; >+ [center removeObserver:m_automaticDashSubstitutionNotificationObserver.get()]; > [[NSWorkspace.sharedWorkspace notificationCenter] removeObserver:m_accessibilityDisplayOptionsNotificationObserver.get()]; > #if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) >- [[NSNotificationCenter defaultCenter] removeObserver:m_scrollerStyleNotificationObserver.get()]; >+ [center removeObserver:m_scrollerStyleNotificationObserver.get()]; > #endif >- [[NSNotificationCenter defaultCenter] removeObserver:m_activationObserver.get()]; >- [[NSNotificationCenter defaultCenter] removeObserver:m_deactivationObserver.get()]; >+ [center removeObserver:m_activationObserver.get()]; >+ [center removeObserver:m_deactivationObserver.get()]; > #elif PLATFORM(IOS) > CFNotificationCenterRemoveObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, static_cast<CFStringRef>(UIBacklightLevelChangedNotification) , nullptr); >- [[NSNotificationCenter defaultCenter] removeObserver:m_accessibilityEnabledObserver.get()]; >+ [center removeObserver:m_accessibilityEnabledObserver.get()]; > #endif // !PLATFORM(IOS_FAMILY) > } > >diff --git a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >index da3b183b52a..f9a2f80dd20 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >+++ b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >@@ -247,22 +247,22 @@ - (void)startObserving:(NSWindow *)window > if (!window) > return; > >- NSNotificationCenter *defaultNotificationCenter = [NSNotificationCenter defaultCenter]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; > > // An NSView derived object such as WKView cannot observe these notifications, because NSView itself observes them. >- [defaultNotificationCenter addObserver:self selector:@selector(_windowDidOrderOffScreen:) name:@"NSWindowDidOrderOffScreenNotification" object:window]; >- [defaultNotificationCenter addObserver:self selector:@selector(_windowDidOrderOnScreen:) name:@"_NSWindowDidBecomeVisible" object:window]; >+ [center addObserver:self selector:@selector(_windowDidOrderOffScreen:) name:@"NSWindowDidOrderOffScreenNotification" object:window]; >+ [center addObserver:self selector:@selector(_windowDidOrderOnScreen:) name:@"_NSWindowDidBecomeVisible" object:window]; > >- [defaultNotificationCenter addObserver:self selector:@selector(_windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:nil]; >- [defaultNotificationCenter addObserver:self selector:@selector(_windowDidResignKey:) name:NSWindowDidResignKeyNotification object:nil]; >- [defaultNotificationCenter addObserver:self selector:@selector(_windowDidMiniaturize:) name:NSWindowDidMiniaturizeNotification object:window]; >- [defaultNotificationCenter addObserver:self selector:@selector(_windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:window]; >- [defaultNotificationCenter addObserver:self selector:@selector(_windowDidMove:) name:NSWindowDidMoveNotification object:window]; >- [defaultNotificationCenter addObserver:self selector:@selector(_windowDidResize:) name:NSWindowDidResizeNotification object:window]; >- [defaultNotificationCenter addObserver:self selector:@selector(_windowDidChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:window]; >- [defaultNotificationCenter addObserver:self selector:@selector(_windowDidChangeScreen:) name:NSWindowDidChangeScreenNotification object:window]; >- [defaultNotificationCenter addObserver:self selector:@selector(_windowDidChangeLayerHosting:) name:@"_NSWindowDidChangeContentsHostedInLayerSurfaceNotification" object:window]; >- [defaultNotificationCenter addObserver:self selector:@selector(_windowDidChangeOcclusionState:) name:NSWindowDidChangeOcclusionStateNotification object:window]; >+ [center addObserver:self selector:@selector(_windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:nil]; >+ [center addObserver:self selector:@selector(_windowDidResignKey:) name:NSWindowDidResignKeyNotification object:nil]; >+ [center addObserver:self selector:@selector(_windowDidMiniaturize:) name:NSWindowDidMiniaturizeNotification object:window]; >+ [center addObserver:self selector:@selector(_windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:window]; >+ [center addObserver:self selector:@selector(_windowDidMove:) name:NSWindowDidMoveNotification object:window]; >+ [center addObserver:self selector:@selector(_windowDidResize:) name:NSWindowDidResizeNotification object:window]; >+ [center addObserver:self selector:@selector(_windowDidChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:window]; >+ [center addObserver:self selector:@selector(_windowDidChangeScreen:) name:NSWindowDidChangeScreenNotification object:window]; >+ [center addObserver:self selector:@selector(_windowDidChangeLayerHosting:) name:@"_NSWindowDidChangeContentsHostedInLayerSurfaceNotification" object:window]; >+ [center addObserver:self selector:@selector(_windowDidChangeOcclusionState:) name:NSWindowDidChangeOcclusionStateNotification object:window]; > > [window addObserver:self forKeyPath:@"contentLayoutRect" options:NSKeyValueObservingOptionInitial context:keyValueObservingContext]; > [window addObserver:self forKeyPath:@"titlebarAppearsTransparent" options:NSKeyValueObservingOptionInitial context:keyValueObservingContext]; >@@ -273,21 +273,21 @@ - (void)stopObserving:(NSWindow *)window > if (!window) > return; > >- NSNotificationCenter *defaultNotificationCenter = [NSNotificationCenter defaultCenter]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; > >- [defaultNotificationCenter removeObserver:self name:@"NSWindowDidOrderOffScreenNotification" object:window]; >- [defaultNotificationCenter removeObserver:self name:@"_NSWindowDidBecomeVisible" object:window]; >+ [center removeObserver:self name:@"NSWindowDidOrderOffScreenNotification" object:window]; >+ [center removeObserver:self name:@"_NSWindowDidBecomeVisible" object:window]; > >- [defaultNotificationCenter removeObserver:self name:NSWindowDidBecomeKeyNotification object:nil]; >- [defaultNotificationCenter removeObserver:self name:NSWindowDidResignKeyNotification object:nil]; >- [defaultNotificationCenter removeObserver:self name:NSWindowDidMiniaturizeNotification object:window]; >- [defaultNotificationCenter removeObserver:self name:NSWindowDidDeminiaturizeNotification object:window]; >- [defaultNotificationCenter removeObserver:self name:NSWindowDidMoveNotification object:window]; >- [defaultNotificationCenter removeObserver:self name:NSWindowDidResizeNotification object:window]; >- [defaultNotificationCenter removeObserver:self name:NSWindowDidChangeBackingPropertiesNotification object:window]; >- [defaultNotificationCenter removeObserver:self name:NSWindowDidChangeScreenNotification object:window]; >- [defaultNotificationCenter removeObserver:self name:@"_NSWindowDidChangeContentsHostedInLayerSurfaceNotification" object:window]; >- [defaultNotificationCenter removeObserver:self name:NSWindowDidChangeOcclusionStateNotification object:window]; >+ [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:nil]; >+ [center removeObserver:self name:NSWindowDidResignKeyNotification object:nil]; >+ [center removeObserver:self name:NSWindowDidMiniaturizeNotification object:window]; >+ [center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:window]; >+ [center removeObserver:self name:NSWindowDidMoveNotification object:window]; >+ [center removeObserver:self name:NSWindowDidResizeNotification object:window]; >+ [center removeObserver:self name:NSWindowDidChangeBackingPropertiesNotification object:window]; >+ [center removeObserver:self name:NSWindowDidChangeScreenNotification object:window]; >+ [center removeObserver:self name:@"_NSWindowDidChangeContentsHostedInLayerSurfaceNotification" object:window]; >+ [center removeObserver:self name:NSWindowDidChangeOcclusionStateNotification object:window]; > > if (_impl->isEditable()) > [[NSFontPanel sharedFontPanel] removeObserver:self forKeyPath:@"visible" context:keyValueObservingContext]; >@@ -1107,9 +1107,10 @@ void WebViewImpl::updateTextTouchBar() > m_textTouchBarItemController = adoptNS([[WKTextTouchBarItemController alloc] initWithWebViewImpl:this]); > > if (!m_startedListeningToCustomizationEvents) { >- [[NSNotificationCenter defaultCenter] addObserver:m_textTouchBarItemController.get() selector:@selector(touchBarDidExitCustomization:) name:NSTouchBarDidExitCustomization object:nil]; >- [[NSNotificationCenter defaultCenter] addObserver:m_textTouchBarItemController.get() selector:@selector(touchBarWillEnterCustomization:) name:NSTouchBarWillEnterCustomization object:nil]; >- [[NSNotificationCenter defaultCenter] addObserver:m_textTouchBarItemController.get() selector:@selector(didChangeAutomaticTextCompletion:) name:NSSpellCheckerDidChangeAutomaticTextCompletionNotification object:nil]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center addObserver:m_textTouchBarItemController.get() selector:@selector(touchBarDidExitCustomization:) name:NSTouchBarDidExitCustomization object:nil]; >+ [center addObserver:m_textTouchBarItemController.get() selector:@selector(touchBarWillEnterCustomization:) name:NSTouchBarWillEnterCustomization object:nil]; >+ [center addObserver:m_textTouchBarItemController.get() selector:@selector(didChangeAutomaticTextCompletion:) name:NSSpellCheckerDidChangeAutomaticTextCompletionNotification object:nil]; > > m_startedListeningToCustomizationEvents = true; > } >diff --git a/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm b/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm >index 2aca868bb8b..148d43d7549 100644 >--- a/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm >+++ b/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm >@@ -73,13 +73,14 @@ - (instancetype)init > > _backgroundTask = UIBackgroundTaskInvalid; > >- [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillEnterForegroundNotification object:[UIApplication sharedApplication] queue:nil usingBlock:^(NSNotification *) { >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center addObserverForName:UIApplicationWillEnterForegroundNotification object:[UIApplication sharedApplication] queue:nil usingBlock:^(NSNotification *) { > _applicationIsBackgrounded = NO; > [self _cancelPendingReleaseTask]; > [self _updateBackgroundTask]; > }]; > >- [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidEnterBackgroundNotification object:[UIApplication sharedApplication] queue:nil usingBlock:^(NSNotification *) { >+ [center addObserverForName:UIApplicationDidEnterBackgroundNotification object:[UIApplication sharedApplication] queue:nil usingBlock:^(NSNotification *) { > _applicationIsBackgrounded = YES; > }]; > >diff --git a/Source/WebKit/UIProcess/ios/WKContentView.mm b/Source/WebKit/UIProcess/ios/WKContentView.mm >index 55d80ca55df..4ba11494ee4 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentView.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentView.mm >@@ -271,8 +271,9 @@ - (instancetype)_commonInitializationWithProcessPool:(WebKit::WebProcessPool&)pr > [self _setupVisibilityPropagationView]; > #endif > >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationWillResignActive:) name:UIApplicationWillResignActiveNotification object:[UIApplication sharedApplication]]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:[UIApplication sharedApplication]]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center addObserver:self selector:@selector(_applicationWillResignActive:) name:UIApplicationWillResignActiveNotification object:[UIApplication sharedApplication]]; >+ [center addObserver:self selector:@selector(_applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:[UIApplication sharedApplication]]; > > return self; > } >diff --git a/Source/WebKit/UIProcess/ios/forms/WKDatePickerViewController.mm b/Source/WebKit/UIProcess/ios/forms/WKDatePickerViewController.mm >index b87cbf50f65..f2eb3063d02 100644 >--- a/Source/WebKit/UIProcess/ios/forms/WKDatePickerViewController.mm >+++ b/Source/WebKit/UIProcess/ios/forms/WKDatePickerViewController.mm >@@ -314,8 +314,10 @@ - (void)viewWillAppear:(BOOL)animated > [super viewWillAppear:animated]; > > _statusBarAssertion = [[PUICApplication sharedPUICApplication] _takeStatusBarGlobalContextAssertionAnimated:NO]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleStatusBarNavigation) name:PUICStatusBarNavigationBackButtonPressedNotification object:nil]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleStatusBarNavigation) name:PUICStatusBarTitleTappedNotification object:nil]; >+ >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center addObserver:self selector:@selector(_handleStatusBarNavigation) name:PUICStatusBarNavigationBackButtonPressedNotification object:nil]; >+ [center addObserver:self selector:@selector(_handleStatusBarNavigation) name:PUICStatusBarTitleTappedNotification object:nil]; > > configureStatusBarForController(self, self.delegate); > } >diff --git a/Source/WebKit/UIProcess/mac/TextCheckerMac.mm b/Source/WebKit/UIProcess/mac/TextCheckerMac.mm >index d003ea9e577..850915c289f 100644 >--- a/Source/WebKit/UIProcess/mac/TextCheckerMac.mm >+++ b/Source/WebKit/UIProcess/mac/TextCheckerMac.mm >@@ -88,14 +88,15 @@ static bool shouldAutomaticDashSubstitutionBeEnabled() > static TextCheckerState& mutableState() > { > static NeverDestroyed<TextCheckerState> state = makeNeverDestroyed([] { >+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; > TextCheckerState initialState; >- initialState.isContinuousSpellCheckingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebContinuousSpellCheckingEnabled] && TextChecker::isContinuousSpellCheckingAllowed(); >- initialState.isGrammarCheckingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebGrammarCheckingEnabled]; >+ initialState.isContinuousSpellCheckingEnabled = [defaults boolForKey:WebContinuousSpellCheckingEnabled] && TextChecker::isContinuousSpellCheckingAllowed(); >+ initialState.isGrammarCheckingEnabled = [defaults boolForKey:WebGrammarCheckingEnabled]; > initialState.isAutomaticTextReplacementEnabled = shouldAutomaticTextReplacementBeEnabled(); > initialState.isAutomaticSpellingCorrectionEnabled = shouldAutomaticSpellingCorrectionBeEnabled(); > initialState.isAutomaticQuoteSubstitutionEnabled = shouldAutomaticQuoteSubstitutionBeEnabled(); > initialState.isAutomaticDashSubstitutionEnabled = shouldAutomaticDashSubstitutionBeEnabled(); >- initialState.isAutomaticLinkDetectionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticLinkDetectionEnabled]; >+ initialState.isAutomaticLinkDetectionEnabled = [defaults boolForKey:WebAutomaticLinkDetectionEnabled]; > return initialState; > }()); > return state; >@@ -111,14 +112,15 @@ static bool testingModeEnabled = false; > void TextChecker::setTestingMode(bool enabled) > { > if (enabled && !testingModeEnabled) { >- [[NSUserDefaults standardUserDefaults] setBool:mutableState().isContinuousSpellCheckingEnabled forKey:WebContinuousSpellCheckingEnabled]; >- [[NSUserDefaults standardUserDefaults] setBool:mutableState().isGrammarCheckingEnabled forKey:WebGrammarCheckingEnabled]; >- [[NSUserDefaults standardUserDefaults] setBool:mutableState().isAutomaticSpellingCorrectionEnabled forKey:WebAutomaticSpellingCorrectionEnabled]; >- [[NSUserDefaults standardUserDefaults] setBool:mutableState().isAutomaticQuoteSubstitutionEnabled forKey:WebAutomaticQuoteSubstitutionEnabled]; >- [[NSUserDefaults standardUserDefaults] setBool:mutableState().isAutomaticDashSubstitutionEnabled forKey:WebAutomaticDashSubstitutionEnabled]; >- [[NSUserDefaults standardUserDefaults] setBool:mutableState().isAutomaticLinkDetectionEnabled forKey:WebAutomaticLinkDetectionEnabled]; >- [[NSUserDefaults standardUserDefaults] setBool:mutableState().isAutomaticTextReplacementEnabled forKey:WebAutomaticTextReplacementEnabled]; >- [[NSUserDefaults standardUserDefaults] setBool:isSmartInsertDeleteEnabled() forKey:WebSmartInsertDeleteEnabled]; >+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; >+ [defaults setBool:mutableState().isContinuousSpellCheckingEnabled forKey:WebContinuousSpellCheckingEnabled]; >+ [defaults setBool:mutableState().isGrammarCheckingEnabled forKey:WebGrammarCheckingEnabled]; >+ [defaults setBool:mutableState().isAutomaticSpellingCorrectionEnabled forKey:WebAutomaticSpellingCorrectionEnabled]; >+ [defaults setBool:mutableState().isAutomaticQuoteSubstitutionEnabled forKey:WebAutomaticQuoteSubstitutionEnabled]; >+ [defaults setBool:mutableState().isAutomaticDashSubstitutionEnabled forKey:WebAutomaticDashSubstitutionEnabled]; >+ [defaults setBool:mutableState().isAutomaticLinkDetectionEnabled forKey:WebAutomaticLinkDetectionEnabled]; >+ [defaults setBool:mutableState().isAutomaticTextReplacementEnabled forKey:WebAutomaticTextReplacementEnabled]; >+ [defaults setBool:isSmartInsertDeleteEnabled() forKey:WebSmartInsertDeleteEnabled]; > } > testingModeEnabled = enabled; > } >@@ -134,8 +136,9 @@ bool TextChecker::isContinuousSpellCheckingAllowed() > static bool readAllowContinuousSpellCheckingDefault = false; > > if (!readAllowContinuousSpellCheckingDefault) { >- if ([[NSUserDefaults standardUserDefaults] objectForKey:@"NSAllowContinuousSpellChecking"]) >- allowContinuousSpellChecking = [[NSUserDefaults standardUserDefaults] boolForKey:@"NSAllowContinuousSpellChecking"]; >+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; >+ if ([defaults objectForKey:@"NSAllowContinuousSpellChecking"]) >+ allowContinuousSpellChecking = [defaults boolForKey:@"NSAllowContinuousSpellChecking"]; > > readAllowContinuousSpellCheckingDefault = true; > } >diff --git a/Source/WebKit/UIProcess/mac/WebInspectorProxyMac.mm b/Source/WebKit/UIProcess/mac/WebInspectorProxyMac.mm >index 007d87dfcd8..9bae7cabbba 100644 >--- a/Source/WebKit/UIProcess/mac/WebInspectorProxyMac.mm >+++ b/Source/WebKit/UIProcess/mac/WebInspectorProxyMac.mm >@@ -193,8 +193,9 @@ using namespace WebCore; > > void WebInspectorProxy::attachmentViewDidChange(NSView *oldView, NSView *newView) > { >- [[NSNotificationCenter defaultCenter] removeObserver:m_objCAdapter.get() name:NSViewFrameDidChangeNotification object:oldView]; >- [[NSNotificationCenter defaultCenter] addObserver:m_objCAdapter.get() selector:@selector(inspectedViewFrameDidChange:) name:NSViewFrameDidChangeNotification object:newView]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center removeObserver:m_objCAdapter.get() name:NSViewFrameDidChangeNotification object:oldView]; >+ [center addObserver:m_objCAdapter.get() selector:@selector(inspectedViewFrameDidChange:) name:NSViewFrameDidChangeNotification object:newView]; > > if (m_isAttached) > attach(m_attachmentSide); >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index d5b68e75653..8d373241a45 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,24 @@ >+2019-05-20 Joseph Pecoraro <pecoraro@apple.com> >+ >+ Remove unnecessary duplicate selector invocations >+ https://bugs.webkit.org/show_bug.cgi?id=198066 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebView/WebPreferences.mm: >+ (-[WebPreferences _postPreferencesChangedNotification]): >+ * WebView/WebVideoFullscreenController.mm: >+ (-[WebVideoFullscreenController windowDidLoad]): >+ * WebView/WebView.mm: >+ (-[WebView _commonInitializationWithFrameName:groupName:]): >+ (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]): >+ (+[WebView initialize]): >+ (-[WebView setPreferences:]): >+ (-[WebView updateTextTouchBar]): >+ * WebView/WebViewData.mm: >+ (-[WebWindowVisibilityObserver startObserving:]): >+ (-[WebWindowVisibilityObserver stopObserving:]): >+ > 2019-05-13 Jer Noble <jer.noble@apple.com> > > Make QTKit an optional framework >diff --git a/Source/WebKitLegacy/mac/WebView/WebPreferences.mm b/Source/WebKitLegacy/mac/WebView/WebPreferences.mm >index 9f1c226fb98..46e415962f8 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebPreferences.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebPreferences.mm >@@ -1889,8 +1889,9 @@ - (void)_postPreferencesChangedNotification > } > #endif > >- [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedInternalNotification object:self userInfo:nil]; >- [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedNotification object:self userInfo:nil]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center postNotificationName:WebPreferencesChangedInternalNotification object:self userInfo:nil]; >+ [center postNotificationName:WebPreferencesChangedNotification object:self userInfo:nil]; > } > > - (void)_postPreferencesChangedAPINotification >diff --git a/Source/WebKitLegacy/mac/WebView/WebVideoFullscreenController.mm b/Source/WebKitLegacy/mac/WebView/WebVideoFullscreenController.mm >index 23aac34426b..98898ae5ca8 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebVideoFullscreenController.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebVideoFullscreenController.mm >@@ -89,8 +89,9 @@ - (void)windowDidLoad > [contentView setLayer:[CALayer layer]]; > [contentView setWantsLayer:YES]; > >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidResignActive:) name:NSApplicationDidResignActiveNotification object:NSApp]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidChangeScreenParameters:) name:NSApplicationDidChangeScreenParametersNotification object:NSApp]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center addObserver:self selector:@selector(applicationDidResignActive:) name:NSApplicationDidResignActiveNotification object:NSApp]; >+ [center addObserver:self selector:@selector(applicationDidChangeScreenParameters:) name:NSApplicationDidChangeScreenParametersNotification object:NSApp]; > } > > - (WebCore::HTMLVideoElement *)videoElement >diff --git a/Source/WebKitLegacy/mac/WebView/WebView.mm b/Source/WebKitLegacy/mac/WebView/WebView.mm >index 9d6eea41c5a..da3a4eb08a9 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebView.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebView.mm >@@ -1485,6 +1485,8 @@ - (void)_commonInitializationWithFrameName:(NSString *)frameName groupName:(NSSt > WebCore::provideDeviceOrientationTo(*_private->page, *new WebDeviceOrientationClient(self)); > #endif > >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ > #if ENABLE(REMOTE_INSPECTOR) > _private->page->setRemoteInspectionAllowed(true); > #endif >@@ -1502,16 +1504,15 @@ - (void)_commonInitializationWithFrameName:(NSString *)frameName groupName:(NSSt > > #if PLATFORM(IOS_FAMILY) > _private->page->settings().setPassiveTouchListenersAsDefaultOnDocument(linkedOnOrAfter(SDKVersion::FirstThatDefaultsToPassiveTouchListenersOnDocument)); >-#endif > >-#if PLATFORM(IOS_FAMILY) > // Preserve the behavior we had before <rdar://problem/7580867> > // by enforcing a 5MB limit for session storage. > _private->page->settings().setSessionStorageQuota(5 * 1024 * 1024); > > [self _updateScreenScaleFromWindow]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_wakWindowScreenScaleChanged:) name:WAKWindowScreenScaleDidChangeNotification object:nil]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_wakWindowVisibilityChanged:) name:WAKWindowVisibilityDidChangeNotification object:nil]; >+ >+ [center addObserver:self selector:@selector(_wakWindowScreenScaleChanged:) name:WAKWindowScreenScaleDidChangeNotification object:nil]; >+ [center addObserver:self selector:@selector(_wakWindowVisibilityChanged:) name:WAKWindowVisibilityDidChangeNotification object:nil]; > _private->_fixedPositionContent = [[WebFixedPositionContent alloc] initWithWebView:self]; > #if ENABLE(ORIENTATION_EVENTS) > _private->deviceOrientation = [[self _UIKitDelegateForwarder] deviceOrientation]; >@@ -1555,7 +1556,7 @@ - (void)_commonInitializationWithFrameName:(NSString *)frameName groupName:(NSSt > [self _setIsVisible:[self _isViewVisible]]; > > WebPreferences *prefs = [self preferences]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesChangedNotification:) >+ [center addObserver:self selector:@selector(_preferencesChangedNotification:) > name:WebPreferencesChangedInternalNotification object:prefs]; > > #if !PLATFORM(IOS_FAMILY) >@@ -1766,8 +1767,9 @@ - (id)initSimpleHTMLDocumentWithStyle:(NSString *)style frame:(CGRect)frame pref > #endif > > [self _updateScreenScaleFromWindow]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_wakWindowScreenScaleChanged:) name:WAKWindowScreenScaleDidChangeNotification object:nil]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_wakWindowVisibilityChanged:) name:WAKWindowVisibilityDidChangeNotification object:nil]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center addObserver:self selector:@selector(_wakWindowScreenScaleChanged:) name:WAKWindowScreenScaleDidChangeNotification object:nil]; >+ [center addObserver:self selector:@selector(_wakWindowVisibilityChanged:) name:WAKWindowVisibilityDidChangeNotification object:nil]; > > [WebFrame _createMainFrameWithSimpleHTMLDocumentWithPage:_private->page frameView:frameView style:style]; > >@@ -5578,17 +5580,17 @@ + (void)initialize > WTF::setProcessPrivileges(allPrivileges()); > WebCore::NetworkStorageSession::permitProcessToUseCookieAPI(true); > >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ > #if !PLATFORM(IOS_FAMILY) >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationWillTerminate) name:NSApplicationWillTerminateNotification object:NSApp]; >+ [center addObserver:self selector:@selector(_applicationWillTerminate) name:NSApplicationWillTerminateNotification object:NSApp]; > #endif >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_cacheModelChangedNotification:) name:WebPreferencesCacheModelChangedInternalNotification object:nil]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesRemovedNotification:) name:WebPreferencesRemovedNotification object:nil]; >+ [center addObserver:self selector:@selector(_cacheModelChangedNotification:) name:WebPreferencesCacheModelChangedInternalNotification object:nil]; >+ [center addObserver:self selector:@selector(_preferencesRemovedNotification:) name:WebPreferencesRemovedNotification object:nil]; > > #if PLATFORM(IOS_FAMILY) > continuousSpellCheckingEnabled = NO; >- > #else >- > NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; > continuousSpellCheckingEnabled = [defaults boolForKey:WebContinuousSpellCheckingEnabled]; > grammarCheckingEnabled = [defaults boolForKey:WebGrammarCheckingEnabled]; >@@ -5599,13 +5601,13 @@ + (void)initialize > automaticTextReplacementEnabled = [self _shouldAutomaticTextReplacementBeEnabled]; > automaticSpellingCorrectionEnabled = [self _shouldAutomaticSpellingCorrectionBeEnabled]; > >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didChangeAutomaticTextReplacementEnabled:) >+ [center addObserver:self selector:@selector(_didChangeAutomaticTextReplacementEnabled:) > name:NSSpellCheckerDidChangeAutomaticTextReplacementNotification object:nil]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didChangeAutomaticSpellingCorrectionEnabled:) >+ [center addObserver:self selector:@selector(_didChangeAutomaticSpellingCorrectionEnabled:) > name:NSSpellCheckerDidChangeAutomaticSpellingCorrectionNotification object:nil]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didChangeAutomaticQuoteSubstitutionEnabled:) >+ [center addObserver:self selector:@selector(_didChangeAutomaticQuoteSubstitutionEnabled:) > name:NSSpellCheckerDidChangeAutomaticQuoteSubstitutionNotification object:nil]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didChangeAutomaticDashSubstitutionEnabled:) >+ [center addObserver:self selector:@selector(_didChangeAutomaticDashSubstitutionEnabled:) > name:NSSpellCheckerDidChangeAutomaticDashSubstitutionNotification object:nil]; > #endif > } >@@ -6312,13 +6314,14 @@ - (void)setPreferences:(WebPreferences *)prefs > > WebPreferences *oldPrefs = _private->preferences; > >- [[NSNotificationCenter defaultCenter] removeObserver:self name:WebPreferencesChangedInternalNotification object:[self preferences]]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center removeObserver:self name:WebPreferencesChangedInternalNotification object:[self preferences]]; > [WebPreferences _removeReferenceForIdentifier:[oldPrefs identifier]]; > > _private->preferences = [prefs retain]; > > // After registering for the notification, post it so the WebCore settings update. >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesChangedNotification:) >+ [center addObserver:self selector:@selector(_preferencesChangedNotification:) > name:WebPreferencesChangedInternalNotification object:[self preferences]]; > [self _preferencesChanged:[self preferences]]; > [[self preferences] _postPreferencesChangedAPINotification]; >@@ -9944,9 +9947,10 @@ - (void)updateTextTouchBar > _private->_textTouchBarItemController = adoptNS([[WebTextTouchBarItemController alloc] initWithWebView:self]); > > if (!_private->_startedListeningToCustomizationEvents) { >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(touchBarDidExitCustomization:) name:NSTouchBarDidExitCustomization object:nil]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(touchBarWillEnterCustomization:) name:NSTouchBarWillEnterCustomization object:nil]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didChangeAutomaticTextCompletion:) name:NSSpellCheckerDidChangeAutomaticTextCompletionNotification object:nil]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center addObserver:self selector:@selector(touchBarDidExitCustomization:) name:NSTouchBarDidExitCustomization object:nil]; >+ [center addObserver:self selector:@selector(touchBarWillEnterCustomization:) name:NSTouchBarWillEnterCustomization object:nil]; >+ [center addObserver:self selector:@selector(didChangeAutomaticTextCompletion:) name:NSSpellCheckerDidChangeAutomaticTextCompletionNotification object:nil]; > _private->_startedListeningToCustomizationEvents = YES; > } > >diff --git a/Source/WebKitLegacy/mac/WebView/WebViewData.mm b/Source/WebKitLegacy/mac/WebView/WebViewData.mm >index 8b49782b6bc..eeddf6c7efd 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebViewData.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebViewData.mm >@@ -141,16 +141,16 @@ - (instancetype)initWithView:(WebView *)view > - (void)startObserving:(NSWindow *)window > { > // An NSView derived object such as WebView cannot observe these notifications, because NSView itself observes them. >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowVisibilityChanged:) >- name:@"NSWindowDidOrderOffScreenNotification" object:window]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowVisibilityChanged:) >- name:@"_NSWindowDidBecomeVisible" object:window]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center addObserver:self selector:@selector(_windowVisibilityChanged:) name:@"NSWindowDidOrderOffScreenNotification" object:window]; >+ [center addObserver:self selector:@selector(_windowVisibilityChanged:) name:@"_NSWindowDidBecomeVisible" object:window]; > } > > - (void)stopObserving:(NSWindow *)window > { >- [[NSNotificationCenter defaultCenter] removeObserver:self name:@"NSWindowDidOrderOffScreenNotification" object:window]; >- [[NSNotificationCenter defaultCenter] removeObserver:self name:@"_NSWindowDidBecomeVisible" object:window]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center removeObserver:self name:@"NSWindowDidOrderOffScreenNotification" object:window]; >+ [center removeObserver:self name:@"_NSWindowDidBecomeVisible" object:window]; > } > > - (void)_windowVisibilityChanged:(NSNotification *)notification >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 2f0245f295b..5d93b7b75d8 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,30 @@ >+2019-05-20 Joseph Pecoraro <pecoraro@apple.com> >+ >+ Remove unnecessary duplicate selector invocations >+ https://bugs.webkit.org/show_bug.cgi?id=198066 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * DumpRenderTree/mac/DumpRenderTree.mm: >+ (setDefaultsToConsistentValuesForTesting): >+ * MiniBrowser/mac/AppDelegate.m: >+ (defaultConfiguration): >+ * TestWebKitAPI/Tests/mac/NavigatorLanguage.mm: >+ (TestWebKitAPI::overrideAppleLanguages): >+ * TestWebKitAPI/ios/mainIOS.mm: >+ (main): >+ * TestWebKitAPI/mac/InjectedBundleControllerMac.mm: >+ (TestWebKitAPI::InjectedBundleController::platformInitialize): >+ * TestWebKitAPI/mac/mainMac.mm: >+ (main): >+ * WebKitLauncher/main.m: >+ (getLastVersionShown): >+ (saveLastVersionShown): >+ * WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm: >+ (WTR::InjectedBundle::platformInitialize): >+ * WebKitTestRunner/cocoa/TestControllerCocoa.mm: >+ (WTR::TestController::platformAddTestOptions const): >+ > 2019-05-20 Fujii Hironori <Hironori.Fujii@sony.com> > > run-webkit-tests not gathering crash logs on Cygwin Python and Windows Python >diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >index 3e0d89525d3..a9a0514ec11 100644 >--- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm >+++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >@@ -1070,7 +1070,8 @@ static void setDefaultsToConsistentValuesForTesting() > @"com.apple.swipescrolldirection": @1, > }; > >- [[NSUserDefaults standardUserDefaults] setValuesForKeysWithDictionary:dict]; >+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; >+ [defaults setValuesForKeysWithDictionary:dict]; > > NSDictionary *processInstanceDefaults = @{ > WebDatabaseDirectoryDefaultsKey: [libraryPath stringByAppendingPathComponent:@"Databases"], >@@ -1079,7 +1080,7 @@ static void setDefaultsToConsistentValuesForTesting() > WebKitResourceLoadStatisticsDirectoryDefaultsKey: [libraryPath stringByAppendingPathComponent:@"LocalStorage"], > }; > >- [[NSUserDefaults standardUserDefaults] setVolatileDomain:processInstanceDefaults forName:NSArgumentDomain]; >+ [defaults setVolatileDomain:processInstanceDefaults forName:NSArgumentDomain]; > } > > static void allocateGlobalControllers() >diff --git a/Tools/MiniBrowser/mac/AppDelegate.m b/Tools/MiniBrowser/mac/AppDelegate.m >index ef19f0d9c6e..9cb6c6eb11b 100644 >--- a/Tools/MiniBrowser/mac/AppDelegate.m >+++ b/Tools/MiniBrowser/mac/AppDelegate.m >@@ -98,11 +98,13 @@ - (void)awakeFromNib > > configuration.processPool = [[[WKProcessPool alloc] _initWithConfiguration:processConfiguration] autorelease]; > >+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; >+ > NSArray<_WKExperimentalFeature *> *experimentalFeatures = [WKPreferences _experimentalFeatures]; > for (_WKExperimentalFeature *feature in experimentalFeatures) { > BOOL enabled; >- if ([[NSUserDefaults standardUserDefaults] objectForKey:feature.key]) >- enabled = [[NSUserDefaults standardUserDefaults] boolForKey:feature.key]; >+ if ([defaults objectForKey:feature.key]) >+ enabled = [defaults boolForKey:feature.key]; > else > enabled = [feature defaultValue]; > [configuration.preferences _setEnabled:enabled forExperimentalFeature:feature]; >@@ -111,8 +113,8 @@ - (void)awakeFromNib > NSArray<_WKInternalDebugFeature *> *internalDebugFeatures = [WKPreferences _internalDebugFeatures]; > for (_WKInternalDebugFeature *feature in internalDebugFeatures) { > BOOL enabled; >- if ([[NSUserDefaults standardUserDefaults] objectForKey:feature.key]) >- enabled = [[NSUserDefaults standardUserDefaults] boolForKey:feature.key]; >+ if ([defaults objectForKey:feature.key]) >+ enabled = [defaults boolForKey:feature.key]; > else > enabled = [feature defaultValue]; > [configuration.preferences _setEnabled:enabled forInternalDebugFeature:feature]; >diff --git a/Tools/TestWebKitAPI/Tests/mac/NavigatorLanguage.mm b/Tools/TestWebKitAPI/Tests/mac/NavigatorLanguage.mm >index ee88cb4bf6b..010a890f816 100644 >--- a/Tools/TestWebKitAPI/Tests/mac/NavigatorLanguage.mm >+++ b/Tools/TestWebKitAPI/Tests/mac/NavigatorLanguage.mm >@@ -48,14 +48,15 @@ namespace TestWebKitAPI { > > void overrideAppleLanguages(NSString *primaryLanguage) > { >- RetainPtr<NSMutableDictionary> argumentDomain = adoptNS([[[NSUserDefaults standardUserDefaults] volatileDomainForName:NSArgumentDomain] mutableCopy]); >+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; >+ RetainPtr<NSMutableDictionary> argumentDomain = adoptNS([[defaults volatileDomainForName:NSArgumentDomain] mutableCopy]); > if (!argumentDomain) > argumentDomain = adoptNS([[NSMutableDictionary alloc] init]); > > [argumentDomain addEntriesFromDictionary:@{ > @"AppleLanguages": @[primaryLanguage] > }]; >- [[NSUserDefaults standardUserDefaults] setVolatileDomain:argumentDomain.get() forName:NSArgumentDomain]; >+ [defaults setVolatileDomain:argumentDomain.get() forName:NSArgumentDomain]; > > [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"AppleLanguagePreferencesChangedNotification" object:nil userInfo:nil options:NSNotificationDeliverImmediately]; > >diff --git a/Tools/TestWebKitAPI/ios/mainIOS.mm b/Tools/TestWebKitAPI/ios/mainIOS.mm >index cb8c0c55e76..8f3adf20f5a 100644 >--- a/Tools/TestWebKitAPI/ios/mainIOS.mm >+++ b/Tools/TestWebKitAPI/ios/mainIOS.mm >@@ -30,10 +30,11 @@ int main(int argc, char** argv) > { > NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; > >- [[NSUserDefaults standardUserDefaults] removePersistentDomainForName:@"TestWebKitAPI"]; >+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; >+ [defaults removePersistentDomainForName:@"TestWebKitAPI"]; > > // Set up user defaults. >- NSMutableDictionary *argumentDomain = [[[NSUserDefaults standardUserDefaults] volatileDomainForName:NSArgumentDomain] mutableCopy]; >+ NSMutableDictionary *argumentDomain = [[defaults volatileDomainForName:NSArgumentDomain] mutableCopy]; > if (!argumentDomain) > argumentDomain = [[NSMutableDictionary alloc] init]; > >@@ -42,7 +43,7 @@ int main(int argc, char** argv) > nil]; > > [argumentDomain addEntriesFromDictionary:dict]; >- [[NSUserDefaults standardUserDefaults] setVolatileDomain:argumentDomain forName:NSArgumentDomain]; >+ [defaults setVolatileDomain:argumentDomain forName:NSArgumentDomain]; > > bool passed = TestWebKitAPI::TestsController::singleton().run(argc, argv); > >diff --git a/Tools/TestWebKitAPI/mac/InjectedBundleControllerMac.mm b/Tools/TestWebKitAPI/mac/InjectedBundleControllerMac.mm >index 7b2bd7f9666..f61c9eca2db 100644 >--- a/Tools/TestWebKitAPI/mac/InjectedBundleControllerMac.mm >+++ b/Tools/TestWebKitAPI/mac/InjectedBundleControllerMac.mm >@@ -33,7 +33,8 @@ namespace TestWebKitAPI { > void InjectedBundleController::platformInitialize() > { > // Set up user defaults. >- NSMutableDictionary *argumentDomain = [[[NSUserDefaults standardUserDefaults] volatileDomainForName:NSArgumentDomain] mutableCopy]; >+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; >+ NSMutableDictionary *argumentDomain = [[defaults volatileDomainForName:NSArgumentDomain] mutableCopy]; > if (!argumentDomain) > argumentDomain = [[NSMutableDictionary alloc] init]; > >@@ -46,7 +47,7 @@ void InjectedBundleController::platformInitialize() > nil]; > > [argumentDomain addEntriesFromDictionary:dict]; >- [[NSUserDefaults standardUserDefaults] setVolatileDomain:argumentDomain forName:NSArgumentDomain]; >+ [defaults setVolatileDomain:argumentDomain forName:NSArgumentDomain]; > > [argumentDomain release]; > } >diff --git a/Tools/TestWebKitAPI/mac/mainMac.mm b/Tools/TestWebKitAPI/mac/mainMac.mm >index d312c67e576..6f4da00c8c8 100644 >--- a/Tools/TestWebKitAPI/mac/mainMac.mm >+++ b/Tools/TestWebKitAPI/mac/mainMac.mm >@@ -32,10 +32,11 @@ int main(int argc, char** argv) > { > NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; > >- [[NSUserDefaults standardUserDefaults] removePersistentDomainForName:@"TestWebKitAPI"]; >+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; >+ [defaults removePersistentDomainForName:@"TestWebKitAPI"]; > > // Set a user default for TestWebKitAPI to bypass all linked-on-or-after checks in WebKit >- NSMutableDictionary *argumentDomain = [[[NSUserDefaults standardUserDefaults] volatileDomainForName:NSArgumentDomain] mutableCopy]; >+ NSMutableDictionary *argumentDomain = [[defaults volatileDomainForName:NSArgumentDomain] mutableCopy]; > if (!argumentDomain) > argumentDomain = [[NSMutableDictionary alloc] init]; > >@@ -44,7 +45,7 @@ int main(int argc, char** argv) > nil]; > > [argumentDomain addEntriesFromDictionary:dict]; >- [[NSUserDefaults standardUserDefaults] setVolatileDomain:argumentDomain forName:NSArgumentDomain]; >+ [defaults setVolatileDomain:argumentDomain forName:NSArgumentDomain]; > > [NSApplication sharedApplication]; > _BeginEventReceiptOnThread(); // Makes window visibility notifications work (and possibly more). >diff --git a/Tools/WebKitLauncher/main.m b/Tools/WebKitLauncher/main.m >index 43155fd64cc..25d77f2e41b 100644 >--- a/Tools/WebKitLauncher/main.m >+++ b/Tools/WebKitLauncher/main.m >@@ -56,14 +56,16 @@ static void displayErrorAndQuit(NSString *title, NSString *message) > > static int getLastVersionShown() > { >- [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObject:@"-1" forKey:@"StartPageShownInVersion"]]; >- return [[NSUserDefaults standardUserDefaults] integerForKey:@"StartPageShownInVersion"]; >+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; >+ [defaults registerDefaults:[NSDictionary dictionaryWithObject:@"-1" forKey:@"StartPageShownInVersion"]]; >+ return [defaults integerForKey:@"StartPageShownInVersion"]; > } > > static void saveLastVersionShown(int lastVersion) > { >- [[NSUserDefaults standardUserDefaults] setInteger:lastVersion forKey:@"StartPageShownInVersion"]; >- [[NSUserDefaults standardUserDefaults] synchronize]; >+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; >+ [defaults setInteger:lastVersion forKey:@"StartPageShownInVersion"]; >+ [defaults synchronize]; > } > > static NSString *getPathForStartPage() >diff --git a/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm b/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm >index 50b1b13d765..5af9eb6499b 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm >+++ b/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm >@@ -43,7 +43,8 @@ void InjectedBundle::platformInitialize(WKTypeRef initializationUserData) > setenv("XTYPE_ALLOW_AUTOACTIVATION", "1", 0); > > // Language was set up earlier in main(). Don't clobber it. >- NSArray *languages = [[[NSUserDefaults standardUserDefaults] volatileDomainForName:NSArgumentDomain] valueForKey:@"AppleLanguages"]; >+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; >+ NSArray *languages = [[defaults volatileDomainForName:NSArgumentDomain] valueForKey:@"AppleLanguages"]; > if (!languages) > languages = @[ @"en" ]; > >@@ -73,7 +74,7 @@ void InjectedBundle::platformInitialize(WKTypeRef initializationUserData) > @"com.apple.trackpad.forceClick": @1, > }; > >- [[NSUserDefaults standardUserDefaults] setVolatileDomain:dict forName:NSArgumentDomain]; >+ [defaults setVolatileDomain:dict forName:NSArgumentDomain]; > > // Underlying frameworks have already read AppleAntiAliasingThreshold default before we changed it. > // A distributed notification is delivered to all applications, but it should be harmless, and it's the only way to update all underlying frameworks anyway. >diff --git a/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm b/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >index 4087735ba25..79a158e3d71 100644 >--- a/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >+++ b/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >@@ -126,9 +126,10 @@ WKPreferencesRef TestController::platformPreferences() > > void TestController::platformAddTestOptions(TestOptions& options) const > { >- if ([[NSUserDefaults standardUserDefaults] boolForKey:@"EnableProcessSwapOnNavigation"]) >+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; >+ if ([defaults boolForKey:@"EnableProcessSwapOnNavigation"]) > options.contextOptions.enableProcessSwapOnNavigation = true; >- if ([[NSUserDefaults standardUserDefaults] boolForKey:@"EnableProcessSwapOnWindowOpen"]) >+ if ([defaults boolForKey:@"EnableProcessSwapOnWindowOpen"]) > options.contextOptions.enableProcessSwapOnWindowOpen = true; > } >
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:
achristensen
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198066
:
370297
| 370299 |
370326