void WebProcess::initializeWebProcess(const WebProcessCreationParameters& parameters, CoreIPC::MessageDecoder& decoder) { ASSERT(m_pageMap.isEmpty()); platformInitializeWebProcess(parameters, decoder); memoryPressureHandler().install(); RefPtr<APIObject> injectedBundleInitializationUserData; InjectedBundleUserMessageDecoder messageDecoder(injectedBundleInitializationUserData); if (!decoder.decode(messageDecoder)) return; if (!parameters.injectedBundlePath.isEmpty()) { m_injectedBundle = InjectedBundle::create(parameters.injectedBundlePath); m_injectedBundle->setSandboxExtension(SandboxExtension::create(parameters.injectedBundlePathExtensionHandle)); if (!m_injectedBundle->load(injectedBundleInitializationUserData.get())) { // Don't keep around the InjectedBundle reference if the load fails. m_injectedBundle.clear(); } } #if ENABLE(SQL_DATABASE) // Make sure the WebDatabaseManager is initialized so that the Database directory is set. WebDatabaseManager::initialize(parameters.databaseDirectory); #endif #if ENABLE(ICONDATABASE) m_iconDatabaseProxy.setEnabled(parameters.iconDatabaseEnabled); #endif StorageTracker::initializeTracker(parameters.localStorageDirectory, &WebKeyValueStorageManager::shared()); m_localStorageDirectory = parameters.localStorageDirectory; if (!parameters.applicationCacheDirectory.isEmpty()) cacheStorage().setCacheDirectory(parameters.applicationCacheDirectory); setShouldTrackVisitedLinks(parameters.shouldTrackVisitedLinks); setCacheModel(static_cast<uint32_t>(parameters.cacheModel)); if (!parameters.languages.isEmpty()) overrideUserPreferredLanguages(parameters.languages); m_textCheckerState = parameters.textCheckerState; m_fullKeyboardAccessEnabled = parameters.fullKeyboardAccessEnabled; for (size_t i = 0; i < parameters.urlSchemesRegistererdAsEmptyDocument.size(); ++i) registerURLSchemeAsEmptyDocument(parameters.urlSchemesRegistererdAsEmptyDocument[i]); for (size_t i = 0; i < parameters.urlSchemesRegisteredAsSecure.size(); ++i) registerURLSchemeAsSecure(parameters.urlSchemesRegisteredAsSecure[i]); for (size_t i = 0; i < parameters.urlSchemesForWhichDomainRelaxationIsForbidden.size(); ++i) setDomainRelaxationForbiddenForURLScheme(parameters.urlSchemesForWhichDomainRelaxationIsForbidden[i]); for (size_t i = 0; i < parameters.urlSchemesRegisteredAsLocal.size(); ++i) registerURLSchemeAsLocal(parameters.urlSchemesRegisteredAsLocal[i]); for (size_t i = 0; i < parameters.urlSchemesRegisteredAsNoAccess.size(); ++i) registerURLSchemeAsNoAccess(parameters.urlSchemesRegisteredAsNoAccess[i]); for (size_t i = 0; i < parameters.urlSchemesRegisteredAsDisplayIsolated.size(); ++i) registerURLSchemeAsDisplayIsolated(parameters.urlSchemesRegisteredAsDisplayIsolated[i]); for (size_t i = 0; i < parameters.urlSchemesRegisteredAsCORSEnabled.size(); ++i) registerURLSchemeAsCORSEnabled(parameters.urlSchemesRegisteredAsCORSEnabled[i]); setDefaultRequestTimeoutInterval(parameters.defaultRequestTimeoutInterval); if (parameters.shouldAlwaysUseComplexTextCodePath) setAlwaysUsesComplexTextCodePath(true); if (parameters.shouldUseFontSmoothing) setShouldUseFontSmoothing(true); #if (PLATFORM(MAC) || USE(CFNETWORK)) && !PLATFORM(WIN) WebFrameNetworkingContext::setPrivateBrowsingStorageSessionIdentifierBase(parameters.uiProcessBundleIdentifier); #endif #if ENABLE(NETWORK_PROCESS) m_usesNetworkProcess = parameters.usesNetworkProcess; ensureNetworkProcessConnection(); #endif setTerminationTimeout(parameters.terminationTimeout); for (size_t i = 0; i < parameters.plugInAutoStartOrigins.size(); ++i) didAddPlugInAutoStartOrigin(parameters.plugInAutoStartOrigins[i]); #if ENABLE(CUSTOM_PROTOCOLS) initializeCustomProtocolManager(parameters); #endif }
void WebProcess::initializeWebProcess(const WebProcessCreationParameters& parameters, CoreIPC::MessageDecoder& decoder) { ASSERT(m_pageMap.isEmpty()); platformInitializeWebProcess(parameters, decoder); memoryPressureHandler().install(); RefPtr<APIObject> injectedBundleInitializationUserData; InjectedBundleUserMessageDecoder messageDecoder(injectedBundleInitializationUserData); if (!decoder.decode(messageDecoder)) return; if (!parameters.injectedBundlePath.isEmpty()) { m_injectedBundle = InjectedBundle::create(parameters.injectedBundlePath); m_injectedBundle->setSandboxExtension(SandboxExtension::create(parameters.injectedBundlePathExtensionHandle)); if (!m_injectedBundle->load(injectedBundleInitializationUserData.get())) { // Don't keep around the InjectedBundle reference if the load fails. m_injectedBundle.clear(); } } WebProcessSupplementMap::const_iterator it = m_supplements.begin(); WebProcessSupplementMap::const_iterator end = m_supplements.end(); for (; it != end; ++it) it->value->initialize(parameters); #if ENABLE(ICONDATABASE) m_iconDatabaseProxy->setEnabled(parameters.iconDatabaseEnabled); #endif if (!parameters.applicationCacheDirectory.isEmpty()) cacheStorage().setCacheDirectory(parameters.applicationCacheDirectory); setShouldTrackVisitedLinks(parameters.shouldTrackVisitedLinks); setCacheModel(static_cast<uint32_t>(parameters.cacheModel)); if (!parameters.languages.isEmpty()) overrideUserPreferredLanguages(parameters.languages); m_textCheckerState = parameters.textCheckerState; m_fullKeyboardAccessEnabled = parameters.fullKeyboardAccessEnabled; for (size_t i = 0; i < parameters.urlSchemesRegistererdAsEmptyDocument.size(); ++i) registerURLSchemeAsEmptyDocument(parameters.urlSchemesRegistererdAsEmptyDocument[i]); for (size_t i = 0; i < parameters.urlSchemesRegisteredAsSecure.size(); ++i) registerURLSchemeAsSecure(parameters.urlSchemesRegisteredAsSecure[i]); for (size_t i = 0; i < parameters.urlSchemesForWhichDomainRelaxationIsForbidden.size(); ++i) setDomainRelaxationForbiddenForURLScheme(parameters.urlSchemesForWhichDomainRelaxationIsForbidden[i]); for (size_t i = 0; i < parameters.urlSchemesRegisteredAsLocal.size(); ++i) registerURLSchemeAsLocal(parameters.urlSchemesRegisteredAsLocal[i]); for (size_t i = 0; i < parameters.urlSchemesRegisteredAsNoAccess.size(); ++i) registerURLSchemeAsNoAccess(parameters.urlSchemesRegisteredAsNoAccess[i]); for (size_t i = 0; i < parameters.urlSchemesRegisteredAsDisplayIsolated.size(); ++i) registerURLSchemeAsDisplayIsolated(parameters.urlSchemesRegisteredAsDisplayIsolated[i]); for (size_t i = 0; i < parameters.urlSchemesRegisteredAsCORSEnabled.size(); ++i) registerURLSchemeAsCORSEnabled(parameters.urlSchemesRegisteredAsCORSEnabled[i]); setDefaultRequestTimeoutInterval(parameters.defaultRequestTimeoutInterval); if (parameters.shouldAlwaysUseComplexTextCodePath) setAlwaysUsesComplexTextCodePath(true); if (parameters.shouldUseFontSmoothing) setShouldUseFontSmoothing(true); #if PLATFORM(MAC) || USE(CFNETWORK) WebFrameNetworkingContext::setPrivateBrowsingStorageSessionIdentifierBase(parameters.uiProcessBundleIdentifier); #endif if (parameters.shouldUseTestingNetworkSession) NetworkStorageSession::switchToNewTestingSession(); #if ENABLE(NETWORK_PROCESS) m_usesNetworkProcess = parameters.usesNetworkProcess; ensureNetworkProcessConnection(); if (usesNetworkProcess()) CookieStorageShim::shared().initialize(); #endif setTerminationTimeout(parameters.terminationTimeout); resetPlugInAutoStartOriginHashes(parameters.plugInAutoStartOriginHashes); for (size_t i = 0; i < parameters.plugInAutoStartOrigins.size(); ++i) m_plugInAutoStartOrigins.add(parameters.plugInAutoStartOrigins[i]); }
void WebProcess::initializeWebProcess(const WebProcessCreationParameters& parameters, CoreIPC::ArgumentDecoder* arguments) { ASSERT(m_pageMap.isEmpty()); platformInitializeWebProcess(parameters, arguments); RefPtr<APIObject> injectedBundleInitializationUserData; InjectedBundleUserMessageDecoder messageDecoder(injectedBundleInitializationUserData); if (!arguments->decode(messageDecoder)) return; if (!parameters.injectedBundlePath.isEmpty()) { m_injectedBundle = InjectedBundle::create(parameters.injectedBundlePath); m_injectedBundle->setSandboxExtension(SandboxExtension::create(parameters.injectedBundlePathExtensionHandle)); if (!m_injectedBundle->load(injectedBundleInitializationUserData.get())) { // Don't keep around the InjectedBundle reference if the load fails. m_injectedBundle.clear(); } } #if ENABLE(DATABASE) // Make sure the WebDatabaseManager is initialized so that the Database directory is set. WebDatabaseManager::initialize(parameters.databaseDirectory); #endif #if ENABLE(ICONDATABASE) m_iconDatabaseProxy.setEnabled(parameters.iconDatabaseEnabled); #endif #if ENABLE(DOM_STORAGE) StorageTracker::initializeTracker(parameters.localStorageDirectory); m_localStorageDirectory = parameters.localStorageDirectory; #endif #if ENABLE(OFFLINE_WEB_APPLICATIONS) if (!parameters.applicationCacheDirectory.isEmpty()) cacheStorage().setCacheDirectory(parameters.applicationCacheDirectory); #endif setShouldTrackVisitedLinks(parameters.shouldTrackVisitedLinks); setCacheModel(static_cast<uint32_t>(parameters.cacheModel)); if (!parameters.languageCode.isEmpty()) overrideDefaultLanguage(parameters.languageCode); m_textCheckerState = parameters.textCheckerState; for (size_t i = 0; i < parameters.urlSchemesRegistererdAsEmptyDocument.size(); ++i) registerURLSchemeAsEmptyDocument(parameters.urlSchemesRegistererdAsEmptyDocument[i]); for (size_t i = 0; i < parameters.urlSchemesRegisteredAsSecure.size(); ++i) registerURLSchemeAsSecure(parameters.urlSchemesRegisteredAsSecure[i]); for (size_t i = 0; i < parameters.urlSchemesForWhichDomainRelaxationIsForbidden.size(); ++i) setDomainRelaxationForbiddenForURLScheme(parameters.urlSchemesForWhichDomainRelaxationIsForbidden[i]); setDefaultRequestTimeoutInterval(parameters.defaultRequestTimeoutInterval); for (size_t i = 0; i < parameters.mimeTypesWithCustomRepresentation.size(); ++i) m_mimeTypesWithCustomRepresentations.add(parameters.mimeTypesWithCustomRepresentation[i]); if (parameters.clearResourceCaches) clearResourceCaches(); if (parameters.clearApplicationCache) clearApplicationCache(); #if PLATFORM(MAC) m_presenterApplicationPid = parameters.presenterApplicationPid; #endif if (parameters.shouldAlwaysUseComplexTextCodePath) setAlwaysUsesComplexTextCodePath(true); #if USE(CFURLSTORAGESESSIONS) WebCore::ResourceHandle::setPrivateBrowsingStorageSessionIdentifierBase(parameters.uiProcessBundleIdentifier); #endif }
void WebProcess::initializeWebProcess(WebProcessCreationParameters&& parameters) { ASSERT(m_pageMap.isEmpty()); #if ENABLE(NETWORK_PROCESS) m_usesNetworkProcess = parameters.usesNetworkProcess; #endif #if OS(LINUX) WebCore::MemoryPressureHandler::ReliefLogger::setLoggingEnabled(parameters.shouldEnableMemoryPressureReliefLogging); #endif platformInitializeWebProcess(WTF::move(parameters)); WTF::setCurrentThreadIsUserInitiated(); MemoryPressureHandler::singleton().install(); if (!parameters.injectedBundlePath.isEmpty()) m_injectedBundle = InjectedBundle::create(parameters, transformHandlesToObjects(parameters.initializationUserData.object()).get()); for (auto& supplement : m_supplements.values()) supplement->initialize(parameters); #if ENABLE(ICONDATABASE) m_iconDatabaseProxy->setEnabled(parameters.iconDatabaseEnabled); #endif if (!parameters.applicationCacheDirectory.isEmpty()) ApplicationCacheStorage::singleton().setCacheDirectory(parameters.applicationCacheDirectory); setCacheModel(static_cast<uint32_t>(parameters.cacheModel)); if (!parameters.languages.isEmpty()) overrideUserPreferredLanguages(parameters.languages); m_textCheckerState = parameters.textCheckerState; m_fullKeyboardAccessEnabled = parameters.fullKeyboardAccessEnabled; for (auto& scheme : parameters.urlSchemesRegisteredAsEmptyDocument) registerURLSchemeAsEmptyDocument(scheme); for (auto& scheme : parameters.urlSchemesRegisteredAsSecure) registerURLSchemeAsSecure(scheme); for (auto& scheme : parameters.urlSchemesRegisteredAsBypassingContentSecurityPolicy) registerURLSchemeAsBypassingContentSecurityPolicy(scheme); for (auto& scheme : parameters.urlSchemesForWhichDomainRelaxationIsForbidden) setDomainRelaxationForbiddenForURLScheme(scheme); for (auto& scheme : parameters.urlSchemesRegisteredAsLocal) registerURLSchemeAsLocal(scheme); for (auto& scheme : parameters.urlSchemesRegisteredAsNoAccess) registerURLSchemeAsNoAccess(scheme); for (auto& scheme : parameters.urlSchemesRegisteredAsDisplayIsolated) registerURLSchemeAsDisplayIsolated(scheme); for (auto& scheme : parameters.urlSchemesRegisteredAsCORSEnabled) registerURLSchemeAsCORSEnabled(scheme); #if ENABLE(CACHE_PARTITIONING) for (auto& scheme : parameters.urlSchemesRegisteredAsCachePartitioned) registerURLSchemeAsCachePartitioned(scheme); #endif setDefaultRequestTimeoutInterval(parameters.defaultRequestTimeoutInterval); if (parameters.shouldAlwaysUseComplexTextCodePath) setAlwaysUsesComplexTextCodePath(true); if (parameters.shouldUseFontSmoothing) setShouldUseFontSmoothing(true); #if PLATFORM(COCOA) || USE(CFNETWORK) SessionTracker::setIdentifierBase(parameters.uiProcessBundleIdentifier); #endif if (parameters.shouldUseTestingNetworkSession) NetworkStorageSession::switchToNewTestingSession(); #if ENABLE(NETWORK_PROCESS) ensureNetworkProcessConnection(); #if PLATFORM(COCOA) if (usesNetworkProcess()) CookieStorageShim::singleton().initialize(); #endif #endif setTerminationTimeout(parameters.terminationTimeout); resetPlugInAutoStartOriginHashes(parameters.plugInAutoStartOriginHashes); for (auto& origin : parameters.plugInAutoStartOrigins) m_plugInAutoStartOrigins.add(origin); setMemoryCacheDisabled(parameters.memoryCacheDisabled); #if ENABLE(SERVICE_CONTROLS) setEnabledServices(parameters.hasImageServices, parameters.hasSelectionServices, parameters.hasRichContentServices); #endif #if ENABLE(REMOTE_INSPECTOR) audit_token_t auditToken; if (parentProcessConnection()->getAuditToken(auditToken)) { RetainPtr<CFDataRef> auditData = adoptCF(CFDataCreate(nullptr, (const UInt8*)&auditToken, sizeof(auditToken))); Inspector::RemoteInspector::singleton().setParentProcessInformation(presenterApplicationPid(), auditData); } #endif #if ENABLE(NETSCAPE_PLUGIN_API) && PLATFORM(MAC) for (auto hostIter = parameters.pluginLoadClientPolicies.begin(); hostIter != parameters.pluginLoadClientPolicies.end(); ++hostIter) { for (auto bundleIdentifierIter = hostIter->value.begin(); bundleIdentifierIter != hostIter->value.end(); ++bundleIdentifierIter) { for (auto versionIter = bundleIdentifierIter->value.begin(); versionIter != bundleIdentifierIter->value.end(); ++versionIter) platformStrategies()->pluginStrategy()->setPluginLoadClientPolicy(static_cast<PluginLoadClientPolicy>(versionIter->value), hostIter->key, bundleIdentifierIter->key, versionIter->key); } } #endif }