2018-05-02 Jason Marcell Cherry-pick r231242. rdar://problem/39860939 [iOS] Provide audio route information when invoking AirPlay picker https://bugs.webkit.org/show_bug.cgi?id=185199 Reviewed by Jer Noble. Source/WebCore: No new tests, this requires a specific hardware setup. * dom/Document.cpp: (WebCore::Document::showPlaybackTargetPicker): Pass route sharing policy and routing context UID. * dom/Document.h: * html/MediaElementSession.cpp: (WebCore::MediaElementSession::showPlaybackTargetPicker): Ditto. * loader/EmptyClients.h: * page/ChromeClient.h: * page/Page.cpp: (WebCore::Page::showPlaybackTargetPicker): Ditto. * page/Page.h: * platform/audio/AudioSession.cpp: (WebCore::AudioSession::routeSharingPolicy const): Empty implementation for non-iOS ports. (WebCore::routingContextUID const): Ditto. * platform/audio/AudioSession.h: * platform/audio/ios/AudioSessionIOS.mm: (WebCore::AudioSession::routeSharingPolicy const): Return the route sharing policy. (WebCore::AudioSession::routingContextUID const): Return the route context UID. Source/WebCore/PAL: * pal/spi/mac/AVFoundationSPI.h: Add additional AVAudioSession SPI. Source/WebKit: * Scripts/webkit/messages.py: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::showPlaybackTargetPicker): Pass route sharing policy and routing context UID. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _showPlaybackTargetPicker:fromRect:routeSharingPolicy:routingContextUID:]): Take same. (-[WKContentView _showPlaybackTargetPicker:fromRect:]): Deleted. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::showPlaybackTargetPicker): Pass route sharing policy and routing context UID. * UIProcess/ios/forms/WKAirPlayRoutePicker.h: * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: (-[WKAirPlayRoutePicker showFromView:routeSharingPolicy:routingContextUID:]): Take same. (-[WKAirPlayRoutePicker showFromView:]): Deleted. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: (WebKit::WebChromeClient::showPlaybackTargetPicker): Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: * WebCoreSupport/WebChromeClientIOS.mm: (WebChromeClientIOS::showPlaybackTargetPicker): Pass route sharing policy and routing context UID. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231242 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-05-02 Eric Carlson [iOS] Provide audio route information when invoking AirPlay picker https://bugs.webkit.org/show_bug.cgi?id=185199 Reviewed by Jer Noble. * Scripts/webkit/messages.py: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::showPlaybackTargetPicker): Pass route sharing policy and routing context UID. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _showPlaybackTargetPicker:fromRect:routeSharingPolicy:routingContextUID:]): Take same. (-[WKContentView _showPlaybackTargetPicker:fromRect:]): Deleted. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::showPlaybackTargetPicker): Pass route sharing policy and routing context UID. * UIProcess/ios/forms/WKAirPlayRoutePicker.h: * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: (-[WKAirPlayRoutePicker showFromView:routeSharingPolicy:routingContextUID:]): Take same. (-[WKAirPlayRoutePicker showFromView:]): Deleted. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: (WebKit::WebChromeClient::showPlaybackTargetPicker): 2018-04-30 Jason Marcell Apply patch. rdar://problem/39741039 2018-04-30 Brent Fulgham Don't Block First Party Cookies on Redirects https://bugs.webkit.org/show_bug.cgi?id=184948 Reviewed by Youenn Fablet. Top-level navigations should not be subject to cookie blocking behavior. When performing redirects for main frame navigation we are blocking cookies, leading to site breakage. We need to keep track of which NetworkDataTasks are due to a main frame navigation. When a redirect is performed on the main frame, we should treat the new origin as the 'first party for cookies' and avoid blocking cookies for that URL. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::preconnectTo): Use the correct parameter type. We actually serialize NetworkResourceLoadParameters over IPC, so we should get access to all the members of this child class. * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::create): Pass new 'loadIsForNavigation' flag to create methods. (WebKit::NetworkDataTask::NetworkDataTask): Capture 'loadIsForNavigation' in constructor. * NetworkProcess/NetworkDataTask.h: (WebKit::NetworkDataTask::isTopLevelNavigation const): Added. * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::NetworkDataTaskBlob): Accept new constructor argument. * NetworkProcess/NetworkDataTaskBlob.h: * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::willPerformHTTPRedirection): Retain requester value from old request during redirect. * NetworkProcess/NetworkResourceLoadParameters.cpp: (NetworkResourceLoadParameters::decode): Update to pass new flag. (NetworkResourceLoadParameters::encode): Ditto. * NetworkProcess/NetworkLoadParameters.h: * NetworkProcess/capture/NetworkDataTaskReplay.cpp: (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay): Accept new constructor argument. * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Accept new constructor argument. (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): Accept new constructor argument. * NetworkProcess/soup/NetworkDataTaskSoup.h: 2018-04-27 Jason Marcell Cherry-pick r230903. rdar://problem/39766220 Web Inspector: WebInspectorProxy releases WKWebInspectorProxyObjCAdapter without removing corresponding observer https://bugs.webkit.org/show_bug.cgi?id=184865 Reviewed by Brian Burg. Replace the early return removed in https://bugs.webkit.org/show_bug.cgi?id=177661, so that WKWebInspectorProxyObjCAdapter and the view controller can be reused when reopening the Inspector while the WebView is still alive. * UIProcess/mac/WebInspectorProxyMac.mm: (WebKit::WebInspectorProxy::platformCreateFrontendPage): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230903 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-04-22 Matt Baker Web Inspector: WebInspectorProxy releases WKWebInspectorProxyObjCAdapter without removing corresponding observer https://bugs.webkit.org/show_bug.cgi?id=184865 Reviewed by Brian Burg. Replace the early return removed in https://bugs.webkit.org/show_bug.cgi?id=177661, so that WKWebInspectorProxyObjCAdapter and the view controller can be reused when reopening the Inspector while the WebView is still alive. * UIProcess/mac/WebInspectorProxyMac.mm: (WebKit::WebInspectorProxy::platformCreateFrontendPage): 2018-04-26 Jason Marcell Apply patch. rdar://problem/39532926 2018-04-26 Chris Dumez Regression(r230733): imported/w3c/web-platform-tests/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html is failing Reviewed by Ryosuke Niwa. Update r230733 to do a more conservative roll out of r222468, since the download attribute code is relying on some of the code. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): Revert changes made to this method in r230733 as the download attribute code relies on it. * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::documentLoaderDetached): Reintroduce null check that was dropped in r230733. 2018-04-17 Kocsen Chung Apply patch. rdar://problem/39305046 2018-04-17 Chris Dumez Regression(r222468 & r227758): Motion JPEG streams only show the first frame and frequently crash Reviewed by Chris Dumez. Roll out r222468 as this patch introduced a null-dereference of the provisionalDocumentLoader. The SPI added in r222468 is not used by any client yet so this is safe to roll out. Also roll out r227758, which attempted to fix the crash introduced in r222468 but ended up ignoring every following frame of Motion JPEG streams. This is because there is no provisional document loader anymore for follow-up of Motion JPEG streams and the r227758 was returning early and asking WebCore to ignore the response when the provisional document loader was null. A proper fix would have been to set the navigationID to 0 when the provisional document loader is null instead of returning early. However, it does not matter in this patch since r222468 is being reverted too. A proper fix will be landed on trunk via https://bugs.webkit.org/show_bug.cgi?id=184268. * UIProcess/API/APINavigation.cpp: (API::Navigation::Navigation): (API::Navigation::appendRedirectionURL): Deleted. * UIProcess/API/APINavigation.h: (API::Navigation::takeRedirectChain): Deleted. (API::Navigation::setWasUserInitiated): Deleted. (API::Navigation::wasUserInitiated const): Deleted. * UIProcess/API/C/WKDownload.cpp: (WKDownloadCopyRedirectChain): (WKDownloadGetWasUserInitiated): Deleted. * UIProcess/API/C/WKDownload.h: * UIProcess/API/Cocoa/_WKDownload.h: * UIProcess/API/Cocoa/_WKDownload.mm: (-[_WKDownload wasUserInitiated]): Deleted. * UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::setWasUserInitiated): Deleted. (WebKit::DownloadProxy::wasUserInitiated const): Deleted. (): Deleted. * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::didStartProvisionalLoad): (WebKit::WebFrameProxy::didReceiveServerRedirectForProvisionalLoad): (WebKit::WebFrameProxy::didFailProvisionalLoad): (WebKit::WebFrameProxy::didFinishLoad): (WebKit::WebFrameProxy::didFailLoad): * UIProcess/WebFrameProxy.h: (WebKit::WebFrameProxy::takeProvisionalLoadRedirectChain): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedPolicyDecision): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForResponse): (WebKit::WebPageProxy::decidePolicyForResponseSync): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::documentLoaderDetached): 2018-04-11 Kocsen Chung Cherry-pick r229872. rdar://problem/39349363 Use the same SWServer for all ephemeral sessions https://bugs.webkit.org/show_bug.cgi?id=183921 Reviewed by Youenn Fablet. Use the same SWServer for all ephemeral sessions. SWServers never go away and we create one per sessionID. When browsing doing private browsing in Safari (and other fetching favorite icons), the sessionID is ephemeral and keeps changing. This means that we kept constructing new SWServers that would never go away. Each SWServer has a thread so we would eventually hit the thread limit for the storage process. * StorageProcess/StorageProcess.cpp: (WebKit::StorageProcess::swServerForSession): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229872 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-03-22 Chris Dumez Use the same SWServer for all ephemeral sessions https://bugs.webkit.org/show_bug.cgi?id=183921 Reviewed by Youenn Fablet. Use the same SWServer for all ephemeral sessions. SWServers never go away and we create one per sessionID. When browsing doing private browsing in Safari (and other fetching favorite icons), the sessionID is ephemeral and keeps changing. This means that we kept constructing new SWServers that would never go away. Each SWServer has a thread so we would eventually hit the thread limit for the storage process. * StorageProcess/StorageProcess.cpp: (WebKit::StorageProcess::swServerForSession): 2018-04-10 Kocsen Chung Cherry-pick r230467. rdar://problem/39317878 Refactor Ignore HSTS code https://bugs.webkit.org/show_bug.cgi?id=184433 Reviewed by Darin Adler. This patch refactors our ignore HSTS code. The convenience functions are moved out of CFNetwork SPI in PAL, and into where they are used. It also switches from performSelector: calls to straight function calls, after checking that there is a responder. Source/WebCore: * platform/network/mac/WebCoreURLResponse.mm: (WebCore::schemeWasUpgradedDueToDynamicHSTS): Add convenience function here since it was moved out of CFNetworkSPI.h. Source/WebCore/PAL: * pal/spi/cf/CFNetworkSPI.h: (schemeWasUpgradedDueToDynamicHSTS): Deleted. (setIgnoreHSTS): Deleted. (ignoreHSTS): Deleted. Source/WebKit: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (schemeWasUpgradedDueToDynamicHSTS): (setIgnoreHSTS): (ignoreHSTS): Add convenience functions here since they were moved out of CFNetworkSPI.h. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230467 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-04-09 John Wilander Refactor Ignore HSTS code https://bugs.webkit.org/show_bug.cgi?id=184433 Reviewed by Darin Adler. This patch refactors our ignore HSTS code. The convenience functions are moved out of CFNetwork SPI in PAL, and into where they are used. It also switches from performSelector: calls to straight function calls, after checking that there is a responder. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (schemeWasUpgradedDueToDynamicHSTS): (setIgnoreHSTS): (ignoreHSTS): Add convenience functions here since they were moved out of CFNetworkSPI.h. 2018-03-21 Jason Marcell Cherry-pick r229297. rdar://problem/38682578 2018-03-05 Andy Estes [Mac] Teach WebCore::Pasteboard about file promise drags https://bugs.webkit.org/show_bug.cgi?id=183314 Reviewed by Darin Adler. Added a FIXME comment. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::performDragOperation): 2018-03-20 Jason Marcell Cherry-pick r229643. rdar://problem/38651639 2018-03-15 Keith Rollin Telemetry for stalled webpage loads https://bugs.webkit.org/show_bug.cgi?id=183221 Reviewed by Chris Dumez. Add telemetry for page loads, tracking the pages that succeed, fail, or are canceled. This information will be used to track the overall health of our page loading as time goes on. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::close): (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::reportPageLoadResult): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::reportPageLoadResult): 2018-03-11 Jason Marcell Cherry-pick r229134. rdar://problem/38035474 2018-03-01 Antti Koivisto Crash when updating cache entry after validation in apps that uses class A file protection https://bugs.webkit.org/show_bug.cgi?id=183242 Reviewed by Chris Dumez. When validating a cache entry, we keep it alive until we get a network response. With 304 response we then update the headers of this existing entry. This accesses the body data of the entry which may be backed by a mapped file. If the app uses class A protection, user might have locked the device and the entry might have become inaccessible, leading to a crash. * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::setNeedsValidation): In case of class A protection, pull the data to a memory buffer immediately before starting a revalidation request. This makes the window where the file could become inaccessible much shorter (since it no longer depends on network). 2018-03-11 Jason Marcell Cherry-pick r229028. rdar://problem/37992284 2018-02-26 Youenn Fablet MessagePort is not always destroyed in the right thread https://bugs.webkit.org/show_bug.cgi?id=183053 Reviewed by Chris Dumez. Update code to pass a lambda to MessagePort::existingMessagePortForIdentifier. * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.cpp: (WebKit::WebMessagePortChannelProvider::checkProcessLocalPortForActivity): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::messagesAvailableForPort): 2018-02-26 Jason Marcell Cherry-pick r229037. rdar://problem/37912529 2018-02-26 Ryosuke Niwa Release assertion in WebPage::updatePreferences https://bugs.webkit.org/show_bug.cgi?id=183075 Reviewed by Youenn Fablet and Chris Dumez. Replaced the release assertion added in r228589 with a more graceful disabling of the feature when the entitlement is missing. * StorageProcess/StorageProcess.cpp: (WebKit::StorageProcess::didReceiveMessage): Added an early exit with an entitlement check to disable the feature. (WebKit::StorageProcess::initializeWebsiteDataStore): Ditto. (WebKit::StorageProcess::createStorageToWebProcessConnection): Replaced the release assertion with a debug assertion. (WebKit::StorageProcess::swServerForSession): Removed the assertion. This code can be reached when the service worker is disabled. (WebKit::StorageProcess::registerSWServerConnection): Replaced the release assertion with a debug assertion. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): Disable the feature instead of crashing when the entitlement is missing. 2018-02-26 Jason Marcell Cherry-pick r229031. rdar://problem/37912128 2018-02-26 Chris Dumez Regression(r223431): Crash under didReceiveChallenge in NetworkSessionCocoa https://bugs.webkit.org/show_bug.cgi?id=183134 Reviewed by Alex Christensen. Like other delegates functions in this file, it is possible for didReceiveChallenge to get called after _session has been nulled out. Other delegate functions already had early returns when _session is null. However, such early return was missing in didReceiveChallenge. This patch ends the early return to didReceiveChallenge so that we do not end up calling _session->downloadID(taskIdentifier) on a null _session. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): 2018-02-26 Jason Marcell Cherry-pick r228978. rdar://problem/37909154 2018-02-25 Chris Dumez Service workers do not work well inside Web.app https://bugs.webkit.org/show_bug.cgi?id=183105 Reviewed by Youenn Fablet. * StorageProcess/StorageProcess.cpp: (WebKit::StorageProcess::didReceiveMessage): We were failing to forward IPC messages to the ChildProcess class here. As a result, the ChildProcess::RegisterURLSchemeServiceWorkersCanHandle IPC was being ignored by the StorageProcess. 2018-02-23 Jason Marcell Apply patch. rdar://problem/37836719 2018-02-23 Chris Dumez Add release asserts for service worker fetch and postMessage events https://bugs.webkit.org/show_bug.cgi?id=183025 Reviewed by Chris Dumez. Moving from release assert to early exit with release logging. * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::startFetch): 2018-02-23 Jason Marcell Cherry-pick r228930. rdar://problem/37836719 2018-02-22 Youenn Fablet Fetch event release assert should take into account the fetch mode https://bugs.webkit.org/show_bug.cgi?id=183047 Reviewed by Chris Dumez. In case of navigation tasks, we should use the request URL and not the origin of the loading client. * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::isValidFetch): (WebKit::WebSWContextManagerConnection::startFetch): 2018-02-23 Jason Marcell Cherry-pick r228919. rdar://problem/37836719 2018-02-22 Youenn Fablet Add release asserts for service worker fetch and postMessage events https://bugs.webkit.org/show_bug.cgi?id=183025 rdar://problem/37765052 Reviewed by Daniel Bates. Add assertion to protect interception of a fetch load by a service worker with a different origin from the page. * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::startFetch): 2018-02-23 Jason Marcell Cherry-pick r228937. rdar://problem/37833035 2018-02-22 Matt Baker Web Inspector: REGRESSION (r228349): ImageBitmap builtin is now runtime guarded https://bugs.webkit.org/show_bug.cgi?id=183056 Reviewed by Joseph Pecoraro. * WebProcess/WebPage/WebInspectorUI.cpp: (WebKit::WebInspectorUI::WebInspectorUI): 2018-02-21 Jason Marcell Cherry-pick r228857. rdar://problem/37734496 2018-02-20 Nan Wang AX: Keyboard focus not following VoiceOver cursor into web content or within web content. https://bugs.webkit.org/show_bug.cgi?id=182752 Reviewed by Ryosuke Niwa. * UIProcess/PageClient.h: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::assistiveTechnologyMakeFirstResponder): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::assistiveTechnologyMakeFirstResponder): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::assistiveTechnologyMakeFirstResponder): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::assistiveTechnologyMakeFirstResponder): * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::assistiveTechnologyMakeFirstResponder): * WebProcess/WebCoreSupport/WebChromeClient.h: 2018-02-20 Jason Marcell Cherry-pick r228713. rdar://problem/37714036 2018-02-19 Daniel Bates Null pointer dereference in WebPageProxy::urlSchemeHandlerForScheme() https://bugs.webkit.org/show_bug.cgi?id=182905 Reviewed by Alex Christensen. Return nullptr when querying for the scheme handler of the null string. Before a navigation is performed WebKit checks if the destination URL is associated with an app unless the embedding client overrides the WKNavigationDelegate delegate callback -webView:decidePolicyForNavigationAction:decisionHandler. If the URL is not associated with an app then WebKit may fall back to checking if the embedding client registered a scheme handler for it. Currently we assume that the scheme is a non-null string when checking the scheme handler registry. However the scheme can be a null string if it is part of a malformed URL. And this leads to bad news bears when we try to use it to look for a scheme handler. Instead check that the scheme is a non-null string before checking to see if it is in the scheme handler registry. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::urlSchemeHandlerForScheme): 2018-02-20 Jason Marcell Cherry-pick r228589. rdar://problem/37697687 2018-02-16 Ryosuke Niwa Add an entitlement check for service worker on iOS https://bugs.webkit.org/show_bug.cgi?id=182865 Reviewed by Brady Eidson. Added an entitlement check to enable service workers on iOS. * Shared/mac/SandboxUtilities.h: * Shared/mac/SandboxUtilities.mm: (WebKit::connectedProcessHasEntitlement): Added. * StorageProcess/StorageProcess.cpp: (WebKit::StorageProcess::createStorageToWebProcessConnection): Enforce the entitlement check by crashing when this code is executed without the parent process having the service worker entitlement. This should never happen unless someone is trying to bypass the entitlement check in UI Process since we ordinarily disable service worker gracefully in WKWebView _initializeWithConfiguration. (WebKit::StorageProcess::swServerForSession): Ditto. (WebKit::StorageProcess::registerSWServerConnection): Ditto. * StorageProcess/StorageProcess.h: (WebKit::StorageProcess::parentProcessHasServiceWorkerEntitlement const): Added. * StorageProcess/ios/StorageProcessIOS.mm: (WebKit::StorageProcess::parentProcessHasServiceWorkerEntitlement const): Added. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): Disable the service workers when the entitlement is missing from the current process. The entitlement is enforced by WebContent and Storage process. This check avoids crashing WebContent process and gracefully disabling the feature. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): Enforce the entitlement check. * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::parentProcessHasServiceWorkerEntitlement const): Added. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::parentProcessHasServiceWorkerEntitlement const): Added. 2018-02-19 Jason Marcell Cherry-pick r228564. rdar://problem/37675352 2018-02-16 Chris Dumez ASSERTION FAILED: !m_processes[i] || *m_processes[i] == process in MessagePortChannel::entanglePortWithProcess() https://bugs.webkit.org/show_bug.cgi?id=182054 Reviewed by Brady Eidson. Pipe postMessage messages to and from service workers via the UIProcess instead of going directly to the StorageProcess. This is temporarily needed to avoid races due to the MessagePort registry currently living in the UIProcess and postMessage messages potentially sending MessagePort objects. This change is covered by tests on the bots that currently flakily crash in debug. * StorageProcess/ServiceWorker/WebSWServerConnection.h: * StorageProcess/StorageProcess.cpp: (WebKit::StorageProcess::postMessageToServiceWorker): * StorageProcess/StorageProcess.h: * StorageProcess/StorageProcess.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::postMessageToServiceWorkerClient): (WebKit::WebProcessPool::postMessageToServiceWorker): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessPool.messages.in: * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::postMessageToServiceWorker): * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient): 2018-02-16 Jason Marcell Cherry-pick r228551. rdar://problem/37615430 2018-02-15 Youenn Fablet Resources loaded from service workers are not downloadable https://bugs.webkit.org/show_bug.cgi?id=182848 Reviewed by Chris Dumez. Downloads are not supporting resources loaded through service worker. As a temporary solution, we will let network process handle it. Note that this would not work if the URL can only be loaded through service worker. Note also that for navigation loads, if the content type is the default one (application/octet-stream) we are overriding it to text/html as we do not support mime sniffing yet from service worker responses. This might interfere with automatic downloads from navigation. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload): 2018-02-15 Jason Marcell Cherry-pick r228472. rdar://problem/37570861 2018-02-14 Maureen Daum Add C SPI for support of Website Data Store in Website Policies https://bugs.webkit.org/show_bug.cgi?id=182698 Reviewed by Andy Estes. Expand the API added for _WKWebsitePolicies.websiteDataStore in r225989 and r226325 to be available in the C API. In the ObjC API, we handle setting the website data store in NavigationState::NavigationClient::decidePolicyForNavigationAction. There we throw an exception if setting the website data store isn't supported, and then change the website data store. The equivalent place to do this work in the C API is in WKFramePolicyListenerUseWithPolicies. However, instead of throwing exceptions, release asserts are used. * UIProcess/API/C/WKFramePolicyListener.cpp: (WKFramePolicyListenerUseWithPolicies): If the website policies data contains a website data store, do the same checks that are done in NavigationState::NavigationClient::decidePolicyForNavigationAction. Namely, that it is a valid website data store and it is a policy decision for a main frame navigation. If these checks are met, change the website data store. * UIProcess/API/C/WKPage.cpp: (WKPageUpdateWebsitePolicies): * UIProcess/API/C/WKWebsitePolicies.cpp: (WKWebsitePoliciesGetDataStore): (WKWebsitePoliciesSetDataStore): * UIProcess/API/C/WKWebsitePolicies.h: * UIProcess/WebFrameListenerProxy.cpp: (WebKit::WebFrameListenerProxy::changeWebsiteDataStore): (WebKit::WebFrameListenerProxy::isMainFrame): Expose whether the frame proxy is for a main frame, which is required to verify that website policies only specify a website data store for main frame policy decisions. * UIProcess/WebFrameListenerProxy.h: * UIProcess/WebFramePolicyListenerProxy.cpp: * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::changeWebsiteDataStore): * UIProcess/WebFrameProxy.h: 2018-02-14 Jason Marcell Cherry-pick r228442. rdar://problem/37559831 2018-02-13 Youenn Fablet Add support for configuring WebsiteDatastore service worker and cache storage path https://bugs.webkit.org/show_bug.cgi?id=182674 Reviewed by Chris Dumez. Beef up WKWebsiteDataStoreConfiguration to easily set the WebsiteDataStore service worker registration and cache storage directory path. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _initWithConfiguration:]): * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: (-[_WKWebsiteDataStoreConfiguration _cacheStorageDirectory]): (-[_WKWebsiteDataStoreConfiguration _setCacheStorageDirectory:]): (-[_WKWebsiteDataStoreConfiguration _serviceWorkerRegistrationDirectory]): (-[_WKWebsiteDataStoreConfiguration _setServiceWorkerRegistrationDirectory:]): 2018-02-13 Jason Marcell Cherry-pick r228350. rdar://problem/37523984 2018-02-09 Nan Wang AX: Accessibility is not notified when a web process cancels the suspension https://bugs.webkit.org/show_bug.cgi?id=182659 Reviewed by Ryosuke Niwa. We were notifying Accessibility with the web process suspended information in actualPrepareToSuspend and processDidResume. However, the suspension can be canceled during the prepare call. So that we should also post a notification in cancelPrepareToSuspend. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::cancelPrepareToSuspend): 2018-02-13 Jason Marcell Cherry-pick r228415. rdar://problem/37518828 2018-02-12 Antti Koivisto Update NetworkCache::Storage::lastStableVersion after r226349 https://bugs.webkit.org/show_bug.cgi?id=182723 Reviewed by Ryosuke Niwa. * NetworkProcess/cache/NetworkCacheStorage.h: Allow deleting version 11 caches. 2018-02-13 Daniel Bates [safari-605-branch] Fix OS X El Capitan layout test failures following r228386 (https://bugs.webkit.org/show_bug.cgi?id=182358) Patch the safari-605 branch-specific NetworkLoad::didReceiveAuthenticationChallenge function to notify the Web Process when the authentication challenge is blocked. * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::didReceiveAuthenticationChallenge): 2018-02-12 Jason Marcell Cherry-pick r228231. rdar://problem/37408885 2018-02-07 Daniel Bates Log error when authentication challenge is blocked due to an insecure request https://bugs.webkit.org/show_bug.cgi?id=182358 Reviewed by Andy Estes. Have network process notify the web process when it blocks an authentication challenge. * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::completeAuthenticationChallenge): * NetworkProcess/NetworkLoadClient.h: (WebKit::NetworkLoadClient::didBlockAuthenticationChallenge): * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::didBlockAuthenticationChallenge): * NetworkProcess/NetworkResourceLoader.h: * WebProcess/Network/WebResourceLoader.cpp: (WebKit::WebResourceLoader::didBlockAuthenticationChallenge): * WebProcess/Network/WebResourceLoader.h: * WebProcess/Network/WebResourceLoader.messages.in: 2018-02-09 Jason Marcell Cherry-pick r228257. rdar://problem/37408882 2018-02-07 Antti Koivisto and Youenn Fablet REGRESSION(r227758): Webpage fails to load due to crash in com.apple.WebKit: WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse + 267 https://bugs.webkit.org/show_bug.cgi?id=182532 Reviewed by Chris Dumez. No test case, don't know how to make one. The repro involves multipart HTTP streaming and details are hazy. We were calling a function that was WTFMoved away just a few lines above. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): 2018-02-09 Jason Marcell Cherry-pick r228253. rdar://problem/37408874 2018-02-07 Tim Horton Evernote device management web view sometimes displays at the wrong scale https://bugs.webkit.org/show_bug.cgi?id=182590 Reviewed by Simon Fraser. Evernote implements the WKWebView's scroll view's delegate method viewForZoomingInScrollView: and returns nil. This results in WKScrollView's zoomScale always returning 1, no matter what the WKContentView's actual scale is. This will result in us never updating the WKContentView's scale to 1. When loading a page that has a few scale changes during load but ends up at scale 1, we get stuck at whatever intermediate scale immediately preceded settling on 1. Fix this by not forwarding viewForZoomingInScrollView: to the external WKScrollView delegate; we are in charge of the contents of the scroll view (including which view scrollView's zoomScale should track), and overriding viewForZoomingInScrollView: is only ever going to lead to a broken WebKit. * UIProcess/ios/WKScrollView.mm: (shouldForwardScrollViewDelegateMethodToExternalDelegate): (-[WKScrollViewDelegateForwarder forwardInvocation:]): (-[WKScrollViewDelegateForwarder forwardingTargetForSelector:]): 2018-02-07 Jason Marcell Cherry-pick r228230. rdar://problem/37319241 2018-02-07 Chris Dumez IndexedDB in service workers is using a memory backed store https://bugs.webkit.org/show_bug.cgi?id=182574 Reviewed by Youenn Fablet. Make sure we pass a proper WebDatabaseProvider to the ServiceWorkerProcess via PageConfiguration. Otherwise, we end up using the default EmptyDatabaseProvider which uses an InProcessIDBServer and a memory-backed store for IndexedDB. * UIProcess/ServiceWorkerProcessProxy.cpp: (WebKit::ServiceWorkerProcessProxy::start): * UIProcess/WebProcessPool.h: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection): (WebKit::WebSWContextManagerConnection::installServiceWorker): * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::establishWorkerContextConnectionToStorageProcess): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2018-02-06 Jason Marcell Cherry-pick r228198. rdar://problem/37294605 2018-02-06 Chris Dumez Layout Test imported/w3c/web-platform-tests/service-workers/service-worker/fetch-waits-for-activate.https.html is a flaky failure on macOS and iOS https://bugs.webkit.org/show_bug.cgi?id=181392 Reviewed by Youenn Fablet. All tasks from the StorageProcess to the WebContent process to update registrations and service workers state are posted to the runloop. However, the fetch callbacks do not do so. This means that fetch results might come in out of order with regards to the registration / service worker state updates. The test was flaky because an intercepted load would sometimes finish before the task to update the service worker state to "activated" was processed by the runloop. We address the issue by having the ServiceWorkerClientFetch callbacks schedule tasks to the runloop too. * WebProcess/Storage/ServiceWorkerClientFetch.cpp: (WebKit::ServiceWorkerClientFetch::didReceiveResponse): (WebKit::ServiceWorkerClientFetch::didReceiveData): (WebKit::ServiceWorkerClientFetch::didFinish): (WebKit::ServiceWorkerClientFetch::didFail): (WebKit::ServiceWorkerClientFetch::didNotHandle): 2018-02-06 Jason Marcell Cherry-pick r228188. rdar://problem/37293107 2018-02-06 Youenn Fablet HasServiceWorkerRegistration bit should be sent when creating a new page https://bugs.webkit.org/show_bug.cgi?id=182410 Reviewed by Chris Dumez. Move the bit computation at page creation time. This allows computing the bit based on the web site data store and not only on the pool configuration. WebPage uses that bit to activate service worker registration matching for the whole process. In case there is a service worker process proxy created, the bit is set to true by default. Bit is computed by checking for database file presence. This information is cached in a map for efficiency reasons and cleared when a service worker process proxy is created. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::initializeWebPage): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess): (WebKit::WebProcessPool::initializeNewWebProcess): (WebKit::WebProcessPool::mayHaveRegisteredServiceWorkers): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_cpuLimit): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): 2018-02-06 Jason Marcell Cherry-pick r228152. rdar://problem/37293023 2018-02-05 Chris Dumez Avoid unnecessarily constructing RunLoops for GC AutomaticThreads in Connection::sendMessage() after r228001 https://bugs.webkit.org/show_bug.cgi?id=182494 Reviewed by Ryosuke Niwa. Somebody fixed a GC crash in r228001 by allowing RunLoop::current() to be called from a GC thread. However, this is still unnecessarily inefficient. Calling RunLoop::current() will construct RunLoops for background GC threads (WTF::AutomaticThreads). This patches updates the IPC code to call isMainThread() instead of RunLoop::isMain() in Connection::sendMessage(). This should mean the same thing since this code runs in WebKit2 and should be more efficient as it ends up simply calling pthread_main_np(), without constructing a RunLoop. * Platform/IPC/Connection.cpp: (IPC::Connection::sendMessage): 2018-02-06 Jason Marcell Cherry-pick r228151. rdar://problem/37264535 2018-02-05 Ryosuke Niwa Release assertion in inlineVideoFrame https://bugs.webkit.org/show_bug.cgi?id=182513 Reviewed by Zalan Bujtas. Fixed the bug. Don't try to update the layout when there is no live render tree or active DOM objects had been stopped: i.e. during a document destruction. * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::inlineVideoFrame): 2018-02-06 Jason Marcell Cherry-pick r228137. rdar://problem/37264553 2018-02-05 Youenn Fablet WebsiteDataStore::resolveDirectoriesIfNecessary() should not overwrite its resolved serviceWorkerRegistrationDirectory if already set https://bugs.webkit.org/show_bug.cgi?id=182514 Reviewed by Chris Dumez. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary): 2018-02-06 Jason Marcell Cherry-pick r228125. rdar://problem/37264500 2018-02-05 Ryosuke Niwa Add DoNotProcessIncomingMessagesWhenWaitingForSyncReply to GetPlugins and RootViewToScreen https://bugs.webkit.org/show_bug.cgi?id=182458 Reviewed by Chris Dumez. Added DoNotProcessIncomingMessagesWhenWaitingForSyncReply to GetPlugins and RootViewToScreen which are found to get sent from WebContent process while ScriptDisallowedScope is present by a work-in-progress patch on webkit.org/b/182449. * WebProcess/Plugins/WebPluginInfoProvider.cpp: (WebKit::WebPluginInfoProvider::populatePluginCache): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::rootViewToScreen): 2018-02-06 Jason Marcell Cherry-pick r228116. rdar://problem/37264514 2018-02-05 Youenn Fablet Add logging to CacheStorageEngineConnection https://bugs.webkit.org/show_bug.cgi?id=182456 Reviewed by Chris Dumez. * NetworkProcess/cache/CacheStorageEngineConnection.cpp: (WebKit::CacheStorageEngineConnection::open): (WebKit::CacheStorageEngineConnection::remove): (WebKit::CacheStorageEngineConnection::caches): (WebKit::CacheStorageEngineConnection::retrieveRecords): (WebKit::CacheStorageEngineConnection::deleteMatchingRecords): (WebKit::CacheStorageEngineConnection::putRecords): (WebKit::CacheStorageEngineConnection::reference): (WebKit::CacheStorageEngineConnection::dereference): * Platform/Logging.h: 2018-02-06 Jason Marcell Cherry-pick r228114. rdar://problem/37264445 2018-02-05 Daniel Bates REGRESSION (r222795): Nike app "Refused to set unsafe header" when adding and viewing cart https://bugs.webkit.org/show_bug.cgi?id=182491 Reviewed by Brent Fulgham. Exempt Nike from the XHR header restrictions in r222795. Following r222795 only Dashboard widgets are allowed to set arbitrary XHR headers. However Nike also depends on such functionality. * UIProcess/API/Cocoa/WKWebView.mm: (shouldAllowSettingAnyXHRHeaderFromFileURLs): 2018-02-05 Jason Marcell Cherry-pick r228135. rdar://problem/37232614 2018-02-05 Brent Fulgham [iOS] Storage process is using the wrong sandbox profile filename https://bugs.webkit.org/show_bug.cgi?id=182500 Reviewed by David Kilzer. The iOS entitlements file was still referencing the old Databases sandbox profile, even though the process has been renamed 'Storage'. * Configurations/Databases-iOS.entitlements: 2018-02-05 Jason Marcell Cherry-pick r227989. rdar://problem/37145565 2018-02-01 Youenn Fablet Delay service worker process creation until actually needed by SWServer https://bugs.webkit.org/show_bug.cgi?id=182301 Reviewed by Chris Dumez. Do not create a service worker process at creation of the first SWServerConnection. Wait for a WebProcess message that needs it: - postMessage message - fetchEvent message - job scheduling. * StorageProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::startFetch): (WebKit::WebSWServerConnection::postMessageToServiceWorker): (WebKit::WebSWServerConnection::scheduleJobInServer): * StorageProcess/ServiceWorker/WebSWServerConnection.h: * StorageProcess/StorageToWebProcessConnection.cpp: (WebKit::StorageToWebProcessConnection::establishSWServerConnection): 2018-02-05 Jason Marcell Cherry-pick r227350. rdar://problem/37243993 2018-01-22 Chris Dumez Add release logging to help debug issues related to service workers https://bugs.webkit.org/show_bug.cgi?id=181935 Reviewed by Brady Eidson. * StorageProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::startFetch): (WebKit::WebSWServerConnection::didFinishFetch): (WebKit::WebSWServerConnection::didFailFetch): (WebKit::WebSWServerConnection::didNotHandleFetch): 2018-02-04 Jason Marcell Apply patch. rdar://problem/36547114 Disable some runtime feature flags on safari-605-branch 2018-02-04 Maciej Stachowiak Disable some runtime feature flags on safari-605-branch Reviewed by Maciej Stachowiak. * Shared/WebPreferences.yaml: Disable offscreen canvas. Enable WebRTC legacy API 2018-02-04 Jason Marcell Cherry-pick r228050. rdar://problem/37220143 2018-02-03 Tim Horton UI process sometimes crashes under -[WKContentView _lookupForWebView:] https://bugs.webkit.org/show_bug.cgi?id=182460 Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _lookupForWebView:]): If you have a range selection, but no rects for the selection, retrieving the 0th element of selectionRects will crash the UI process. To fix, in this case, use the rect for the starting caret instead. It doesn't seem like the presentationRect is actually currently used for the Lookup service, so the only impact is that we shouldn't crash anymore. 2018-02-04 Jason Marcell Cherry-pick r228041. rdar://problem/37220123 2018-02-02 Youenn Fablet CacheStorage should check for origin file presence when computing the origin of a folder https://bugs.webkit.org/show_bug.cgi?id=182454 Reviewed by Chris Dumez. In case caches is opened for an origin but no cache is added, we do not have a caches name file but we do have an origin filename. We should be checking the origin filename anyway since we will be reading it afterwards. * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::retrieveOriginFromDirectory): 2018-02-04 Jason Marcell Cherry-pick r228033. rdar://problem/37220144 2018-02-02 Youenn Fablet Configure serviceWorkerRegistrationDirectory on the web site data store and move it to a Caches subfolder as a default https://bugs.webkit.org/show_bug.cgi?id=182403 Reviewed by Alex Christensen. * UIProcess/WebProcessPool.cpp: (WebKit::legacyWebsiteDataStoreConfiguration): Setting serviceWorkerRegistrationDirectory for legacy stores. 2018-02-04 Jason Marcell Cherry-pick r228025. rdar://problem/37220140 2018-02-02 Youenn Fablet Clearing all service worker registrations should wait for importing service worker registration to finish https://bugs.webkit.org/show_bug.cgi?id=182407 Reviewed by Chris Dumez. Updating API to take a completion handler. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations): * UIProcess/API/C/WKWebsiteDataStoreRef.h: 2018-02-04 Jason Marcell Cherry-pick r228019. rdar://problem/37220144 2018-02-02 Youenn Fablet Configure serviceWorkerRegistrationDirectory on the web site data store and move it to a Caches subfolder as a default https://bugs.webkit.org/show_bug.cgi?id=182403 Reviewed by Alex Christensen. WebsiteDataStore is the place to set configuration information such as service worker registration path. This patch updates WebKit code accordingly. By default, the service worker registration path is in a Caches subfolder, similarly to cache API path. * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::createWithLegacyOptions): (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration): (API::ProcessPoolConfiguration::ProcessPoolConfiguration): (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/C/WKContextConfigurationRef.cpp: (WKContextConfigurationCopyServiceWorkerDatabaseDirectory): Deleted. (WKContextConfigurationSetServiceWorkerDatabaseDirectory): Deleted. * UIProcess/API/C/WKContextConfigurationRef.h: * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm: (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory): * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _serviceWorkerRegistrationDirectory]): (-[WKWebsiteDataStore _setServiceWorkerRegistrationDirectory:]): * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore): (WebKit::WebProcessPool::initializeNewWebProcess): * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::serviceWorkerRegistrationDirectory const): (WebKit::WebsiteDataStore::setServiceWorkerRegistrationDirectory): * UIProcess/gtk/WebProcessPoolGtk.cpp: * UIProcess/gtk/WebProcessPoolWPE.cpp: 2018-02-04 Jason Marcell Cherry-pick r227990. rdar://problem/37145451 2018-02-01 David Kilzer REGRESSION (r222824): UI process crashes in WebKit::WebBackForwardList::backItem const Reviewed by Alex Christensen. * UIProcess/WebBackForwardList.cpp: (WebKit::WebBackForwardList::goToItem): Fix typo so the for loop actually checks each value in m_entries. 2018-02-04 Jason Marcell Cherry-pick r227927. rdar://problem/37145549 2018-01-31 Tim Horton Occasional null deref under WebPageProxy::updateBackingStoreDiscardableState() https://bugs.webkit.org/show_bug.cgi?id=182349 Reviewed by Simon Fraser. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::updateBackingStoreDiscardableState): m_drawingArea can be null during process launch and relaunch. Cocoa ports don't use the result of setBackingStoreIsDiscardable(), but they do run this code to keep it up to date. 2018-01-31 Jason Marcell Cherry-pick r227941. rdar://problem/37092137 2018-01-31 Brent Fulgham Follow-up to r227939. https://bugs.webkit.org/show_bug.cgi?id=182354 Make sure the correct sandbox is used on iOS as well. * StorageProcess/ios/StorageProcessIOS.mm: (WebKit::StorageProcess::initializeSandbox): 2018-01-31 Jason Marcell Cherry-pick r227939. rdar://problem/37092137 2018-01-31 Brent Fulgham REGRESSION(r220094): com.apple.WebKit.Storage lost its sandbox https://bugs.webkit.org/show_bug.cgi?id=182354 Reviewed by Ryosuke Niwa. The Database process was renamed to Storage, but it's sandbox was not updated. * Configurations/WebKit.xcconfig: Update for sandbox rename. * DerivedSources.make: Ditto. * Resources/SandboxProfiles/ios/com.apple.WebKit.Databases.sb: Removed. * Resources/SandboxProfiles/ios/com.apple.WebKit.Storage.sb: Copied from Resources/SandboxProfiles/ios/com.apple.WebKit.Databases.sb. * StorageProcess/mac/com.apple.WebKit.Databases.sb.in: Removed. * StorageProcess/mac/com.apple.WebKit.Storage.sb.in: Copied from StorageProcess/mac/com.apple.WebKit.Databases.sb.in. * WebKit.xcodeproj/project.pbxproj: Update for sandbox rename. 2018-01-31 Jason Marcell Cherry-pick r227790. rdar://problem/37050332 2018-01-30 Brent Fulgham Add telemetry to track storage access API adoption https://bugs.webkit.org/show_bug.cgi?id=182197 Reviewed by Chris Dumez. This patch also handled aggregating the counts in the UIProcess, which has access to the right data. The original patch assumed the WebContent process kept track of user interaction. This is only tracked in the UIProcess, so we can get rid of some of the logging code adding in r227755. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): Rollout of r227755 changes not needed to track the statistics. (WebKit::WebProcessCreationParameters::decode): Ditto. * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto. * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::wasAccessedAsFirstPartyDueToUserInteraction): Moved from the WebContent process, which does not keep track of user interaction. (WebKit::WebResourceLoadStatisticsStore::mergeStatistics): Aggregate counts while processing the statistics. * UIProcess/WebResourceLoadStatisticsStore.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): 2018-01-31 Jason Marcell Cherry-pick r227860. rdar://problem/37050332 2018-01-30 Brent Fulgham Add telemetry to track storage access API adoption https://bugs.webkit.org/show_bug.cgi?id=182197 Reviewed by Chris Dumez. Part 2: Add telemetry for the Storage Access API case This change increments a counter when an origin is loaded in a first part context because it was granted Storage Access API permissions. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::logCookieInformation const): Add logging to indicate loads that happened with the Storage Access API enabled. * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess): Increment counter for loads using the new API. 2018-01-31 Jason Marcell Cherry-pick r227770. rdar://problem/37019490 2018-01-29 Youenn Fablet ServiceWorkerClientFetch should not consider responses without Location headers as redirection responses https://bugs.webkit.org/show_bug.cgi?id=182134 Reviewed by Chris Dumez. As per fetch spec, a response with a redirection status code but no Location header should not be considered as a redirection. This is also consistent with SubresourceLoader::didReceiveResponse. * WebProcess/Storage/ServiceWorkerClientFetch.cpp: (WebKit::ServiceWorkerClientFetch::didReceiveResponse): 2018-01-31 Jason Marcell Cherry-pick r227755. rdar://problem/37050332 2018-01-29 Brent Fulgham Add telemetry to track storage access API adoption https://bugs.webkit.org/show_bug.cgi?id=182197 Reviewed by Chris Dumez. Part 1: Add telemetry for the user interaction case This patch adds telemetry to track how frequently third-party cookies are used in a first party context due to user interaction. This will help understand cases where the new Storage Access API can help, and to help us understand if we have considered relevant use cases in its design. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/WebResourceLoadStatisticsTelemetry.cpp: (WebKit::sortedPrevalentResourceTelemetry): Update for new telemetry. (WebKit::submitTopList): Update for new data types. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): Handle the partitioning time passed from the UIProcess. 2018-01-31 Jason Marcell Cherry-pick r227869. rdar://problem/37059542 2018-01-30 Tim Horton WKWebView layout is sometimes wrong after rotation on iPhone X https://bugs.webkit.org/show_bug.cgi?id=182304 Reviewed by Simon Fraser. * Platform/spi/ios/UIKitSPI.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _computedContentInset]): (-[WKWebView _scrollViewSystemContentInset]): (activeMinimumLayoutSize): It turns out that it is not always safe to look at the safe area insets of children from inside layoutSubviews, even after the call to super. Instead, make use of the fact that WKScrollView and WKWebView have identical coordinate spaces, and map WKWebView's safe area insets into the WKScrollView. It's safe to use the scroll view's affected-edges and contentScrollInset, because those aren't updated at the same outside-of-layout time that safe area insets are. We could alternatively move all calls to activeMinimumLayoutSize outside of layoutSubviews, but that seems like a larger and riskier change. All attempts to write a test have failed; this depends heavily on use of autolayout and the mechanism by which the system updates system-owned safe area insets during device rotation. 2018-01-31 Jason Marcell Cherry-pick r227855. rdar://problem/37059539 2018-01-30 Megan Gardner Make preserve and restore focus more likely to be symmetrical https://bugs.webkit.org/show_bug.cgi?id=182264 Reviewed by Tim Horton. Keep a stack of if we actually increment the focusState, so that changes to the web content do not result in asymmetric decrements to the focus state. To work around problems associated with . * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _restoreFocusWithToken:]): (-[WKContentView _preserveFocusWithToken:destructively:]): 2018-01-30 Jason Marcell Cherry-pick r227625. rdar://problem/37019502 2018-01-25 Youenn Fablet DocumentLoader should interrupt ongoing load when getting a redirection from network that matches a service worker https://bugs.webkit.org/show_bug.cgi?id=182115 Reviewed by Alex Christensen. * WebProcess/Storage/ServiceWorkerClientFetch.cpp: (WebKit::ServiceWorkerClientFetch::didReceiveResponse): 2018-01-30 Jason Marcell Cherry-pick r227789. rdar://problem/37035797 2018-01-30 Chris Dumez Make sure we never create a WebSWClientConnection with an invalid sessionID https://bugs.webkit.org/show_bug.cgi?id=182276 Reviewed by Alex Christensen. Make sure we never create a WebSWClientConnection with an invalid sessionID as this could corrupt our hash tables. * StorageProcess/StorageProcess.cpp: (WebKit::StorageProcess::swServerForSession): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess): * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::WebSWClientConnection): * WebProcess/Storage/WebServiceWorkerProvider.cpp: (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession): (WebKit::WebServiceWorkerProvider::existingServiceWorkerConnectionForSession): * WebProcess/Storage/WebToStorageProcessConnection.cpp: (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession): 2018-01-30 Jason Marcell Cherry-pick r227772. rdar://problem/37019441 2018-01-29 Ryosuke Niwa Release assert in updateLayout while waiting for sync reply to WebPageProxy::HasInsecureContent https://bugs.webkit.org/show_bug.cgi?id=182273 Reviewed by Chris Dumez. The assertion was caused by unrelated sync IPCs being processed while WebContent process is waiting for the reply to WebPageProxy::HasInsecureContent. Since this IPC can be used while creating CachedFrame, it's not safe to execute arbitrary code. Fixed the bug by using DoNotProcessIncomingMessagesWhenWaitingForSyncReply added in r227566. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame): 2018-01-30 Jason Marcell Cherry-pick r227768. rdar://problem/37019510 2018-01-29 Youenn Fablet Cache API should make sure to resolve caches.open promises in the same order as called https://bugs.webkit.org/show_bug.cgi?id=182193 Reviewed by Chris Dumez. Covered by added test. Whenever opening/removing a cache requires writing to disk, wait to finish the task until any disk writing task is done. Applying this strategy when clearing data so that we also clear data that is pending to be written. For removing cache, we now return whether a cache was actually deleted by returning zero as removed cache identifier. WebCore uses that information to return true/false as promise resolution value. * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::retrieveCaches): * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::clear): (WebKit::CacheStorage::Caches::open): (WebKit::CacheStorage::Caches::remove): (WebKit::CacheStorage::Caches::writeCachesToDisk): (WebKit::CacheStorage::Caches::cacheInfos): (WebKit::CacheStorage::Caches::cacheInfos const): Deleted. * NetworkProcess/cache/CacheStorageEngineCaches.h: (WebKit::CacheStorage::Caches::createWeakPtr): 2018-01-30 Jason Marcell Cherry-pick r227765. rdar://problem/37019523 2018-01-29 Alex Christensen Clean up API after bugs 178240 and 176474 https://bugs.webkit.org/show_bug.cgi?id=182259 Reviewed by Dan Bernstein. NS_OPTIONS should be NSUInteger, not NSInteger. This is how all other NS_OPTIONS in WebKit are, and it's necessary if we get really big numbers as options. Changing them won't cause binary incompatibility unless someone does signed integer comparison with currently invalid values. Added availability macros I forgot to add earlier. * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: 2018-01-30 Jason Marcell Cherry-pick r227759. rdar://problem/37019477 2018-01-29 Andy Estes [iOS] Restrict synthetic clicks to the origin that handled the underlying touch event https://bugs.webkit.org/show_bug.cgi?id=182252 Reviewed by Tim Horton. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::dispatchTouchEvent): (WebKit::WebPage::updatePotentialTapSecurityOrigin): Record the target frame origin of touch events that are potential taps, are TouchStart events, are targeted in frames that have touch event listeners, and are not handled by those listeners. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::potentialTapAtPosition): (WebKit::WebPage::commitPotentialTap): (WebKit::WebPage::cancelPotentialTapInFrame): Passed the target frame origin to Frame::nodeRespondingToClickEvents() then cleared it. 2018-01-30 Jason Marcell Cherry-pick r227758. rdar://problem/37019506 2018-01-29 Alex Christensen Make policy checks more robust against null pointer dereferencing https://bugs.webkit.org/show_bug.cgi?id=182263 Reviewed by Tim Horton. We're still dereferencing null. Check everything. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): 2018-01-30 Jason Marcell Cherry-pick r227754. rdar://problem/37019474 2018-01-29 Alex Christensen Fix crash when during canAuthenticateAgainstProtectionSpace https://bugs.webkit.org/show_bug.cgi?id=182260 Reviewed by Chris Dumez. If we have a valid network load with no challenge completion handler and we are telling it to continue with the challenge handling, something has gone wrong. Maybe we've just recovered from a crashed network process. If this happens, do nothing. * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace): 2018-01-30 Jason Marcell Cherry-pick r227751. rdar://problem/37019491 2018-01-29 Chris Dumez Make sure we do not re-enter Webcore during StorageToWebProcessConnection::EstablishSWServerConnection Sync IPC https://bugs.webkit.org/show_bug.cgi?id=182256 Reviewed by Simon Fraser. Make sure we do not re-enter Webcore during StorageToWebProcessConnection::EstablishSWServerConnection Sync IPC as this can lead to crashes such as the one in . * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::WebSWClientConnection): 2018-01-30 Jason Marcell Cherry-pick r227710. rdar://problem/37019457 2018-01-26 Megan Gardner Don't retain focus for input peripheral views https://bugs.webkit.org/show_bug.cgi?id=182204 Reviewed by Tim Horton. Retaining focus on input peripheral views makes it so they cannot dismiss themselves with the current architecture. This should probably be fixed in UIKit, as there is no reason for focus to be retained on these views anyways, as they don't have keyboard input, but this guards against over-aggressive retain requests. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _restoreFocusWithToken:]): (-[WKContentView _preserveFocusWithToken:destructively:]): 2018-01-30 Jason Marcell Cherry-pick r227709. rdar://problem/37019451 2018-01-26 Chris Dumez Make sure service worker code does not launch a StorageProcess unnecessarily https://bugs.webkit.org/show_bug.cgi?id=182192 Reviewed by Geoffrey Garen. When calling WebProcess::existingWebToStorageProcessConnection(), make sure we do not force the creation of a WebProcess connection to the StorageProcess. If there is no WebProcess, just return false right away. * WebProcess/Storage/WebServiceWorkerProvider.cpp: (WebKit::WebServiceWorkerProvider::existingServiceWorkerConnectionForSession): * WebProcess/WebProcess.h: 2018-01-30 Jason Marcell Cherry-pick r227647. rdar://problem/37019494 2018-01-25 Alex Christensen REGRESSION (r221899): Web Content process hangs when webpage tries to make a new window if the WKWebView doesn’t have a UI delegate https://bugs.webkit.org/show_bug.cgi?id=182152 Reviewed by Joseph Pecoraro. Call the completion handler of the default API::UIClient::createNewPage. * UIProcess/API/APIUIClient.h: (API::UIClient::createNewPage): * UIProcess/API/C/WKPage.cpp: (WKPageSetPageUIClient): * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::createNewPage): 2018-01-30 Jason Marcell Cherry-pick r227638. rdar://problem/37019454 2018-01-25 Chris Dumez Clients.get(id) should only returns clients in the service worker's origin https://bugs.webkit.org/show_bug.cgi?id=182149 Reviewed by Youenn Fablet. * StorageProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::postMessageToServiceWorker): 2018-01-30 Jason Marcell Cherry-pick r227637. rdar://problem/37019468 2018-01-25 Youenn Fablet WebPluginInfoProvider should handle null host queries https://bugs.webkit.org/show_bug.cgi?id=182112 Reviewed by Chris Dumez. Return early if host is null. * WebProcess/Plugins/WebPluginInfoProvider.cpp: (WebKit::WebPluginInfoProvider::populatePluginCache): 2018-01-30 Jason Marcell Cherry-pick r227621. rdar://problem/37019519 2018-01-25 Alex Christensen Fix crash when preconnecting while closing private browsing https://bugs.webkit.org/show_bug.cgi?id=182114 Reviewed by Joseph Pecoraro. * NetworkProcess/PreconnectTask.cpp: There is a race condition when destroying a session while a page is initiating a preconnect. If this happens, fail gracefully instead of trying to preconnect with a null session. 2018-01-29 Jason Marcell Cherry-pick r227737. rdar://problem/36746140 2018-01-29 Brady Eidson Make it possible for apps that use both WK1 and WK2 to use MessagePorts. https://bugs.webkit.org/show_bug.cgi?id=182229 Reviewed by Chris Dumez. * UIProcess/UIMessagePortChannelProvider.cpp: (WebKit::UIMessagePortChannelProvider::UIMessagePortChannelProvider): * UIProcess/WebPageProxy.cpp: (WebKit::m_configurationPreferenceValues): The UI process does not need to override the global singleton provider. It can remain the default ProviderImpl to allow WK1 views to work fine, too. 2018-01-26 Jason Marcell Cherry-pick r227687. rdar://problem/36873343 2018-01-26 Alex Christensen Allow cellular access for default-created ephemeral sessions https://bugs.webkit.org/show_bug.cgi?id=182179 Reviewed by Andy Estes. This makes it so when we recover from a NetworkProcess crash (see r227590) on iOS, we will be able to continue browsing using cell data. * Shared/WebsiteDataStoreParameters.cpp: (WebKit::WebsiteDataStoreParameters::privateSessionParameters): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore): * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::setPrivateBrowsingEnabled): 2018-01-25 Jason Marcell Cherry-pick r227590. rdar://problem/36873343 2018-01-24 Alex Christensen Gracefully recover from NetworkProcess crashes in private browsing https://bugs.webkit.org/show_bug.cgi?id=182073 Reviewed by Geoff Garen. If we're using a non-persistent WKWebsiteDataStore and the NetworkProcess crashes and we try to do a load, then the WebProcess restarts the NetworkProcess but doesn't recreate the ephemeral session in the NetworkProcess. When this happens, we've already lost the browsing state in memory in the NetworkProcess, but we don't want to hang. If this is the problem, then just recreate the ephemeral session and continue loading. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame): (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage): * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::startNetworkLoad): * Shared/WebsiteDataStoreParameters.cpp: (WebKit::WebsiteDataStoreParameters::privateSessionParameters): (WebKit::WebsiteDataStoreParameters::legacyPrivateSessionParameters): Deleted. * Shared/WebsiteDataStoreParameters.h: (WebKit::WebsiteDataStoreParameters::legacyPrivateSessionParameters): 2018-01-25 Jason Marcell Cherry-pick r227566. rdar://problem/36722508 2018-01-24 Chris Dumez Add a IPC::SendSyncOption indicating we should not process incoming IPC while waiting for the sync reply https://bugs.webkit.org/show_bug.cgi?id=182021 Reviewed by Ryosuke Niwa. Add a new DoNotProcessIncomingMessagesWhenWaitingForSyncReply SendSyncOption that the caller can set when calling sendSync(). This indicates that the sendSync() should return only when we receive the response to our sync IPC message, and that we should not process ANY incoming IPC in the meantime. This patch also starts using this flag in 3 places where we know processing incoming IPC is an issue and is causing crashes. * Platform/IPC/Connection.cpp: (IPC::Connection::sendSyncMessage): When DoNotProcessIncomingMessagesWhenWaitingForSyncReply SendSyncOption is set, make sure we set the ShouldDispatchMessageWhenWaitingForSyncReply flag on the encoder. If we did not set this flag then it could cause deadlocks when the destination process is also waiting on a synchronous IPC from us. Normally, this flag already gets set for sync messages because sendSyncMessage() calls sendMessage() with DispatchMessageEvenWhenWaitingForSyncReply SyncOption. However, sendMessage() ignores the DispatchMessageEvenWhenWaitingForSyncReply flag if the m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage flag is set on the connection. Note that this flag is set on the connection from the WebProcess to the UIProcess at the moment, which is why we saw deadlocks on the previous iteration of this patch. (IPC::Connection::waitForSyncReply): If DoNotProcessIncomingMessagesWhenWaitingForSyncReply SendSyncOption is set, do not process incoming IPC messages while waiting for our sync IPC reply. * Platform/IPC/Connection.h: Add new SendSyncOption. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::testIncomingSyncIPCMessageWhileWaitingForSyncReply): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: Testing infrastructure. * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::loadResourceSynchronously): Use new flag. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::testIncomingSyncIPCMessageWhileWaitingForSyncReply): * WebProcess/WebCoreSupport/WebChromeClient.h: Testing infrastructure. * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue): Use new flag. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::syncIPCMessageWhileWaitingForSyncReplyForTesting): Testing infrastructure. (WebKit::WebProcess::ensureNetworkProcessConnection): Use new flag. * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: Testing infrastructure. 2018-01-24 Jason Marcell Cherry-pick r227531. rdar://problem/36830355 2018-01-24 Youenn Fablet Fetch response should copy its url from the request if null https://bugs.webkit.org/show_bug.cgi?id=182048 Reviewed by Chris Dumez. * WebProcess/Storage/ServiceWorkerClientFetch.cpp: (WebKit::ServiceWorkerClientFetch::didReceiveResponse): 2018-01-23 Jason Marcell Cherry-pick r227457. rdar://problem/36807161 2018-01-23 Eric Carlson Resign NowPlaying status when no media element is eligible https://bugs.webkit.org/show_bug.cgi?id=181914 Reviewed by Jer Noble. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _requestActiveNowPlayingSessionInfo:]): Return registeredAsNowPlayingApplication status. * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::nowPlayingInfoCallback): Ditto. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::requestActiveNowPlayingSessionInfo): Ditto. 2018-01-23 Jason Marcell Cherry-pick r227425. rdar://problem/36791667 2018-01-23 Brady Eidson Allow passing MessagePorts across processes (e.g. ServiceWorkers). https://bugs.webkit.org/show_bug.cgi?id=181178 Reviewed by Andy Estes. * StorageProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::postMessageToServiceWorker): (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient): * StorageProcess/ServiceWorker/WebSWServerConnection.h: * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in: * StorageProcess/StorageProcess.cpp: (WebKit::StorageProcess::postMessageToServiceWorkerClient): * StorageProcess/StorageProcess.h: * StorageProcess/StorageProcess.messages.in: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::entangleLocalPortInThisProcessToRemote): (WebKit::WebProcessProxy::postMessageToRemote): * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::postMessageToServiceWorker): (WebKit::WebSWClientConnection::postMessageToServiceWorkerClient): * WebProcess/Storage/WebSWClientConnection.h: * WebProcess/Storage/WebSWClientConnection.messages.in: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::postMessageToServiceWorker): (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient): * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/Storage/WebSWContextManagerConnection.messages.in: 2018-01-23 Jason Marcell Revert r227216. rdar://problem/36722508 2018-01-23 Jason Marcell Cherry-pick r227429. rdar://problem/36791608 2018-01-23 Joseph Pecoraro Web Inspector: Window resizing is broken after detaching to separate window https://bugs.webkit.org/show_bug.cgi?id=181992 Reviewed by Brian Burg. * UIProcess/mac/WebInspectorProxyMac.mm: (WebKit::WebInspectorProxy::platformDetach): Restore the inspector view's autoresizingMask to the initial value that works with a detached window. This gets changed when the view gets attached to bottom/side, so we need to revert it on detaching. 2018-01-23 Jason Marcell Cherry-pick r227419. rdar://problem/36791643 2018-01-23 Youenn Fablet REGRESSION (r227348): ASSERT_NOT_REACHED in WebKit::ServiceWorkerClientFetch::didFinish() https://bugs.webkit.org/show_bug.cgi?id=181956 Reviewed by Chris Dumez. Covered by test no longer crashing in Debug builds. Reset m_redirectionStatus to None when starting an SW fetch. * WebProcess/Storage/ServiceWorkerClientFetch.cpp: (WebKit::ServiceWorkerClientFetch::start): (WebKit::ServiceWorkerClientFetch::didFinish): 2018-01-22 Jason Marcell Cherry-pick r227358. rdar://problem/36763023 2018-01-22 Youenn Fablet SW: Make sure ServiceWorker loading and requests are correctly cleared by ITP https://bugs.webkit.org/show_bug.cgi?id=181942 Reviewed by Chris Dumez. Add ServiceWorkerRegistrations and DOMCache as persistent data to be cleared according ITP decisions. * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::monitoredDataTypes): 2018-01-22 Jason Marcell Cherry-pick r227340. rdar://problem/36746140 2018-01-22 Brady Eidson In WebKit2, make the MessagePortChannelRegistry live in the UI process. https://bugs.webkit.org/show_bug.cgi?id=181922 Reviewed by Andy Estes. With all of the work that went into making MessagePorts be fully asynchronous and to be process-aware, formally moving them out-of-process is just a matter of adding WebKit IPC layers. The basic unit of asynchronicity is "MessagePortChannelProvider", and this patch adds both a WebMessagePortChannelProvider and UIMessagePortChannelProvider for each side of the process divide. * UIProcess/UIMessagePortChannelProvider.cpp: Added. (WebKit::UIMessagePortChannelProvider::singleton): (WebKit::UIMessagePortChannelProvider::UIMessagePortChannelProvider): (WebKit::UIMessagePortChannelProvider::~UIMessagePortChannelProvider): (WebKit::UIMessagePortChannelProvider::createNewMessagePortChannel): (WebKit::UIMessagePortChannelProvider::entangleLocalPortInThisProcessToRemote): (WebKit::UIMessagePortChannelProvider::messagePortDisentangled): (WebKit::UIMessagePortChannelProvider::messagePortClosed): (WebKit::UIMessagePortChannelProvider::takeAllMessagesForPort): (WebKit::UIMessagePortChannelProvider::postMessageToRemote): (WebKit::UIMessagePortChannelProvider::checkRemotePortForActivity): (WebKit::UIMessagePortChannelProvider::checkProcessLocalPortForActivity): * UIProcess/UIMessagePortChannelProvider.h: Added. (WebKit::UIMessagePortChannelProvider::registry): * UIProcess/WebPageProxy.cpp: (WebKit::m_configurationPreferenceValues): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processForIdentifier): (WebKit::m_userMediaCaptureManagerProxy): (WebKit::WebProcessProxy::~WebProcessProxy): (WebKit::WebProcessProxy::shutDown): (WebKit::WebProcessProxy::createNewMessagePortChannel): (WebKit::WebProcessProxy::entangleLocalPortInThisProcessToRemote): (WebKit::WebProcessProxy::messagePortDisentangled): (WebKit::WebProcessProxy::messagePortClosed): (WebKit::WebProcessProxy::takeAllMessagesForPort): (WebKit::WebProcessProxy::didDeliverMessagePortMessages): (WebKit::WebProcessProxy::postMessageToRemote): (WebKit::WebProcessProxy::checkRemotePortForActivity): (WebKit::WebProcessProxy::checkProcessLocalPortForActivity): (WebKit::WebProcessProxy::didCheckProcessLocalPortForActivity): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.cpp: Added. (WebKit::WebMessagePortChannelProvider::singleton): (WebKit::WebMessagePortChannelProvider::WebMessagePortChannelProvider): (WebKit::WebMessagePortChannelProvider::~WebMessagePortChannelProvider): (WebKit::WebMessagePortChannelProvider::createNewMessagePortChannel): (WebKit::WebMessagePortChannelProvider::entangleLocalPortInThisProcessToRemote): (WebKit::WebMessagePortChannelProvider::messagePortDisentangled): (WebKit::WebMessagePortChannelProvider::messagePortClosed): (WebKit::WebMessagePortChannelProvider::takeAllMessagesForPort): (WebKit::WebMessagePortChannelProvider::didTakeAllMessagesForPort): (WebKit::WebMessagePortChannelProvider::didCheckRemotePortForActivity): (WebKit::WebMessagePortChannelProvider::postMessageToRemote): (WebKit::WebMessagePortChannelProvider::checkProcessLocalPortForActivity): (WebKit::WebMessagePortChannelProvider::checkRemotePortForActivity): * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.h: Added. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeProcess): (WebKit::WebProcess::didTakeAllMessagesForPort): (WebKit::WebProcess::checkProcessLocalPortForActivity): (WebKit::WebProcess::didCheckRemotePortForActivity): (WebKit::WebProcess::messagesAvailableForPort): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2018-01-22 Jason Marcell Cherry-pick r227218. rdar://problem/36746114 2018-01-19 Daniel Bates REGRESSION (r223149): Ref WebPageProxy objects before calling their functionality https://bugs.webkit.org/show_bug.cgi?id=181863 Reviewed by Chris Dumez. More fix ups following r223149. When notifying all pages of a process state change we need to take care to ref all the pages before iterating over them and notifying them of the change. Notifying a page of such a state change may ultimately delegate to the embedding client. And the embedding client can do anything, including deallocating one or more pages. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didBecomeUnresponsive): (WebKit::WebProcessProxy::didBecomeResponsive): (WebKit::WebProcessProxy::willChangeIsResponsive): (WebKit::WebProcessProxy::didChangeIsResponsive): (WebKit::WebProcessProxy::requestTermination): 2018-01-22 Jason Marcell Cherry-pick r227282. rdar://problem/36746077 2018-01-21 Ryosuke Niwa Turning off custom pasteboard data doesn't actually turn it off in WK2 https://bugs.webkit.org/show_bug.cgi?id=181920 Reviewed by Wenson Hsieh. Moved the code to decide when to enable custom pasteboard data from WebCore since we never enable this feature in WebKit1. * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.cpp: (defaultCustomPasteboardDataEnabled): Added. * Shared/WebPreferencesDefaultValues.h: 2018-01-22 Jason Marcell Cherry-pick r227298. rdar://problem/36746084 2018-01-22 Youenn Fablet Bump default cache storage quota to 50MB https://bugs.webkit.org/show_bug.cgi?id=181924 Reviewed by Chris Dumez. Existing web sites use more than 20 MB. * UIProcess/WebsiteData/WebsiteDataStore.h: 2018-01-22 Jason Marcell Cherry-pick r227345. rdar://problem/36745991 2018-01-22 Brent Fulgham [macOS, iOS] Allow accss to AVFoundation preference https://bugs.webkit.org/show_bug.cgi?id=181937 Reviewed by Eric Carlson. Grant access to the 'com.apple.avfoundation.frecents' preference. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2018-01-22 Jason Marcell Cherry-pick r227349. rdar://problem/36746053 2018-01-22 Brent Fulgham [iOS] REGRESSION (r225763): Allow access to power logging features https://bugs.webkit.org/show_bug.cgi?id=181938 Reviewed by Eric Carlson. I denied access to the powerlog facility in r225763, not realizing that it gets activated in certain logging scenarios. This patch reverts this change. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2018-01-22 Jason Marcell Cherry-pick r227174. rdar://problem/36723030 2018-01-18 Chris Dumez We should be able to terminate service workers that are unresponsive https://bugs.webkit.org/show_bug.cgi?id=181563 Reviewed by Alex Christensen. * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::terminateWorker): Use a 10 second timeout for forcefully exiting the service worker process when the service worker in question fails to terminate. (WebKit::WebSWContextManagerConnection::syncTerminateWorker): Use a 100ms timeout for forcefully exiting the service worker process when the service worker in question fails to terminate. This method is only called from the layout tests, which is why we use a very short timeout. 2018-01-22 Jason Marcell Cherry-pick r227274. rdar://problem/36722660 2018-01-20 Andy Estes [Apple Pay] Stop eagerly loading PassKit.framework https://bugs.webkit.org/show_bug.cgi?id=181911 Reviewed by Tim Horton. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: Removed availablePaymentNetworks from WebPageCreationParameters. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetApplePayEnabled): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): Stopped calling WebPaymentCoordinatorProxy::platformSupportsPayments(). * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp: (WebKit::WebPaymentCoordinatorProxy::availablePaymentNetworks): * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h: * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in: Added message AvailablePaymentNetworks, which synchronously returns a Vector of payment networks. * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments): Returned false if PassKitLibrary() fails. (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard): (WebKit::WebPaymentCoordinatorProxy::platformOpenPaymentSetup): Called completionHandler with false if PassKitLibrary() fails. (WebKit::WebPaymentCoordinatorProxy::platformAvailablePaymentNetworks): (WebKit::WebPaymentCoordinatorProxy::availablePaymentNetworks): Renamed availablePaymentNetworks to platformAvailablePaymentNetworks (WebKit::WebPaymentCoordinatorProxy::platformSupportsPayments): Deleted. * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Called completionHandler with false if PassKitLibrary() fails. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): Stopped calling WebPaymentCoordinatorProxy::availablePaymentNetworks(). * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::availablePaymentNetworks): (WebKit::WebPaymentCoordinator::validatedPaymentNetwork): * WebProcess/ApplePay/WebPaymentCoordinator.h: Implemented PaymentCoordinatorClient::validatedPaymentNetwork(). m_availablePaymentNetworks starts off as std::nullopt, but is initialized by sending the AvailablePaymentNetworks sync message the first time it's accessed. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): Stopped setting PageConfiguration::availablePaymentNetworks. 2018-01-22 Jason Marcell Cherry-pick r227272. rdar://problem/36722635 2018-01-20 Jer Noble Release ASSERT when reloading Vimeo page @ WebCore: WebCore::Document::updateLayout https://bugs.webkit.org/show_bug.cgi?id=181840 Reviewed by Simon Fraser. Updating layout while the document is suspended or stopped is unsafe. * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::inlineVideoFrame): 2018-01-22 Jason Marcell Cherry-pick r227269. rdar://problem/36722433 2018-01-20 Chris Dumez DOMCache data sometimes not properly removed when clearing data for a given origin https://bugs.webkit.org/show_bug.cgi?id=181887 Reviewed by Youenn Fablet. * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::clearCachesForOrigin): This code was iterating through folders on disk, then reading the folder's origin from the origin file on disk. Then, if the origin would match the one we want to delete, it would regenerate the folder path using cachesRootPath(*folderOrigin). I don't know how but on my machine, I was ended up in a state where the path generated by cachesRootPath(*folderOrigin) differed from the actual folder path we read the origin from (Likely a different salt?). To make the code more robust, I updated the code to delete "folderPath", which is the path we read the origin from. 2018-01-22 Jason Marcell Cherry-pick r227242. rdar://problem/36722539 2018-01-19 Youenn Fablet Do not go to the storage process when registering a service worker client if there is no service worker registered https://bugs.webkit.org/show_bug.cgi?id=181740 Reviewed by Chris Dumez. UIProcess notifies all web processes to register their service worker clients when spinning the service worker process. Add private API to set the number of web processes for testing purposes. * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _setMaximumNumberOfProcesses:]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::registerServiceWorkerClients): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2018-01-22 Jason Marcell Cherry-pick r227240. rdar://problem/36722464 2018-01-19 Dean Jackson REGRESSION (r221092): Swipe actions are hard to perform in FastMail app https://bugs.webkit.org/show_bug.cgi?id=181817 Reviewed by Simon Fraser. Add a linked-on-or-after check to set passive touch listeners on document in WebCore. * CMakeLists.txt: * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.cpp: Copied from Source/WebKit/UIProcess/Cocoa/VersionChecks.h. (defaultPassiveTouchListenersAsDefaultOnDocument): * Shared/WebPreferencesDefaultValues.h: * UIProcess/Cocoa/VersionChecks.h: * WebKit.xcodeproj/project.pbxproj: 2018-01-22 Jason Marcell Cherry-pick r227216. rdar://problem/36722508 2018-01-19 Chris Dumez The WebContent process should not process incoming IPC while waiting for a sync IPC reply https://bugs.webkit.org/show_bug.cgi?id=181560 Reviewed by Ryosuke Niwa. The WebContent process should not process incoming IPC while waiting for a sync IPC reply. This is causing hard-to-debug crashes because developers often assume the state does not change during a sendSync() call. * Platform/IPC/Connection.cpp: (IPC::Connection::waitForSyncReply): * Platform/IPC/Connection.h: (IPC::Connection::setShouldProcessIncomingMessagesWhileWaitingForSyncReply): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::testIncomingSyncIPCMessageWhileWaitingForSyncReply): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebProcess/Network/NetworkProcessConnection.cpp: (WebKit::NetworkProcessConnection::NetworkProcessConnection): * WebProcess/Storage/WebToStorageProcessConnection.cpp: (WebKit::WebToStorageProcessConnection::WebToStorageProcessConnection): * WebProcess/WebConnectionToUIProcess.cpp: (WebKit::WebConnectionToUIProcess::WebConnectionToUIProcess): * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::testIncomingSyncIPCMessageWhileWaitingForSyncReply): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebEditorClient.cpp: (WebKit::WebEditorClient::undo): (WebKit::WebEditorClient::redo): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::syncIPCMessageWhileWaitingForSyncReplyForTesting): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2018-01-22 Jason Marcell Cherry-pick r227161. rdar://problem/36722461 2018-01-18 Youenn Fablet Do not go to the storage process when loading a main resource if there is no service worker registered https://bugs.webkit.org/show_bug.cgi?id=181395 Reviewed by Chris Dumez. Add a new web process creation parameter to know whether there is any service worker registered at web process creation time. If there is none, the web process will then start to load HTTP resources from the network. The connection to the storage process is then executed when receiving the first bytes of the main resource. This connection is needed as other web processes may create service workers at any given time. If there is one registered service worker, the web process will wait for its connection to the storage process to be active. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/ServiceWorkerProcessProxy.cpp: (WebKit::ServiceWorkerProcessProxy::hasRegisteredServiceWorkers): * UIProcess/ServiceWorkerProcessProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): * WebProcess/Storage/WebServiceWorkerProvider.cpp: (WebKit::WebServiceWorkerProvider::existingServiceWorkerConnectionForSession): * WebProcess/Storage/WebServiceWorkerProvider.h: * WebProcess/Storage/WebToStorageProcessConnection.h: (WebKit::WebToStorageProcessConnection::existingServiceWorkerConnectionForSession): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): 2018-01-22 Jason Marcell Cherry-pick r227157. rdar://problem/36723021 2018-01-18 Chris Dumez Regression(r223149): WebProcessProxy::didClose() no longer refs WebPageProxy objects https://bugs.webkit.org/show_bug.cgi?id=181771 Reviewed by Brady Eidson. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didClose): Use copyToVectorOf>() to maintain pre-r223149 behavior and ref the pages. 2018-01-22 Jason Marcell Cherry-pick r227153. rdar://problem/36722558 2018-01-18 Chris Dumez Service Workers restored from persistent storage have 'redundant' state https://bugs.webkit.org/show_bug.cgi?id=181749 Reviewed by Youenn Fablet. Allow service workers to intercept custom protocol loads as this is useful for API testing. * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoad): (WebKit::WebLoaderStrategy::tryLoadingUsingURLSchemeHandler): * WebProcess/Network/WebLoaderStrategy.h: 2018-01-22 Jason Marcell Cherry-pick r227079. rdar://problem/36722442 2018-01-17 Youenn Fablet Put fetch request keepAlive behind a runtime flag https://bugs.webkit.org/show_bug.cgi?id=181592 Reviewed by Chris Dumez. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetFetchAPIKeepAliveEnabled): (WKPreferencesGetFetchAPIKeepAliveEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: 2018-01-19 Megan Gardner Temporarily restore block selection code conditionally https://bugs.webkit.org/show_bug.cgi?id=181895 Reviewed by Tim Horton. We need to restore this code temporarily to avoid a crash. * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]): 2018-01-19 Megan Gardner Present WKFileUploadPanel on correct ViewController https://bugs.webkit.org/show_bug.cgi?id=181884 Reviewed by Tim Horton and Joseph Pecoraro We should not be getting the main view controller directly, as done in ValidationBubbleIOS. This will keep us from presenting on view controllers are in the midst of being dismissed, etc, causing us to get into states where we lose the ability to present the WKFileUploadPanel. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView viewControllerForPresentingFileUploadPanel:]): * UIProcess/ios/forms/WKFileUploadPanel.h: * UIProcess/ios/forms/WKFileUploadPanel.mm: (fallbackViewController): (-[WKFileUploadPanel _presentFullscreenViewController:animated:]): 2018-01-18 Jason Marcell Cherry-pick r227146. rdar://problem/36624319 2018-01-18 Brent Fulgham REGRESSION(r225858): Sandbox violations due to blocked access to Spotlight search preferences https://bugs.webkit.org/show_bug.cgi?id=181797 Reviewed by Eric Carlson. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: Add the read permission for 'com.apple.lookup.shared' to support DataDetectors. 2018-01-17 Jason Marcell Cherry-pick r227103. rdar://problem/36598105 2018-01-17 John Wilander Resource Load Statistics: Block cookies for prevalent resources without user interaction https://bugs.webkit.org/show_bug.cgi?id=177394 Reviewed by Alex Christensen. * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: Now has m_hasBeenSetToUseStatelessCookieStorage to handle cookie blocking. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::statelessCookieStorage): Returns singleton empty, deny-all cookie storage for cookie blocking. The ugly pragma instructions for clang are because the NSString parameter for _initWithIdentifier was not marked nullable pre-Sierra. (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy): Instead of just decision making, this now applies the policy. (WebKit::NetworkDataTaskCocoa::applyCookiePartitioningPolicy): New method. (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Now blocks cookies for domains where cookies will be purged anyway. (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): Now blocks cookies for domains where cookies will be purged anyway. (WebKit::shouldChangePartition): Deleted. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]): Now downgrades for blocked cookies instead of partitioned cookies. (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]): Now downgrades for blocked cookies instead of partitioned cookies. 2018-01-17 Jason Marcell Cherry-pick r227093. rdar://problem/36598105 2018-01-17 Matt Lewis Unreviewed, rolling out r227076. This breaks internal builds Reverted changeset: "Resource Load Statistics: Block cookies for prevalent resources without user interaction" https://bugs.webkit.org/show_bug.cgi?id=177394 https://trac.webkit.org/changeset/227076 2018-01-17 Jason Marcell Cherry-pick r227076. rdar://problem/36598105 2018-01-17 John Wilander Resource Load Statistics: Block cookies for prevalent resources without user interaction https://bugs.webkit.org/show_bug.cgi?id=177394 Reviewed by Alex Christensen. * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: Now has m_hasBeenSetToUseStatelessCookieStorage to handle cookie blocking. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::statelessCookieStorage): Returns singleton empty, deny-all cookie storage for cookie blocking. (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy): Instead of just decision making, this now applies the policy. (WebKit::NetworkDataTaskCocoa::applyCookiePartitioningPolicy): New method. (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Now blocks cookies for domains where cookies will be purged anyway. (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): Now blocks cookies for domains where cookies will be purged anyway. (WebKit::shouldChangePartition): Deleted. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]): Now downgrades for blocked cookies instead of partitioned cookies. (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]): Now downgrades for blocked cookies instead of partitioned cookies. 2018-01-17 Jason Marcell Cherry-pick r227075. rdar://problem/36598185 2018-01-17 Daniel Bates REGRESSION (r222795): Cardiogram never signs in https://bugs.webkit.org/show_bug.cgi?id=181693 Reviewed by Ryosuke Niwa. Exempt Cardiogram from the XHR header restrictions in r222795. Following r222795 only Dashboard widgets are allowed to set arbitrary XHR headers. However Cardiogram also depends on such functionality. * Shared/WebPreferences.yaml: * UIProcess/API/Cocoa/WKWebView.mm: (shouldAllowSettingAnyXHRHeaderFromFileURLs): (-[WKWebView _initializeWithConfiguration:]): * UIProcess/Cocoa/VersionChecks.h: 2018-01-16 Jason Marcell Cherry-pick r226990. rdar://problem/36568066 2018-01-16 Eric Carlson AVSampleBufferDisplayLayer should be flushed when application activates https://bugs.webkit.org/show_bug.cgi?id=181623 Reviewed by Darin Adler. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::applicationWillResignActive): Call page. (WebKit::WebPage::applicationDidEnterBackground): Ditto, let it call libWebRTCProvider. (WebKit::WebPage::applicationWillEnterForeground): Call page. (WebKit::WebPage::applicationDidBecomeActive): Ditto, let it call libWebRTCProvider. 2018-01-16 Jason Marcell Cherry-pick r226946. rdar://problem/36568013 2018-01-15 Youenn Fablet ASSERTION FAILED: m_ptr under WebKit::CacheStorage::Caches::writeRecord https://bugs.webkit.org/show_bug.cgi?id=181401 Reviewed by Darin Adler. m_isInitialized is true but m_storage is set to nullptr when calling writeRecord. The only case seems to be if: - We are doing persistent storage - We are traversing the storage to do the initialization. At that point m_storage is set to a correct value. - clearMemoryRepresentation is called, thus setting m_storage to nullptr and m_isInitialized to false. We fix this by making clearMemoryRepresentation a no-op if we are initializing the caches. clearMemoryRepresentation is about cleaning the in-memory information of the caches and the memory representation is empty at init time. Nullifying m_storage is a memory consumption optimization. * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::clearMemoryRepresentation): 2018-01-16 Jason Marcell Cherry-pick r226904. rdar://problem/36568017 2018-01-12 Youenn Fablet WebProcess should pass the registration identifier and not the worker identifier for fetch events https://bugs.webkit.org/show_bug.cgi?id=181591 Reviewed by Chris Dumez. Use service worker registration identifier to compute the active service worker identifier responsible to handle the fetch event. * StorageProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::startFetch): * StorageProcess/ServiceWorker/WebSWServerConnection.h: * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in: * WebProcess/Storage/ServiceWorkerClientFetch.cpp: (WebKit::ServiceWorkerClientFetch::start): * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::startFetch): * WebProcess/Storage/WebSWClientConnection.h: * WebProcess/Storage/WebServiceWorkerProvider.cpp: (WebKit::shouldHandleFetch): 2018-01-16 Jason Marcell Cherry-pick r226790. rdar://problem/36568094 2018-01-11 Youenn Fablet Replace WebRTCLegacyAPIDisabled by WebRTCLegacyAPIEnabled and switch off WebRTC legacy flag by default https://bugs.webkit.org/show_bug.cgi?id=181480 Reviewed by Eric Carlson. Renaming preference to WebRTCLegacyAPIEnabled for simplification and removing it from experimental feature. Set it to off by default. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetWebRTCLegacyAPIEnabled): (WKPreferencesGetWebRTCLegacyAPIEnabled): * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _webRTCLegacyAPIEnabled]): (-[WKPreferences _setWebRTCLegacyAPIEnabled:]): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): 2018-01-12 Jason Marcell Cherry-pick r226838. rdar://problem/36480711 2018-01-11 Brent Fulgham REGRESSION(r219530): ResourceLoadStatisticsPersistentStorage should be read-only in ephemeral sessions https://bugs.webkit.org/show_bug.cgi?id=181136 Reviewed by Chris Dumez. Some uses of WebKit involve running a UIProcess as an ephemeral session for the life of the process. In this case, we do not initialize the data path for the set of load statistics triggering an assertion. We actually intended ephemeral sessions to consume the existing resource load data (presumably captured during non-ephemeral browsing). This would be a read-only mode, where it would not add new entries to the load statistics, but would take advantage of existing observations. Currently that does not happen (for this type of WebKit embed), which forces each run as an ephemeral session to build up in-memory browsing data until it has enough observations to begin modifying loads. We need to set the ResourceLoadStatisticsPersistentStorage object to a "read only" mode in this case, so that it read (but does not write) from this database. Tested by ephemeral website data TestWebKitAPI tests. * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp: (WebKit::ResourceLoadStatisticsPersistentStorage::create): Added to allow creation of the right style of Persistent Storage. (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage): Initialize the new data member. (WebKit::ResourceLoadStatisticsPersistentStorage::asyncWriteTimerFired): RELEASE_ASSERT that we never run this method when in "read only" mode. (WebKit::ResourceLoadStatisticsPersistentStorage::writeMemoryStoreToDisk): Ditto. (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore): Return early if asked to schedule a write operation for a "read only" persistent store. (WebKit::ResourceLoadStatisticsPersistentStorage::finishAllPendingWorkSynchronously): RELEASE_ASSERT if we ever shut down in "read only" mode with an active write timer. * UIProcess/ResourceLoadStatisticsPersistentStorage.h: * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): Pass a flag indicating whether the storage session is ephemeral or not. * UIProcess/WebResourceLoadStatisticsStore.h: 2018-01-12 Jason Marcell Apply patch. rdar://problem/36303061 Disable WebKit features we don't want to ship after branching 2018-01-12 Maciej Stachowiak Disable WebKit features we don't want to ship after branching Reviewed by Maciej Stachowiak. * Configurations/FeatureDefines.xcconfig: 2018-01-12 Jason Marcell Cherry-pick r226792. rdar://problem/36450742 2018-01-11 Youenn Fablet Redirected iframe loading with Request.redirect=follow should fail https://bugs.webkit.org/show_bug.cgi?id=181491 Reviewed by Alex Christensen. * WebProcess/Storage/ServiceWorkerClientFetch.cpp: (WebKit::ServiceWorkerClientFetch::validateResponse): 2018-01-11 Jason Marcell Cherry-pick r226826. rdar://problem/36458927 2018-01-11 Megan Gardner Implement MultiDocument protocol for restoring focus to a WKWebView https://bugs.webkit.org/show_bug.cgi?id=181510 Reviewed by Dan Bernstein. Support the UIKit protocol for restoring focus to a what previously had focus. WebKit already has a method to silently remove and replace focus, without telling the web process about the unfocus and refocusing, so we're just using that. * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _restoreFocusWithToken:]): (-[WKContentView _preserveFocusWithToken:destructively:]): 2018-01-11 Jason Marcell Cherry-pick r226753. rdar://problem/36429138 2018-01-10 Wenson Hsieh REGRESSION(r222507): Composition highlight doesn't render when using IME https://bugs.webkit.org/show_bug.cgi?id=181485 Reviewed by Ryosuke Niwa. Add plumbing for a `suppressUnderline` argument when setting marked text. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageSetComposition): * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setCompositionForTesting): * WebProcess/WebPage/WebPage.h: 2018-01-11 Jason Marcell Cherry-pick r226750. rdar://problem/36429156 2018-01-10 Tim Horton REGRESSION (r213590): Swipe from edge to go to previous page is significantly slower than tapping back button on Twitter https://bugs.webkit.org/show_bug.cgi?id=181269 Reviewed by Simon Fraser. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _processDidExit]): (-[WKWebView _didCommitLayerTree:]): When swiping to a page that set history.scrollRestoration = "manual", we will never restore the scroll position. We will still restore "state", but won't have a location. Currently, the code assumes that it should wait to remove the swipe snapshot until the scroll position is restored. Instead, wait until the "state" is restored, whether or not that includes a scroll position/center point restoration. Do this by making _firstTransactionIDAfterPageRestore an optional, and reset it after it fires, so that we only run the restoration code in _didCommitLayerTree for the first commit after state restoration, not all subsequent commits. Then, tell ViewGestureController that the scroll position has been restored even if the page opted out. The reason that this is specific to pushState is that normal, non-same-document loads bail from waiting for the scroll position restoration in VGC::didReachMainFrameLoadTerminalState() (see the long comment there for an explanation). (-[WKWebView _beginBackSwipeForTesting]): (-[WKWebView _completeBackSwipeForTesting]): * Platform/spi/ios/UIKitSPI.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/ViewGestureController.h: * UIProcess/ios/ViewGestureControllerIOS.mm: (-[WKSwipeTransitionController transitionForDirection:]): (WebKit::ViewGestureController::beginSimulatedSwipeInDirectionForTesting): (WebKit::ViewGestureController::completeSimulatedSwipeInDirectionForTesting): * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::beginSimulatedSwipeInDirectionForTesting): (WebKit::ViewGestureController::completeSimulatedSwipeInDirectionForTesting): Add a mechanism to forcefully test swipe back. Instead of simulating events like on Mac, we just talk to the UIKit internals and force the interaction to start, pause, and then complete when we want. 2018-01-11 Jason Marcell Cherry-pick r226742. rdar://problem/36429136 2018-01-10 Brent Fulgham Use protectedThis for the 'updatePrevalentDomainsToPartitionOrBlockCookies' lambda https://bugs.webkit.org/show_bug.cgi?id=181452 Reviewed by Chris Dumez. We forgot to use a 'protectedThis' back in r225006 for one of the lambdas used by the WebsiteDataStore for processing. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback): 2018-01-11 Jason Marcell Cherry-pick r226644. rdar://problem/36429133 2018-01-09 Paul Knight Don't record dynamic spelling corrections while in an ephemeral browsing session https://bugs.webkit.org/show_bug.cgi?id=181417 Dynamic spelling correction responses are kept on disk. Avoid recording these responses when in an ephemeral session. Reviewed by Tim Horton and Wenson Hsieh. * UIProcess/mac/CorrectionPanel.h: * UIProcess/mac/CorrectionPanel.mm: (WebKit::CorrectionPanel::recordAutocorrectionResponse): Add a WebViewImpl parameter so we can query the current session. Return early before recording the response if the session is ephemeral. (WebKit::CorrectionPanel::handleAcceptedReplacement): Update a caller to include the new parameter. * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::recordAutocorrectionResponse): Ditto. 2018-01-09 Jason Marcell Cherry-pick r226669. rdar://problem/36393011 2018-01-09 John Wilander Storage Access API: Turn feature on by default in WebPreferences.yaml https://bugs.webkit.org/show_bug.cgi?id=181458 Reviewed by Brent Fulgham. * Shared/WebPreferences.yaml: 2018-01-09 Jason Marcell Cherry-pick r226626. rdar://problem/36392359 2018-01-09 Youenn Fablet SWClientConnection should not keep references to service worker jobs https://bugs.webkit.org/show_bug.cgi?id=181381 Reviewed by Chris Dumez. Updated IPC handling based on WebCore refactoring. * Scripts/webkit/messages.py: (forward_declarations_and_headers): (headers_for_type): * StorageProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::rejectJobInClient): (WebKit::WebSWServerConnection::resolveRegistrationJobInClient): (WebKit::WebSWServerConnection::resolveUnregistrationJobInClient): (WebKit::WebSWServerConnection::startScriptFetchInClient): * StorageProcess/ServiceWorker/WebSWServerConnection.h: * WebProcess/Storage/WebSWClientConnection.messages.in: 2018-01-09 Jason Marcell Cherry-pick r226542. rdar://problem/36392364 2018-01-08 John Wilander Storage Access API: Remove access for all frames under a page when the page is closed https://bugs.webkit.org/show_bug.cgi?id=181398 Reviewed by Alex Christensen. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::close): 2018-01-09 Jason Marcell Cherry-pick r226528. rdar://problem/36392391 2018-01-08 Youenn Fablet Caches::writeCachesToDisk should assert that it is initialized https://bugs.webkit.org/show_bug.cgi?id=181383 Reviewed by Alex Christensen. Add assertion to ensure caches is initialized * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::writeCachesToDisk): 2018-01-09 Jason Marcell Cherry-pick r226519. rdar://problem/36392376 2018-01-08 Youenn Fablet WebProcessPool::terminateServiceWorkerProcess should protect itself in debug builds https://bugs.webkit.org/show_bug.cgi?id=181384 Reviewed by Chris Dumez. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::terminateServiceWorkerProcess): 2018-01-08 Frederic Wang Unreviewed build fix after r226211. * UIProcess/API/Cocoa/WKPreferencesPrivate.h: Use WK_IOS_TBA for iOS. 2018-01-08 Youenn Fablet navigator.onLine does not work inside service workers https://bugs.webkit.org/show_bug.cgi?id=181079 Reviewed by Darin Adler. Added support for a callback called for each service worker proxy creation. Callback is used by WTR to inject a self.internals object used for testing. * WebProcess/InjectedBundle/API/c/WKBundle.cpp: (WKBundleSetServiceWorkerProxyCreationCallback): * WebProcess/InjectedBundle/API/c/WKBundle.h: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::setServiceWorkerProxyCreationCallback): * WebProcess/InjectedBundle/InjectedBundle.h: 2018-01-07 David Kilzer Enable -Wcast-qual for WebInspectorUI, WebKitLegacy, WebKit projects Reviewed by Darin Adler. * Configurations/Base.xcconfig: (WARNING_CFLAGS): Add -Wcast-qual. * NetworkProcess/cache/NetworkCacheCodersCocoa.cpp: (WTF::Persistence::encodeCertificateChain): Include TypeCastsCF.h from WTF, and use checked_cf_cast() to fix warning. * Platform/cocoa/WKCrashReporter.mm: (WebKit::setCrashReportApplicationSpecificInformation): - Move `oldMessage` check above nullptr check to fix a leak when passing in nullptr after previously setting the crash string. - Change C-style cast to const_cast() to fix warning. * PluginProcess/mac/PluginProcessShim.mm: (WebKit::shim_shmat): Change C-style cast to const_cast() to fix warning. * Shared/Authentication/mac/AuthenticationManager.mac.mm: (WebKit::leafCertificate): Include TypeCastsCF.h from WTF, and use checked_cf_cast() to fix warning. * Shared/cf/ArgumentCodersCF.cpp: (IPC::encode): Use static_cast<>(const_cast() to fix warnings since the CFTypeID has already been checked. * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::decodeNSError): Use an `auto` variable to hold the CFMutableDictionaryRef, then WTFMove() to assign it back to `userInfo`. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::takeWindowSnapshot): Include TypeCastsCF.h from WTF, and use checked_cf_cast() to fix warning. 2018-01-07 Konstantin Tokarev [cmake] Unset CMAKE_REQUIRED_LIBRARIES after check_function_exists test https://bugs.webkit.org/show_bug.cgi?id=181371 Reviewed by Michael Catanzaro. This variable is used by check_function_exists internally, its value should be never used for anything else. * CMakeLists.txt: 2018-01-05 Dan Bernstein REGRESSION (r226218): iOS-only assets are installed on macOS https://bugs.webkit.org/show_bug.cgi?id=181362 Reviewed by Anders Carlsson. * Configurations/WebKit.xcconfig: Exclude everything under Resources/ios when not targeting iOS. * Resources/ios: Added. * Resources/ios/iOS.xcassets: Moved from Source/WebKit/WebKit.xcassets. * Resources/ios/iOS.xcassets/LockMini.imageset/NavigationBarLockMini@2x.pdf: Set the svn:mime-type property. * Resources/ios/iOS.xcassets/LockMini.imageset/NavigationBarLockMini@3x.pdf: Ditto. * Resources/mac: Added. * Resources/mac/mediaIcon.pdf: Moved here… * Resources/mediaIcon.pdf: …from here. * WebKit.xcassets: Moved under Resources/ios. * WebKit.xcodeproj/project.pbxproj: Created an ios group under the Resources group, and cleaned up the mac group. Removed the Recovered References group. 2018-01-05 John Wilander Storage Access API: Refactor to make naming accurate and explicit, simplify access table, and prepare for access removal for page https://bugs.webkit.org/show_bug.cgi?id=181357 Reviewed by Alex Christensen. This change does the following: - Changes function and message names to reflect how this feature was eventually implemented, i.e. access per frame. - Makes it explicit that the UI process is only involved in granting storage access and not removing storage access. The latter is done directly by the web process. - Simplifies the network process' entry map since only needs to be able to give access to one domain in one frame at a time. Access goes away on frame navigation so there can only be one domain at a time per frame. Also, the map now uses pageIDs as main keys to prepare for efficient access removal for all frames under a page. - Fixes a bug in so that a cross-origin iframe with the same partition as the top frame correctly is handled as already having access. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame): (WebKit::NetworkConnectionToWebProcess::removeStorageAccess): Deleted. * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::hasStorageAccessForFrame): (WebKit::NetworkProcess::grantStorageAccessForFrame): (WebKit::NetworkProcess::hasStorageAccessForPrevalentDomains): Deleted. (WebKit::NetworkProcess::updateStorageAccessForPrevalentDomains): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::hasStorageAccessForFrame): (WebKit::NetworkProcessProxy::grantStorageAccessForFrame): (WebKit::NetworkProcessProxy::hasStorageAccessForPrevalentDomains): Deleted. (WebKit::NetworkProcessProxy::updateStorageAccessForPrevalentDomains): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess): (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess): * UIProcess/WebResourceLoadStatisticsStore.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::hasStorageAccessForFrameHandler): (WebKit::WebsiteDataStore::grantStorageAccessForFrameHandler): (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback): (WebKit::WebsiteDataStore::hasStorageAccessForPrevalentDomainsHandler): Deleted. (WebKit::WebsiteDataStore::updateStorageAccessForPrevalentDomainsHandler): Deleted. * UIProcess/WebsiteData/WebsiteDataStore.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::detachedFromParent2): (WebKit::WebFrameLoaderClient::dispatchWillChangeDocument): 2018-01-05 Youenn Fablet Implement Cache API partitioning based on ClientOrigin https://bugs.webkit.org/show_bug.cgi?id=181240 Reviewed by Alex Christensen. open and retrieveCaches now take a ClientOrigin instead of a String. Updated cache filesystem path computation to take both client origin and top origin. When clearing an origin, caches whose client origin or top origin matches the origin are cleared. Caches are added to the web site data of their client origin with their corresponding cache size. Caches are added to the web site data of their top origin with a size equal to 0. Updated memory representation dumping used for test to include both top and client origins. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::cachesRootPath): (WebKit::CacheStorage::Engine::open): (WebKit::CacheStorage::Engine::remove): (WebKit::CacheStorage::Engine::retrieveCaches): (WebKit::CacheStorage::Engine::readCachesFromDisk): (WebKit::CacheStorage::Engine::removeCaches): (WebKit::CacheStorage::Engine::fetchEntries): (WebKit::CacheStorage::Engine::clearCachesForOrigin): (WebKit::CacheStorage::Engine::clearMemoryRepresentation): (WebKit::CacheStorage::Engine::representation): * NetworkProcess/cache/CacheStorageEngine.h: * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::Cache::Cache): * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::retrieveOriginFromDirectory): (WebKit::CacheStorage::Caches::Caches): (WebKit::CacheStorage::Caches::storeOrigin): (WebKit::CacheStorage::Caches::readOrigin): (WebKit::CacheStorage::Caches::open): * NetworkProcess/cache/CacheStorageEngineCaches.h: (WebKit::CacheStorage::Caches::create): (WebKit::CacheStorage::Caches::origin const): * NetworkProcess/cache/CacheStorageEngineConnection.cpp: (WebKit::CacheStorageEngineConnection::open): (WebKit::CacheStorageEngineConnection::caches): (WebKit::CacheStorageEngineConnection::clearMemoryRepresentation): * NetworkProcess/cache/CacheStorageEngineConnection.h: * NetworkProcess/cache/CacheStorageEngineConnection.messages.in: * WebProcess/Cache/WebCacheStorageConnection.cpp: (WebKit::WebCacheStorageConnection::doOpen): (WebKit::WebCacheStorageConnection::doRetrieveCaches): (WebKit::WebCacheStorageConnection::clearMemoryRepresentation): * WebProcess/Cache/WebCacheStorageConnection.h: 2018-01-05 Megan Gardner Show Keyboard when re-launching WKWebView with a previously focused element https://bugs.webkit.org/show_bug.cgi?id=181353 Reviewed by Tim Horton. When relaunching an app with a WKWebView, restore the keyboard if there was a previously focused element that was being assisted. The element was already being tracked, we just needed to not bail on showing the keyboard for instances where it was a state change that caused the element to be refocused. * UIProcess/PageClient.h: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::startAssistingNode): * UIProcess/ios/WKContentView.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]): Deleted. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::startAutoscrollAtPosition): (WebKit::WebPageProxy::startAssistingNode): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setActivityState): (WebKit::WebPage::elementDidFocus): * WebProcess/WebPage/WebPage.h: 2018-01-05 Alex Christensen Restrict navigation-time WKWebsiteDataStore swapping to main frame navigations https://bugs.webkit.org/show_bug.cgi?id=181217 Reviewed by Tim Horton. If we swap during an iframe navigation, then we get a page in a strange state. The intent of the main frame navigation WKWebsiteDataStore swap is that that is a time when we can change storages without a page in an inconsistent state. * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): 2018-01-05 Alex Christensen Add WKBundleFrameCreateFrameHandle https://bugs.webkit.org/show_bug.cgi?id=181232 Reviewed by Tim Horton. InjectedBundle clients wanting to sent a _WKFrameHandle cannot without this function. Before, they would just send the WKBundleFrameRef which would be changed into a WKFrameRef in the UIProcess by WebProcessProxy::transformHandlesToObjects, but there is no ObjC equivalent of WKFrameRef, so we were just getting a WKObject when we wanted a _WKFrameHandle. We can't change WebProcessProxy::transformHandlesToObjects without being incompatible with the existing C API, so let's add a way for clients to say "I want a _WKFrameHandle". * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundleFrameCreateFrameHandle): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: 2018-01-05 Wenson Hsieh [Attachment Support] Add a way to write blob data to a file URL from the UI process https://bugs.webkit.org/show_bug.cgi?id=181236 Reviewed by Brady Eidson. Add support for writing a blob to a designated file path. In WebKit, this is mainly plumbing writeBlobToFilePath through WebPageProxy to the network process. * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp: (WebKit::NetworkBlobRegistry::writeBlobToFilePath): Call out to the BlobRegistryImpl to write blobs to the file path. Additionally grant sandbox extensions for any file-backed blob parts corresponding to the given blob URL. (WebKit::NetworkBlobRegistry::filesInBlob): Introduce a version of filesInBlob that doesn't check against the NetworkConnectionToWebProcess. This is used when the UI process is the driver for writing a blob. * NetworkProcess/FileAPI/NetworkBlobRegistry.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::writeBlobToFilePath): Temporarily grant sandbox access to the given file path. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): Deleted. (IPC::ArgumentCoder::decode): Deleted. Remove PromisedBlobData (see WebCore/ChangeLog for more information). * Shared/WebCoreArgumentCoders.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::didClose): If the network process is terminated, flush any pending callbacks in m_writeBlobToFilePathCallbackMap, passing in a failure result (success := false) and clearing the callback map. (WebKit::NetworkProcessProxy::writeBlobToFilePath): (WebKit::NetworkProcessProxy::didWriteBlobToFilePath): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::writeBlobToFilePath): * UIProcess/WebPageProxy.h: 2018-01-05 Dan Bernstein Add injected bundle equivalents of DOMHTMLDocument (DOMHTMLDocumentExtensions) https://bugs.webkit.org/show_bug.cgi?id=181345 Reviewed by Tim Horton. * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h: Declared new methods. * WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm: (-[WKDOMDocument createDocumentFragmentWithMarkupString:baseURL:]): Added. Calls WebCore’s createFragmentFromMarkup. (-[WKDOMDocument createDocumentFragmentWithText:]): Added. Calls WebCore’s createFragmentFromText. 2018-01-05 Don Olmstead [Curl] Add implementation stubs for Network Cache https://bugs.webkit.org/show_bug.cgi?id=181343 Reviewed by Alex Christensen. * NetworkProcess/cache/NetworkCacheCodersCurl.cpp: Added. (WTF::Persistence::Coder::encode): (WTF::Persistence::Coder::decode): * NetworkProcess/cache/NetworkCacheDataCurl.cpp: Added. (WebKit::NetworkCache::Data::Data): (WebKit::NetworkCache::Data::empty): (WebKit::NetworkCache::Data::data const): (WebKit::NetworkCache::Data::isNull const): (WebKit::NetworkCache::Data::apply const): (WebKit::NetworkCache::Data::subrange const): (WebKit::NetworkCache::concatenate): (WebKit::NetworkCache::Data::adoptMap): * NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp: Added. (WebKit::NetworkCache::IOChannel::IOChannel): (WebKit::NetworkCache::IOChannel::~IOChannel): (WebKit::NetworkCache::IOChannel::open): (WebKit::NetworkCache::IOChannel::read): (WebKit::NetworkCache::IOChannel::write): * PlatformWin.cmake: 2018-01-05 Don Olmstead [Curl] Update method declarations in WebKit https://bugs.webkit.org/show_bug.cgi?id=181342 Reviewed by Alex Christensen. * NetworkProcess/Downloads/curl/DownloadCurl.cpp: (WebKit::Download::resume): * NetworkProcess/curl/RemoteNetworkingContextCurl.cpp: (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession): Deleted. (WebKit::RemoteNetworkingContext::blockedError const): Deleted. 2018-01-05 Don Olmstead WebFullScreenManager should compile when ENABLE(VIDEO) is off https://bugs.webkit.org/show_bug.cgi?id=181338 Reviewed by Alex Christensen. * WebProcess/FullScreen/WebFullScreenManager.cpp: (WebKit::WebFullScreenManager::didEnterFullScreen): (WebKit::WebFullScreenManager::willExitFullScreen): * WebProcess/FullScreen/WebFullScreenManager.h: 2018-01-05 Andy Estes [Apple Pay] Disable Apple Pay on platforms that don't have PassKit.framework https://bugs.webkit.org/show_bug.cgi?id=181335 Reviewed by Brady Eidson. When Safari is running in the macOS Base System, PassKit.framework is not available. If we fail to dlopen PassKit, we should disable Apple Pay. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetApplePayEnabled): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h: * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::WebPaymentCoordinatorProxy::availablePaymentNetworks): (WebKit::WebPaymentCoordinatorProxy::platformSupportsPayments): 2018-01-05 Dan Bernstein Fixed the build following AppKit API deprecations in a recent SDKs * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController enterFullScreen:]): Suppressed deprecation warnings. (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): Ditto. (-[WKFullScreenWindowController exitFullScreen]): Ditto. (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): Ditto. (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]): Ditto. (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]): Ditto. (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]): Ditto. * UIProcess/mac/WKPrintingView.mm: (-[WKPrintingView _setAutodisplay:]): Ditto. 2018-01-05 Matt Lewis Unreviewed, rolling out r226401. This caused timeouts on multiple platforms. Reverted changeset: "Implement Cache API partitioning based on ClientOrigin" https://bugs.webkit.org/show_bug.cgi?id=181240 https://trac.webkit.org/changeset/226401 2018-01-05 Joseph Pecoraro ServiceWorkers: Enable UserTiming / ResourceTiming https://bugs.webkit.org/show_bug.cgi?id=181297 Reviewed by Youenn Fablet. * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::updatePreferencesStore): Enable Resource Timing / User Timing for the ServiceWorker process. 2018-01-04 Zan Dobersek Unreviewed GTK+ build fix. * UIProcess/API/glib/WebKitUserMediaPermissionRequest.cpp: (webkit_user_media_permission_is_for_audio_device): Call UserMediaPermissionRequestProxy::requiresAudioCapture(). (webkit_user_media_permission_is_for_video_device): Call UserMediaPermissionRequestProxy::requiresVideoCapture(). 2018-01-04 Don Olmstead [Curl] Fix compilation error in WebFrameNetworkingContext https://bugs.webkit.org/show_bug.cgi?id=181312 Reviewed by Alex Christensen. * WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.cpp: (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession): 2018-01-04 Tim Horton WKWebView loses minimum layout size overrides that happen while the process is terminated https://bugs.webkit.org/show_bug.cgi?id=181306 Reviewed by Dan Bernstein. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _didRelaunchProcess]): Deleted. * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * UIProcess/WebPageProxy.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::didRelaunchProcess): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize): (WebKit::WebPageProxy::setForceAlwaysUserScalable): (WebKit::WebPageProxy::setMaximumUnobscuredSize): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): Pass the current viewport minimum layout size and maximum unobscured size in the WebPageCreationParameters instead of re-sending them in _didRelaunchProcess. The previous approach was problematic when _dispatchSetMinimumLayoutSize: was changed to not re-send identical updates, because if the client calls _overrideLayoutParametersWithMinimumLayoutSize before the Web Content process is re-launched (after terminating), we would cache the size, attempt to send it, fail silently (because the process is not launched), and then in _didRelaunchProcess we would choose not to re-send (after the process is successfully relaunched) because we think we already sent the new value. Add isValid() checks to our message sends. Ideally send() would assert if the process is not alive to avoid problems like this, but it doesn't (yet). Get rid of WKWebView's _didRelaunchProcess, because it does nothing now. 2018-01-04 Stephan Szabo NetworkProcess cache files use functions from unistd.h without explicitly including it https://bugs.webkit.org/show_bug.cgi?id=181261 Reviewed by Alex Christensen. * NetworkProcess/cache/NetworkCacheBlobStorage.cpp: * NetworkProcess/cache/NetworkCacheData.cpp: 2018-01-04 Keith Rollin Add commas https://bugs.webkit.org/show_bug.cgi?id=181295 Reviewed by Brent Fulgham. Fix a problem introduced in r226226 where the emitted JSON didn't include some required commas. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::logCookieInformation const): 2018-01-04 Eric Carlson [MediaStream] Add Mock screen capture source https://bugs.webkit.org/show_bug.cgi?id=181291 Reviewed by Dean Jackson. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): Deleted, moved to CaptureDevice.h (IPC::ArgumentCoder::decode): Ditto. * Shared/WebCoreArgumentCoders.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: Add _WKCaptureDeviceDisplay. * UIProcess/Cocoa/UIDelegate.mm: (WebKit::requestUserMediaAuthorizationForDevices): Deal with display capture. (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): Ditto. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied): requiresAudio -> requiresAudioCapture. (WebKit::UserMediaPermissionRequestManagerProxy::searchForGrantedRequest const): Never reuse a previously granted display capture request. * UIProcess/UserMediaPermissionRequestProxy.cpp: (WebKit::UserMediaPermissionRequestProxy::allow): Search the eligible devices instead of asking the source center to find devices. * UIProcess/UserMediaPermissionRequestProxy.h: (WebKit::UserMediaPermissionRequestProxy::requiresAudioCapture const): Renamed. (WebKit::UserMediaPermissionRequestProxy::requiresVideoCapture const): Ditto. (WebKit::UserMediaPermissionRequestProxy::requiresDisplayCapture const): New. (WebKit::UserMediaPermissionRequestProxy::requiresAudio const): Deleted. (WebKit::UserMediaPermissionRequestProxy::requiresVideo const): Deleted. 2018-01-04 Youenn Fablet FetchResponse should set its internal response text encoding name https://bugs.webkit.org/show_bug.cgi?id=181284 Reviewed by Alex Christensen. * WebProcess/Storage/ServiceWorkerClientFetch.cpp: (WebKit::ServiceWorkerClientFetch::didReceiveResponse): Set default encoding to UTF-8. 2018-01-04 Youenn Fablet Implement Cache API partitioning based on ClientOrigin https://bugs.webkit.org/show_bug.cgi?id=181240 Reviewed by Alex Christensen. open and retrieveCaches now take a ClientOrigin instead of a String. Updated cache filesystem path computation to take both client origin and top origin. When clearing an origin, caches whose client origin or top origin matches the origin are cleared. Caches are added to the web site data of their client origin with their corresponding cache size. Caches are added to the web site data of their top origin with a size equal to 0. Updated memory representation dumping used for test to include both top and client origins. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::cachesRootPath): (WebKit::CacheStorage::Engine::open): (WebKit::CacheStorage::Engine::remove): (WebKit::CacheStorage::Engine::retrieveCaches): (WebKit::CacheStorage::Engine::readCachesFromDisk): (WebKit::CacheStorage::Engine::removeCaches): (WebKit::CacheStorage::Engine::fetchEntries): (WebKit::CacheStorage::Engine::clearCachesForOrigin): (WebKit::CacheStorage::Engine::clearMemoryRepresentation): (WebKit::CacheStorage::Engine::representation): * NetworkProcess/cache/CacheStorageEngine.h: * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::Cache::Cache): * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::retrieveOriginFromDirectory): (WebKit::CacheStorage::Caches::Caches): (WebKit::CacheStorage::Caches::storeOrigin): (WebKit::CacheStorage::Caches::readOrigin): (WebKit::CacheStorage::Caches::open): * NetworkProcess/cache/CacheStorageEngineCaches.h: (WebKit::CacheStorage::Caches::create): (WebKit::CacheStorage::Caches::origin const): * NetworkProcess/cache/CacheStorageEngineConnection.cpp: (WebKit::CacheStorageEngineConnection::open): (WebKit::CacheStorageEngineConnection::caches): (WebKit::CacheStorageEngineConnection::clearMemoryRepresentation): * NetworkProcess/cache/CacheStorageEngineConnection.h: * NetworkProcess/cache/CacheStorageEngineConnection.messages.in: * WebProcess/Cache/WebCacheStorageConnection.cpp: (WebKit::WebCacheStorageConnection::doOpen): (WebKit::WebCacheStorageConnection::doRetrieveCaches): (WebKit::WebCacheStorageConnection::clearMemoryRepresentation): * WebProcess/Cache/WebCacheStorageConnection.h: 2018-01-04 Youenn Fablet Service Worker should expose redirect mode for navigation loads as manual https://bugs.webkit.org/show_bug.cgi?id=181067 Reviewed by Alex Christensen. * WebProcess/Storage/ServiceWorkerClientFetch.cpp: (WebKit::ServiceWorkerClientFetch::didReceiveResponse): 2018-01-03 Wenson Hsieh [Attachment Support] Create attachment elements when dropping files on iOS https://bugs.webkit.org/show_bug.cgi?id=181192 Reviewed by Tim Horton. Make some minor adjustments for changes to the pasteboard in WebCore. See WebCore/ChangeLog for more detail. Teaches WebPasteboardProxy et. al. to plumb PasteboardItemInfo from the UI process to the web process via the new `InformationForItemAtIndex` codepath. * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: (WebKit::WebPasteboardProxy::informationForItemAtIndex): (WebKit::WebPasteboardProxy::getFilenamesForDataInteraction): Deleted. * UIProcess/WebPasteboardProxy.h: * UIProcess/WebPasteboardProxy.messages.in: * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::informationForItemAtIndex): (WebKit::WebPlatformStrategies::getFilenamesForDataInteraction): Deleted. * WebProcess/WebCoreSupport/WebPlatformStrategies.h: 2018-01-03 Ting-Wei Lan Replace hard-coded paths in shebangs with #!/usr/bin/env https://bugs.webkit.org/show_bug.cgi?id=181040 Reviewed by Alex Christensen. * Scripts/generate-forwarding-headers.pl: 2018-01-03 Wenson Hsieh [Attachment Support] Add plumbing for starting a drag with promised blob data https://bugs.webkit.org/show_bug.cgi?id=181201 Reviewed by Tim Horton. Add boilerplate plumbing for PrepareToDragPromisedBlob, which delivers blob promises to the UI process when dragging, respectively. * Scripts/webkit/messages.py: (headers_for_type): * Shared/WebCoreArgumentCoders.cpp: (IPC::encodeTypesAndData): (IPC::decodeTypesAndData): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): Add IPC support PromisedBlobInfo's additionalTypes and additionalData. (IPC::encodeClientTypesAndData): Deleted. (IPC::decodeClientTypesAndData): Deleted. Rename these helper functions and move them to the top of the file. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::prepareToDragPromisedBlob): * UIProcess/PageClient.h: (WebKit::PageClient::prepareToDragPromisedBlob): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::prepareToDragPromisedBlob): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::prepareToDragPromisedBlob): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _prepareToDragPromisedBlob:]): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::prepareToDragPromisedBlob): * WebProcess/WebCoreSupport/WebDragClient.cpp: (WebKit::WebDragClient::prepareToDragPromisedBlob): * WebProcess/WebCoreSupport/WebDragClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::prepareToDragPromisedBlob): * WebProcess/WebPage/WebPage.h: 2018-01-03 David Kilzer REGRESSION (r212929): WKSnapshotConfiguration may leak an NSNumber when deallocated Reviewed by Joseph Pecoraro. * UIProcess/API/Cocoa/WKSnapshotConfiguration.mm: (-[WKSnapshotConfiguration dealloc]): Implement method and release _snapshotWidth. 2018-01-03 John Wilander Storage Access API: Refactor XPC for access removal to go straight from the web process to the network process https://bugs.webkit.org/show_bug.cgi?id=181270 Reviewed by Alex Christensen. This change refactors how the web process tells the network process to remove storage access. Previously, this was done over the UI process just like requests for storage access. But since no further reasoning is needed, the message should go straight from the web process to the network process for performance reasons and to minimize the risk of a race. As a consequence, the XPC code for storage access removal in the UI process is deleted. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::removeStorageAccess): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::removeStorageAccess): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::removeStorageAccess): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestStorageAccess): (WebKit::WebPageProxy::removeStorageAccess): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::requestStorageAccess): (WebKit::WebsiteDataStore::removeStorageAccess): Deleted. * UIProcess/WebsiteData/WebsiteDataStore.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::detachedFromParent2): (WebKit::WebFrameLoaderClient::dispatchWillChangeDocument): 2018-01-03 David Kilzer com.apple.WebKit.Networking crash in com.apple.Foundation: -[__NSOperationInternal _start:] Reviewed by Alex Christensen. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (downgradeRequest): Remove unnecessary -autorelease. 2018-01-03 Brent Fulgham [macOS] Constant frame dropping during Flash video playback https://bugs.webkit.org/show_bug.cgi?id=181249 Reviewed by Eric Carlson. Review of logs during jerky flash video playback shows a few IOKit properties are being blocked by the sandbox, which prevents some high-efficiency codecs from being used. Add 'AppleGVAKeyDoesNotExist', 'IODVDBundleName', and 'IOGVA*Encode' to the whitelist. * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: 2018-01-03 Michael Catanzaro [GTK] Add web process API to detect when form is submitted via JavaScript https://bugs.webkit.org/show_bug.cgi?id=173915 Reviewed by Carlos Garcia Campos. Epiphany relies on the DOM submit event to detect when a form has been submitted. However, for historical reasons, the submit event is not emitted when a form is submitted by JavaScript. It is therefore not currently possible for a web browser to reliably detect form submission and not possible to implement a robust password storage feature. In order to avoid this problem, this patch adds a new WebKitWebPage signal, will-submit-form, that browsers can use in preference to a DOM event listener. Unfortunately, this signal is not available for WPE because it depends on the DOM API. There are two submission events, WEBKIT_FORM_SUBMISSION_WILL_SEND_DOM_EVENT and WEBKIT_FORM_SUBMISSION_WILL_COMPLETE. WEBKIT_FORM_SUBMISSION_WILL_SEND_DOM_EVENT occurs earlier than WEBKIT_FORM_SUBMISSION_WILL_COMPLETE and can be used to retrieve form values before websites receive the DOM submit event. This is useful as some websites like to delete form values right before a submit would normally happen in order to attempt to defeat browser password managers. There are two tricks to note: JavaScript can cancel form submission immediately after this event occurs (by returning false in an onsubmit handler), and, for historical reasons, this event will not occur at all when form submission is triggered by JavaScript. WEBKIT_FORM_SUBMISSION_WILL_COMPLETE occurs next, and is more straightforward: it is always emitted when a form is about to be submitted, when it is too late to cancel. The recommended way to reliably retrieve password form values would be to watch for both events, use the form value detected in WEBKIT_FORM_SUBMISSION_WILL_SEND_DOM_EVENT if that event is emitted, and use the value detected later in WEBKIT_FORM_SUBMISSION_WILL_COMPLETE otherwise. Since one of the signal arguments is an enum, we now have to run glib-mkenums for the web process API. And that has resulted in this patch also adding GType goo for WebKitConsoleMessageLevel and WebKitConsoleMessageSource that was previously missing. Any applications that for some unlikely reason want to use these enums in properties or signals will be happy. * PlatformGTK.cmake: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: (webkit_web_page_class_init): * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h: * WebProcess/InjectedBundle/API/gtk/WebKitWebProcessEnumTypes.cpp.template: Added. * WebProcess/InjectedBundle/API/gtk/WebKitWebProcessEnumTypes.h.template: Added. 2018-01-03 Carlos Garcia Campos Unreviewed. Really fix plugin process after r226327. * PluginProcess/unix/PluginProcessMainUnix.cpp: 2018-01-02 Brent Fulgham [macOS, iOS] Adopt new secure coding APIs in WebKit https://bugs.webkit.org/show_bug.cgi?id=181085 Reviewed by Tim Horton. Update WebKit code to use NSSecureCoding when the underlying operating system supports it. Use new wrapper functions so the same code can be built on all supported OS releases, while enabling seure coding when possible. Note that NSView-based classes cannot be migrated at present due to AppKit not supporting NSSecureCoding in its class hierarchy. Tested by exising TestWebKitAPI tests for Coding and data transfer. * Platform/ios/AccessibilityIOS.mm: (WebKit::newAccessibilityRemoteToken): Encode using NSSecureCoding. * UIProcess/API/Cocoa/WKPreferences.h: * UIProcess/API/Cocoa/WKPreferences.mm: (+[WKPreferences supportsSecureCoding]): Added to enable NSSecureCoding. * UIProcess/API/Cocoa/WKProcessPool.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (+[WKProcessPool supportsSecureCoding]): Ditto. * UIProcess/API/Cocoa/WKUserContentController.h: * UIProcess/API/Cocoa/WKUserContentController.mm: (+[WKUserContentController supportsSecureCoding]): Ditto. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView initWithCoder:]): Use coding initialization that supports secure coding if it is available in the supplied class. * UIProcess/API/Cocoa/WKWebViewConfiguration.h: * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (+[WKWebViewConfiguration supportsSecureCoding]): Added to enable NSSecureCoding. (-[WKWebViewConfiguration initWithCoder:]): Use secure coding when possible. * UIProcess/API/Cocoa/WKWebsiteDataStore.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (+[WKWebsiteDataStore supportsSecureCoding]): Added to enable NSSecureCoding. * UIProcess/API/Cocoa/_WKApplicationManifest.h: * UIProcess/API/Cocoa/_WKApplicationManifest.mm: (+[_WKApplicationManifest supportsSecureCoding]): Added to enable NSSecureCoding. (-[_WKApplicationManifest initWithCoder:]): Use secure coding when possible. 2017-12-28 Yusuke Suzuki Remove std::chrono completely https://bugs.webkit.org/show_bug.cgi?id=181186 Reviewed by Alex Christensen. Use MonotonicTime, WallTime, and Seconds instead. Changes are mechanical ones. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::deleteWebsiteData): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::clear): * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::responseHasExpired): (WebKit::NetworkCache::responseNeedsRevalidation): (WebKit::NetworkCache::makeStoreDecision): (WebKit::NetworkCache::Cache::clear): (WebKit::NetworkCache::Cache::storeData): * NetworkProcess/cache/NetworkCache.h: * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::Entry): (WebKit::NetworkCache::Entry::asJSON const): * NetworkProcess/cache/NetworkCacheEntry.h: (WebKit::NetworkCache::Entry::timeStamp const): * NetworkProcess/cache/NetworkCacheFileSystem.cpp: (WebKit::NetworkCache::fileTimes): (WebKit::NetworkCache::updateFileModificationTimeIfNeeded): * NetworkProcess/cache/NetworkCacheFileSystem.h: * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp: (WebKit::NetworkCache::IOChannel::IOChannel): * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: (WebKit::NetworkCache::responseNeedsRevalidation): (WebKit::NetworkCache::canRevalidate): * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::readRecord): (WebKit::NetworkCache::Storage::clear): (WebKit::NetworkCache::computeRecordWorth): * NetworkProcess/cache/NetworkCacheStorage.h: Bump the cache version. We now change the data in persistent cache. * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp: (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo): (WebKit::NetworkCache::SubresourcesEntry::SubresourcesEntry): * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h: (WebKit::NetworkCache::SubresourceInfo::lastSeen const): (WebKit::NetworkCache::SubresourceInfo::firstSeen const): (WebKit::NetworkCache::SubresourcesEntry::timeStamp const): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::clearHSTSCache): (WebKit::clearNSURLCache): (WebKit::NetworkProcess::clearDiskCache): * NetworkProcess/curl/NetworkProcessCurl.cpp: (WebKit::NetworkProcess::clearDiskCache): * NetworkProcess/mac/NetworkProcessMac.mm: (WebKit::NetworkProcess::clearCacheForAllOrigins): * NetworkProcess/soup/NetworkProcessSoup.cpp: (WebKit::NetworkProcess::clearCacheForAllOrigins): (WebKit::NetworkProcess::clearDiskCache): * Platform/IPC/ArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): Deleted. (IPC::ArgumentCoder::decode): Deleted. * Platform/IPC/ArgumentCoders.h: * PluginProcess/PluginProcess.cpp: (WebKit::PluginProcess::deleteWebsiteData): * PluginProcess/PluginProcess.h: * PluginProcess/PluginProcess.messages.in: * Scripts/webkit/messages.py: (headers_for_type): * Shared/RemoteLayerTree/RemoteLayerBackingStore.h: (WebKit::RemoteLayerBackingStore::lastDisplayTime const): * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::RemoteLayerBackingStore): (WebKit::RemoteLayerBackingStore::display): * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.h: * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm: (WebKit::RemoteLayerBackingStoreCollection::markBackingStoreVolatile): (WebKit::RemoteLayerBackingStoreCollection::volatilityTimerFired): * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): Deleted. (IPC::ArgumentCoder::decode): Deleted. * Shared/WebCoreArgumentCoders.h: * StorageProcess/StorageProcess.cpp: (WebKit::StorageProcess::deleteWebsiteData): * StorageProcess/StorageProcess.h: * StorageProcess/StorageProcess.messages.in: * UIProcess/API/C/WKApplicationCacheManager.cpp: (WKApplicationCacheManagerDeleteAllEntries): * UIProcess/API/C/WKCookieManager.cpp: (WKCookieManagerDeleteAllCookiesModifiedAfterDate): * UIProcess/API/C/WKKeyValueStorageManager.cpp: (WKKeyValueStorageManagerDeleteAllEntries): * UIProcess/API/C/WKResourceCacheManager.cpp: (WKResourceCacheManagerClearCacheForAllOrigins): * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours): (WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemoval): (WKWebsiteDataStoreRemoveAllFetchCaches): (WKWebsiteDataStoreRemoveAllIndexedDatabases): (WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations): * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (toSystemClockTime): (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:]): * UIProcess/API/glib/WebKitWebContext.cpp: (webkit_web_context_clear_cache): * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkit_website_data_manager_clear): * UIProcess/DrawingAreaProxy.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::deleteWebsiteData): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Plugins/PluginProcessManager.cpp: (WebKit::PluginProcessManager::deleteWebsiteData): * UIProcess/Plugins/PluginProcessManager.h: * UIProcess/Plugins/PluginProcessProxy.cpp: (WebKit::PluginProcessProxy::deleteWebsiteData): * UIProcess/Plugins/PluginProcessProxy.h: * UIProcess/Storage/StorageProcessProxy.cpp: (WebKit::StorageProcessProxy::deleteWebsiteData): * UIProcess/Storage/StorageProcessProxy.h: * UIProcess/WebCookieManagerProxy.cpp: (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince): * UIProcess/WebCookieManagerProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::deleteWebsiteData): * UIProcess/WebProcessProxy.h: * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent): * UIProcess/WebResourceLoadStatisticsStore.h: * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp: (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince): * UIProcess/WebStorage/LocalStorageDatabaseTracker.h: * UIProcess/WebStorage/StorageManager.cpp: (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince): * UIProcess/WebStorage/StorageManager.h: * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::platformRemoveRecentSearches): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::removeData): (WebKit::WebsiteDataStore::removeMediaKeys): * UIProcess/WebsiteData/WebsiteDataStore.h: * UIProcess/gtk/WebPageProxyGtk.cpp: (WebKit::WebsiteDataStore::platformRemoveRecentSearches): * UIProcess/wpe/WebPageProxyWPE.cpp: (WebKit::WebsiteDataStore::platformRemoveRecentSearches): * WebProcess/Cookies/WebCookieManager.cpp: (WebKit::WebCookieManager::deleteAllCookiesModifiedSince): * WebProcess/Cookies/WebCookieManager.h: * WebProcess/Cookies/WebCookieManager.messages.in: * WebProcess/Plugins/PluginView.cpp: (WebKit::lastModifiedDateMS): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::deleteWebsiteData): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2018-01-02 Wenson Hsieh [Attachment Support] Introduce data structures and IPC support for writing promised blobs https://bugs.webkit.org/show_bug.cgi?id=181189 Reviewed by Tim Horton. Add IPC support for PromisedBlobInfo and PromisedBlobData. See WebCore/ChangeLog for more detail. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Shared/WebCoreArgumentCoders.h: 2018-01-02 Michael Catanzaro REGRESSION(r223253): Broke ResourceLoadStatistics layout tests for non-Cocoa ports https://bugs.webkit.org/show_bug.cgi?id=181231 Reviewed by Alex Christensen. Add new C API for use by WebKitTestRunner. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreIsStatisticsRegisteredAsSubFrameUnder): (WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo): * UIProcess/API/C/WKWebsiteDataStoreRef.h: 2018-01-02 Jiewen Tan Add a WebAuthentication runtime feature flag https://bugs.webkit.org/show_bug.cgi?id=181220 Reviewed by Brent Fulgham. Renames the CredentialManagement runtime feature flag into WebAuthentication. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetWebAuthenticationEnabled): (WKPreferencesGetWebAuthenticationEnabled): (WKPreferencesSetCredentialManagementEnabled): Deleted. (WKPreferencesGetCredentialManagementEnabled): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): 2018-01-02 Michael Catanzaro REGRESSION(r226327): [GTK] Plugin process is broken https://bugs.webkit.org/show_bug.cgi?id=181187 Unreviewed, fix PluginProcessMainUnix after r226327. * PluginProcess/unix/PluginProcessMainUnix.cpp: 2018-01-02 Tim Horton Fix the build on platforms where UICurrentUserInterfaceIdiomIsPad is defined to false https://bugs.webkit.org/show_bug.cgi?id=181218 Reviewed by Alex Christensen. * Platform/spi/ios/UIKitSPI.h: (currentUserInterfaceIdiomIsPad): * UIProcess/ios/SmartMagnificationController.mm: (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKFormInputSession setAccessoryViewCustomButtonTitle:]): (-[WKContentView _requiresKeyboardWhenFirstResponder]): (-[WKContentView _displayFormNodeInputView]): (-[WKContentView requiresAccessoryView]): (-[WKContentView _updateAccessory]): * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: (-[WKAirPlayRoutePicker show:fromRect:]): * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]): (-[WKFileUploadPanel _presentMenuOptionForCurrentInterfaceIdiom:]): * UIProcess/ios/forms/WKFormInputControl.mm: (-[WKDateTimePicker initWithView:datePickerMode:]): (-[WKFormInputControl initWithView:]): * UIProcess/ios/forms/WKFormSelectControl.mm: (-[WKFormSelectControl initWithView:]): On platforms where UICurrentUserInterfaceIdiomIsPad is defined to false, blocks that conditionally execute based on its value are unreachable. This causes the compiler to complain. Hide it away inside an inline function and make use of that everywhere we used to use the macro. 2018-01-02 Alex Christensen Remove SVN file accidentally added in r226160 https://bugs.webkit.org/show_bug.cgi?id=180934 * UIProcess/WebPageProxy.cpp.orig: Removed. 2018-01-02 Alex Christensen Use BlockPtrs and lambdas instead of new/delete to pass parameters to blocks in WebViewImpl::performDragOperation https://bugs.webkit.org/show_bug.cgi?id=180795 Reviewed by Brent Fulgham. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::performDragOperation): 2018-01-02 Michael Catanzaro [WPE][GTK] Implement the assignment of ProcessIdentifiers to child processes https://bugs.webkit.org/show_bug.cgi?id=181187 Reviewed by Brady Eidson. * Shared/ChildProcess.cpp: Make the ProcessIdentifier mandatory. (WebKit::ChildProcess::initialize): * Shared/unix/ChildProcessMain.cpp: Initialize ChildProcessInitializationParameters with the ProcessIdentifier. (WebKit::ChildProcessMainBase::parseCommandLine): * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp: Copy the ProcessIdentifier from LaunchOptions into argv. (WebKit::ProcessLauncher::launchProcess): * WebProcess/wpe/WebProcessMainWPE.cpp: Expect the WPE socket ID later in the command line. 2018-01-02 Alex Christensen Use new WebsiteDataStore passed in through decidePolicyForNavigation SPI https://bugs.webkit.org/show_bug.cgi?id=180897 Reviewed by Brent Fulgham. * Shared/WebsitePoliciesData.cpp: (WebKit::WebsitePoliciesData::applyToDocumentLoader): * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::changeWebsiteDataStore): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore): (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore): (WebKit::WebProcessPool::pageAddedToProcess): Deleted. (WebKit::WebProcessPool::pageRemovedFromProcess): Deleted. * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::addExistingWebPage): (WebKit::WebProcessProxy::removeWebPage): * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm: (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession): 2018-01-02 Alex Christensen Only use CookieStorageShim when we aren't using NetworkSession https://bugs.webkit.org/show_bug.cgi?id=180766 Reviewed by Brent Fulgham. * Shared/mac/CookieStorageShim.h: * Shared/mac/CookieStorageShim.mm: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): 2018-01-02 Alex Christensen Clean up context menu code https://bugs.webkit.org/show_bug.cgi?id=181074 Reviewed by Brent Fulgham. Use Ref instead of RefPtr where possible. Use move semantics instead of copying from const references when possible. Remove dead iOS code. Reduce allocations. Add stub for WPE. * UIProcess/API/APIContextMenuClient.h: (API::ContextMenuClient::getContextMenuFromProposedMenu): (API::ContextMenuClient::getContextMenuFromProposedMenuAsync): (API::ContextMenuClient::showContextMenu): * UIProcess/API/C/WKPage.cpp: (WKPageSetPageContextMenuClient): * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::createContextMenuProxy): * UIProcess/API/gtk/PageClientImpl.h: * UIProcess/PageClient.h: * UIProcess/WebContextMenuListenerProxy.cpp: (WebKit::WebContextMenuListenerProxy::useContextMenuItems): * UIProcess/WebContextMenuProxy.cpp: (WebKit::WebContextMenuProxy::WebContextMenuProxy): * UIProcess/WebContextMenuProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showContextMenu): (WebKit::WebPageProxy::internalShowContextMenu): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/gtk/WebContextMenuProxyGtk.cpp: (WebKit::WebContextMenuProxyGtk::showContextMenuWithItems): (WebKit::WebContextMenuProxyGtk::WebContextMenuProxyGtk): * UIProcess/gtk/WebContextMenuProxyGtk.h: (WebKit::WebContextMenuProxyGtk::create): * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::createContextMenuProxy): Deleted. * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::createContextMenuProxy): * UIProcess/mac/WebContextMenuProxyMac.h: (WebKit::WebContextMenuProxyMac::create): * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::WebContextMenuProxyMac::WebContextMenuProxyMac): (WebKit::WebContextMenuProxyMac::showContextMenuWithItems): (WebKit::WebContextMenuProxyMac::showContextMenu): == Rolled over to ChangeLog-2018-01-01 ==