WebKit Bugzilla
Attachment 362771 Details for
Bug 194427
: Add SPI to use networking daemon instead of XPC service
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194427-20190222153304.patch (text/plain), 17.20 KB, created by
Alex Christensen
on 2019-02-22 15:33:05 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2019-02-22 15:33:05 PST
Size:
17.20 KB
patch
obsolete
>Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 241966) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,36 @@ >+2019-02-22 Alex Christensen <achristensen@webkit.org> >+ >+ Revert r241223, r241235, and r241287 >+ https://bugs.webkit.org/show_bug.cgi?id=194427 >+ <rdar://48045861> >+ >+ This caused crashes, and feature design has evolved away from needing the daemon in this form. >+ >+ * NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm: >+ (WebKit::DaemonMain): >+ * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h: >+ * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: >+ (WebKit::XPCServiceEventHandler): >+ (WebKit::XPCServiceMain): >+ (WebKit::XPCEventHandler): Deleted. >+ (WebKit::XPCInitializationHandler): Deleted. >+ * UIProcess/API/APIProcessPoolConfiguration.h: >+ * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: >+ * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: >+ (-[_WKProcessPoolConfiguration usesNetworkingDaemon]): Deleted. >+ (-[_WKProcessPoolConfiguration setUsesNetworkingDaemon:]): Deleted. >+ * UIProcess/AuxiliaryProcessProxy.cpp: >+ (WebKit::AuxiliaryProcessProxy::getLaunchOptions): >+ * UIProcess/Launcher/ProcessLauncher.h: >+ * UIProcess/Launcher/mac/ProcessLauncherMac.mm: >+ (WebKit::serviceName): >+ (WebKit::ProcessLauncher::launchProcess): >+ * UIProcess/Network/NetworkProcessProxy.cpp: >+ (WebKit::NetworkProcessProxy::getLaunchOptions): >+ * UIProcess/WebProcessPool.cpp: >+ (WebKit::WebProcessPool::usesNetworkingDaemon const): Deleted. >+ * UIProcess/WebProcessPool.h: >+ > 2019-02-22 Chris Dumez <cdumez@apple.com> > > Regression(PSON) Unable to preview password-protected documents on iCloud.com >Index: Source/WebKit/NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm >=================================================================== >--- Source/WebKit/NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm (revision 241962) >+++ Source/WebKit/NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm (working copy) >@@ -26,33 +26,11 @@ > #import "config.h" > #import "DaemonEntryPoint.h" > >-#import "XPCServiceEntryPoint.h" >-#import <wtf/spi/darwin/XPCSPI.h> >- > namespace WebKit { > >-int DaemonMain(int argc, const char** argv) >+int DaemonMain(int, const char**) > { >- if (argc < 2 || strcmp(argv[1], "WebKitNetworkingDaemon")) { >- WTFLogAlways("Unexpected daemon parameters"); >- return EXIT_FAILURE; >- } >- >- xpc_connection_t listener = xpc_connection_create_mach_service("com.apple.WebKit.NetworkingDaemon", dispatch_get_main_queue(), XPC_CONNECTION_MACH_SERVICE_LISTENER); >- >- xpc_connection_set_event_handler(listener, ^(xpc_object_t peer) { >- if (!peer || xpc_get_type(peer) != XPC_TYPE_CONNECTION) { >- WTFLogAlways("Unexpected XPC object"); >- return; >- } >- >- XPCEventHandler(peer, AuxiliaryProcessType::Daemon); >- }); >- >- xpc_connection_resume(listener); >- CFRunLoopRun(); >- >- return EXIT_SUCCESS; >+ return 0; > } > > } >Index: Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h >=================================================================== >--- Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h (revision 241962) >+++ Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h (working copy) >@@ -130,9 +130,6 @@ ALLOW_DEPRECATED_DECLARATIONS_END > > int XPCServiceMain(int, const char**); > >-enum class AuxiliaryProcessType { Daemon, XPCService }; >-void XPCEventHandler(xpc_connection_t, AuxiliaryProcessType); >- > void XPCServiceExit(OSObjectPtr<xpc_object_t>&& priorityBoostMessage); > > } // namespace WebKit >Index: Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm >=================================================================== >--- Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm (revision 241962) >+++ Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm (working copy) >@@ -38,9 +38,7 @@ > > namespace WebKit { > >-void XPCInitializationHandler(xpc_object_t); >- >-void XPCEventHandler(xpc_connection_t peer, AuxiliaryProcessType processType) >+static void XPCServiceEventHandler(xpc_connection_t peer) > { > static xpc_object_t priorityBoostMessage = nullptr; > >@@ -49,19 +47,13 @@ void XPCEventHandler(xpc_connection_t pe > xpc_type_t type = xpc_get_type(event); > if (type == XPC_TYPE_ERROR) { > if (event == XPC_ERROR_CONNECTION_INVALID || event == XPC_ERROR_TERMINATION_IMMINENT) { >- if (processType == AuxiliaryProcessType::XPCService) { >- // FIXME: Handle this case more gracefully. >- exit(EXIT_FAILURE); >- } else { >- // FIXME: Deref the NetworkProcess object associated with this xpc connection >- // once we have a container for such objects. >- } >+ // FIXME: Handle this case more gracefully. >+ exit(EXIT_FAILURE); > } > } else { > assert(type == XPC_TYPE_DICTIONARY); > > if (!strcmp(xpc_dictionary_get_string(event, "message-name"), "bootstrap")) { >- XPCInitializationHandler(xpc_dictionary_get_value(event, "initialization-message")); > > CFBundleRef webKitBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")); > CFStringRef entryPointFunctionName = (CFStringRef)CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), CFSTR("WebKitEntryPoint")); >@@ -101,13 +93,8 @@ void XPCEventHandler(xpc_connection_t pe > xpc_connection_resume(peer); > } > >-void XPCInitializationHandler(xpc_object_t event) >+int XPCServiceMain(int, const char**) > { >- ASSERT(event); >- ASSERT(xpc_get_type(event) == XPC_TYPE_DICTIONARY); >- >- static std::once_flag once; >- std::call_once(once, [event] { > #if defined(__i386__) > // FIXME: This should only be done for the 32-bit plug-in XPC service so we rely on the fact that > // it's the only of the XPC services that are 32-bit. We should come up with a more targeted #if check. >@@ -118,16 +105,18 @@ void XPCInitializationHandler(xpc_object > } > #endif > >+ auto bootstrap = adoptOSObject(xpc_copy_bootstrap()); > #if PLATFORM(IOS_FAMILY) >- auto containerEnvironmentVariables = xpc_dictionary_get_value(event, "ContainerEnvironmentVariables"); >- xpc_dictionary_apply(containerEnvironmentVariables, ^(const char *key, xpc_object_t value) { >- setenv(key, xpc_string_get_string_ptr(value), 1); >- return true; >- }); >+ auto containerEnvironmentVariables = xpc_dictionary_get_value(bootstrap.get(), "ContainerEnvironmentVariables"); >+ xpc_dictionary_apply(containerEnvironmentVariables, ^(const char *key, xpc_object_t value) { >+ setenv(key, xpc_string_get_string_ptr(value), 1); >+ return true; >+ }); > #endif > >+ if (bootstrap) { > #if PLATFORM(MAC) >- if (const char* webKitBundleVersion = xpc_dictionary_get_string(event, "WebKitBundleVersion")) { >+ if (const char* webKitBundleVersion = xpc_dictionary_get_string(bootstrap.get(), "WebKitBundleVersion")) { > CFBundleRef webKitBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")); > NSString *expectedBundleVersion = (NSString *)CFBundleGetValueForInfoDictionaryKey(webKitBundle, kCFBundleVersionKey); > >@@ -138,7 +127,7 @@ void XPCInitializationHandler(xpc_object > } > #endif > >- if (xpc_object_t languages = xpc_dictionary_get_value(event, "OverrideLanguages")) { >+ if (xpc_object_t languages = xpc_dictionary_get_value(bootstrap.get(), "OverrideLanguages")) { > @autoreleasepool { > NSDictionary *existingArguments = [[NSUserDefaults standardUserDefaults] volatileDomainForName:NSArgumentDomain]; > NSMutableDictionary *newArguments = [existingArguments mutableCopy]; >@@ -151,11 +140,8 @@ void XPCInitializationHandler(xpc_object > [[NSUserDefaults standardUserDefaults] setVolatileDomain:newArguments forName:NSArgumentDomain]; > } > } >- }); >-} >+ } > >-int XPCServiceMain(int, const char**) >-{ > #if PLATFORM(MAC) > // Don't allow Apple Events in WebKit processes. This can be removed when <rdar://problem/14012823> is fixed. > setenv("__APPLEEVENTSSERVICENAME", "", 1); >@@ -169,9 +155,7 @@ int XPCServiceMain(int, const char**) > #endif > #endif > >- xpc_main([] (xpc_connection_t peer) { >- XPCEventHandler(peer, AuxiliaryProcessType::XPCService); >- }); >+ xpc_main(XPCServiceEventHandler); > return 0; > } > >Index: Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp >=================================================================== >--- Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp (revision 241962) >+++ Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp (working copy) >@@ -72,9 +72,6 @@ void AuxiliaryProcessProxy::getLaunchOpt > case ProcessLauncher::ProcessType::Network: > varname = "NETWORK_PROCESS_CMD_PREFIX"; > break; >- case ProcessLauncher::ProcessType::NetworkDaemon: >- ASSERT_NOT_REACHED(); >- break; > } > const char* processCmdPrefix = getenv(varname); > if (processCmdPrefix && *processCmdPrefix) >Index: Source/WebKit/UIProcess/WebProcessPool.cpp >=================================================================== >--- Source/WebKit/UIProcess/WebProcessPool.cpp (revision 241962) >+++ Source/WebKit/UIProcess/WebProcessPool.cpp (working copy) >@@ -1524,15 +1524,6 @@ void WebProcessPool::updateMaxSuspendedP > m_suspendedPages.removeFirst(); > } > >-bool WebProcessPool::usesNetworkingDaemon() const >-{ >-#if PLATFORM(COCOA) >- return m_configuration->usesNetworkingDaemon(); >-#else >- return false; >-#endif >-} >- > void WebProcessPool::setCacheModel(CacheModel cacheModel) > { > m_configuration->setCacheModel(cacheModel); >Index: Source/WebKit/UIProcess/WebProcessPool.h >=================================================================== >--- Source/WebKit/UIProcess/WebProcessPool.h (revision 241962) >+++ Source/WebKit/UIProcess/WebProcessPool.h (working copy) >@@ -268,8 +268,6 @@ public: > DownloadProxy* createDownloadProxy(const WebCore::ResourceRequest&, WebPageProxy* originatingPage); > API::DownloadClient& downloadClient() { return *m_downloadClient; } > >- bool usesNetworkingDaemon() const; >- > API::LegacyContextHistoryClient& historyClient() { return *m_historyClient; } > WebContextClient& client() { return m_client; } > >Index: Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h >=================================================================== >--- Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h (revision 241962) >+++ Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h (working copy) >@@ -185,9 +185,6 @@ public: > #if PLATFORM(COCOA) > bool suppressesConnectionTerminationOnSystemChange() const { return m_suppressesConnectionTerminationOnSystemChange; } > void setSuppressesConnectionTerminationOnSystemChange(bool suppressesConnectionTerminationOnSystemChange) { m_suppressesConnectionTerminationOnSystemChange = suppressesConnectionTerminationOnSystemChange; } >- >- bool usesNetworkingDaemon() const { return m_usesNetworkingDaemon; } >- void setUsesNetworkingDaemon(bool usesNetworkingDaemon) { m_usesNetworkingDaemon = usesNetworkingDaemon; } > #endif > > private: >@@ -242,7 +239,6 @@ private: > > #if PLATFORM(COCOA) > bool m_suppressesConnectionTerminationOnSystemChange { false }; >- bool m_usesNetworkingDaemon { false }; > #endif > }; > >Index: Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h >=================================================================== >--- Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h (revision 241962) >+++ Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h (working copy) >@@ -71,7 +71,6 @@ WK_CLASS_AVAILABLE(macosx(10.10), ios(8. > @property (nonatomic) BOOL pageCacheEnabled WK_API_AVAILABLE(macosx(10.14), ios(12.0)); > @property (nonatomic) BOOL suppressesConnectionTerminationOnSystemChange WK_API_AVAILABLE(macosx(10.14), ios(12.0)); > @property (nonatomic, getter=isJITEnabled) BOOL JITEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); >-@property (nonatomic) BOOL usesNetworkingDaemon WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); > > @end > >Index: Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm >=================================================================== >--- Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm (revision 241962) >+++ Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm (working copy) >@@ -326,17 +326,6 @@ - (void)setJITEnabled:(BOOL)enabled > _processPoolConfiguration->setJITEnabled(enabled); > } > >-- (BOOL)usesNetworkingDaemon >-{ >- return _processPoolConfiguration->usesNetworkingDaemon(); >-} >- >-- (void)setUsesNetworkingDaemon:(BOOL)enabled >-{ >- _processPoolConfiguration->setUsesNetworkingDaemon(enabled); >-} >- >- > - (void)setSuppressesConnectionTerminationOnSystemChange:(BOOL)suppressesConnectionTerminationOnSystemChange > { > _processPoolConfiguration->setSuppressesConnectionTerminationOnSystemChange(suppressesConnectionTerminationOnSystemChange); >Index: Source/WebKit/UIProcess/Launcher/ProcessLauncher.h >=================================================================== >--- Source/WebKit/UIProcess/Launcher/ProcessLauncher.h (revision 241962) >+++ Source/WebKit/UIProcess/Launcher/ProcessLauncher.h (working copy) >@@ -64,8 +64,7 @@ public: > Plugin32, > Plugin64, > #endif >- Network, >- NetworkDaemon >+ Network > }; > > struct LaunchOptions { >Index: Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm >=================================================================== >--- Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm (revision 241962) >+++ Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm (working copy) >@@ -56,9 +56,6 @@ static const char* serviceName(const Pro > return launchOptions.nonValidInjectedCodeAllowed ? "com.apple.WebKit.WebContent.Development" : "com.apple.WebKit.WebContent"; > case ProcessLauncher::ProcessType::Network: > return "com.apple.WebKit.Networking"; >- case ProcessLauncher::ProcessType::NetworkDaemon: >- ASSERT_NOT_REACHED(); >- return nullptr; > #if ENABLE(NETSCAPE_PLUGIN_API) > case ProcessLauncher::ProcessType::Plugin32: > return "com.apple.WebKit.Plugin.32"; >@@ -98,16 +95,12 @@ void ProcessLauncher::launchProcess() > { > ASSERT(!m_xpcConnection); > >- if (m_launchOptions.processType == ProcessLauncher::ProcessType::NetworkDaemon) >- m_xpcConnection = adoptOSObject(xpc_connection_create_mach_service("com.apple.WebKit.NetworkingDaemon", dispatch_get_main_queue(), 0)); >- else { >- const char* name = m_launchOptions.customWebContentServiceBundleIdentifier.isNull() ? serviceName(m_launchOptions) : m_launchOptions.customWebContentServiceBundleIdentifier.data(); >- m_xpcConnection = adoptOSObject(xpc_connection_create(name, nullptr)); >- >- uuid_t uuid; >- uuid_generate(uuid); >- xpc_connection_set_oneshot_instance(m_xpcConnection.get(), uuid); >- } >+ const char* name = m_launchOptions.customWebContentServiceBundleIdentifier.isNull() ? serviceName(m_launchOptions) : m_launchOptions.customWebContentServiceBundleIdentifier.data(); >+ m_xpcConnection = adoptOSObject(xpc_connection_create(name, nullptr)); >+ >+ uuid_t uuid; >+ uuid_generate(uuid); >+ xpc_connection_set_oneshot_instance(m_xpcConnection.get(), uuid); > > // Inherit UI process localization. It can be different from child process default localization: > // 1. When the application and system frameworks simply have different localized resources available, we should match the application. >@@ -203,6 +196,9 @@ void ProcessLauncher::launchProcess() > auto errorHandlerImpl = [weakProcessLauncher = makeWeakPtr(*this), listeningPort] (xpc_object_t event) { > ASSERT(!event || xpc_get_type(event) == XPC_TYPE_ERROR); > >+ if (event) >+ LOG_ERROR("Error launching auxiliary process: %s", xpc_dictionary_get_string(event, XPC_ERROR_KEY_DESCRIPTION)); >+ > auto processLauncher = weakProcessLauncher.get(); > if (!processLauncher) > return; >Index: Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >=================================================================== >--- Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (revision 241962) >+++ Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (working copy) >@@ -102,7 +102,7 @@ NetworkProcessProxy::~NetworkProcessProx > > void NetworkProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions) > { >- launchOptions.processType = m_processPool.usesNetworkingDaemon() ? ProcessLauncher::ProcessType::NetworkDaemon : ProcessLauncher::ProcessType::Network; >+ launchOptions.processType = ProcessLauncher::ProcessType::Network; > AuxiliaryProcessProxy::getLaunchOptions(launchOptions); > > if (processPool().shouldMakeNextNetworkProcessLaunchFailForTesting()) {
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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194427
:
361491
|
361494
|
361507
|
361554
|
362771
|
362783
|
362803
|
362815
|
363381