[macOS] Remove redundant call to check in with Launch Services
https://bugs.webkit.org/show_bug.cgi?id=209911
Reviewed by Darin Adler.
Source/WebCore/PAL:
Move declarations to SPI header files.
* PAL.xcodeproj/project.pbxproj:
* pal/spi/cocoa/CoreServicesSPI.h: Added.
* pal/spi/cocoa/LaunchServicesSPI.h:
Source/WebKit:
There is no need to explicitly check in with Launch Services or call RegisterApplication in the WebContent process,
since this is handled when calling [NSApplication _accessibilityInitialize].
No new tests, since this only removes a redundant call, and should be covered by existing tests.
* Shared/mac/AuxiliaryProcessMac.mm:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
(WebKit::WebProcess::updateProcessName):
(WebKit::WebProcess::platformInitializeProcess):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@259396 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/PAL/ChangeLog b/Source/WebCore/PAL/ChangeLog
index f22c436..8e11393 100644
--- a/Source/WebCore/PAL/ChangeLog
+++ b/Source/WebCore/PAL/ChangeLog
@@ -1,3 +1,16 @@
+2020-04-02 Per Arne Vollan <pvollan@apple.com>
+
+ [macOS] Remove redundant call to check in with Launch Services
+ https://bugs.webkit.org/show_bug.cgi?id=209911
+
+ Reviewed by Darin Adler.
+
+ Move declarations to SPI header files.
+
+ * PAL.xcodeproj/project.pbxproj:
+ * pal/spi/cocoa/CoreServicesSPI.h: Added.
+ * pal/spi/cocoa/LaunchServicesSPI.h:
+
2020-04-02 Eric Carlson <eric.carlson@apple.com>
[iOS] Allow WebKit to use camera in multi-tasking mode
diff --git a/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj b/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
index 56d0790..bfe3917 100644
--- a/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
+++ b/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
@@ -345,6 +345,7 @@
A3C66CDA1F462D6A009E6EE9 /* SessionID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SessionID.cpp; sourceTree = "<group>"; };
A3C66CDB1F462D6A009E6EE9 /* SessionID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SessionID.h; sourceTree = "<group>"; };
C037494124127CCB00D9A36E /* AccessibilitySupportSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccessibilitySupportSPI.h; sourceTree = "<group>"; };
+ C138EA1A2436447200656DF1 /* CoreServicesSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CoreServicesSPI.h; sourceTree = "<group>"; };
C15CBB3223F34A1200300CC7 /* NSUserDefaultsSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSUserDefaultsSPI.h; sourceTree = "<group>"; };
C2147A4A1EFD0AA600056FA5 /* CopyPALHeaders.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CopyPALHeaders.xcconfig; sourceTree = "<group>"; };
CDACB35E23873E480018D7CE /* MediaToolboxSoftLink.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MediaToolboxSoftLink.cpp; sourceTree = "<group>"; };
@@ -427,6 +428,7 @@
0C2DA1221F3BEB4900DBC317 /* AVKitSPI.h */,
0C2DA1231F3BEB4900DBC317 /* CFNSURLConnectionSPI.h */,
7A36D0F8223AD9AB00B0522E /* CommonCryptoSPI.h */,
+ C138EA1A2436447200656DF1 /* CoreServicesSPI.h */,
0C2DA1241F3BEB4900DBC317 /* CoreTextSPI.h */,
0C2DA1251F3BEB4900DBC317 /* DataDetectorsCoreSPI.h */,
1D12CC4A2411BCAE00FDA0A3 /* FeatureFlagsSPI.h */,
diff --git a/Source/WebCore/PAL/pal/spi/cocoa/CoreServicesSPI.h b/Source/WebCore/PAL/pal/spi/cocoa/CoreServicesSPI.h
new file mode 100644
index 0000000..0c4c8dd
--- /dev/null
+++ b/Source/WebCore/PAL/pal/spi/cocoa/CoreServicesSPI.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#include <CarbonCore/RuntimePriv.h>
+
+#endif
+
+extern "C" void _CSCheckFixDisable();
diff --git a/Source/WebCore/PAL/pal/spi/cocoa/LaunchServicesSPI.h b/Source/WebCore/PAL/pal/spi/cocoa/LaunchServicesSPI.h
index 2ad0197..5b5bced 100644
--- a/Source/WebCore/PAL/pal/spi/cocoa/LaunchServicesSPI.h
+++ b/Source/WebCore/PAL/pal/spi/cocoa/LaunchServicesSPI.h
@@ -31,6 +31,7 @@
#if PLATFORM(MAC)
#import <CoreServices/CoreServicesPriv.h>
+#import <LaunchServices/LSApplicationServicesPriv.h>
#elif PLATFORM(IOS_FAMILY)
#import <MobileCoreServices/LSAppLinkPriv.h>
#elif PLATFORM(IOS)
@@ -103,6 +104,10 @@
OSStatus _RegisterApplication(CFDictionaryRef, ProcessSerialNumber*);
+typedef bool (^LSServerConnectionAllowedBlock) (CFDictionaryRef optionsRef);
+extern "C" void _LSSetApplicationLaunchServicesServerConnectionStatus(uint64_t flags, LSServerConnectionAllowedBlock block);
+extern "C" CFDictionaryRef _LSApplicationCheckIn(LSSessionID sessionID, CFDictionaryRef applicationInfo);
+
WTF_EXTERN_C_END
#endif // PLATFORM(MAC)
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog
index 80d21b6..5fc3d0f 100644
--- a/Source/WebKit/ChangeLog
+++ b/Source/WebKit/ChangeLog
@@ -1,3 +1,21 @@
+2020-04-02 Per Arne Vollan <pvollan@apple.com>
+
+ [macOS] Remove redundant call to check in with Launch Services
+ https://bugs.webkit.org/show_bug.cgi?id=209911
+
+ Reviewed by Darin Adler.
+
+ There is no need to explicitly check in with Launch Services or call RegisterApplication in the WebContent process,
+ since this is handled when calling [NSApplication _accessibilityInitialize].
+
+ No new tests, since this only removes a redundant call, and should be covered by existing tests.
+
+ * Shared/mac/AuxiliaryProcessMac.mm:
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::WebProcess::platformInitializeWebProcess):
+ (WebKit::WebProcess::updateProcessName):
+ (WebKit::WebProcess::platformInitializeProcess):
+
2020-04-02 Alex Christensen <achristensen@webkit.org>
Add SPI to restrict loading to main resources or non-network loads
diff --git a/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm b/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm
index 6010a95..90f03a5 100644
--- a/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm
+++ b/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm
@@ -41,6 +41,7 @@
#import <mach/mach.h>
#import <mach/task.h>
#import <pal/crypto/CryptoDigest.h>
+#import <pal/spi/cocoa/CoreServicesSPI.h>
#import <pal/spi/cocoa/LaunchServicesSPI.h>
#import <pwd.h>
#import <stdlib.h>
@@ -72,13 +73,6 @@
};
#endif
-typedef bool (^LSServerConnectionAllowedBlock) ( CFDictionaryRef optionsRef );
-extern "C" void _LSSetApplicationLaunchServicesServerConnectionStatus(uint64_t flags, LSServerConnectionAllowedBlock block);
-extern "C" CFDictionaryRef _LSApplicationCheckIn(LSSessionID sessionID, CFDictionaryRef applicationInfo);
-#if HAVE(CSCHECKFIXDISABLE)
-extern "C" void _CSCheckFixDisable();
-#endif
-
namespace WebKit {
using namespace WebCore;
diff --git a/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm b/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
index f22c025..4208b99 100644
--- a/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
+++ b/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
@@ -77,6 +77,7 @@
#import <pal/spi/cf/CFNetworkSPI.h>
#import <pal/spi/cf/CFUtilitiesSPI.h>
#import <pal/spi/cg/CoreGraphicsSPI.h>
+#import <pal/spi/cocoa/CoreServicesSPI.h>
#import <pal/spi/cocoa/LaunchServicesSPI.h>
#import <pal/spi/cocoa/NSAccessibilitySPI.h>
#import <pal/spi/cocoa/QuartzCoreSPI.h>
@@ -230,6 +231,8 @@
#if PLATFORM(MAC) && ENABLE(WEBPROCESS_NSRUNLOOP)
// Need to initialize accessibility for VoiceOver to work when the WebContent process is using NSRunLoop.
// Currently, it is also needed to allocate and initialize an NSApplication object.
+ // This method call will also call RegisterApplication, so there is no need for us to call this or
+ // check in with Launch Services
[NSApplication _accessibilityInitialize];
#endif
@@ -274,7 +277,6 @@
SandboxExtension::consumePermanently(parameters.dynamicMachExtensionHandles[i]);
#endif
-#if PLATFORM(COCOA)
if (parameters.neHelperExtensionHandle)
SandboxExtension::consumePermanently(*parameters.neHelperExtensionHandle);
if (parameters.neSessionManagerExtensionHandle)
@@ -285,18 +287,15 @@
if (parameters.mimeTypesMap)
overriddenMimeTypesMap() = WTFMove(parameters.mimeTypesMap);
-#endif
#if PLATFORM(IOS_FAMILY)
RenderThemeIOS::setCSSValueToSystemColorMap(WTFMove(parameters.cssValueToSystemColorMap));
RenderThemeIOS::setFocusRingColor(parameters.focusRingColor);
#endif
-#if PLATFORM(COCOA)
// FIXME(207716): The following should be removed when the GPU process is complete.
for (size_t i = 0, size = parameters.mediaExtensionHandles.size(); i < size; ++i)
SandboxExtension::consumePermanently(parameters.mediaExtensionHandles[i]);
-#endif
#if ENABLE(CFPREFS_DIRECT_MODE)
if (parameters.preferencesExtensionHandle) {
@@ -345,14 +344,6 @@
void WebProcess::updateProcessName()
{
#if PLATFORM(MAC)
- static std::once_flag onceFlag;
- std::call_once(
- onceFlag,
- [this] {
- // Checking in with Launch Services is necessary to be able to set the process' display name.
- launchServicesCheckIn();
- });
-
NSString *applicationName;
switch (m_processType) {
case ProcessType::Inspector:
@@ -546,6 +537,12 @@
#if HAVE(APP_SSO)
[NSURLSession _disableAppSSO];
#endif
+
+#if HAVE(CSCHECKFIXDISABLE)
+ // _CSCheckFixDisable() needs to be called before checking in with Launch Services. The WebContent process is checking in
+ // with Launch Services in WebProcess::platformInitializeWebProcess when calling +[NSApplication _accessibilityInitialize].
+ _CSCheckFixDisable();
+#endif
}
#if USE(APPKIT)