Changeset 264178 in webkit
- Timestamp:
- Jul 9, 2020, 10:06:14 AM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 added
- 21 edited
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/wtf/PlatformHave.h (modified) (1 diff)
-
WebCore/PAL/ChangeLog (modified) (1 diff)
-
WebCore/PAL/pal/spi/cocoa/LaunchServicesSPI.h (modified) (2 diffs)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/NetworkProcess/NetworkProcess.cpp (modified) (2 diffs)
-
WebKit/NetworkProcess/cocoa/LaunchServicesDatabaseObserver.h (added)
-
WebKit/NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm (added)
-
WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb (modified) (1 diff)
-
WebKit/Scripts/process-entitlements.sh (modified) (4 diffs)
-
WebKit/Shared/Cocoa/LaunchServicesDatabaseXPCConstants.h (added)
-
WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm (modified) (1 diff)
-
WebKit/SourcesCocoa.txt (modified) (1 diff)
-
WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (modified) (1 diff)
-
WebKit/UIProcess/Cocoa/XPCEventHandler.h (added)
-
WebKit/UIProcess/Launcher/ProcessLauncher.h (modified) (2 diffs)
-
WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm (modified) (1 diff)
-
WebKit/UIProcess/Network/NetworkProcessProxy.h (modified) (3 diffs)
-
WebKit/UIProcess/Network/NetworkProcessProxyCocoa.mm (added)
-
WebKit/UIProcess/WebProcessPool.h (modified) (3 diffs)
-
WebKit/UIProcess/WebProcessProxy.cpp (modified) (1 diff)
-
WebKit/WebKit.xcodeproj/project.pbxproj (modified) (11 diffs)
-
WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (modified) (2 diffs)
-
WebKit/WebProcess/WebProcess.cpp (modified) (1 diff)
-
WebKit/WebProcess/WebProcess.h (modified) (1 diff)
-
WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.h (added)
-
WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.mm (added)
-
WebKit/WebProcess/cocoa/WebProcessCocoa.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r264167 r264178 1 2020-07-09 Per Arne Vollan <pvollan@apple.com> 2 3 [Cocoa] Update Launch Services database in the WebContent process from the Network process 4 https://bugs.webkit.org/show_bug.cgi?id=213794 5 6 Reviewed by Brent Fulgham. 7 8 Added HAVE define for determining if the class LSDatabaseContext is present. 9 10 * wtf/PlatformHave.h: 11 1 12 2020-07-09 Commit Queue <commit-queue@webkit.org> 2 13 -
trunk/Source/WTF/wtf/PlatformHave.h
r264167 r264178 673 673 #define HAVE_APP_ACCENT_COLORS 1 674 674 #endif 675 676 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101600) \ 677 || ((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000) \ 678 || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 70000) \ 679 || (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 140000) 680 #define HAVE_LSDATABASECONTEXT 1 681 #endif -
trunk/Source/WebCore/PAL/ChangeLog
r264167 r264178 1 2020-07-09 Per Arne Vollan <pvollan@apple.com> 2 3 [Cocoa] Update Launch Services database in the WebContent process from the Network process 4 https://bugs.webkit.org/show_bug.cgi?id=213794 5 6 Reviewed by Brent Fulgham. 7 8 Declare interface for observing and consuming the Launch Services database. 9 10 * pal/spi/cocoa/LaunchServicesSPI.h: 11 1 12 2020-07-09 Commit Queue <commit-queue@webkit.org> 2 13 -
trunk/Source/WebCore/PAL/pal/spi/cocoa/LaunchServicesSPI.h
r264167 r264178 26 26 #import <Foundation/Foundation.h> 27 27 28 #include <wtf/spi/darwin/XPCSPI.h> 29 28 30 #if USE(APPLE_INTERNAL_SDK) 29 30 #if PLATFORM(MAC)31 31 #import <CoreServices/CoreServicesPriv.h> 32 #elif PLATFORM(IOS_FAMILY)33 #import <MobileCoreServices/LSAppLinkPriv.h>34 #elif PLATFORM(IOS)35 #import <MobileCoreServices/MobileCoreServicesPriv.h>36 #endif37 38 32 #endif // USE(APPLE_INTERNAL_SDK) 39 33 … … 84 78 #endif 85 79 80 #if HAVE(LSDATABASECONTEXT) 81 @interface LSDatabaseContext : NSObject 82 @property (class, readonly) LSDatabaseContext *sharedDatabaseContext; 83 @end 84 #endif 85 86 86 #endif // !USE(APPLE_INTERNAL_SDK) 87 87 88 @interface _LSDService : NSObject <NSXPCListenerDelegate> 89 + (NSXPCConnection *)XPCConnectionToService; 88 #if HAVE(LSDATABASECONTEXT) 89 @interface LSDatabaseContext (WebKitChangeTracking) 90 - (id <NSObject>)addDatabaseChangeObserver4WebKit:(void (^)(xpc_object_t change))observer; 91 - (void)removeDatabaseChangeObserver4WebKit:(id <NSObject>)token; 92 - (void)observeDatabaseChange4WebKit:(xpc_object_t)change; 90 93 @end 91 92 @interface _LSDReadService : _LSDService 93 @end 94 #endif 94 95 95 96 #if PLATFORM(MAC) -
trunk/Source/WebKit/ChangeLog
r264177 r264178 1 2020-07-09 Per Arne Vollan <pvollan@apple.com> 2 3 [Cocoa] Update Launch Services database in the WebContent process from the Network process 4 https://bugs.webkit.org/show_bug.cgi?id=213794 5 6 Reviewed by Brent Fulgham. 7 8 To be able to deny mach lookup access to the Launch Services database mapping service in the WebContent process, the database needs to be 9 sent from the Networking process to the WebContent process, represented by an xpc object. The Networking process is chosen instead of the UI 10 process, since WebKit is controlling the sandbox of the Networking process. There is already a direct connection between the Networking 11 process and the WebContent process, but this is a CoreIPC connection. Since the database is represented by an xpc object, an xpc connection 12 is requiered to transfer the database. This patch creates a direct xpc connection between the Networking process and the WebContent process, 13 by creating an xpc endpoint in the Networking process, sending this to the UI process over the bootstrap xpc connection, and then providing 14 each WebContent process with this endpoint by sending it over the bootstrap xpc connection between the UI process and the WebContent process. 15 This endpoint has to be sent via the xpc connections to the UI process, since the already existing direct connection between the Networking 16 process and the WebContent process is a lower level CoreIPC connection, which does not support transferring xpc objects like the xpc endpoint. 17 When the WebContent process receives the endpoint, it will create an xpc connection from the endpoint, which will create a direct connection 18 with the Networking process. A message is then sent over the connection to request the database xpc object. When the Networking process 19 receives this message, it checks the entitlement of the remote end to make sure it is communicating with a WebContent process, and then sends 20 the database if the entitlement check succeeds. When the WebContent process receives this message, it performs an entitlement check as well, 21 and if successful, the database object is consumed. Consuming this database object, will make sure UTI to MIME type mapping is working 22 correctly in the WebContent process. 23 24 For the UI process to be able to pick up xpc messages on the bootstrap connection, a new virtual method, handleXPCEvent, is added to the 25 ProcessLauncher Client class. This way, a ProcessLauncher client will be able to pick up xpc messages from the xpc bootstrap connection. 26 Previously the event handler for the bootstrap connection in the UI process would handle only xpc error messages. It has now been expanded 27 to handle normal messages, which are being forwarded to the ProcessLauncher client. In this case the client is the Network process proxy, 28 which will check the message received, and if it turns out to be a message containing an xpc endpoint, the message will be forwarded to 29 all Web processes. The ProcessLauncher client can be expanded to handle any xpc message, but right not the Network process proxy only 30 handles the xpc endpoint message. The handleXPCEvent virtual method return a RefPtr to an XPCEventHandler, which is captured in the event 31 handler of the bootstrap xpc connection. 32 33 No new tests, since there already exist tests for this. UTI to MIME type mapping is being used in WebKit and underlying framework, and many 34 tests would fail if this mapping was not working. 35 36 * NetworkProcess/NetworkProcess.cpp: 37 (WebKit::NetworkProcess::initializeConnection): 38 * NetworkProcess/cocoa/LaunchServicesDatabaseObserver.h: Added. 39 * NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm: Added. 40 (WebKit::LaunchServicesDatabaseObserver::singleton): 41 (WebKit::LaunchServicesDatabaseObserver::LaunchServicesDatabaseObserver): 42 (WebKit::LaunchServicesDatabaseObserver::startObserving): 43 (WebKit::LaunchServicesDatabaseObserver::~LaunchServicesDatabaseObserver): 44 (WebKit::LaunchServicesDatabaseObserver::xpcEndpointMessageNameKey const): 45 (WebKit::LaunchServicesDatabaseObserver::xpcEndpointMessageName const): 46 (WebKit::LaunchServicesDatabaseObserver::xpcEndpointNameKey const): 47 (WebKit::LaunchServicesDatabaseObserver::handleEvent): 48 * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 49 * Scripts/process-entitlements.sh: 50 * Shared/Cocoa/LaunchServicesDatabaseXPCConstants.h: Added. 51 * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: 52 * SourcesCocoa.txt: 53 * UIProcess/Cocoa/WebProcessPoolCocoa.mm: 54 (WebKit::WebProcessPool::xpcEndpointMessage const): 55 (WebKit::WebProcessPool::sendNetworkProcessXPCEndpointToWebProcess): 56 * UIProcess/Cocoa/XPCEventHandler.h: Added. 57 (WebKit::XPCEventHandler::~XPCEventHandler): 58 * UIProcess/Launcher/ProcessLauncher.h: 59 (WebKit::ProcessLauncher::Client::xpcEventHandler const): 60 * UIProcess/Launcher/mac/ProcessLauncherMac.mm: 61 (WebKit::ProcessLauncher::launchProcess): 62 * UIProcess/Network/NetworkProcessProxy.h: 63 * UIProcess/Network/NetworkProcessProxyCocoa.mm: Added. 64 (WebKit::NetworkProcessProxy::xpcEventHandler const): 65 (WebKit::NetworkProcessProxy::XPCEventHandler::handleXPCEvent const): 66 (WebKit::NetworkProcessProxy::XPCEventHandler::XPCEventHandler): 67 (WebKit::NetworkProcessProxy::XPCEventHandler::~XPCEventHandler): 68 * UIProcess/WebProcessPool.h: 69 * UIProcess/WebProcessProxy.cpp: 70 (WebKit::WebProcessProxy::didFinishLaunching): 71 * WebKit.xcodeproj/project.pbxproj: 72 * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: 73 (WebKit::WebPage::platformDidReceiveLoadParameters): 74 * WebProcess/WebProcess.cpp: 75 (WebKit::WebProcess::initializeConnection): 76 * WebProcess/WebProcess.h: 77 * WebProcess/cocoa/LaunchServicesDatabaseManager.h: Added. 78 * WebProcess/cocoa/LaunchServicesDatabaseManager.mm: Added. 79 (WebKit::LaunchServicesDatabaseManager::singleton): 80 (WebKit::LaunchServicesDatabaseManager::handleEvent): 81 (WebKit::LaunchServicesDatabaseManager::didConnect): 82 (WebKit::LaunchServicesDatabaseManager::waitForDatabaseUpdate): 83 * WebProcess/cocoa/WebProcessCocoa.mm: 84 (WebKit::WebProcess::handleXPCEndpointMessages const): 85 (WebKit::WebProcess::platformInitializeWebProcess): 86 1 87 2020-07-09 Eric Carlson <eric.carlson@apple.com> 2 88 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r264167 r264178 98 98 99 99 #if PLATFORM(COCOA) 100 #include "LaunchServicesDatabaseObserver.h" 100 101 #include "NetworkSessionCocoa.h" 101 102 #endif … … 163 164 #if ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER) 164 165 addSupplement<LegacyCustomProtocolManager>(); 166 #endif 167 #if PLATFORM(COCOA) 168 addSupplement<LaunchServicesDatabaseObserver>(); 165 169 #endif 166 170 #if PLATFORM(COCOA) && ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER) -
trunk/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb
r264167 r264178 589 589 (ipc-posix-name-prefix "apple.cfprefs.")) 590 590 591 ( allowmach-lookup591 (deny mach-lookup 592 592 (global-name "com.apple.lsd.mapdb")) 593 593 -
trunk/Source/WebKit/Scripts/process-entitlements.sh
r264167 r264178 16 16 if [[ "${WK_USE_RESTRICTED_ENTITLEMENTS}" == YES ]] 17 17 then 18 plistbuddy Add :com.apple.private.webkit.use-xpc-endpoint bool YES 18 19 plistbuddy Add :com.apple.rootless.storage.WebKitWebContentSandbox bool YES 19 20 fi … … 52 53 fi 53 54 55 plistbuddy Add :com.apple.private.webkit.use-xpc-endpoint bool YES 54 56 plistbuddy Add :com.apple.rootless.storage.WebKitNetworkingSandbox bool YES 55 57 fi … … 145 147 plistbuddy Add :com.apple.private.webinspector.allow-remote-inspection bool YES 146 148 plistbuddy Add :com.apple.private.webinspector.proxy-application bool YES 149 plistbuddy Add :com.apple.private.webkit.use-xpc-endpoint bool YES 147 150 plistbuddy Add :com.apple.runningboard.assertions.webkit bool YES 148 151 plistbuddy Add :dynamic-codesigning bool YES … … 185 188 plistbuddy Add :com.apple.private.memorystatus bool YES 186 189 plistbuddy Add :com.apple.private.network.socket-delegate bool YES 190 plistbuddy Add :com.apple.private.webkit.use-xpc-endpoint bool YES 187 191 plistbuddy Add :com.apple.runningboard.assertions.webkit bool YES 188 192 -
trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm
r264167 r264178 30 30 #import <CoreFoundation/CoreFoundation.h> 31 31 #import <pal/spi/cf/CFUtilitiesSPI.h> 32 #import <pal/spi/cocoa/LaunchServicesSPI.h> 32 33 #import <wtf/OSObjectPtr.h> 33 34 #import <wtf/RetainPtr.h> -
trunk/Source/WebKit/SourcesCocoa.txt
r264167 r264178 416 416 UIProcess/Inspector/mac/WKInspectorWKWebView.mm 417 417 418 UIProcess/Network/NetworkProcessProxyCocoa.mm 419 418 420 UIProcess/ios/forms/WKAirPlayRoutePicker.mm 419 421 UIProcess/ios/forms/WKDatePickerViewController.mm -
trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
r264167 r264178 935 935 #endif 936 936 937 OSObjectPtr<xpc_object_t> WebProcessPool::xpcEndpointMessage() const 938 { 939 return m_endpointMessage; 940 } 941 942 void WebProcessPool::sendNetworkProcessXPCEndpointToWebProcess(OSObjectPtr<xpc_object_t> endpointMessage) 943 { 944 m_endpointMessage = endpointMessage; 945 946 for (auto process : m_processes) { 947 if (process->state() != AuxiliaryProcessProxy::State::Running) 948 continue; 949 if (!process->connection()) 950 continue; 951 auto connection = process->connection()->xpcConnection(); 952 xpc_connection_send_message(connection, endpointMessage.get()); 953 } 954 } 955 937 956 } // namespace WebKit -
trunk/Source/WebKit/UIProcess/Launcher/ProcessLauncher.h
r264167 r264178 40 40 #endif 41 41 42 #if PLATFORM(COCOA) 43 #include "XPCEventHandler.h" 44 #endif 45 42 46 namespace WebKit { 43 47 … … 58 62 virtual bool shouldConfigureJSCForTesting() const { return false; } 59 63 virtual bool isJITEnabled() const { return true; } 64 #if PLATFORM(COCOA) 65 virtual RefPtr<XPCEventHandler> xpcEventHandler() const { return nullptr; } 66 #endif 60 67 }; 61 68 -
trunk/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm
r264167 r264178 239 239 }; 240 240 241 auto errorHandler = [errorHandlerImpl = WTFMove(errorHandlerImpl)] (xpc_object_t event) mutable { 242 RunLoop::main().dispatch([errorHandlerImpl = WTFMove(errorHandlerImpl), event] { 243 errorHandlerImpl(event); 244 }); 241 auto eventHandler = [errorHandlerImpl = WTFMove(errorHandlerImpl), eventHandler = m_client->xpcEventHandler()] (xpc_object_t event) mutable { 242 243 if (!event || xpc_get_type(event) == XPC_TYPE_ERROR) { 244 RunLoop::main().dispatch([errorHandlerImpl = WTFMove(errorHandlerImpl), event = OSObjectPtr(event)] { 245 errorHandlerImpl(event.get()); 246 }); 247 return; 248 } 249 250 if (eventHandler) { 251 RunLoop::main().dispatch([eventHandler = eventHandler, event = OSObjectPtr(event)] { 252 eventHandler->handleXPCEvent(event.get()); 253 }); 254 } 245 255 }; 246 256 247 xpc_connection_set_event_handler(m_xpcConnection.get(), e rrorHandler);257 xpc_connection_set_event_handler(m_xpcConnection.get(), eventHandler); 248 258 249 259 xpc_connection_resume(m_xpcConnection.get()); 250 260 251 261 if (UNLIKELY(m_launchOptions.shouldMakeProcessLaunchFailForTesting)) { 252 e rrorHandler(nullptr);262 eventHandler(nullptr); 253 263 return; 254 264 } -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
r264167 r264178 43 43 #if ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER) 44 44 #include "LegacyCustomProtocolManagerProxy.h" 45 #endif 46 47 #if PLATFORM(COCOA) 48 #include "XPCEventHandler.h" 45 49 #endif 46 50 … … 298 302 // ProcessLauncher::Client 299 303 void didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier) override; 304 #if PLATFORM(COCOA) 305 RefPtr<XPCEventHandler> xpcEventHandler() const override; 306 #endif 300 307 301 308 void processAuthenticationChallenge(PAL::SessionID, Ref<AuthenticationChallengeProxy>&&); … … 328 335 }; 329 336 Optional<UploadActivity> m_uploadActivity; 337 338 #if PLATFORM(COCOA) 339 class XPCEventHandler : public WebKit::XPCEventHandler { 340 public: 341 XPCEventHandler(const NetworkProcessProxy&); 342 343 bool handleXPCEvent(xpc_object_t) const override; 344 345 private: 346 WeakPtr<NetworkProcessProxy> m_networkProcess; 347 }; 348 #endif 330 349 }; 331 350 -
trunk/Source/WebKit/UIProcess/WebProcessPool.h
r264167 r264178 390 390 // Network Process Management 391 391 NetworkProcessProxy& ensureNetworkProcess(WebsiteDataStore* withWebsiteDataStore = nullptr); 392 NetworkProcessProxy* networkProcess() { return m_networkProcess.get(); }392 NetworkProcessProxy* networkProcess() const { return m_networkProcess.get(); } 393 393 void networkProcessCrashed(NetworkProcessProxy&); 394 394 … … 542 542 #endif 543 543 544 #if PLATFORM(COCOA) 545 OSObjectPtr<xpc_object_t> xpcEndpointMessage() const; 546 void sendNetworkProcessXPCEndpointToWebProcess(OSObjectPtr<xpc_object_t> endpointMessage); 547 #endif 548 544 549 private: 545 550 void platformInitialize(); … … 825 830 #if ENABLE(RESOURCE_LOAD_STATISTICS) 826 831 HashSet<WebCore::RegistrableDomain> m_domainsWithUserInteraction; 832 #endif 833 834 #if PLATFORM(COCOA) 835 OSObjectPtr<xpc_object_t> m_endpointMessage; 827 836 #endif 828 837 }; -
trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp
r264167 r264178 954 954 } 955 955 956 #if PLATFORM(COCOA) 957 auto endpointMessage = processPool().xpcEndpointMessage(); 958 if (endpointMessage) 959 xpc_connection_send_message(connection()->xpcConnection(), endpointMessage.get()); 960 #endif 961 956 962 RELEASE_ASSERT(!m_webConnection); 957 963 m_webConnection = WebConnectionToWebProcess::create(this); -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r264167 r264178 1685 1685 C11E1694212B87C500985FF6 /* WKMockDisplay.h in Headers */ = {isa = PBXBuildFile; fileRef = C11E1692212B87C500985FF6 /* WKMockDisplay.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1686 1686 C149380922347104000CD707 /* WebSpeechSynthesisClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C149380222341C60000CD707 /* WebSpeechSynthesisClient.h */; }; 1687 C14D37FE24ACE086007FF014 /* LaunchServicesDatabaseManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = C14D37FD24ACE086007FF014 /* LaunchServicesDatabaseManager.mm */; }; 1687 1688 C15CBB3623F3777100300CC7 /* PreferenceObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = C145CC0E23DCA427003A5EEB /* PreferenceObserver.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1688 1689 C15CBB3723F37ECB00300CC7 /* PreferenceObserver.mm in Sources */ = {isa = PBXBuildFile; fileRef = C15CBB3323F34C3800300CC7 /* PreferenceObserver.mm */; }; 1690 C1663E5B24AEAA2F00C6A3B2 /* LaunchServicesDatabaseXPCConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = C1663E5A24AEA74200C6A3B2 /* LaunchServicesDatabaseXPCConstants.h */; }; 1691 C1710CF724AA643200D7C112 /* LaunchServicesDatabaseObserver.mm in Sources */ = {isa = PBXBuildFile; fileRef = C1710CF624AA643200D7C112 /* LaunchServicesDatabaseObserver.mm */; }; 1689 1692 C18173612058424700DFDA65 /* DisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = C18173602058424700DFDA65 /* DisplayLink.h */; }; 1690 1693 C1E123BA20A11573002646F4 /* PDFContextMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = C1E123B920A11572002646F4 /* PDFContextMenu.h */; }; … … 5019 5022 C149380322341DF7000CD707 /* WebSpeechSynthesisClient.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebSpeechSynthesisClient.cpp; sourceTree = "<group>"; }; 5020 5023 C149380A223853BE000CD707 /* WebSpeechSynthesisVoice.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebSpeechSynthesisVoice.h; sourceTree = "<group>"; }; 5024 C14D37FC24ACDF45007FF014 /* LaunchServicesDatabaseManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LaunchServicesDatabaseManager.h; sourceTree = "<group>"; }; 5025 C14D37FD24ACE086007FF014 /* LaunchServicesDatabaseManager.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = LaunchServicesDatabaseManager.mm; sourceTree = "<group>"; }; 5021 5026 C15CBB3323F34C3800300CC7 /* PreferenceObserver.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PreferenceObserver.mm; sourceTree = "<group>"; }; 5027 C1663E5A24AEA74200C6A3B2 /* LaunchServicesDatabaseXPCConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LaunchServicesDatabaseXPCConstants.h; sourceTree = "<group>"; }; 5028 C1710CF224A7BD0300D7C112 /* XPCEventHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPCEventHandler.h; sourceTree = "<group>"; }; 5029 C1710CF524AA634500D7C112 /* LaunchServicesDatabaseObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LaunchServicesDatabaseObserver.h; sourceTree = "<group>"; }; 5030 C1710CF624AA643200D7C112 /* LaunchServicesDatabaseObserver.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = LaunchServicesDatabaseObserver.mm; sourceTree = "<group>"; }; 5022 5031 C181735E205839F600DFDA65 /* DrawingAreaMac.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DrawingAreaMac.cpp; sourceTree = "<group>"; }; 5023 5032 C18173602058424700DFDA65 /* DisplayLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayLink.h; sourceTree = "<group>"; }; … … 5026 5035 C18FB51E242F9F77007E9875 /* WebSleepDisablerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSleepDisablerClient.h; sourceTree = "<group>"; }; 5027 5036 C1E123B920A11572002646F4 /* PDFContextMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PDFContextMenu.h; sourceTree = "<group>"; }; 5037 C1ED723724A5690E003F6CD3 /* NetworkProcessProxyCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkProcessProxyCocoa.mm; sourceTree = "<group>"; }; 5028 5038 C517388012DF8F4F00EE3F47 /* DragControllerAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragControllerAction.h; sourceTree = "<group>"; }; 5029 5039 C5237F5F12441CA300780472 /* WebEditorClientMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebEditorClientMac.mm; sourceTree = "<group>"; }; … … 6385 6395 2DC6D9C118C44A610043BAD4 /* WKWebViewContentProviderRegistry.h */, 6386 6396 2DC6D9C218C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm */, 6397 C1710CF224A7BD0300D7C112 /* XPCEventHandler.h */, 6387 6398 ); 6388 6399 path = Cocoa; … … 7482 7493 CE550E132283744400D28791 /* InsertTextOptions.cpp */, 7483 7494 CE550E12228373C800D28791 /* InsertTextOptions.h */, 7495 C1663E5A24AEA74200C6A3B2 /* LaunchServicesDatabaseXPCConstants.h */, 7484 7496 2D1087621D2C641B00B85F82 /* LoadParametersCocoa.mm */, 7485 7497 CD2865EC2255562000606AC7 /* ProcessTaskStateObserver.h */, … … 7845 7857 isa = PBXGroup; 7846 7858 children = ( 7859 C1ED723624A568F5003F6CD3 /* cocoa */, 7847 7860 29AD3091164B4C100072DEA9 /* CustomProtocols */, 7848 7861 516319931628980E00E22F00 /* mac */, … … 8375 8388 CD4570CB2440FB2A00A3DCEB /* AudioSessionRoutingArbitrator.cpp */, 8376 8389 CD4570CA2440FB2A00A3DCEB /* AudioSessionRoutingArbitrator.h */, 8390 C14D37FC24ACDF45007FF014 /* LaunchServicesDatabaseManager.h */, 8391 C14D37FD24ACE086007FF014 /* LaunchServicesDatabaseManager.mm */, 8377 8392 446DC64B24A2D8AD0061F390 /* PlaybackSessionContextIdentifier.h */, 8378 8393 CDA29A191CBDBF4100901CCF /* PlaybackSessionManager.h */, … … 8426 8441 2D0C56FB229F1DEA00BD33E7 /* DeviceManagementSoftLink.h */, 8427 8442 2D0C56FC229F1DEA00BD33E7 /* DeviceManagementSoftLink.mm */, 8443 C1710CF524AA634500D7C112 /* LaunchServicesDatabaseObserver.h */, 8444 C1710CF624AA643200D7C112 /* LaunchServicesDatabaseObserver.mm */, 8428 8445 5315876B2076B713004BF9F3 /* NetworkActivityTrackerCocoa.mm */, 8429 8446 5321594F1DBAE6D70054AA3C /* NetworkDataTaskCocoa.h */, … … 10252 10269 tabWidth = 8; 10253 10270 usesTabs = 0; 10271 }; 10272 C1ED723624A568F5003F6CD3 /* cocoa */ = { 10273 isa = PBXGroup; 10274 children = ( 10275 C1ED723724A5690E003F6CD3 /* NetworkProcessProxyCocoa.mm */, 10276 ); 10277 name = cocoa; 10278 sourceTree = "<group>"; 10254 10279 }; 10255 10280 C54256AE18BEC16100DE4179 /* forms */ = { … … 10859 10884 1AE49A4911FFA8CE0048B464 /* JSNPMethod.h in Headers */, 10860 10885 1AE4987811FF7FAA0048B464 /* JSNPObject.h in Headers */, 10886 C1663E5B24AEAA2F00C6A3B2 /* LaunchServicesDatabaseXPCConstants.h in Headers */, 10861 10887 BCE0937814FB128C001138D9 /* LayerHostingContext.h in Headers */, 10862 10888 1A92DC1112F8BA460017AF65 /* LayerTreeContext.h in Headers */, … … 12727 12753 2D913441212CF9F000128AFD /* JSNPMethod.cpp in Sources */, 12728 12754 2D913442212CF9F000128AFD /* JSNPObject.cpp in Sources */, 12755 C14D37FE24ACE086007FF014 /* LaunchServicesDatabaseManager.mm in Sources */, 12756 C1710CF724AA643200D7C112 /* LaunchServicesDatabaseObserver.mm in Sources */, 12729 12757 2984F588164BA095004BC0C6 /* LegacyCustomProtocolManagerMessageReceiver.cpp in Sources */, 12730 12758 2984F57C164B915F004BC0C6 /* LegacyCustomProtocolManagerProxyMessageReceiver.cpp in Sources */, -
trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
r264167 r264178 28 28 29 29 #import "InsertTextOptions.h" 30 #import "LaunchServicesDatabaseManager.h" 30 31 #import "LoadParameters.h" 31 32 #import "PluginView.h" … … 63 64 void WebPage::platformDidReceiveLoadParameters(const LoadParameters& parameters) 64 65 { 66 bool databaseUpdated = LaunchServicesDatabaseManager::singleton().waitForDatabaseUpdate(5_s); 67 ASSERT_UNUSED(databaseUpdated, databaseUpdated); 68 65 69 m_dataDetectionContext = parameters.dataDetectionContext; 66 70 -
trunk/Source/WebKit/WebProcess/WebProcess.cpp
r264167 r264178 291 291 AuxiliaryProcess::initializeConnection(connection); 292 292 293 #if PLATFORM(COCOA) 294 handleXPCEndpointMessages(); 295 #endif 296 293 297 // We call _exit() directly from the background queue in case the main thread is unresponsive 294 298 // and AuxiliaryProcess::didClose() does not get called. -
trunk/Source/WebKit/WebProcess/WebProcess.h
r264167 r264178 516 516 bool isAlwaysOnLoggingAllowed() { return m_sessionID ? m_sessionID->isAlwaysOnLoggingAllowed() : true; } 517 517 518 #if PLATFORM(COCOA) 519 void handleXPCEndpointMessages() const; 520 #endif 521 518 522 RefPtr<WebConnectionToUIProcess> m_webConnection; 519 523 -
trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
r264167 r264178 28 28 #import "WebProcessCocoa.h" 29 29 30 #import "LaunchServicesDatabaseManager.h" 31 #import "LaunchServicesDatabaseXPCConstants.h" 30 32 #import "LegacyCustomProtocolManager.h" 31 33 #import "LogInitialization.h" … … 70 72 #import <WebCore/SystemBattery.h> 71 73 #import <WebCore/UTIUtilities.h> 74 #import <WebCore/XPCEndpoint.h> 72 75 #import <algorithm> 73 76 #import <dispatch/dispatch.h> … … 162 165 #endif 163 166 167 void WebProcess::handleXPCEndpointMessages() const 168 { 169 if (!parentProcessConnection()) 170 return; 171 172 auto connection = parentProcessConnection()->xpcConnection(); 173 174 xpc_connection_set_target_queue(connection, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)); 175 xpc_connection_set_event_handler(connection, ^(xpc_object_t event) { 176 if (xpc_get_type(event) != XPC_TYPE_DICTIONARY) 177 return; 178 179 String messageName = xpc_dictionary_get_string(event, XPCEndpoint::xpcMessageNameKey); 180 if (messageName.isEmpty()) 181 return; 182 183 if (messageName == LaunchServicesDatabaseXPCConstants::xpcLaunchServicesDatabaseXPCEndpointMessageName) { 184 auto endpoint = xpc_dictionary_get_value(event, LaunchServicesDatabaseXPCConstants::xpcLaunchServicesDatabaseXPCEndpointNameKey); 185 LaunchServicesDatabaseManager::singleton().setEndpoint(endpoint); 186 return; 187 } 188 }); 189 } 190 164 191 void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters& parameters) 165 192 { 166 // Map Launch Services database. This should be done as early as possible, as the mapping will fail 167 // if 'com.apple.lsd.mapdb' is being accessed before this. 168 if (parameters.mapDBExtensionHandle) { 169 auto extension = SandboxExtension::create(WTFMove(*parameters.mapDBExtensionHandle)); 170 bool ok = extension->consume(); 171 ASSERT_UNUSED(ok, ok); 172 // Perform API calls which will communicate with the database mapping service, and map the database. 173 auto uti = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, CFSTR("text/html"), 0)); 174 175 [[objc_getClass("_LSDReadService") XPCConnectionToService] invalidate]; 176 177 ok = extension->revoke(); 178 ASSERT_UNUSED(ok, ok); 179 180 ASSERT(String(uti.get()) == String(adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, CFSTR("text/html"), 0)).get())); 181 } 182 193 #if HAVE(LSDATABASECONTEXT) 194 // FIXME: Remove this entire section when the selector observeDatabaseChange4WebKit is present 195 auto context = [NSClassFromString(@"LSDatabaseContext") sharedDatabaseContext]; 196 if (![context respondsToSelector:@selector(observeDatabaseChange4WebKit:)]) { 197 // Map Launch Services database. This should be done as early as possible, as the mapping will fail 198 // if 'com.apple.lsd.mapdb' is being accessed before this. 199 if (parameters.mapDBExtensionHandle) { 200 auto extension = SandboxExtension::create(WTFMove(*parameters.mapDBExtensionHandle)); 201 bool ok = extension->consume(); 202 ASSERT_UNUSED(ok, ok); 203 // Perform API calls which will communicate with the database mapping service, and map the database. 204 auto uti = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, CFSTR("text/html"), 0)); 205 ok = extension->revoke(); 206 ASSERT_UNUSED(ok, ok); 207 ASSERT(String(uti.get()) == String(adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, CFSTR("text/html"), 0)).get())); 208 } 209 } 210 #endif 183 211 #if !LOG_DISABLED || !RELEASE_LOG_DISABLED 184 212 WebCore::initializeLogChannelsIfNecessary(parameters.webCoreLoggingChannels);
Note:
See TracChangeset
for help on using the changeset viewer.