2019-04-30 Chris Dumez Regression(PSON) URL scheme handlers can no longer respond asynchronously https://bugs.webkit.org/show_bug.cgi?id=197426 Reviewed by Brady Eidson. The issue was that when committing the provisional process, we would call WebPageProxy::processDidTerminate() which would call WebPageProxy::stopAllURLSchemeTasks(). This would terminate all URL scheme tasks associated with the page, including the one associated with the provisisional page / process. To address the issue, pass m_process to stopAllURLSchemeTasks() in processDidTerminate() and only stop the tasks associated with the m_process (which is the process we're about to swap away from). * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::processDidTerminate): (WebKit::WebPageProxy::stopAllURLSchemeTasks): * UIProcess/WebPageProxy.h: * UIProcess/WebURLSchemeHandler.cpp: (WebKit::WebURLSchemeHandler::processForTaskIdentifier): (WebKit::WebURLSchemeHandler::stopAllTasksForPage): * UIProcess/WebURLSchemeHandler.h: * UIProcess/WebURLSchemeTask.h: (WebKit::WebURLSchemeTask::process const): 2019-04-30 John Wilander Add logging of Ad Click Attribution errors and events to a dedicated channel https://bugs.webkit.org/show_bug.cgi?id=197332 Reviewed by Youenn Fablet. This patch adds an experimental Ad Click Attribution debug mode which logs information. Most changes are just log output in the various functions in WebKit::AdClickAttributionManager. The constructor to WebKit::AdClickAttributionManager now takes a PAL::SessionID so that the log functions can make sure they don't output anything in ephemeral sessions. WebProcessPool::platformInitializeNetworkProcess() now picks up the debug mode setting from the incoming WebKit::NetworkProcessCreationParameters object. NetworkResourceLoader::handleAdClickAttributionConversion() was moved to AdClickAttributionManager::handleConversion() to keep all the logging in one file. * NetworkProcess/AdClickAttributionManager.cpp: (WebKit::AdClickAttributionManager::storeUnconverted): (WebKit::AdClickAttributionManager::handleConversion): (WebKit::AdClickAttributionManager::convert): (WebKit::AdClickAttributionManager::fireConversionRequest): (WebKit::AdClickAttributionManager::firePendingConversionRequests): (WebKit::AdClickAttributionManager::clearExpired): (WebKit::AdClickAttributionManager::debugModeEnabled const): * NetworkProcess/AdClickAttributionManager.h: (WebKit::AdClickAttributionManager::AdClickAttributionManager): (WebKit::AdClickAttributionManager::m_sessionID): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): (WebKit::NetworkResourceLoader::handleAdClickAttributionConversion): Deleted. * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::NetworkSession): (WebKit::NetworkSession::handleAdClickAttributionConversion): (WebKit::NetworkSession::convertAdClickAttribution): Deleted. * NetworkProcess/NetworkSession.h: * Platform/Logging.h: * Shared/WebPreferences.yaml: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): 2019-04-30 Devin Rousso Crash when running test wpt/tests/element_click/bubbling.py::test_element_disappears_during_click https://bugs.webkit.org/show_bug.cgi?id=197361 Reviewed by Brian Burg. Don't assume that all elements have client rects (e.g. `getClientRects`). If the container element isn't visible, then the child won't be either. * UIProcess/Automation/SimulatedInputDispatcher.cpp: (WebKit::SimulatedInputDispatcher::resolveLocation): (WebKit::SimulatedInputDispatcher::transitionInputSourceToState): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement): 2019-04-30 Chris Dumez Unreviewed, rolling out r244802. Caused an API test failure Reverted changeset: "Regression(PSON) URL scheme handlers can no longer respond asynchronously" https://bugs.webkit.org/show_bug.cgi?id=197426 https://trac.webkit.org/changeset/244802 2019-04-30 Chris Dumez Regression(PSON) URL scheme handlers can no longer respond asynchronously https://bugs.webkit.org/show_bug.cgi?id=197426 Reviewed by Brady Eidson. The issue was that when committing the provisional process, we would call WebPageProxy::processDidTerminate() which would call WebPageProxy::stopAllURLSchemeTasks(). This would terminate all URL scheme tasks associated with the page, including the one associated with the provisisional page / process. To address the issue, pass m_process to stopAllURLSchemeTasks() in processDidTerminate() and only stop the tasks associated with the m_process (which is the process we're about to swap away from). * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::processDidTerminate): (WebKit::WebPageProxy::stopAllURLSchemeTasks): * UIProcess/WebPageProxy.h: * UIProcess/WebURLSchemeHandler.cpp: (WebKit::WebURLSchemeHandler::processForTaskIdentifier): (WebKit::WebURLSchemeHandler::stopAllTasksForPage): * UIProcess/WebURLSchemeHandler.h: * UIProcess/WebURLSchemeTask.h: (WebKit::WebURLSchemeTask::process const): 2019-04-30 Chris Dumez Only use a related page's process if that page has not been closed yet https://bugs.webkit.org/show_bug.cgi?id=197393 Reviewed by Tim Horton. We should not attempt to use a related page's process if that related page has already been closed. Once closed, a page's process is invalid and trying to launch a new process for the closed page leads to crashes such as the one in the radar. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::launchProcess): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::createWebPage): 2019-04-30 Tim Horton Long-standing rare crash under -[WKWebView _web_immediateActionAnimationControllerForHitTestResultInternal...] https://bugs.webkit.org/show_bug.cgi?id=197404 Reviewed by Wenson Hsieh. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _updateImmediateActionItem]): (-[WKImmediateActionController menuItem:previewItemAtPoint:]): (-[WKImmediateActionController menuItem:itemFrameForPoint:]): (-[WKImmediateActionController _animationControllerForDataDetectedLink]): Add some null checks; _webHitTestResult can be null if we (somehow) get an immediate action gesture without having previously gotten a mouseDidMoveOverElement from the Web Content process. Cover all our bases. 2019-04-30 Per Arne Vollan [iOS] Fix crash caused by sandbox violation https://bugs.webkit.org/show_bug.cgi?id=197416 Reviewed by Brent Fulgham. Add syscall to the iOS sandbox. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-04-30 Zalan Bujtas [iOS] Double-tapping a post to like doesn't work on Instagram.com (needs 'dblclick' event) https://bugs.webkit.org/show_bug.cgi?id=197347 Reviewed by Wenson Hsieh. This patch adds support for dispatching dblclick event as the result of the double tap gesture. 1. The new double tap gesture recognizer always fires regardless of what type of action the other, existing double gesture recognizers (double-tap to zoom) trigger. 2. The dblclick event is dispatched on the node with registered dblclick event handler unless the node prohibits double tap gesture (touch-action != auto). * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): (-[WKContentView cleanupInteraction]): (-[WKContentView _removeDefaultGestureRecognizers]): (-[WKContentView _addDefaultGestureRecognizers]): (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): (-[WKContentView gestureRecognizerShouldBegin:]): (-[WKContentView _doubleTapRecognizedForDoubleClick:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint): 2019-04-30 Antti Koivisto Tighten type of ScrollingTree:rootNode() to ScrollingTreeFrameScrollingNode https://bugs.webkit.org/show_bug.cgi?id=197414 Reviewed by Frédéric Wang. * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: 2019-04-30 Carlos Garcia Campos REGRESSION(r244750): [GTK][WPE] Network process is crashing in all layout tests https://bugs.webkit.org/show_bug.cgi?id=197406 Reviewed by Žan Doberšek. Do not trasnfer ownership of cachePath to traverseDirectory() lambda, since it's passed also as first argument and it can be passed as a reference. * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::deleteOldVersions): 2019-04-29 Truitt Savell Unreviewed, rolling out r244755. Casued several test failures on iOS Reverted changeset: "Double-tapping a post to like doesn't work on Instagram.com (needs 'dblclick' event)" https://bugs.webkit.org/show_bug.cgi?id=197347 https://trac.webkit.org/changeset/244755 2019-04-29 Chris Dumez [iOS] The UIProcess may get killed for trying to stay runnable in the background for more than 30 seconds https://bugs.webkit.org/show_bug.cgi?id=197385 Reviewed by Geoffrey Garen. If the UIProcess holds a background assertion for itself for 30 seconds, the assertion's invalidation handler will get called and it is our responsibility to release this assertion or the UIProcess will get killed by the system. The logic in ProcessAssertion would normally do that but it would also happily try and re-take another background process assertion shortly after the previous one expired (and before the UIProcess got suspended). When doing so, the new background assertion would expire right away and we would get killed without its invalidation handler getting called. To address the issue, the logic in ProcessAssertion will now prevent taking a new background assertion after one expires and until the application becomes foreground again. * UIProcess/ios/ProcessAssertionIOS.mm: (-[WKProcessAssertionBackgroundTaskManager init]): (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]): 2019-04-29 Alex Christensen Fix internal High Sierra build https://bugs.webkit.org/show_bug.cgi?id=197388 * Configurations/Base.xcconfig: 2019-04-29 Zalan Bujtas [iOS] Double-tapping a post to like doesn't work on Instagram.com (needs 'dblclick' event) https://bugs.webkit.org/show_bug.cgi?id=197347 Reviewed by Wenson Hsieh. This patch adds support for dispatching dblclick event as the result of the double tap gesture. 1. The new double tap gesture recognizer always fires regardless of what type of action the other, existing double gesture recognizers (double-tap to zoom) trigger. 2. The dblclick event is dispatched on the node with registered dblclick event handler unless the node prohibits double tap gesture (touch-action != auto). * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): (-[WKContentView cleanupInteraction]): (-[WKContentView _removeDefaultGestureRecognizers]): (-[WKContentView _addDefaultGestureRecognizers]): (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): (-[WKContentView gestureRecognizerShouldBegin:]): (-[WKContentView _doubleTapRecognizedForDoubleClick:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint): 2019-04-29 Tim Horton REGRESSION (r244142): Fandango accounts tab crashes under Color() https://bugs.webkit.org/show_bug.cgi?id=197380 Reviewed by Megan Gardner. * UIProcess/API/Cocoa/WKWebView.mm: (baseScrollViewBackgroundColor): We now call -_updateScrollViewBackground from -setBackgroundColor:. -setBackgroundColor: can be called from -[UIView initWithCoder:]; if it is, WKWebView's _page is not yet initialized, so we crash. Return an invalid color. Then, the caller falls back to WKContentView's backgroundColor. But WKContentView isn't initialized yet either. So add a further fallback. 2019-04-29 Dean Jackson Add InteractionIsHappening to SuppressSelectionAssistantReason https://bugs.webkit.org/show_bug.cgi?id=197375 Reviewed by Megan Gardner. Add a new reason for suppressing the selection assistant, to be used in a follow-up patch. * UIProcess/ios/WKContentViewInteraction.h: Add InteractionIsHappening. 2019-04-29 Alex Christensen Storage::deleteOldVersions does not need to retain Storage https://bugs.webkit.org/show_bug.cgi?id=197336 Reviewed by Darin Adler. * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::deleteOldVersions): Something is wrong with the lifetime of Storage, but we only need a String, not the whole Storage. 2019-04-29 Brent Fulgham [Cocoa] Move common sandbox files from Shared/mac to Shared/Cocoa https://bugs.webkit.org/show_bug.cgi?id=197376 Reviewed by Dean Jackson. The Apple sandboxing logic currently lives in the inappropriate 'Shared/mac' directory. This is confusing because the code is used by all Apple ports, not just macOS. This patch just moves the relevant files from 'Shared/mac' to 'Shared/Cocoa' to avoid this confusion. * Shared/Cocoa/SandboxExtensionCocoa.mm: Renamed from Source/WebKit/Shared/mac/SandboxExtensionMac.mm. * Shared/Cocoa/SandboxInitialiationParametersCocoa.mm: Renamed from Source/WebKit/Shared/mac/SandboxInitialiationParametersMac.mm. * Shared/Cocoa/SandboxUtilities.h: Renamed from Source/WebKit/Shared/mac/SandboxUtilities.h. * Shared/Cocoa/SandboxUtilities.mm: Renamed from Source/WebKit/Shared/mac/SandboxUtilities.mm. * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: 2019-04-29 Alexander Mikhaylenko [GTK] Back/forward gesture snapshot always times out https://bugs.webkit.org/show_bug.cgi?id=197233 Reviewed by Michael Catanzaro. Delaying web process launch caused a regression where we create ViewGestureController when the web process doesn't yet exist. The controller immediately tries to connect to it and fails, and because of that never receives DidHitRenderTreeSizeThreshold() message, so navigation snapshot always stays until timeout after performing the gesture. To prevent this, create the controller in webkitWebViewBaseDidRelaunchWebProcess() instead of webkitWebViewBaseCreateWebPage(). Additionally, since settings are now created earlier than ViewGestureController, store the value of whether swipe gesture is enabled in WebKitWebViewBase and immediately apply it when creating the controller. Since there is now a point where controller is null, make webkitWebViewBaseViewGestureController() return null and add null checks everywhere. * UIProcess/API/glib/WebKitWebView.cpp: (enableBackForwardNavigationGesturesChanged): Move the logic into webkitWebViewBaseSetEnableBackForwardNavigationGesture(). * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore): Add a null check. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseDraw): Ditto. (webkitWebViewBaseScrollEvent): Ditto. (webkitWebViewBaseSetEnableBackForwardNavigationGesture): Added. In addition to what was in WebKitWebViewBase::enableBackForwardNavigationGesturesChanged(), store the value in a field for the case ViewGestureController doesn't exist yet. (webkitWebViewBaseViewGestureController): Return a pointer instead of reference. (webkitWebViewBaseCreateWebPage): Stop creating ViewGestureController. (webkitWebViewBaseDidRelaunchWebProcess): Move creating ViewGestureController here. Also immediately call setSwipeGestureEnabled() with the stored value. (webkitWebViewBaseDidStartProvisionalLoadForMainFrame): Add a null check. (webkitWebViewBaseDidFirstVisuallyNonEmptyLayoutForMainFrame):Ditto. (webkitWebViewBaseDidFinishLoadForMainFrame): Ditto. (webkitWebViewBaseDidFailLoadForMainFrame): Ditto. (webkitWebViewBaseDidSameDocumentNavigationForMainFrame): Ditto. (webkitWebViewBaseDidRestoreScrollPosition): Ditto. * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: 2019-04-29 Chris Dumez User-facing strings should use curly quotes instead of straight https://bugs.webkit.org/show_bug.cgi?id=197370 Reviewed by Geoffrey Garen. Update localizable alert text that was recently added to use curly quotes instead of straight ones, as per our guidelines. * UIProcess/Cocoa/WKOrientationAccessAlert.mm: (WebKit::presentOrientationAccessAlert): * UIProcess/Cocoa/WKStorageAccessAlert.mm: (WebKit::presentStorageAccessAlert): 2019-04-29 Alex Christensen Build fix. * UIProcess/ios/WKActionSheet.mm: (-[WKActionSheet updateSheetPosition]): 2019-04-29 Commit Queue Unreviewed, rolling out r244648. https://bugs.webkit.org/show_bug.cgi?id=197363 Lots of tests are crashing (Requested by KaL on #webkit). Reverted changeset: "[GTK] Back/forward gesture snapshot always times out" https://bugs.webkit.org/show_bug.cgi?id=197233 https://trac.webkit.org/changeset/244648 2019-04-29 Michael Catanzaro [WPE][GTK] window-object-cleared documentation should reference webkit_frame_get_js_context_for_script_world() https://bugs.webkit.org/show_bug.cgi?id=197357 Reviewed by Carlos Garcia Campos. We should recommend using the non-deprecated replacement for webkit_frame_get_javascript_context_for_script_world(). * WebProcess/InjectedBundle/API/glib/WebKitScriptWorld.cpp: 2019-04-27 Chris Dumez Improve safety of MachMessage class https://bugs.webkit.org/show_bug.cgi?id=197323 Reviewed by Darin Adler. Improve safety of MachMessage class and clean things up a bit. * Platform/IPC/mac/ConnectionMac.mm: (IPC::Connection::sendOutgoingMessage): - Pass MessageReceiverName / MessageName when constructing the MachMessage rather than setting them afterwards since they never change for a given MachMessage. - Set header->msgh_id to the right value right away instead of setting it first to inlineBodyMessageID and then later fixing it to be outOfLineBodyMessageID when the body is out of line. - When messageBodyIsOOL was true, we would call getDescriptorAndSkip() which would advance the pointer by sizeof(mach_msg_port_descriptor_t), even though the descriptor type is mach_msg_ool_descriptor_t. This would not matter in the end because we would not use the messageData pointer after this but still. * Platform/IPC/mac/MachMessage.cpp: (IPC::MachMessage::create): Use fastZeroedMalloc() instead of fastMalloc() for safety, given that this class has a mach_msg_header_t flexible array member. This is what is recommended by the mach documentation. It is much safer because it otherwize relies on the user (Connection::sendOutgoingMessage()) to initialize ALL the message members correctly. I suspect this was the cause of because Connection::sendOutgoingMessage() would fail to initialize header->msgh_voucher_port and the MachMessage destructor would then call mach_msg_destroy(header()), which would mach_msg_destroy_port(header->msgh_voucher_port). (IPC::MachMessage::MachMessage): Pass MessageReceiverName / MessageName when constructing the MachMessage rather than setting them afterwards since they never change for a given MachMessage. (IPC::MachMessage::messageSize): Drop if checks for portDescriptorCount and memoryDescriptorCount since the logic will do the right thing even if they are 0. * Platform/IPC/mac/MachMessage.h: (IPC::MachMessage::header): (IPC::MachMessage::messageReceiverName const): (IPC::MachMessage::messageName const): 2019-04-26 Wenson Hsieh Rename m_LayerTreeFreezeReasons to m_layerTreeFreezeReasons https://bugs.webkit.org/show_bug.cgi?id=197343 Reviewed by Antti Koivisto. No change in behavior. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::freezeLayerTree): (WebKit::WebPage::unfreezeLayerTree): (WebKit::WebPage::updateDrawingAreaLayerTreeFreezeState): * WebProcess/WebPage/WebPage.h: 2019-04-26 Keith Rollin Enable new build rule for post-processing headers when using XCBuild https://bugs.webkit.org/show_bug.cgi?id=197340 Reviewed by Brent Fulgham. In Bug 197116, we conditionally disabled the old method for post-processing header files when we are using the new XCBuild build system. This check-in conditionally enables the new post-processing facility. Note that the old system is disabled and the new system enabled only when the USE_NEW_BUILD_SYSTEM environment variable is set to YES. * Configurations/WebKit.xcconfig: 2019-04-26 Jessie Berlin Add new mac target numbers https://bugs.webkit.org/show_bug.cgi?id=197313 Reviewed by Alex Christensen. * Configurations/Version.xcconfig: * Configurations/WebKitTargetConditionals.xcconfig: 2019-04-26 Youenn Fablet Use kDNSServiceFlagsKnownUnique to speed up mdns name registration for ICE candidates https://bugs.webkit.org/show_bug.cgi?id=197328 Reviewed by Eric Carlson. This allows skipping the probing step of MDNS name registration. We can do that as registered names are random UUIDs. * NetworkProcess/webrtc/NetworkMDNSRegister.cpp: (WebKit::NetworkMDNSRegister::registerMDNSName): 2019-04-26 Chris Dumez [iOS] Our process assertion should not allow idle sleep https://bugs.webkit.org/show_bug.cgi?id=197317 Reviewed by Geoffrey Garen. Our process assertion should not allow idle sleep. This is bad for power because the device may switch between sleep and awake state frequently, as it get woken up by network packages. * UIProcess/ios/ProcessAssertionIOS.mm: 2019-04-26 Eric Carlson Create AVFoundationSoftLink.{h,mm} to reduce duplicate code https://bugs.webkit.org/show_bug.cgi?id=197171 Reviewed by Youenn Fablet. * Shared/ios/WebIconUtilities.mm: (WebKit::iconForVideoFile): * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::ArgumentCoder::encodePlatformData): (IPC::ArgumentCoder::decodePlatformData): * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm: (WebKit::PlatformCALayerRemoteCustom::clone const): 2019-04-26 Commit Queue Unreviewed, rolling out r244683. https://bugs.webkit.org/show_bug.cgi?id=197320 Causing crash on iOS Simulator and EWS failures (Requested by sroberts on #webkit). Reverted changeset: "[iOS] Add internal setting to force -webkit-text-size-adjust to "auto"" https://bugs.webkit.org/show_bug.cgi?id=197275 https://trac.webkit.org/changeset/244683 2019-04-26 Youenn Fablet Use normal loading path for ping loads https://bugs.webkit.org/show_bug.cgi?id=196807 Reviewed by Alex Christensen. In case a NetworkResourceLoader has the keepAlive option we do the following: - Always use NetworkLoadChecker as we might need it to do checks after the Web context is gone. - In case of aborting a KeepAlive loader, remove it from NetworkConnectionToWebProcess map and add it to a kept-alive NetworkSession load set. The loader is only kept alive if it has not yet received a response. Mark the loader as kept-alive. - In case loader is kept-alive, cancel the load as soon as a response is gathered. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::transferKeptAliveLoad): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::addKeptAliveLoad): (WebKit::NetworkProcess::removeKeptAliveLoad): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkResourceLoadMap.cpp: (WebKit::NetworkResourceLoadMap::remove): (WebKit::NetworkResourceLoadMap::take): * NetworkProcess/NetworkResourceLoadMap.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::m_shouldCaptureExtraNetworkLoadMetrics): (WebKit::NetworkResourceLoader::cleanup): (WebKit::NetworkResourceLoader::abort): (WebKit::NetworkResourceLoader::didReceiveResponse): (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): * NetworkProcess/NetworkResourceLoader.h: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::maximumBufferingTime): (WebKit::WebLoaderStrategy::usePingLoad const): * WebProcess/Network/WebLoaderStrategy.h: 2019-04-26 Alex Christensen Fix internal High Sierra build after r244653 https://bugs.webkit.org/show_bug.cgi?id=197131 * DerivedSources.make: -std=gnu++17 didn't exist yet. -std=gnu++1z did. 2019-04-26 Alex Christensen Fix an internal High Sierra build after r244653 ​https://bugs.webkit.org/show_bug.cgi?id=197131 * DerivedSources.make: Apparently we can't use gnu++17 when preprocessing Platform.h in the makefile. 2019-04-26 Sihui Liu Stop IDB transactions to release locked database files when network process is ready to suspend https://bugs.webkit.org/show_bug.cgi?id=196372 Reviewed by Brady Eidson. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::processWillSuspendImminently): (WebKit::NetworkProcess::prepareToSuspend): (WebKit::NetworkProcess::resume): 2019-04-25 Myles C. Maxfield [iOS] Add internal setting to force -webkit-text-size-adjust to "auto" https://bugs.webkit.org/show_bug.cgi?id=197275 Reviewed by Simon Fraser. * Shared/WebPreferences.yaml: * UIProcess/WebPreferences.h: 2019-04-25 Myles C. Maxfield [iOS] Implement idempotent mode for text autosizing https://bugs.webkit.org/show_bug.cgi?id=197250 Reviewed by Jon Lee. Push the initial scale down into the page. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::dynamicViewportSizeUpdate): (WebKit::WebPage::viewportConfigurationChanged): 2019-04-25 Alex Christensen Make NetworkCache blobs safe for mmap instead of not using blobs https://bugs.webkit.org/show_bug.cgi?id=197264 Reviewed by Antti Koivisto. This does what r244597 did for WKContentRuleLists but for the NetworkCache's blobs. Those are the two cases where we were calling mmap and seeing crashes in apps with default file protection of NSFileProtectionComplete. * NetworkProcess/cache/NetworkCacheBlobStorage.cpp: (WebKit::NetworkCache::BlobStorage::add): * NetworkProcess/cache/NetworkCacheFileSystem.cpp: (WebKit::NetworkCache::isSafeToUseMemoryMapForPath): Deleted. * NetworkProcess/cache/NetworkCacheFileSystem.h: * NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm: (WebKit::NetworkCache::isSafeToUseMemoryMapForPath): * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::Storage): (WebKit::NetworkCache::Storage::synchronize): (WebKit::NetworkCache::Storage::mayContainBlob const): (WebKit::NetworkCache::Storage::shouldStoreBodyAsBlob): (WebKit::NetworkCache::estimateRecordsSize): Deleted. * NetworkProcess/cache/NetworkCacheStorage.h: 2019-04-25 Simon Fraser REGRESSION (r234330): 3 legacy-animation-engine/compositing tests are flaky failures https://bugs.webkit.org/show_bug.cgi?id=188357 Reviewed by Dean Jackson. DumpRenderTree had no code that set page.setCompositingPolicyOverride() to Normal, so some tests would fall into low memory mode and have different behavior. Fix by moving the code that calls setCompositingPolicyOverride(Normal) from the WK2 layer to Internals, so it's shared by DRT and WTR. We no longer need the WK2 C SPI glue. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageSetEventThrottlingBehaviorOverride): (WKBundlePageSetCompositingPolicyOverride): Deleted. * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: 2019-04-25 Chris Dumez Trying to load a main resource outside the sandbox should not crash the WebContent process https://bugs.webkit.org/show_bug.cgi?id=197299 Reviewed by Geoffrey Garen. Trying to load a main resource outside the sandbox should not crash the WebContent process. We should simply ignore the load and log an error message. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): 2019-04-25 Timothy Hatcher Only send a synthetic mouse out event if synthetic mouse move events were sent. https://bugs.webkit.org/show_bug.cgi?id=197295 rdar://problem/49040233 Reviewed by Zalan Bujtas. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::completeSyntheticClick): 2019-04-25 Timothy Hatcher Disable date and time inputs on iOSMac. https://bugs.webkit.org/show_bug.cgi?id=197287 rdar://problem/46794376 Reviewed by Wenson Hsieh. * Configurations/FeatureDefines.xcconfig: 2019-04-25 Brady Eidson REGRESSION (243388): WebProcess::shouldFreezeOnSuspension() decision is flipped and https://bugs.webkit.org/show_bug.cgi?id=197284 Reviewed by Chris Dumez. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::shouldFreezeOnSuspension const): If any non-suspended pages are in the process it should be eligible. Only if all pages are suspended should it be jetsam-able. 2019-04-25 Alex Christensen Start using C++17 https://bugs.webkit.org/show_bug.cgi?id=197131 Reviewed by Darin Adler. * Configurations/Base.xcconfig: * DerivedSources.make: 2019-04-25 Alexander Mikhaylenko [GTK] Back/Forward gesture interferes with scrolling https://bugs.webkit.org/show_bug.cgi?id=197168 Reviewed by Michael Catanzaro. When the gesture is released with 0 velocity close to an edge of the webview, the finishing animation is way too long, and in some cases it can look like the gesture is already over, when it's still animating. By scrolling vertically while that happens, it's possible to reset animation over and over again. To reduce the duration in this case, instead of using maximum possible duration (400ms), introduce a base velocity and use it for calculating the duration if the actual velocity, relative to the end point, is equal to or less than 0. * UIProcess/gtk/ViewGestureControllerGtk.cpp: (WebKit::ViewGestureController::SwipeProgressTracker::startAnimation): 2019-04-25 Alexander Mikhaylenko [GTK] Back/forward gesture snapshot always times out https://bugs.webkit.org/show_bug.cgi?id=197233 Reviewed by Michael Catanzaro. Delaying web process launch caused a regression where we create ViewGestureController when the web process doesn't yet exist. The controller immediately tries to connect to it and fails, and because of that never receives DidHitRenderTreeSizeThreshold() message, so navigation snapshot always stays until timeout after performing the gesture. To prevent this, create the controller in webkitWebViewBaseDidRelaunchWebProcess() instead of webkitWebViewBaseCreateWebPage(). Additionally, since settings are now created earlier than ViewGestureController, store the value of whether swipe gesture is enabled in WebKitWebViewBase and immediately apply it when creating the controller. * UIProcess/API/glib/WebKitWebView.cpp: (enableBackForwardNavigationGesturesChanged): Move the logic into webkitWebViewBaseSetEnableBackForwardNavigationGesture(). * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSetEnableBackForwardNavigationGesture): Added. In addition to what was in WebKitWebViewBase::enableBackForwardNavigationGesturesChanged(), store the value in a field for the case ViewGestureController doesn't exist yet. (webkitWebViewBaseCreateWebPage): Stop creating ViewGestureController. (webkitWebViewBaseDidRelaunchWebProcess): Move creating ViewGestureController here. Also immediately call setSwipeGestureEnabled() with the stored value. * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: 2019-04-25 Youenn Fablet [Mac iOS WK2] Layout Test http/wpt/cache-storage/cache-quota-after-restart.any.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=197040 Reviewed by Antti Koivisto. Delay write operations in case synchronize is ongoing. This is restricted to AvoidRandomness mode which is always used by CacheAPI and is also used by network cache for layout tests. Tested by cache-quota-after-restart.any.html no longer exhibiting write disk errors. * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::synchronize): (WebKit::NetworkCache::Storage::store): 2019-04-25 Commit Queue Unreviewed, rolling out r244627. https://bugs.webkit.org/show_bug.cgi?id=197282 Causing internal build failures (Requested by ShawnRoberts on #webkit). Reverted changeset: "Create AVFoundationSoftLink.{h,mm} to reduce duplicate code" https://bugs.webkit.org/show_bug.cgi?id=197171 https://trac.webkit.org/changeset/244627 2019-04-24 Carlos Garcia Campos [GTK] Hardcoded text color in input fields https://bugs.webkit.org/show_bug.cgi?id=126907 Reviewed by Michael Catanzaro. Implement PageClient::effectiveAppearanceIsDark() for GTK port. * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::effectiveAppearanceIsDark const): Check if gtk-application-prefer-dark-theme setting is enabled, or the theme name contains the -dark suffix or the GTK_THEME environment variable contains the :dark suffix. * UIProcess/API/gtk/PageClientImpl.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (themeChanged): Notify the WebPageProxy that the theme has changed. (webkitWebViewBaseSetToplevelOnScreenWindow): Connect to notify::gtk-application-prefer-dark-theme and notify::gtk-theme-name. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/gtk/WebPageGtk.cpp: (WebKit::WebPage::setUseDarkAppearance): Set gtk-application-prefer-dark-theme setting accordingly. 2019-04-24 Zalan Bujtas Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering https://bugs.webkit.org/show_bug.cgi?id=196948 Reviewed by Tim Horton. Move intrinsicContentSizeDidChange out of DrawingArea. Intrinsic content size is a layout concept and after r244291 there's no reason to have it in DrawingArea. * UIProcess/DrawingAreaProxy.h: (WebKit::DrawingAreaProxy::didUpdateGeometry): (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): Deleted. * UIProcess/DrawingAreaProxy.messages.in: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didChangeIntrinsicContentSize): (WebKit::WebPageProxy::setViewLayoutSize): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h: * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm: (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): Deleted. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::intrinsicContentSizeDidChange): Deleted. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::intrinsicContentsSizeChanged const): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded): (WebKit::WebPage::dispatchDidReachLayoutMilestone): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded): Deleted. 2019-04-24 Commit Queue Unreviewed, rolling out r244228. https://bugs.webkit.org/show_bug.cgi?id=197262 Causes compat issues (Requested by smfr on #webkit). Reverted changeset: "Unreviewed test gardening for Windows." https://trac.webkit.org/changeset/244228 2019-04-24 Eric Carlson Create AVFoundationSoftLink.{h,mm} to reduce duplicate code https://bugs.webkit.org/show_bug.cgi?id=197171 Reviewed by Youenn Fablet. * Shared/ios/WebIconUtilities.mm: (WebKit::iconForVideoFile): * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::ArgumentCoder::encodePlatformData): (IPC::ArgumentCoder::decodePlatformData): * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm: (WebKit::PlatformCALayerRemoteCustom::clone const): 2019-04-24 Per Arne Vollan [macOS] Fix syscall sandbox violation https://bugs.webkit.org/show_bug.cgi?id=197247 Reviewed by Brent Fulgham. A missing syscall in the sandbox of the WebContent process is causing a crash. * WebProcess/com.apple.WebProcess.sb.in: 2019-04-24 John Wilander Age out unconverted Ad Click Attributions after one week. https://bugs.webkit.org/show_bug.cgi?id=197238 Reviewed by Chris Dumez. AdClickAttributionManager::storeUnconverted() and AdClickAttributionManager::convert() now start by calling the new AdClickAttributionManager::clearExpired() function to remove any expired, unconverted attributions before continuing. The rest of the patch is infrastructure to allow tests to expire all unconverted attributions early. * NetworkProcess/AdClickAttributionManager.cpp: (WebKit::AdClickAttributionManager::storeUnconverted): (WebKit::AdClickAttributionManager::convert): (WebKit::AdClickAttributionManager::clearExpired): (WebKit::AdClickAttributionManager::markAllUnconvertedAsExpiredForTesting): * NetworkProcess/AdClickAttributionManager.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::markAdClickAttributionsAsExpiredForTesting): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::markAdClickAttributionsAsExpiredForTesting): * NetworkProcess/NetworkSession.h: * UIProcess/API/C/WKPage.cpp: (WKPageSetAdClickAttributionConversionURLForTesting): (WKPageMarkAdClickAttributionsAsExpiredForTesting): * UIProcess/API/C/WKPagePrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::markAdClickAttributionsAsExpiredForTesting): * UIProcess/WebPageProxy.h: 2019-04-24 Wenson Hsieh Plumb the navigation's request when determining recommended compatibility mode https://bugs.webkit.org/show_bug.cgi?id=197225 Reviewed by Alex Christensen. Adds a new argument to effectiveCompatibilityModeAfterAdjustingPolicies. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::effectiveCompatibilityModeAfterAdjustingPolicies): * UIProcess/WebPageProxy.h: 2019-04-24 Tim Horton Clean up WKActionSheetAssistant's use of LaunchServices https://bugs.webkit.org/show_bug.cgi?id=194645 Reviewed by Andy Estes. * UIProcess/ios/WKActionSheetAssistant.mm: (applicationHasAppLinkEntitlements): (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]): (-[WKActionSheetAssistant _appendOpenActionsForURL:actions:elementInfo:]): (appLinkForURL): Deleted. Make this function much more early-returny and flat. Adopt LS sync SPI instead of using a semaphore ourselves. Adopt modern open SPI. 2019-04-24 Simon Fraser Make it possible to control the renderTreeAsText output by setting options on testRunner https://bugs.webkit.org/show_bug.cgi?id=197133 Reviewed by Sam Weinig. Add testRunner.setRenderTreeDumpOptions() and expose the subset of RenderAsTextFlag flags that make sense in testing (those that don't dump unstable data like addresses), and plumb these flags through the various framework layers. Convert RenderAsTextBehavior to an OptionSet. Fix code generation in WebKitTestRunner to generate bindings for IDL const values, and hand-code DumpRenderTree bindings. Some cleanup of the TestRunners, using member initializers. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageCopyRenderTreeExternalRepresentation): * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::toRenderAsTextFlags): (WebKit::WebPage::renderTreeExternalRepresentation const): (WebKit::WebPage::renderTreeExternalRepresentationForPrinting const): * WebProcess/WebPage/WebPage.h: 2019-04-24 Alex Christensen WKContentRuleLists should have a maximum FileProtection of CompleteUnlessOpen https://bugs.webkit.org/show_bug.cgi?id=197078 Reviewed by Geoff Garen. r242735 was a fix for crashes when using mmap'd memory in apps with default FileProtection of NSFileProtectionComplete. It is more memory efficient and just as secure to reduce the FileProtection of these files to NSFileProtectionCompleteUnlessOpen. * NetworkProcess/cache/NetworkCacheFileSystem.cpp: (WebKit::NetworkCache::isSafeToUseMemoryMapForPath): (WebKit::NetworkCache::makeSafeToUseMemoryMapForPath): (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting): Deleted. (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting): Deleted. * NetworkProcess/cache/NetworkCacheFileSystem.h: * NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm: Added. (WebKit::NetworkCache::isSafeToUseMemoryMapForPath): (WebKit::NetworkCache::makeSafeToUseMemoryMapForPath): * Shared/WebCompiledContentRuleList.cpp: (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const): (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const): (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const): (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const): (WebKit::WebCompiledContentRuleList::actions const): (WebKit::WebCompiledContentRuleList::usesCopiedMemory const): Deleted. * Shared/WebCompiledContentRuleList.h: * Shared/WebCompiledContentRuleListData.cpp: (WebKit::WebCompiledContentRuleListData::encode const): (WebKit::WebCompiledContentRuleListData::decode): (WebKit::WebCompiledContentRuleListData::size const): Deleted. (WebKit::WebCompiledContentRuleListData::dataPointer const): Deleted. * Shared/WebCompiledContentRuleListData.h: (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData): * SourcesCocoa.txt: * UIProcess/API/APIContentRuleList.cpp: (API::ContentRuleList::usesCopiedMemory const): Deleted. * UIProcess/API/APIContentRuleList.h: * UIProcess/API/APIContentRuleListStore.cpp: (API::openAndMapOrCopyContentRuleList): (API::compiledToFile): (API::createExtension): (API::ContentRuleListStore::getContentRuleListSource): (API::ContentRuleListStore::readContentsOfFile): Deleted. (API::MappedOrCopiedData::dataPointer const): Deleted. * UIProcess/API/APIContentRuleListStore.h: * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm: (API::ContentRuleListStore::readContentsOfFile): Deleted. * UIProcess/API/Cocoa/WKContentRuleListStore.mm: (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]): Deleted. * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h: * UIProcess/API/Cocoa/_WKUserContentFilter.mm: (-[_WKUserContentFilter usesCopiedMemory]): Deleted. * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h: * WebKit.xcodeproj/project.pbxproj: 2019-04-24 David Kilzer Fix build due to missing SPI declaration of kAXSFullKeyboardAccessEnabledNotification * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm: Import AccessibilitySupportSPI.h. 2019-04-24 Chris Dumez URL set by document.open() is communicated with the WebPageProxy but not the WebFrameProxy https://bugs.webkit.org/show_bug.cgi?id=197214 Reviewed by Alex Christensen. URL set by document.open() is communicated with the WebPageProxy (since r244361) but not the WebFrameProxy. This patch fixes this. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _mainFrameURL]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/FrameLoadState.cpp: (WebKit::FrameLoadState::didExplicitOpen): * UIProcess/FrameLoadState.h: * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::didExplicitOpen): * UIProcess/WebFrameProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didExplicitOpenForFrame): 2019-04-24 Chris Dumez X-Frame-Options header should be ignored when frame-ancestors CSP directive is present https://bugs.webkit.org/show_bug.cgi?id=197226 Reviewed by Alex Christensen. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions): 2019-04-24 Dean Jackson Rename _highlightLongPressCanClick and only add gesture recognizer when necessary https://bugs.webkit.org/show_bug.cgi?id=197231 Reviewed by Antoine Quint. Rename _highlightLongPressCanClick to _longPressCanClick since it will be used in other places. Only attach the _highlightLongPressGestureRecognizer when we're not using long presses for preview. This might revert in the future, if we can set up an appropriate gesture resolution between the two. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): (-[WKContentView _webTouchEvent:preventsNativeGestures:]): (-[WKContentView _highlightLongPressRecognized:]): (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]): (-[WKContentView _presentedViewControllerForPreviewItemController:]): (-[WKContentView _previewItemControllerDidCancelPreview:]): 2019-04-24 chris fleizach AX: Remove deprecated Accessibility Object Model events https://bugs.webkit.org/show_bug.cgi?id=197073 Reviewed by Ryosuke Niwa. * Platform/spi/ios/AccessibilitySupportSPI.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): (-[WKWebView dealloc]): (accessibilityEventsEnabledChangedCallback): Deleted. (-[WKWebView _updateAccessibilityEventsEnabled]): Deleted. * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::updateAccessibilityEventsEnabled): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updateAccessibilityEventsEnabled): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2019-04-23 John Wilander Move Ad Click Attribution from internal feature to experimental feature https://bugs.webkit.org/show_bug.cgi?id=197218 Reviewed by Brent Fulgham. * Shared/WebPreferences.yaml: 2019-04-23 Keith Rollin Add Xcode version check for Header post-processing scripts https://bugs.webkit.org/show_bug.cgi?id=197116 Reviewed by Brent Fulgham. There are several places in our Xcode projects that post-process header files after they've been exported. Because of XCBuild, we're moving to a model where the post-processing is performed at the same time the header files are exported, rather than as a distinct post-processing step. This patch disables the distinct step when the inline processing is available. In practice, this means prefixing appropriate post-processing Custom Build phases with: if [ "${XCODE_VERSION_MAJOR}" -ge "1100" -a "${USE_NEW_BUILD_SYSTEM}" = "YES" ]; then # In this configuration, post-processing is performed at the same time as copying in the postprocess-header-rule script, so there's no need for this separate step. exit 0 fi * WebKit.xcodeproj/project.pbxproj: 2019-04-23 John Wilander Remove Ad Click Attribution data when removing website data https://bugs.webkit.org/show_bug.cgi?id=197215 Reviewed by Chris Dumez. This patch adds a new WebsiteDataType called AdClickAttributions and flags it as owned by the network process. The new website data type is added to the Cocoa API layer for website data records management. When either of the two WebsiteDataStore::removeData() functions calls NetworkProcess::deleteWebsiteData() or NetworkProcess::deleteWebsiteDataForOrigins() over IPC, the network process now calls into AdClickAttributionManager::clear() and AdClickAttributionManager::clearForRegistrableDomain() respectively, if the website datatypes include WebsiteDataType::AdClickAttributions. The patch removes a couple of completion handlers in NetworkSession function calls are because those are not asynchronous. * NetworkProcess/AdClickAttributionManager.cpp: (WebKit::AdClickAttributionManager::clear): (WebKit::AdClickAttributionManager::clearForRegistrableDomain): (WebKit::AdClickAttributionManager::toString const): * NetworkProcess/AdClickAttributionManager.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::clearAdClickAttribution): * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::clearAdClickAttribution): (WebKit::NetworkSession::clearAdClickAttributionForRegistrableDomain): * NetworkProcess/NetworkSession.h: * Shared/WebsiteData/WebsiteData.cpp: (WebKit::WebsiteData::ownerProcess): * Shared/WebsiteData/WebsiteDataType.h: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm: (dataTypesToString): * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h: (WebKit::toWebsiteDataType): (WebKit::toWKWebsiteDataTypes): * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (+[WKWebsiteDataStore _allWebsiteDataTypesIncludingPrivate]): 2019-04-23 Tim Horton Return annotated text checking strings via UIWKDocumentContext https://bugs.webkit.org/show_bug.cgi?id=197177 Reviewed by Ryosuke Niwa. * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h: * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm: (WebKit::TextCheckingControllerProxy::annotatedSubstringBetweenPositions): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestDocumentEditingContext): Respect the UIWKDocumentRequestAnnotation flag, returning an attributed string containing the platform text checking annotations. 2019-04-23 Commit Queue Unreviewed, rolling out r244556. https://bugs.webkit.org/show_bug.cgi?id=197212 Causing build failures on multiple builders (Requested by ShawnRoberts on #webkit). Reverted changeset: "Create AVFoundationSoftLink.{h,mm} to reduce duplicate code" https://bugs.webkit.org/show_bug.cgi?id=197171 https://trac.webkit.org/changeset/244556 2019-04-23 Remy Demarest Build fix after r244545. Reviewed by Tim Horton. * Platform/spi/mac/AppKitSPI.h: The SPI was an IPI in High Sierra. 2019-04-23 Per Arne Vollan [iOS] Input field on ddg.gg is auto focused when url is entered with the software keyboard https://bugs.webkit.org/show_bug.cgi?id=196740 Reviewed by Megan Gardner. When an url for a page with an autofocused input field is entered with the software keyboard, the input field is auto selected, and the software keyboard reappears. This does not happen when picking the url from favorites. After using the software keyboard to enter the url, the activity state is being changed to focused. The method '_elementDidFocus' checks whether the activity state changed, and allows the software keyboard to be shown in this case. To avoid showing the software keyboard in this case, send the changing activity state bitfield to the UI process, and check if the focus flag is the only flag set. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): 2019-04-23 Guy Lewin Multiple File Input Icon Set Regardless of File List https://bugs.webkit.org/show_bug.cgi?id=195537 Reviewed by Alexey Proskuryakov. Add WKOpenPanelResultListenerChooseMediaFiles() to choose files with icon and display string on iOS file open panels * UIProcess/API/C/WKOpenPanelResultListener.cpp: (WKOpenPanelResultListenerChooseMediaFiles): * UIProcess/API/C/WKOpenPanelResultListener.h: 2019-04-23 Eric Carlson Create AVFoundationSoftLink.{h,mm} to reduce duplicate code https://bugs.webkit.org/show_bug.cgi?id=197171 Reviewed by Youenn Fablet. * Shared/ios/WebIconUtilities.mm: (WebKit::iconForVideoFile): * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::ArgumentCoder::encodePlatformData): (IPC::ArgumentCoder::decodePlatformData): * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm: (WebKit::PlatformCALayerRemoteCustom::clone const): 2019-04-22 Dean Jackson Use additional members and protocols from WebKitAdditions in WKContentViewInteraction https://bugs.webkit.org/show_bug.cgi?id=197184 Reviewed by Wenson Hsieh. WebKitAdditions defines some macros to include additional members and protocols for WKContentViewInteraction. It also defines some new functions. Provide empty version of those functions when WebKitAdditions is not available. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _registerPreview]): (-[WKContentView _unregisterPreview]): 2019-04-23 Tim Horton Action sheet shares a stringified URL instead of a URL object https://bugs.webkit.org/show_bug.cgi?id=197185 Reviewed by Darin Adler. * UIProcess/Cocoa/WKShareSheet.h: * UIProcess/Cocoa/WKShareSheet.mm: (-[WKShareSheet presentWithParameters:inRect:completionHandler:]): (-[WKShareSheet presentWithParameters:completionHandler:]): Deleted. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::showShareSheet): * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::showShareSheet): Make it possible to optionally provide WKShareSheet with a rect to present relative to. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _showShareSheet:inRect:completionHandler:]): (-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]): (-[WKContentView _showShareSheet:completionHandler:]): Deleted. Instead of stringifying the URL and using the text selection assistant's share method, hand WKShareSheet a proper URL. 2019-04-23 Ryosuke Niwa [iOS] element.focus() sometimes fails to reveal the focused element when it becomes editable dynamically https://bugs.webkit.org/show_bug.cgi?id=197188 Reviewed by Wenson Hsieh. Commit the scroll tree update before revealing the keyboard via editor state update. * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree): 2019-04-23 Remy Demarest Fix layout issues occuring when entering full screen mode. https://bugs.webkit.org/show_bug.cgi?id=197086 . Reviewed by Darin Adler. This issue is the result of changing the style mask of the window after entering full screen mode. Safari adds an invisible toolbar to display the URL of the page which ends up breaking the layout. Having that window use a style that includes a titlebar fixes the bug. * Platform/spi/mac/AppKitSPI.h: Declare an SPI to be used in WKFullScreenWindowController. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::fullScreenWindow): Make the full screen window show a titlebar and make the content view underlap the titlebar to match the current behavior. Remove NSWindowStyleMaskBorderless which has no effects since it is equal to zero. * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController initWithWindow:webView:page:]): Hide the titlebar before beginning the animation to full screen. (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): Show the title bar when in full screen instead of a blank bar. (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): Hide the title bar to restore the initial setting. 2019-04-23 John Wilander Ad Click Attribution redirects to well-known location should not trigger a conversion if they are blocked by content blockers https://bugs.webkit.org/show_bug.cgi?id=197183 Reviewed by Alex Christensen. Ad Click Attribution conversions are picked up in the redirect handler in WebKit::NetworkResourceLoader. Content blocking typically happens in the continued redirect request handling in the web content process and a blocked request comes back empty. We need to call the WebKit::NetworkLoadChecker in the network process for these specific redirects, just like we do for Ping. The change makes use of the existing function NetworkLoadChecker::enableContentExtensionsCheck() for this purpose. In essence, this change makes it possible to block all conversions made to a "/.well-known/ad-click-attribution/" URL. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::handleAdClickAttributionConversion): New convenience function. (WebKit::NetworkResourceLoader::willSendRedirectedRequest): Now calls NetworkLoadChecker::enableContentExtensionsCheck() if an Ad Click Attribution conversion was found in the redirect URL. (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): If the request was not blocked, it will store any found conversion here. * NetworkProcess/NetworkResourceLoader.h: 2019-04-23 Don Olmstead [CMake][Win] Use target oriented design for WebKit https://bugs.webkit.org/show_bug.cgi?id=197173 Reviewed by Alex Christensen. Enumerate public framework headers for WinCairo's WebKit implementation and copy them. Migrate to use WebKit_DERIVED_SOURCES_DIR. * CMakeLists.txt: * PlatformGTK.cmake: * PlatformWPE.cmake: * PlatformWin.cmake: 2019-04-23 Chris Dumez [Process-Swap-On-Navigation] WebKit hangs when going back to a form submission's page due to Process-Swap-On-Navigation on iOS 12.2 and higher https://bugs.webkit.org/show_bug.cgi?id=197097 Reviewed by Alex Christensen. The issue is that when doing a history navigation with form data, we try to resubmit the form. We initially use the ReturnCacheDataDontLoad cache policy without prompting the user to get cached data. If this fails, we sent a DidFailProvisionalLoadForFrame IPC to the UIProcess but the WebContent process actually retries the load with ReturnCacheDataElseLoad cache policy. This new load triggers a new decidePolicyForNavigationAction. This would cause trouble with process-swapping because we normally destroy the ProvisionalPageProxy as soon as we receive a DidFailProvisionalLoadForFrame IPC from the provisional process. As a result, the provisional process would not be able to retry. To address the issue, we add pass a flag with the DidFailProvisionalLoadForFrame IPC to if the load will continue or not. When this flag is set, the UIProcess does not destroy the provisional page. * Scripts/webkit/messages.py: Minor IPC message handler build fix. * UIProcess/API/Cocoa/WKURLSchemeTask.mm: (-[WKURLSchemeTaskImpl _onlyIfCached]): * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h: Add new _onlyIfCached SPI to WKURLSchemeTaskPrivate to allow for API testing. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::cancel): Pass WillContinueLoading flag. (WebKit::ProvisionalPageProxy::validateInput): Consider IPC with a navigationID of 0 as valid. When the navigation is triggered by the WebContent process, it sends us a DecidePolicyForNavigationActionAsync IPC with a navigationID of 0, until the UIProcess can generate a valid identifier. (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync): When the WebPageProxy has generated a navigationID for the new WebContent process-initiated navigation, update m_navigationID so that follow-up IPC is considered valid. * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared): (WebKit::WebPageProxy::decidePolicyForNavigationAction): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2019-04-22 Zalan Bujtas [ContentChangeObserver] Some dropdown menus may close without user gesture on americanexpress.com https://bugs.webkit.org/show_bug.cgi?id=197175 Reviewed by Simon Fraser. Do not generate additional synthetic mouse events (e.g. mouseout in this case) when the content handles the click event. This helps cases when the synthetic mouseout ended up dismissing the dropdown menus. However it won't regress cases like youtube.com, where sending mouseout is required to have the control bar dismissed on play. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::completeSyntheticClick): 2019-04-22 Alex Christensen Deprecate WKContextCreateWithInjectedBundlePath https://bugs.webkit.org/show_bug.cgi?id=197169 Reviewed by Youenn Fablet. * UIProcess/API/C/WKContext.h: 2019-04-22 Alex Christensen REGRESSION(r230681) Do not use stored credentials if WKBundlePageResourceLoadClient.shouldUseCredentialStorage returns false https://bugs.webkit.org/show_bug.cgi?id=197093 Reviewed by Chris Dumez. Only get the StoredCredentialsPolicy from the NetworkLoadChecker if we haven't already been told not to use credentials. Also add some test infrastructure for clearing persistent credentials added by the test. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::removeCredential): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::startNetworkLoad): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::removeCredential): * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _removeCredential:forProtectionSpace:completionHandler:]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::removeCredential): * UIProcess/WebProcessPool.h: 2019-04-22 Chris Dumez Delayed WebProcessLaunch may break the _relatedWebView SPI https://bugs.webkit.org/show_bug.cgi?id=197160 Reviewed by Alex Christensen. Delayed WebProcessLaunch may break the _relatedWebView SPI. The breakage would happen if the client would relate a WebView to another which has not launched its initial process yet. To address the issue, when we need a running process for a WebView which has a related view, we need to make sure the related view has a running process and use that process. Previously, we would share the "dummy" process instead. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::launchProcess): (WebKit::WebPageProxy::ensureRunningProcess): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::createWebPage): 2019-04-22 David Quesada Remove linked-on-or-after check for download attribute handling https://bugs.webkit.org/show_bug.cgi?id=197176 rdar://problem/48459714 Reviewed by Alex Christensen. There are no apps linked prior to this SDK version that are using the _WKDownload SPI, so it doesn't make sense to preserve the old behavior of forcing download-attribute links to start downloads. * UIProcess/Cocoa/VersionChecks.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): 2019-04-22 Chris Dumez Unreviewed, rolling out r244502. Caused crashes on the bots Reverted changeset: "Delayed WebProcessLaunch may break the _relatedWebView SPI" https://bugs.webkit.org/show_bug.cgi?id=197160 https://trac.webkit.org/changeset/244502 2019-04-22 Ryan Haddad Unreviewed, rolling out r244437. Still breaks internal tests. Reverted changeset: "InjectedBundle parameters often need initialization function called before unarchiving" https://bugs.webkit.org/show_bug.cgi?id=189709 https://trac.webkit.org/changeset/244437 2019-04-22 Chris Dumez Delayed WebProcessLaunch may break the _relatedWebView SPI https://bugs.webkit.org/show_bug.cgi?id=197160 Reviewed by Alex Christensen. Delayed WebProcessLaunch may break the _relatedWebView SPI. The breakage would happen if the client would relate a WebView to another which has not launched its initial process yet. To address the issue, when we need a running process for a WebView which has a related view, we need to make sure the related view has a running process and use that process. Previously, we would share the "dummy" process instead. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::launchProcess): (WebKit::WebPageProxy::ensureRunningProcess): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::createWebPage): 2019-04-22 Ludovico de Nittis [GTK] fix gtk_style_context_set_background deprecation https://bugs.webkit.org/show_bug.cgi?id=196912 Reviewed by Carlos Garcia Campos. Since gtk 3.18 gtk_style_context_set_background has been deprecated. Backgrounds are not rendered in the UI process, so it can be simply removed. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseRealize): 2019-04-21 Wenson Hsieh Defer EditorState updates until the next layer tree flush in a few additional circumstances https://bugs.webkit.org/show_bug.cgi?id=197145 Reviewed by Darin Adler. Gets rid of sendPartialEditorStateAndSchedulePostLayoutUpdate(), in favor of always scheduling a full editor state update after the next compositing flush. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updateEditorStateAfterLayoutIfEditabilityChanged): (WebKit::WebPage::setNeedsFontAttributes): (WebKit::WebPage::didChangeOverflowScrollPosition): (WebKit::WebPage::didChangeSelection): (WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition): (WebKit::WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::platformEditorState const): (WebKit::WebPage::updateVisibleContentRects): 2019-04-21 Chris Dumez Regression(r243767) WebFrame::m_navigationIsContinuingInAnotherProcess flag is never reset https://bugs.webkit.org/show_bug.cgi?id=197144 Reviewed by Darin Adler. WebFrame::m_navigationIsContinuingInAnotherProcess flag is never reset since it was introduced in r243767. This leads to leaking Navigation objects in the UIProcess when reusing a previously suspended process because such process will no longer send the DidDestroyNavigation IPC. It turns out that resetting the flags causes API tests such as ProcessSwap.QuickBackForwardNavigationWithPSON to ASSERT. This is because when the UIProcess quickly navigate back and forth without waiting for policy decisions, we may end up getting the policy decision for a particular navigation *after* we've sent the DidDestroyNavigation. As a result, this patch reverts r243767 and fixes in the assertion in http/tests/adClickAttribution/store-ad-click-attribution.html another way. We initially assumed that the logic in WebPageProxy::didDestroyNavigation() was failing to ignore the DidDestroyNavigation from the previous process after a swap due to a race, maybe because it was sometimes received too late and m_provisionalPage was already cleared. However, this would not make sense since the test is crashing consistently and the page would no longer be able to receive IPC from the previous process *after* we've committed the provisional process/page. The real issue was that the DidDestroyNavigation IPC was received *before* we could construct the provisional page, which is why the logic in WebPageProxy::didDestroyNavigation() was failing to ignore the bad IPC. In WebPageProxy::receivedNavigationPolicyDecision(), we were calling receivedPolicyDecision() (which would send the DidReceivePolicyDecision to the previous WebProcess) and then continueNavigationInNewProcess() in order to construct the provisional page. I personally did not expect we could receive IPC between the calls to receivedNavigationPolicyDecision() and receivedPolicyDecision(), since we are not yielding and since the DidReceivePolicyDecision IPC is asynchronous. However, this is exactly what was happening in the context of this test. The reason is that the DidReceivePolicyDecision IPC was getting wrapped in a synchronous message and sent as synchronous message due to the Connection::m_inDispatchMessageMarkedToUseFullySynchronousModeForTesting flag which seems to get set in the test due to some EventSender IPC. I believe this is because the test uses EventSender to do a click on a link which triggers the navigation. To address the issue, I now call receivedNavigationPolicyDecision() *after* continueNavigationInNewProcess() to make sure that we always start the provisional load in the new process before we tell the previous process to stop loading. This way, there is no way we get IPC from the previous process about the current navigation before we have a provisional page. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::didDestroyNavigation): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::didReceivePolicyDecision): (WebKit::WebFrame::documentLoaderDetached): * WebProcess/WebPage/WebFrame.h: 2019-04-20 Chris Dumez Unreviewed, fix iOS build with recent SDKs. * UIProcess/API/Cocoa/WKWebView.mm: (deviceOrientation): * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: (-[WKFullScreenViewController initWithWebView:]): (-[WKFullScreenViewController viewWillTransitionToSize:withTransitionCoordinator:]): (-[WKFullScreenViewController _statusBarFrameDidChange:]): 2019-04-19 John Wilander Disable Ad Click Attribution in ephemeral sessions and make sure conversion requests use an ephemeral, stateless session https://bugs.webkit.org/show_bug.cgi?id=197108 Reviewed by Alex Christensen. This patch introduces a new NSURLSession in WebKit::NetworkSessionCocoa called m_ephemeralStatelessCookielessSession. As its name implies, it's ephemeral, stateless, and has a NSHTTPCookieAcceptPolicyNever cookie policy. The new session can be invoked with the new enum value of WebCore::StoredCredentialsPolicy called EphemeralStatelessCookieless. WebKit::AdClickAttributionManager::fireConversionRequest() makes use of the new session for its conversion requests. This patch also makes sure that Ad Click Attributions cannot be stored in ephemeral sessions and already stored attributions cannot be converted in ephemeral sessions. * NetworkProcess/AdClickAttributionManager.cpp: (WebKit::AdClickAttributionManager::fireConversionRequest): (WebKit::AdClickAttributionManager::toString const): * NetworkProcess/NetworkLoadChecker.h: * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::willSendRedirectedRequest): * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Calls NetworkSessionCocoa::initializeEphemeralStatelessCookielessSession() lazily. (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa): (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::initializeEphemeralStatelessCookielessSession): (WebKit::NetworkSessionCocoa::invalidateAndCancel): * Shared/WebCoreArgumentCoders.h: 2019-04-19 Daniel Bates Use RetainPtr and rename +autocorrectionRectsWithRects:lastRect: to +autocorrectionRectsWithFirstCGRect:lastCGRect: https://bugs.webkit.org/show_bug.cgi?id=197122 Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView requestAutocorrectionRectsForString:withCompletionHandler:]): Renamed; formerly named +autocorrectionRectsWithRects:lastRect:. While I am here use else-branch to initialize firstRect and lastRect just to make the code closer to the optimal assembly. Also use Vector::{isEmpty, first, last}() instead of using the index operator overload and size() for emptiness checks. The code is more readable at the cost being ever so slightly slower (due to the overflow checks in first() and last()), but this code is likely not hot enough for it to matter. (-[WKContentView applyAutocorrection:toString:withCompletionHandler:]): Update for renaming. (+[WKAutocorrectionRects autocorrectionRectsWithFirstCGRect:lastCGRect:]): Ditto. (+[WKAutocorrectionRects autocorrectionRectsWithRects:lastRect:]): Deleted. 2019-04-19 Daniel Bates -[WKAutocorrectionContext emptyAutocorrectionContext:] generates invalid empty context https://bugs.webkit.org/show_bug.cgi?id=197119 Reviewed by Wenson Hsieh. Use the existing EditingRange type to represent the location and length of the marked text range for an autocorrection instead of managing integers. This type avoid the need to handle the special case for an empty range represented as NSMakeRange(NSNotFound, 0). Currently WKAutocorrectionContext incorrectly represents the empty range as NSMakeRange(WTF::notFound, 0). While I am here, simplify the existing WebAutocorrectionContext encoder/decoder code and rename +[WKAutocorrectionContext autocorrectionContextWithContext:] to +autocorrectionContextWithWebContext to better reflect the expected source of the conversion: a Web-type. * Shared/ios/WebAutocorrectionContext.h: (WebKit::WebAutocorrectionContext::encode const): Reformat while I am here to make this logic easy to amend without losing SVN history. (WebKit::WebAutocorrectionContext::decode): Simplify the code while I am here. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _handleAutocorrectionContext:]): Update for renaming. (+[WKAutocorrectionContext emptyAutocorrectionContext]): Update for renaming. (+[WKAutocorrectionContext autocorrectionContextWithWebContext:]): Renamed; formerly named autocorrectionContextWithContext. (+[WKAutocorrectionContext autocorrectionContextWithContext:]): Deleted. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::autocorrectionContext): Update to make use of EditingRange. Also instantiate the struct and return it, initializing its fields individually instead of using the constructor to make this code less error prone. It's easy to introduce an error with the constructor notation when amending the the struct because so many of the arguments are of the same data type. Individually initializing the struct fields makes it less likely for an ordering mistake to be introduced. 2019-04-19 Dean Jackson Add more _WKElementActionTypes and provide API to create with custom types https://bugs.webkit.org/show_bug.cgi?id=197117 Reviewed by Tim Horton. We were missing a few obvious types that are well-known browser actions, and/or should be visible in share sheets. Also, clean up the API for constructing new types. * UIProcess/API/Cocoa/_WKElementAction.h: Add new types for opening in new tabs, windows and downloading. * UIProcess/API/Cocoa/_WKElementAction.mm: (+[_WKElementAction elementActionWithType:title:actionHandler:]): New constructor with type, title and action. (+[_WKElementAction elementActionWithType:]): Call new method. 2019-04-18 Daniel Bates Use existing KeyEventCodesIOS constants instead of duplicating them https://bugs.webkit.org/show_bug.cgi?id=197081 Rubber-stamped by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _interpretKeyEvent:isCharEvent:]): While I am here, remove the case for the space key as it is identical to the default switch case. 2019-04-19 Keith Rollin Add postprocess-header-rule scripts https://bugs.webkit.org/show_bug.cgi?id=197072 Reviewed by Brent Fulgham. Several projects have post-processing build phases where exported headers are tweaked after they've been copied. This post-processing is performed via scripts called postprocess-headers.sh. For reasons related to XCBuild, we are now transitioning to a build process where the post-processing is performed at the same time as the exporting/copying. To support this process, add similar scripts named postprocess-header-rule, which are geared towards processing a single file at a time rather than all exported files at once. Also add a build rule that makes use of these scripts. These scripts and build rules are not used at the moment; they will come into use in an imminent patch. Note that I've named these postprocess-header-rule rather than postprocess-header-rule.sh. Scripts in Tools/Scripts do not have suffixes indicating how the tool is implemented. Scripts in per-project Scripts folders appear to be mixed regarding the use of suffixes. I'm opting here to follow the Tools/Scripts convention, with the expectation that over time we completely standardize on that. * Scripts/postprocess-header-rule: Added. * WebKit.xcodeproj/project.pbxproj: 2019-04-19 Brady Eidson Deprecate WebKit2 plug-in support. and https://bugs.webkit.org/show_bug.cgi?id=197080 Reviewed by Andy Estes. * UIProcess/API/Cocoa/WKPreferences.h: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences encodeWithCoder:]): (-[WKPreferences initWithCoder:]): (-[WKPreferences javaEnabled]): (-[WKPreferences setJavaEnabled:]): (-[WKPreferences plugInsEnabled]): (-[WKPreferences setPlugInsEnabled:]): 2019-04-19 Chris Dumez Minor PSON release logging improvements https://bugs.webkit.org/show_bug.cgi?id=197104 Reviewed by Darin Adler. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::didProcessRequestToSuspend): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::continueNavigationInNewProcess): 2019-04-19 Tim Horton YouTube and Twitter embeds don't load in News https://bugs.webkit.org/show_bug.cgi?id=197111 Reviewed by Timothy Hatcher. * WebProcess/com.apple.WebProcess.sb.in: Adjust this sandbox exception to include both platforms. 2019-04-19 Wenson Hsieh [iOS] Add quirks to disable autocorrection and autocapitalization in hidden editable areas on some websites https://bugs.webkit.org/show_bug.cgi?id=197102 Reviewed by Ryosuke Niwa. If the quirk for disabling autocorrection and autocapitalization in hidden editable areas is active, then check whether the focused element is hidden, and turn off autocorrection and autocapitalization if needed. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getFocusedElementInformation): 2019-04-19 Commit Queue Unreviewed, rolling out r244447. https://bugs.webkit.org/show_bug.cgi?id=197103 Caused build failures with Internal and Opensource builders (Requested by ShawnRoberts on #webkit). Reverted changeset: "Deprecate WebKit2 plug-in support." https://bugs.webkit.org/show_bug.cgi?id=197080 https://trac.webkit.org/changeset/244447 2019-04-18 Brady Eidson Deprecate WebKit2 plug-in support. and https://bugs.webkit.org/show_bug.cgi?id=197080 Reviewed by Andy Estes. * UIProcess/API/Cocoa/WKPreferences.h: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences encodeWithCoder:]): (-[WKPreferences initWithCoder:]): (-[WKPreferences javaEnabled]): (-[WKPreferences setJavaEnabled:]): (-[WKPreferences plugInsEnabled]): (-[WKPreferences setPlugInsEnabled:]): 2019-04-18 Commit Queue Unreviewed, rolling out r244434. https://bugs.webkit.org/show_bug.cgi?id=197089 caused 1 API test failure (Requested by zalan on #webkit). Reverted changeset: "Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering" https://bugs.webkit.org/show_bug.cgi?id=196948 https://trac.webkit.org/changeset/244434 2019-04-18 Wenson Hsieh Add new compatibility mode API on WKNavigation https://bugs.webkit.org/show_bug.cgi?id=197069 Reviewed by Tim Horton. Adds a new property on WKNavigation. * Shared/WebCompatibilityMode.h: Drive-by fix: make this enum class 8 bits wide. * UIProcess/API/APINavigation.h: (API::Navigation::setEffectiveCompatibilityMode): (API::Navigation::effectiveCompatibilityMode const): Add a new member variable to API::Navigation. * UIProcess/API/Cocoa/WKNavigation.h: * UIProcess/API/Cocoa/WKNavigation.mm: * UIProcess/API/Cocoa/WKWebpagePreferences.mm: * UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h: Add various hooks into WebKitAdditions. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): Set API::Navigation's effective compatibility mode. (WebKit::WebPageProxy::effectiveCompatibilityModeAfterAdjustingPolicies): Renamed and refactored this method to return the effective compatibility mode, chosen while adjusting website policies. (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode): Deleted. * UIProcess/WebPageProxy.h: 2019-04-18 Don Olmstead [CMake] Make WebCore headers copies https://bugs.webkit.org/show_bug.cgi?id=182512 Reviewed by Alex Christensen. WebCore now uses WebCore_PRIVATE_INCLUDE_DIRECTORIES for all ports. This revealed problems with WebKit's usage of WebCore headers. All include directories directly referencing the WebCore source tree we're removed from the CMake files. Any includes of WebCore headers using "*.h" were modified to Removed generation of forwarding headers for WebCore using the perl script. * CMakeLists.txt: * NetworkProcess/curl/NetworkDataTaskCurl.h: * PlatformWPE.cmake: * PlatformWin.cmake: * Scripts/generate-forwarding-headers.pl: * UIProcess/API/glib/WebKitUserContentFilterStore.cpp: * UIProcess/API/wpe/WebKitColorPrivate.h: * UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp: * UIProcess/win/PageClientImpl.cpp: 2019-04-18 Chris Dumez [iOS] Improve detection of when web views go to background / foreground https://bugs.webkit.org/show_bug.cgi?id=197035 Reviewed by Tim Horton. Improve detection of when web views go to background / foreground on iOS. * UIProcess/ApplicationStateTracker.mm: (WebKit::ApplicationStateTracker::ApplicationStateTracker): Deleted. (WebKit::ApplicationStateTracker::~ApplicationStateTracker): Deleted. (WebKit::ApplicationStateTracker::applicationDidEnterBackground): Deleted. (WebKit::ApplicationStateTracker::applicationDidFinishSnapshottingAfterEnteringBackground): Deleted. (WebKit::ApplicationStateTracker::applicationWillEnterForeground): Deleted. 2019-04-18 Jer Noble Refactoring: Pull all fullscreen code out of Document and into its own helper class https://bugs.webkit.org/show_bug.cgi?id=197017 Reviewed by Eric Carlson. * WebProcess/FullScreen/WebFullScreenManager.cpp: (WebKit::WebFullScreenManager::willEnterFullScreen): (WebKit::WebFullScreenManager::didEnterFullScreen): (WebKit::WebFullScreenManager::willExitFullScreen): (WebKit::WebFullScreenManager::didExitFullScreen): (WebKit::WebFullScreenManager::setAnimatingFullScreen): (WebKit::WebFullScreenManager::requestExitFullScreen): * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp: (webkit_dom_document_webkit_cancel_fullscreen): (webkit_dom_document_webkit_exit_fullscreen): (webkit_dom_document_get_webkit_is_fullscreen): (webkit_dom_document_get_webkit_fullscreen_keyboard_input_allowed): (webkit_dom_document_get_webkit_current_fullscreen_element): (webkit_dom_document_get_webkit_fullscreen_element): * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createWindow): 2019-04-18 Megan Gardner Update UIKit when a cut causes a selection change https://bugs.webkit.org/show_bug.cgi?id=197047 Reviewed by Wenson Hsieh. We need to let UIKit know when a cut causes a selection change (always), so that is can appropriately update the button on the keyboard bar. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cutForWebView:]): 2019-04-18 Brent Fulgham InjectedBundle parameters often need initialization function called before unarchiving https://bugs.webkit.org/show_bug.cgi?id=189709 Reviewed by Ryosuke Niwa. Handle the case where the InjectedBundle parameters do not successfully decode because they contain an unexpected class from the embedding program. If this happens, try decoding the bundle parameters after the bundle initialiation function runs, which gives the embedding program the opportunity to register additional classes that are safe for serialization. Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need to be serialized by the InjectedBundle. Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'. Revise 'initialize' to call this new method. * WebProcess/InjectedBundle/InjectedBundle.h: * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm: (WebKit::InjectedBundle::initialize): Use the new method. (WebKit::InjectedBundle::decodeBundleParameters): Added. (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete 'classesForCoder' method to unarchive the passed bundle parameters, rather than the NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the NSDictionary object may itself hold other kinds of objects. * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h: (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added. 2019-04-18 Zalan Bujtas Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering https://bugs.webkit.org/show_bug.cgi?id=196948 Reviewed by Tim Horton. Move intrinsicContentSizeDidChange out of DrawingArea. Intrinsic content size is a layout concept and after r244291 there's no reason to have it in DrawingArea. * UIProcess/DrawingAreaProxy.h: (WebKit::DrawingAreaProxy::didUpdateGeometry): (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): Deleted. * UIProcess/DrawingAreaProxy.messages.in: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didChangeIntrinsicContentSize): (WebKit::WebPageProxy::setViewLayoutSize): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h: * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm: (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): Deleted. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::intrinsicContentSizeDidChange): Deleted. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded): (WebKit::WebPage::dispatchDidReachLayoutMilestone): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded): Deleted. 2019-04-18 Ryan Haddad Unreviewed, rolling out r244299. Breaks internal tests. Reverted changeset: "InjectedBundle parameters often need initialization function called before unarchiving" https://bugs.webkit.org/show_bug.cgi?id=189709 https://trac.webkit.org/changeset/244299 2019-04-18 Shawn Roberts Unreviewed manual rollout of r244248 and r244409 Causing assertion failures on Mac WK2 Debug builds https://bugs.webkit.org/show_bug.cgi?id=195623 * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::lowMemoryHandler): * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::prefetchCache): Deleted. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::retrieveCacheEntry): (WebKit::NetworkResourceLoader::didReceiveResponse): (WebKit::NetworkResourceLoader::didReceiveBuffer): (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry): (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const): Deleted. * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/cache/PrefetchCache.cpp: Removed. * NetworkProcess/cache/PrefetchCache.h: Removed. * Shared/WebPreferences.yaml: * Sources.txt: * WebKit.xcodeproj/project.pbxproj: 2019-04-18 Devin Rousso Web Inspector: Canvas: enable WebGL2 for inspector page https://bugs.webkit.org/show_bug.cgi?id=196932 Reviewed by Timothy Hatcher. * WebProcess/WebPage/WebInspectorUI.cpp: (WebKit::WebInspectorUI::WebInspectorUI): 2019-04-17 Devin Rousso Web Inspector: InspectorFrontendHost::inspectionLevel returns wrong value for inspector3 https://bugs.webkit.org/show_bug.cgi?id=197044 Reviewed by Joseph Pecoraro. * UIProcess/WebInspectorUtilities.h: * UIProcess/WebInspectorUtilities.cpp: (WebKit::trackInspectorPage): (WebKit::untrackInspectorPage): Determine the level of the inspector page by looking to see if the page being inspected is in the inspector page map. If so, we must be inspecting an inspector page and should use that inspector page's inspection level as the value to increment. * UIProcess/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::createFrontendPage): * UIProcess/RemoteWebInspectorProxy.cpp: (WebKit::RemoteWebInspectorProxy::createFrontendPageAndWindow): 2019-04-17 Tim Horton Adopt different scroll view flashing SPI https://bugs.webkit.org/show_bug.cgi?id=197043 Reviewed by Wenson Hsieh. * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKKeyboardScrollingAnimator.mm: (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]): 2019-04-17 Tim Horton REGRESSION (r241988): Switching tabs is slow https://bugs.webkit.org/show_bug.cgi?id=197037 Reviewed by Simon Fraser. * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm: (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState): r241988 changed to wait for a WebPageProxy message to a given DrawingArea ID, but WebPageProxy messages are identified by their WebPageProxy ID. Revert that one change. The rest of the patch looks OK. 2019-04-17 Rob Buis Link prefetch not useful for top-level navigation https://bugs.webkit.org/show_bug.cgi?id=195623 Reviewed by Alex Christensen. Fix macOS and iOS Debug WK2 bots ASSERTS after r367404, by simply not sending the DidReceiveResponse message. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::didReceiveResponse): 2019-04-17 Truitt Savell Unreviewed, rolling out r244400. Caused testing to exit early with assertionon Debug WK2 Reverted changeset: "UI↔Web deadlock when printing with a JavaScript alert visible" https://bugs.webkit.org/show_bug.cgi?id=196839 https://trac.webkit.org/changeset/244400 2019-04-17 Brady Eidson Link clicks in PDFs shouldn't send referrer headers. and https://bugs.webkit.org/show_bug.cgi?id=196980 Reviewed by Tim Horton. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::clickedLink): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick): 2019-04-17 Andy Estes [iOS] Support multiple file selection in UIDocumentPickerViewController https://bugs.webkit.org/show_bug.cgi?id=197014 Reviewed by Tim Horton. * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel _showDocumentPickerMenu]): Allowed multiple file selection in our UIDocumentPickerViewController when _allowMultipleFiles is YES. (displayStringForDocumentsAtURLs): (-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]): Changed to support multiple file selection. When more than one file is selected, use WebCore::multipleFileUploadText() as the display string. 2019-04-17 Alex Christensen Make WebCompiledContentRuleListData non-default-constructible, move its nonserialized member to API::ContentRuleList https://bugs.webkit.org/show_bug.cgi?id=197033 Reviewed by Tim Horton. This is just cleanup that makes the code nicer without changing behavior. * Shared/WebCompiledContentRuleListData.cpp: (WebKit::WebCompiledContentRuleListData::encode const): (WebKit::WebCompiledContentRuleListData::decode): * Shared/WebCompiledContentRuleListData.h: (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData): * UIProcess/API/APIContentRuleList.h: * UIProcess/API/APIContentRuleListStore.cpp: (API::createExtension): 2019-04-17 John Wilander Add prioritization of ad click conversions and cleaning of sent ad click conversions https://bugs.webkit.org/show_bug.cgi?id=196934 Reviewed by Chris Dumez. In this description, by "pair" I mean { AdClickAttribution::Source, AdClickAttribution::Destination }. This patch adds handling of prioritization of conversions according to these rules: - If we have a matching unconverted attribution, convert it. This consumes the conversion. - If we have no previously converted attribution for this pair, just store. - If we have a previously converted attribution for this pair, replace it if the new one has higher priority. - If we had no matching unconverted attribution but do have a previously converted attribution for this pair, re-convert the previously converted attribution to make sure the highest priority gets set. This handling is in part done by dividing the previous m_adClickAttributionMap into m_unconvertedAdClickAttributionMap and m_convertedAdClickAttributionMap, which now use a std::pair as key instead of a nested HashMap. This patch also changes AdClickAttributionManager::firePendingConversionRequests() so that it now removes attributions which have been sent out. Finally, AdClickAttributionManager::clear() no longer clears m_conversionBaseURLForTesting and m_isRunningTest since doing so caused test flakiness. It is now up to the test case that sets these members to also clear them when done. * NetworkProcess/AdClickAttributionManager.cpp: (WebKit::AdClickAttributionManager::storeUnconverted): (WebKit::AdClickAttributionManager::convert): (WebKit::AdClickAttributionManager::firePendingConversionRequests): (WebKit::AdClickAttributionManager::clear): (WebKit::AdClickAttributionManager::toString const): (WebKit::AdClickAttributionManager::setConversionURLForTesting): (WebKit::AdClickAttributionManager::ensureDestinationMapForSource): Deleted. (WebKit::AdClickAttributionManager::store): Deleted. * NetworkProcess/AdClickAttributionManager.h: (WebKit::AdClickAttributionManager::AdClickAttributionManager): (WebKit::AdClickAttributionManager::setConversionURLForTesting): Deleted. * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::storeAdClickAttribution): 2019-04-17 Tim Horton UI↔Web deadlock when printing with a JavaScript alert visible https://bugs.webkit.org/show_bug.cgi?id=196839 Reviewed by Andy Estes. * Platform/IPC/Connection.cpp: (IPC::Connection::dispatchWorkQueueMessageReceiverMessage): (IPC::Connection::sendSyncReply): (IPC::Connection::dispatchSyncMessage): * Platform/IPC/Connection.h: (IPC::Connection::hasOutstandingOutgoingSynchronousReplies const): Keep track of whether we owe the other side of the connection any delayed sync replies. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _webViewPrintFormatter]): Most actions one can take with a _WKWebViewPrintFormatter involve synchronously messaging the Web Content process with an infinite timeout. Doing so while the Web Content process is awaiting a reply to a deferred-reply synchronous message (like, say, an alert()) results in an app-destroying deadlock. Instead of that, return a nil _WKWebViewPrintFormatter, indicating to the client that we can't print right now. * UIProcess/ios/WKContentView.mm: (-[WKContentView _wk_pageCountForPrintFormatter:]): (-[WKContentView _wk_printedDocument]): The above isn't sufficient, though, because a sync message could arrive and be handled between creation and use of the _WKWebViewPrintFormatter. So, we also bail with a zero page count and null CGPDFDocument immediately before we would send a sync message to the Web Content process. Clients handle this less gracefully (e.g. showing a zero page PDF), but it is very rare compared to the above case. 2019-04-17 Zalan Bujtas [ContentChangeObserver] Use aria role as a hint whether a tap should result in a synthetic click https://bugs.webkit.org/show_bug.cgi?id=196988 Reviewed by Simon Fraser. Tapping on elements with cretain aria role attributes should trigger synthetic click the same way it does on form control elements. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::isAriaRoleForImmediateClick): (WebKit::nodeAlwaysRequiresClick): (WebKit::WebPage::handleSyntheticClick): 2019-04-17 Alex Christensen WKRetainPtr's adoption constructor should be private https://bugs.webkit.org/show_bug.cgi?id=197019 Reviewed by Tim Horton. RefPtr and RetainPtr have already done this. It makes us use nicer syntax. * UIProcess/API/C/WKContext.cpp: (WKContextSetDownloadClient): * UIProcess/API/cpp/WKRetainPtr.h: (WebKit::WKRetainPtr::WKRetainPtr): (WebKit::adoptWK): 2019-04-17 Alex Christensen Fix crash during teardown of PingLoad https://bugs.webkit.org/show_bug.cgi?id=197024 Reviewed by Jer Noble. * NetworkProcess/PingLoad.cpp: (WebKit::PingLoad::initialize): Early return if weakThis is null. 2019-04-17 Wenson Hsieh REGRESSION (r243926): [iOS] Release assertion when computing editor state during an overflow scroll triggered by layout https://bugs.webkit.org/show_bug.cgi?id=197012 Reviewed by Simon Fraser. We hit the release assertion due to the following sequence of events: - Dispatch a queued event (in this case, a scroll event) - Invoke the scroll event listener, which modifies layout in some way - This scrolls an overflow scrollable container under the scope of layout - Overflow scrolling then calls didChangeSelection and triggers an editor state update, which updates layout In the case where the selection is in the main frame, we bail early due to the check for recursive layout (i.e. frameView->layoutContext().isInRenderTreeLayout()). However, in the case where the selection is inside a subframe, we end up skipping past this check, since the subframe's FrameView isn't currently laying out, and so we end up hitting the release assertion underneath the early return. To fix this, simply defer editor state updates due to overflow scrolling until the next remote layer tree commit instead of computing and sending the information immediately. While this only defers editor state updates during overflow scrolling, tracks making editor state updates deferred in the general case. Test: editing/selection/overflow-scroll-while-selecting-text.html * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm: (WebKit::WebEditorClient::overflowScrollPositionChanged): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didChangeOverflowScrollPosition): (WebKit::WebPage::didChangeSelection): (WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition): * WebProcess/WebPage/WebPage.h: 2019-04-17 Chris Dumez Remember device orientation permission for the duration of the browsing session https://bugs.webkit.org/show_bug.cgi?id=196992 Reviewed by Alex Christensen. Implement caching of device orientation permission decisions on the WebDeviceOrientationAndMotionAccessController, which is owned by the WebsiteDataStore. This way, if we already prompted the user of a given origin, we will remember the previous decision for the duration of the session and not prompt again. * Shared/WebsitePoliciesData.cpp: (WebKit::WebsitePoliciesData::encode const): (WebKit::WebsitePoliciesData::decode): * Shared/WebsitePoliciesData.h: * UIProcess/API/APIWebsitePolicies.cpp: (API::WebsitePolicies::copy const): (API::WebsitePolicies::data): * UIProcess/API/APIWebsitePolicies.h: * UIProcess/API/Cocoa/WKWebpagePreferences.mm: (toDeviceOrientationOrMotionPermissionState): (-[WKWebpagePreferences _setDeviceOrientationAndMotionAccessPolicy:]): (toWKWebsiteDeviceOrientationAndMotionAccessPolicy): (-[WKWebpagePreferences _deviceOrientationAndMotionAccessPolicy]): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::shouldAllowDeviceOrientationAndMotionAccess): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.cpp: Added. (WebKit::WebDeviceOrientationAndMotionAccessController::shouldAllowDeviceOrientationAndMotionAccess): (WebKit::WebDeviceOrientationAndMotionAccessController::deviceOrientationPermission const): * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.h: Copied from Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h. * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::deviceOrientationAndMotionAccessController): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess): * WebProcess/WebPage/WebPage.h: 2019-04-16 Andy Estes [iOSMac] Use UIDocumentPickerViewController for picking files https://bugs.webkit.org/show_bug.cgi?id=196999 Reviewed by Tim Horton. * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel _showDocumentPickerMenu]): Changed to present a UIDocumentPickerViewController on iOSMac. (-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]): (-[WKFileUploadPanel documentPicker:didPickDocumentAtURL:]): Replaced a deprecated delegate method implementation. 2019-04-16 Wenson Hsieh [iOS] [WebKit2] Add support for honoring -[UIMenuItem dontDismiss] https://bugs.webkit.org/show_bug.cgi?id=196919 Reviewed by Tim Horton. Adds modern WebKit support for -dontDismiss by implementing a couple of new platform hooks. Covered by a new layout test: editing/selection/ios/selection-after-changing-text-with-callout-menu.html. * Platform/spi/ios/UIKitSPI.h: Declare the private -dontDismiss property of UIMenuItem. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView willFinishIgnoringCalloutBarFadeAfterPerformingAction]): Additionally teach the web view (not just the content view) to respond to the hook. This matters in the case where the WebKit client (most notably, Mail) overrides WKWebView methods to define custom actions in the menu controller. This scenario is exercised by the new layout test. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView willFinishIgnoringCalloutBarFadeAfterPerformingAction]): If an action was performed where callout bar fading was ignored, then in WebKit, don't allow selection changes to fade the callout bar until after the next remote layer tree commit. (-[WKContentView _updateChangedSelection:]): Stop suppressing selection updates when showing B/I/U controls, now that we can properly honor the -dontDismiss property. This was originally introduced in , presumably to ensure that B/I/U buttons (which have -dontDismiss set to YES) don't trigger selection change and end up dismissing themselves; however, if triggering B/I/U actually changes the selection rects, this also means that the selection rects on-screen would be stale after triggering these actions. This effect is most noticeable when bolding text. (-[WKContentView shouldAllowHidingSelectionCommands]): 2019-04-16 Ross Kirsling Unreviewed non-unified build fix after r244307. * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h: 2019-04-16 Megan Gardner Allow sharing from imageSheet on an image document https://bugs.webkit.org/show_bug.cgi?id=196891 Reviewed by Tim Horton. Allow sharing from an image sheet generated from an image document by storing the image URL and using it as a fallback for the URL. Store it as an image on WKElementAction to not accidentally trigger any actions that should actually be associated with pure URLs. * UIProcess/API/Cocoa/_WKActivatedElementInfo.h: * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm: (-[_WKActivatedElementInfo _initWithInteractionInformationAtPosition:]): (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:]): (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:userInfo:]): (-[_WKActivatedElementInfo imageURL]): (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:]): Deleted. (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:userInfo:]): Deleted. * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h: * UIProcess/API/Cocoa/_WKElementAction.mm: (+[_WKElementAction _elementActionWithType:customTitle:assistant:]): * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant showImageSheet]): (-[WKActionSheetAssistant defaultActionsForImageSheet:]): (-[WKActionSheetAssistant showLinkSheet]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _showAttachmentSheet]): (-[WKContentView _dataForPreviewItemController:atPosition:type:]): (-[WKContentView _presentedViewControllerForPreviewItemController:]): 2019-04-16 Wenson Hsieh [Cocoa] Add a way for Apple-internal clients to opt into recommended compatibility mode https://bugs.webkit.org/show_bug.cgi?id=196977 Reviewed by Tim Horton. Add a helper method to query whether the navigation client should bypass policy safeguards when determining the recommended compatibility mode. We bypass policy safeguards in Cocoa platforms if the navigation delegate implements the new navigation delegate API. * UIProcess/API/APINavigationClient.h: (API::NavigationClient::shouldBypassCompatibilityModeSafeguards const): * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::shouldBypassCompatibilityModeSafeguards const): 2019-04-16 Per Arne Vollan -[WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:] never returns _WKWebsiteDataTypeCredentials https://bugs.webkit.org/show_bug.cgi?id=196991 Reviewed by Brent Fulgham. The credentials are stored in the Network process. To enable fetching credentials from the Network process, a proper process access type needs to be set for the credential Website data type. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::computeNetworkProcessAccessTypeForDataFetch): 2019-04-16 Alex Christensen REGRESSION(r244162) Clearing website data from ephemeral WKWebsiteDataStore should finish instead of asserting or hanging https://bugs.webkit.org/show_bug.cgi?id=196995 Reviewed by Brady Eidson. Always call CompletionHandlers. Otherwise things hang or assert. I added an API test that asserts without this change so we don't regress this again. * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::clearAllCaches): (WebKit::CacheStorage::Engine::clearCachesForOrigin): 2019-04-16 Chris Dumez URL set by document.open() is not communicated to the UIProcess https://bugs.webkit.org/show_bug.cgi?id=196941 Reviewed by Geoff Garen. Whenever the UIProcess is notified of an explicit document.open() call, update the PageLoadState to make sure the URL is up-to-date. Also make sure the page / process knows it committed a load (i.e. It is no longer showing the initially empty document). * UIProcess/PageLoadState.cpp: (WebKit::PageLoadState::didExplicitOpen): * UIProcess/PageLoadState.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didExplicitOpenForFrame): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2019-04-16 Chris Dumez Show prompt for device orientation access if the client does not implement the corresponding API delegate https://bugs.webkit.org/show_bug.cgi?id=196971 Reviewed by Alex Christensen. Show prompt for device orientation access if the client does not implement the corresponding API delegate, instead of rejecting access by default. * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess): * UIProcess/Cocoa/WKOrientationAccessAlert.h: Added. * UIProcess/Cocoa/WKOrientationAccessAlert.mm: Added. (WebKit::presentOrientationAccessAlert): * WebKit.xcodeproj/project.pbxproj: 2019-04-16 Zalan Bujtas REGRESSION(r243557)[ContentChangeObserver] Need to double tap text formatting elements in MS Word web app https://bugs.webkit.org/show_bug.cgi?id=196975 Reviewed by Simon Fraser. This patch ensures that we always proceed with synthetic click on form elements. Covered by existing tests. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleSyntheticClick): 2019-04-16 Timothy Hatcher FrameView base background color always starts white. https://bugs.webkit.org/show_bug.cgi?id=196976 Reviewed by Beth Dakin. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): Set m_backgroundColor before calling WebFrame::createWithCoreMainFrame so the call to create the FrameView for the empty page in transitionToCommittedForNewPage() gets the correct color from WebPage. 2019-04-16 Ryan Haddad Unreviewed, fix the build with recent SDKs. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (WebKit::WKWebViewState::store): 2019-04-16 Commit Queue Unreviewed, rolling out r244321. https://bugs.webkit.org/show_bug.cgi?id=196968 Causing all WK2 Debug builds to exit early after Assertion failures. (Requested by ShawnRoberts on #webkit). Reverted changeset: "URL set by document.open() is not communicated to the UIProcess" https://bugs.webkit.org/show_bug.cgi?id=196941 https://trac.webkit.org/changeset/244321 2019-04-15 Joseph Pecoraro Web Inspector: CRASH when reopening tab with docked inspector on crashed page https://bugs.webkit.org/show_bug.cgi?id=196954 Reviewed by Ryosuke Niwa. * UIProcess/mac/WebInspectorProxyMac.mm: (WebKit::WebInspectorProxy::inspectedViewFrameDidChange): 2019-04-15 Chris Dumez URL set by document.open() is not communicated to the UIProcess https://bugs.webkit.org/show_bug.cgi?id=196941 Reviewed by Geoffrey Garen. Whenever the UIProcess is notified of an explicit document.open() call, update the PageLoadState to make sure the URL is up-to-date. Also make sure the page / process knows it committed a load (i.e. It is no longer showing the initially empty document). * UIProcess/PageLoadState.cpp: (WebKit::PageLoadState::didExplicitOpen): * UIProcess/PageLoadState.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didExplicitOpenForFrame): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2019-04-15 Alex Christensen Stop using hyphenationFactor https://bugs.webkit.org/show_bug.cgi?id=196949 Reviewed by Geoffrey Garen. * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]): I added this use of hyphenationFactor in r241124 but the other changes in that revision make the use of hyphenationFactor redundant. There is a reason to remove it in the radar. 2019-04-15 Alex Christensen Forward declare WKWebView in _WKDiagnosticLoggingDelegate.h * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h: This fixes builds where _WKDiagnosticLoggingDelegate.h is the only WebKit header included, such as my work on rdar://problem/35175989 2019-04-15 Jer Noble Add a DiagnosticLogging method taking an arbitrary dictionary of values. https://bugs.webkit.org/show_bug.cgi?id=196773 Reviewed by Alex Christensen. In addition to adding the new logging delegate method (and piping everything into it), add a new APIObject class to represent a signed integer. * Shared/API/APINumber.h: * Shared/API/APIObject.h: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * Shared/Cocoa/WKNSNumber.mm: (-[WKNSNumber dealloc]): (-[WKNSNumber objCType]): (-[WKNSNumber getValue:]): (-[WKNSNumber longLongValue]): (-[WKNSNumber _apiObject]): * Shared/UserData.cpp: (WebKit::UserData::encode): (WebKit::UserData::decode): * UIProcess/API/APIDiagnosticLoggingClient.h: * UIProcess/API/C/WKPageDiagnosticLoggingClient.h: * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h: * UIProcess/Cocoa/DiagnosticLoggingClient.h: * UIProcess/Cocoa/DiagnosticLoggingClient.mm: (WebKit::DiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary): * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::didReceiveMessage): * UIProcess/WebPageDiagnosticLoggingClient.cpp: (WebKit::WebPageDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary): * UIProcess/WebPageDiagnosticLoggingClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::logDiagnosticMessageWithValueDictionary): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp: (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary): * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h: 2019-04-15 Dean Jackson Provide option to not create a longpress gesture recognizer https://bugs.webkit.org/show_bug.cgi?id=196937 Build fix for iOS platforms that don't have link preview. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): 2019-04-15 Brent Fulgham InjectedBundle parameters often need initialization function called before unarchiving https://bugs.webkit.org/show_bug.cgi?id=189709 Reviewed by Ryosuke Niwa. Handle the case where the InjectedBundle parameters do not successfully decode because they contain an unexpected class from the embedding program. If this happens, try decoding the bundle parameters after the bundle initialiation function runs, which gives the embedding program the opportunity to register additional classes that are safe for serialization. Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need to be serialized by the InjectedBundle. Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'. Revise 'initialize' to call this new method. * WebProcess/InjectedBundle/InjectedBundle.h: * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm: (WebKit::InjectedBundle::initialize): Use the new method. (WebKit::InjectedBundle::decodeBundleParameters): Added. (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete 'classesForCoder' method to unarchive the passed bundle parameters, rather than the NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the NSDictionary object may itself hold other kinds of objects. * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h: (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added. 2019-04-15 Dean Jackson Provide option to not create a longpress gesture recognizer https://bugs.webkit.org/show_bug.cgi?id=196937 Reviewed by Antoine Quint. A WebKitAdditions file has changed name to WKContentViewInteractionWKInteraction.mm. Add a property to toggle if we should add a long press gesture recognizer. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): (shouldUsePreviewForLongPress): (-[WKContentView shouldUsePreviewForLongPress]): 2019-04-15 Don Olmstead [CMake] WebCore derived sources should only be referenced inside WebCore https://bugs.webkit.org/show_bug.cgi?id=196904 Reviewed by Konstantin Tokarev. Remove reference to DERIVED_SOURCES_WEBCORE_DIR in PlatformMac.cmake. * PlatformMac.cmake: 2019-04-15 Zalan Bujtas DrawingArea should only capture painting related milestones https://bugs.webkit.org/show_bug.cgi?id=196926 Reviewed by Tim Horton. While dispatching layout milestones (mixture of layout and painting items), the associated drawing areas should only capture the painting related milestones. These captured milestones get dispatched later in the commit handler to ensure that they are not forwarded prematurely. However the truly layout related milestones (e.g. DidFirstVisuallyNonEmptyLayout) should be dispatched right away with no delay. * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h: (WebKit::RemoteLayerTreeTransaction::newlyReachedPaintingMilestones const): (WebKit::RemoteLayerTreeTransaction::setNewlyReachedPaintingMilestones): (WebKit::RemoteLayerTreeTransaction::newlyReachedLayoutMilestones const): Deleted. (WebKit::RemoteLayerTreeTransaction::setNewlyReachedLayoutMilestones): Deleted. * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm: (WebKit::RemoteLayerTreeTransaction::encode const): (WebKit::RemoteLayerTreeTransaction::decode): * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree): * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::addMilestonesToDispatch): (WebKit::DrawingArea::dispatchDidReachLayoutMilestone): Deleted. * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: (WebKit::RemoteLayerTreeDrawingArea::addMilestonesToDispatch): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::flushLayers): (WebKit::RemoteLayerTreeDrawingArea::dispatchDidReachLayoutMilestone): Deleted. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::dispatchDidReachLayoutMilestone): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: (WebKit::TiledCoreAnimationDrawingArea::addMilestonesToDispatch): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedPaintingMilestones): (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones): Deleted. (WebKit::TiledCoreAnimationDrawingArea::dispatchDidReachLayoutMilestone): Deleted. 2019-04-15 John Wilander Send delayed Ad Click Attribution conversion requests to the click source https://bugs.webkit.org/show_bug.cgi?id=196838 Reviewed by Chris Dumez and Youenn Fablet. This patch schedules a conversion request with appropriate data going to the click source as a result of an ad click conversion. WebKit::AdClickAttributionManager makes use of existing WebKit::PingLoad infrastructure to make the request. This will probably be reworked into a dedicated load class further on. New test infrastructure allows for an override of both the conversion URL and the 24-48 hour timer. * NetworkProcess/AdClickAttributionManager.cpp: Added. (WebKit::AdClickAttributionManager::ensureDestinationMapForSource): (WebKit::AdClickAttributionManager::store): (WebKit::AdClickAttributionManager::startTimer): Convenience function to support test override. (WebKit::AdClickAttributionManager::convert): This function now sets the timer. (WebKit::AdClickAttributionManager::fireConversionRequest): Fire an individual request. (WebKit::AdClickAttributionManager::firePendingConversionRequests): This is the timer function that iterates over all pending attributions. (WebKit::AdClickAttributionManager::clear): Now clears the two new test settings members. (WebKit::AdClickAttributionManager::toString const): * NetworkProcess/AdClickAttributionManager.h: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.h. (WebKit::AdClickAttributionManager::AdClickAttributionManager): (WebKit::AdClickAttributionManager::setPingLoadFunction): (WebKit::AdClickAttributionManager::setOverrideTimerForTesting): (WebKit::AdClickAttributionManager::setConversionURLForTesting): * NetworkProcess/NetworkAdClickAttribution.cpp: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.cpp. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::storeAdClickAttribution): (WebKit::NetworkProcess::dumpAdClickAttribution): (WebKit::NetworkProcess::clearAdClickAttribution): (WebKit::NetworkProcess::setAdClickAttributionOverrideTimerForTesting): (WebKit::NetworkProcess::setAdClickAttributionConversionURLForTesting): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::NetworkSession): (WebKit::NetworkSession::setAdClickAttributionOverrideTimerForTesting): (WebKit::NetworkSession::setAdClickAttributionConversionURLForTesting): * NetworkProcess/NetworkSession.h: * NetworkProcess/PingLoad.cpp: (WebKit::PingLoad::PingLoad): (WebKit::m_blobFiles): (WebKit::PingLoad::initialize): The PingLoad constructor is now split in two to allow for construction without a WebKit::NetworkConnectionToWebProcess object. The body of the constructor was moved into the new initialize() function which is shared between constructors. * NetworkProcess/PingLoad.h: * Sources.txt: Removed NetworkProcess/NetworkAdClickAttribution.cpp and added NetworkProcess/NetworkAdClickAttribution.cpp. * UIProcess/API/C/WKPage.cpp: (WKPageSetAdClickAttributionOverrideTimerForTesting): (WKPageSetAdClickAttributionConversionURLForTesting): * UIProcess/API/C/WKPagePrivate.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::dumpAdClickAttribution): Deleted. (WebKit::NetworkProcessProxy::clearAdClickAttribution): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::dumpAdClickAttribution): (WebKit::WebPageProxy::clearAdClickAttribution): (WebKit::WebPageProxy::setAdClickAttributionOverrideTimerForTesting): (WebKit::WebPageProxy::setAdClickAttributionConversionURLForTesting): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::dumpAdClickAttribution): Deleted. (WebKit::WebProcessPool::clearAdClickAttribution): Deleted. * UIProcess/WebProcessPool.h: * WebKit.xcodeproj/project.pbxproj: 2019-04-15 Devin Rousso WebDriver: Set Cookie endpoint does not correctly set subdomain cookies https://bugs.webkit.org/show_bug.cgi?id=196872 Reviewed by Joseph Pecoraro. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::addSingleCookie): Rather than try to "force" the cookie to be set on the current active URL, use the cookie itself to figure out which domain it should be set on. 2019-04-15 Philippe Normand [GTK][WPE] Add enable-media websetting https://bugs.webkit.org/show_bug.cgi?id=196863 Reviewed by Michael Catanzaro. It can be useful for headless browsers, for instance. The setting is enabled by default. * Shared/WebPreferences.yaml: * UIProcess/API/glib/WebKitSettings.cpp: (webKitSettingsSetProperty): (webKitSettingsGetProperty): (webkit_settings_class_init): (webkit_settings_get_enable_media): (webkit_settings_set_enable_media): * UIProcess/API/gtk/WebKitSettings.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitSettings.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: 2019-04-14 Rob Buis Link prefetch not useful for top-level navigation https://bugs.webkit.org/show_bug.cgi?id=195623 Reviewed by Youenn Fablet. Cache cross-domain top-level prefetches in a dedicated cache. When a navigation to the same url is done within a threshold (5 seconds), reuse the prefetch cache entry, move it to the disk cache and navigate to the url, meaning no extra network trip is needed. When not used within the threshold period, the prefetch entry will be erased using a timer. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::lowMemoryHandler): * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::prefetchCache): * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::retrieveCacheEntry): (WebKit::NetworkResourceLoader::didReceiveResponse): (WebKit::NetworkResourceLoader::didReceiveBuffer): (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry): (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/cache/PrefetchCache.cpp: Added. (WebKit::PrefetchCache::Entry::Entry): (WebKit::PrefetchCache::PrefetchCache): (WebKit::PrefetchCache::~PrefetchCache): (WebKit::PrefetchCache::clear): (WebKit::PrefetchCache::take): (WebKit::PrefetchCache::store): (WebKit::PrefetchCache::sessionPrefetchMap const): (WebKit::PrefetchCache::clearExpiredEntries): * NetworkProcess/cache/PrefetchCache.h: Added. (WebKit::PrefetchCache::Entry::response const): (WebKit::PrefetchCache::Entry::releaseBuffer): * Shared/WebPreferences.yaml: * Sources.txt: * WebKit.xcodeproj/project.pbxproj: 2019-04-14 Andy Estes [Cocoa] WKCustomProtocolLoader should store a WeakPtr to its LegacyCustomProtocolManagerProxy https://bugs.webkit.org/show_bug.cgi?id=196893 Reviewed by Anders Carlsson. In addition to manually invalidating each WKCustomProtocolLoader's _customProtocolManagerProxy pointer when the LegacyCustomProtocolManagerClient is invalidated, use a WeakPtr in case the LegacyCustomProtocolManagerProxy is ever destroyed without first invalidating the client. Also add null pointer checks to NSURLConnectionDelegate methods, which might be called after the LegacyCustomProtocolManagerProxy has been destroyed. * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm: (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]): (-[WKCustomProtocolLoader cancel]): (-[WKCustomProtocolLoader connection:didFailWithError:]): (-[WKCustomProtocolLoader connection:didReceiveResponse:]): (-[WKCustomProtocolLoader connection:didReceiveData:]): (-[WKCustomProtocolLoader connection:willSendRequest:redirectResponse:]): (-[WKCustomProtocolLoader connectionDidFinishLoading:]): (WebKit::LegacyCustomProtocolManagerClient::startLoading): (WebKit::LegacyCustomProtocolManagerClient::invalidate): (-[WKCustomProtocolLoader customProtocolManagerProxyDestroyed]): Deleted. * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h: 2019-04-14 Don Olmstead [CMake] JavaScriptCore derived sources should only be referenced inside JavaScriptCore https://bugs.webkit.org/show_bug.cgi?id=196742 Reviewed by Konstantin Tokarev. Don't set JavaScriptCore_SCRIPTS_DIR now that it is set within WebKitFS. * CMakeLists.txt: * PlatformWin.cmake: Remove use of DERIVED_SOURCES_JAVASCRIPTCORE_DIR. 2019-04-13 Chris Dumez [ Mac Debug ] TestWebKitAPI.ProcessSwap.ReuseSuspendedProcessForRegularNavigationRetainBundlePage is a flaky crash https://bugs.webkit.org/show_bug.cgi?id=196548 Reviewed by Darin Adler. Update ProvisionalPageProxy methods to more consistently ignore unexpected IPC from the process. Previously, some of the methods were doing this, but some other like didFailProvisionalLoadForFrame() weren't and this was leading to this flaky crash. The issue is that if we do the load in an existing process that was recently doing, there may be leftover IPC for the same pageID and this IPC gets received by the ProvisionalPageProxy even though it is from a previous navigation. For this reason, the ProvisionalPageProxy should ignore all incoming IPC that is not for its associated navigation. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::didPerformClientRedirect): (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didCommitLoadForFrame): (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData): (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame): (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync): (WebKit::ProvisionalPageProxy::decidePolicyForResponse): (WebKit::ProvisionalPageProxy::didPerformServerRedirect): (WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync): 2019-04-13 Wenson Hsieh Unreviewed, try to fix the internal build after r244239 Force the bots to regenerate WKWebpagePreferences.h by touching the file. Adds a `Foundation/Foundation.h` import that was missing anyways. * UIProcess/API/Cocoa/WKWebpagePreferences.h: 2019-04-12 Wenson Hsieh Enable modern compatibility mode by default in WKWebView on some devices https://bugs.webkit.org/show_bug.cgi?id=196883 Reviewed by Tim Horton. Make some minor adjustments to new API. * Shared/WebCompatibilityMode.h: Rename WebCompatibilityMode::Default to WebCompatibilityMode::Recommended. * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.h: Now that the role of the UseModernCompatibilityModeByDefault debug preference is limited to bypassing linked-on- or-after and app bundle compatibility hacks, we no longer make this default to true in iOSMac. * UIProcess/API/APIWebsitePolicies.h: * UIProcess/API/Cocoa/WKNavigationDelegate.h: Rename the withPreferences: label to just preferences:. * UIProcess/API/Cocoa/WKWebViewConfiguration.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::setNavigationDelegate): (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): * UIProcess/Cocoa/VersionChecks.h: * UIProcess/ios/WebPageProxyIOS.mm: 2019-04-12 Brian Burg WebDriver: fix typo in EnterFullscreen.js in error-handling code https://bugs.webkit.org/show_bug.cgi?id=196882 Reviewed by Devin Rousso. * UIProcess/Automation/atoms/EnterFullscreen.js: (enterFullscreen): 2019-04-12 Ross Kirsling Unreviewed fix for non-unified build. * Shared/PrintInfo.cpp: Add missing include from r244202. 2019-04-12 Saam barati Sometimes we need to user fewer CPUs in our threading calculations https://bugs.webkit.org/show_bug.cgi?id=196794 Reviewed by Yusuke Suzuki. * WebProcess/com.apple.WebProcess.sb.in: 2019-04-12 Devin Rousso WebDriver: evaluating javascript shouldn't fail if a dialog is shown https://bugs.webkit.org/show_bug.cgi?id=196847 Reviewed by Brian Burg. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::willShowJavaScriptDialog): 2019-04-12 Ross Kirsling WebKit should build successfully even with -DENABLE_UNIFIED_BUILDS=OFF https://bugs.webkit.org/show_bug.cgi?id=196845 Reviewed by Ryosuke Niwa. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/NetworkCORSPreflightChecker.cpp: * NetworkProcess/NetworkDataTask.cpp: * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp: * NetworkProcess/NetworkHTTPSUpgradeChecker.h: Include wtf/Forward.h for String and CompletionHandler fwd decls. * NetworkProcess/NetworkProcess.cpp: * NetworkProcess/NetworkResourceLoadMap.cpp: * NetworkProcess/NetworkResourceLoadMap.h: * NetworkProcess/NetworkResourceLoader.cpp: * NetworkProcess/PingLoad.h: * Shared/WebCompiledContentRuleListData.cpp: * Shared/gtk/WebEventFactory.cpp: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore): (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours): (WKWebsiteDataStoreStatisticsResetToConsistentState): * UIProcess/Downloads/DownloadProxyMap.cpp: * UIProcess/InspectorTargetProxy.cpp: * UIProcess/PageClient.h: * UIProcess/ProcessAssertion.cpp: * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageInspectorTargetAgent.h: * UIProcess/geoclue/GeoclueGeolocationProvider.cpp: * WebProcess/Cache/WebCacheStorageConnection.cpp: (WebKit::WebCacheStorageConnection::updateQuotaBasedOnSpaceUsage): * WebProcess/InjectedBundle/API/c/WKBundle.cpp: (WKBundleSetDatabaseQuota): * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h: Add missing includes / forward declarations to address compiler errors on GTK / WinCairo. 2019-04-12 Eric Carlson Update AudioSession route sharing policy https://bugs.webkit.org/show_bug.cgi?id=196776 Reviewed by Jer Noble. * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: (-[WKAirPlayRoutePicker showFromView:routeSharingPolicy:routingContextUID:hasVideo:]): 2019-04-12 Wenson Hsieh WebsitePolicies doesn't copy its media source policy in WebsitePolicies::copy https://bugs.webkit.org/show_bug.cgi?id=196862 Reviewed by Darin Adler. Add a missing bit of code to copy m_mediaSourcePolicy over when making a copy of WebsitePolicies. This doesn't have any observable effect, since m_mediaSourcePolicy isn't currently exposed as SPI on WKWebpagePreferences. * UIProcess/API/APIWebsitePolicies.cpp: (API::WebsitePolicies::copy const): 2019-04-12 Simon Fraser [iOS WK2] Make -webkit-overflow-scrolling be a no-op https://bugs.webkit.org/show_bug.cgi?id=196803 rdar://problem/49078202 Reviewed by Antti Koivisto. Flip LegacyOverflowScrollingTouchEnabled to false. * Shared/WebPreferences.yaml: 2019-04-12 Wenson Hsieh [iOS] Software keyboard is shown too frequently on some websites https://bugs.webkit.org/show_bug.cgi?id=195856 Reviewed by Darin Adler. On some websites, hidden editable elements are very frequently focused upon user interaction. Currently, this causes the software keyboard to pop in and out unexpectedly; luckily, these same sites also apply inputmode="none" to the hidden editable element, which ought to ensure that the software keyboard doesn't appear when the element is focused. However, since we disabled support for inputmode="none" in r240497, the software keyboard is no longer suppressed, and becomes a big nuissance. r240497 removed support for this feature because, when using a hardware keyboard, pressing the globe key no longer showed UI for switching languages. However, support for inputmode none makes a much larger impact when a software keyboard is used (since the entire software keyboard animates in and out), whereas a hardware keyboard only displays an input accessory view. For this reason, we can mitigate this bug without reintroducing by re-enabling inputmode="none", but only when a hardware keyboard is not attached. * UIProcess/API/Cocoa/WKWebView.mm: (hardwareKeyboardAvailabilityChangedCallback): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView shouldShowAutomaticKeyboardUI]): Don't show the keyboard if inputmode is none and a hardware keyboard is not attached. (-[WKContentView _hardwareKeyboardAvailabilityChanged]): Reload input views if the inputmode is none to ensure that if a hardware keyboard is attached while editing an element with inputmode="none", we'll show the input accessory view once again. 2019-04-12 Antoine Quint Opt some websites into the simulated mouse events dispatch quirk when in modern compatibility mode https://bugs.webkit.org/show_bug.cgi?id=196830 Reviewed by Wenson Hsieh. We add a new policy to determine whether simulated mouse events dispatch are allowed. * Shared/WebsitePoliciesData.cpp: (WebKit::WebsitePoliciesData::encode const): (WebKit::WebsitePoliciesData::decode): (WebKit::WebsitePoliciesData::applyToDocumentLoader): * Shared/WebsitePoliciesData.h: * Shared/WebsiteSimulatedMouseEventsDispatchPolicy.h: Added. * UIProcess/API/APIWebsitePolicies.cpp: (API::WebsitePolicies::copy const): (API::WebsitePolicies::data): * UIProcess/API/APIWebsitePolicies.h: * WebKit.xcodeproj/project.pbxproj: 2019-04-12 Chris Dumez [iOS Sim Debug] ASSERTION FAILED: m_downloads.isEmpty() Layout Test http/tests/websocket/tests/hybi/network-process-crash-error.html is a flaky crash https://bugs.webkit.org/show_bug.cgi?id=196781 Reviewed by Darin Adler. When the network process gets terminated by the client, the NetworkProcessProxy object (and thus its DownloadProxyMap member) get destroyed right away, before we get a call to didClose(IPC::Connection&). As a result, if there are ongoing downloads at the time of the termination, we will hit the assertion above. To address the issue, update the NetworkProcessProxy destructor to invalidate its DownloadProxyMap member, similator to what it does in didClose(IPC::Connection&). * UIProcess/Downloads/DownloadProxyMap.cpp: (WebKit::DownloadProxyMap::invalidate): (WebKit::DownloadProxyMap::processDidClose): Deleted. * UIProcess/Downloads/DownloadProxyMap.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::~NetworkProcessProxy): (WebKit::NetworkProcessProxy::didClose): 2019-04-11 Carlos Garcia Campos [GTK] REGRESSION(r243860): Many tests failing https://bugs.webkit.org/show_bug.cgi?id=196791 Reviewed by Joanmarie Diggs. Calling updateAccessibilityTree() on document loaded was causing a re-layout because of the backing store update that confused all those tests. We shouldn't need to update the accessibility tree on document load, it should happen automatically when root object is attached/detached. This patch emits children-changed::add when the root object wrapper is attached and children-changed::remove when the root object is detached. That way ATs are notified of the changes in the accessibility tree. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad): Remove call to WebPage::updateAccessibilityTree(). * WebProcess/WebPage/WebPage.h: Remove updateAccessibilityTree(). * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp: (coreRootObjectWrapperDetachedCallback): Emit children-changed::remove. (rootWebAreaWrapper): Helper to get the root WebArea wrapper. (accessibilityRootObjectWrapper): Set the parent here when root object is created and emit children-changed::add. (webkitWebPageAccessibilityObjectRefChild): Dot no set the parent here, it's now set when the root object is created. * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Remove webkitWebPageAccessibilityObjectRefresh(). * WebProcess/WebPage/gtk/WebPageGtk.cpp: 2019-04-11 Megan Gardner Update 'Save Image' to more clear instructions https://bugs.webkit.org/show_bug.cgi?id=196833 Reviewed by Wenson Hsieh. Just updating to a new string. * UIProcess/API/Cocoa/_WKElementAction.mm: (+[_WKElementAction _elementActionWithType:customTitle:assistant:]): 2019-04-11 Chris Dumez Unable to run system Safari with trunk WebKit https://bugs.webkit.org/show_bug.cgi?id=196777 Reviewed by Alex Christensen. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): Add a linkedOnAfter check so that throwing exceptions when related web views use a different data store only happens for apps rebuilt using recent SDK. * UIProcess/Cocoa/VersionChecks.h: * UIProcess/Cocoa/VersionChecks.mm: (WebKit::linkedOnOrAfter): - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can be controlled by the caller. - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the 0 value for sdkVersion. 2019-04-11 Zalan Bujtas Add @page margin support https://bugs.webkit.org/show_bug.cgi?id=196680 Reviewed by Tim Horton. * Shared/PrintInfo.cpp: (WebKit::PrintInfo::encode const): (WebKit::PrintInfo::decode): * Shared/PrintInfo.h: * Shared/WebPreferences.yaml: * Shared/gtk/PrintInfoGtk.cpp: (WebKit::PrintInfo::PrintInfo): * Shared/mac/PrintInfoMac.mm: (WebKit::PrintInfo::PrintInfo): * UIProcess/API/C/WKPage.cpp: (WKPageComputePagesForPrinting): * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetPageAtRuleSupportEnabled): (WKPreferencesGetPageAtRuleSupportEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/GenericCallback.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::computedPagesCallback): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/WKPrintingView.mm: (pageDidComputePageRects): (-[WKPrintingView _askPageToComputePageRects]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::beginPrinting): (WebKit::WebPage::computePagesForPrinting): (WebKit::WebPage::computePagesForPrintingImpl): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::computePagesForPrintingAndDrawToPDF): 2019-04-11 Dean Jackson Extract UTI mapping and allow for additions https://bugs.webkit.org/show_bug.cgi?id=196822 Reviewed by Tim Horton. Use the new helper to map MIME type to UTI. * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]): * UIProcess/ios/WKSystemPreviewView.mm: (getUTIForSystemPreviewMIMEType): 2019-04-11 Said Abou-Hallawa REGRESSION (r244182): RemoteLayerTreeDrawingArea::flushLayers() should not be reentrant https://bugs.webkit.org/show_bug.cgi?id=196825 Reviewed by Simon Fraser. Ensure the layer transactions IDs are sequential. So bail out of RemoteLayerTreeDrawingArea::flushLayers() if reentrancy is detected. * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::flushLayers): 2019-04-11 Wenson Hsieh Allow the MediaSource API to be enabled via website policy https://bugs.webkit.org/show_bug.cgi?id=196429 Reviewed by Tim Horton. Adds support for using WebsitePolicies to determine whether to enable the MediaSource API. * Shared/WebPreferences.yaml: Disengage the mediaSourceEnabled internal preference from the corresponding WebCore setting; to ensure that setting the preference to `true` still results in enabling the MediaSource API, we instead make it such that turning on mediaSourceEnabled causes WebsitePolicies to set its WebsiteMediaSourcePolicy to Enable. In the future, we should deprecate and remove this preference, in favor of simply setting preferred compatibility mode on WKWebpagePreferences. * Shared/WebPreferences.yaml: * Shared/WebsiteMediaSourcePolicy.h: Copied from Source/WebKit/Shared/WebsitePoliciesData.h. * Shared/WebsitePoliciesData.cpp: (WebKit::WebsitePoliciesData::encode const): (WebKit::WebsitePoliciesData::decode): Add plumbing for m_mediaSourcePolicy in the set of website policies. (WebKit::WebsitePoliciesData::applyToDocumentLoader): Update the document loader with the given media source policy. There are two possibilities when applying the set of policies to the document loader; either the document loader is already attached to a Frame, or the document loader is yet to be attached to a Frame. In the first case, we update Frame's settings on the spot, by calling the new applyPoliciesToSettings helper method. In the second scenario, we stash the policy state on DocumentLoader; when the DocumentLoader is attached to a Frame, we'll then update the Frame's settings using DocumentLoader's policy. * Shared/WebsitePoliciesData.h: * UIProcess/API/APIWebsitePolicies.cpp: (API::WebsitePolicies::data): * UIProcess/API/APIWebsitePolicies.h: * UIProcess/API/C/WKPage.cpp: (WKPageSetPageNavigationClient): * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): Move code that adjusts website policies after deciding policies for the navigation action from NavigationClient ::decidePolicyForNavigationAction to the completion handler of the policy listener. This allows us to respect default website policies on the web view configuration, even when using the C API to set the navigation client, and also allows us to have a single call site for adjustPoliciesForCompatibilityMode. This also enables our layout tests to opt into modern compatibility mode by default, when specifying modern compatibility mode on webpage preferences. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode): * UIProcess/WebPageProxy.h: * WebKit.xcodeproj/project.pbxproj: 2019-04-11 Antti Koivisto REGRESSION: changing iPad orientation on blogger.com crashes under RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations() https://bugs.webkit.org/show_bug.cgi?id=196813 Reviewed by Simon Fraser. No test, can't repro. * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations): Null check the nodes. 2019-04-10 Chris Dumez Regression(r244144) ProcessSwap.ReuseSuspendedProcessLoadHTMLString API test is flaky https://bugs.webkit.org/show_bug.cgi?id=196784 Reviewed by Antti Koivisto. When we enter accelerated compositing mode in the new process, we supposed to *close* the last SuspendedPageProxy, not destroy it. This was causing flakiness in the test because it was testing that we were using the SuspendedPageProxy's process for a cross-site link navigation, which is an optimization. This optimization was partly broken by r244144 as the SuspendedPageProxy would not sometimes be gone by the time we need it. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode): 2019-04-10 Alex Christensen WKNavigationResponse._downloadAttribute should be nil when no download attribute is present https://bugs.webkit.org/show_bug.cgi?id=196809 Reviewed by Brady Eidson. * UIProcess/API/Cocoa/WKNavigationResponse.mm: (-[WKNavigationResponse _downloadAttribute]): 2019-04-10 Tim Horton REGRESSION (r241734): ⌥⌘↑ and ⌥⌘↓ no longer navigate to previous/next Reading List article https://bugs.webkit.org/show_bug.cgi?id=196797 Reviewed by Simon Fraser. * UIProcess/ios/WKKeyboardScrollingAnimator.mm: (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]): Validate the set of modifier keys pressed when handling a key event for scrolling: Ignore key events with multiple modifier keys pressed. Ignore key events with an invalid modifier key pressed for a given primary key. 2019-04-10 Said Abou-Hallawa requestAnimationFrame should execute before the next frame https://bugs.webkit.org/show_bug.cgi?id=177484 Reviewed by Simon Fraser. Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by a single call to Page::updateRendering(). This new function implements "Update the rendering" step of the HTML Event Loop specification . * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush): (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState): (WebKit::DrawingAreaCoordinatedGraphics::display): * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp: (WebKit::LayerTreeHost::layerFlushTimerFired): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::flushLayers): -- Call Page::updateRendering() to make sure that "Update the rendering" happens immediately before updating the page. -- Move the call to RemoteLayerBackingStoreCollection::willFlushLayers() to be exactly before flushing the layers. This fixes the assertion ASSERT(m_inLayerFlush) which was firing when running a layout test. RemoteLayerTreeDrawingArea::flushLayers() now can call itself through TestRunner::notifyDone(). flushLayers() was calling willFlushLayers() twice before calling didFlushLayers(). * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::layoutIfNeeded): (WebKit::WebPage::updateRendering): (WebKit::WebPage::willDisplayPage): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::flushLayers): 2019-04-10 Devin Rousso Web Inspector: save sheet should be anchored underneath the tab bar when detached https://bugs.webkit.org/show_bug.cgi?id=196722 Reviewed by Timothy Hatcher. * WebProcess/WebPage/WebInspectorUI.h: * WebProcess/WebPage/WebInspectorUI.cpp: (WebKit::WebInspectorUI::changeSheetRect): Added. * UIProcess/WebInspectorProxy.messages.in: * UIProcess/WebInspectorProxy.h: (WebKit::WebInspectorProxy::sheetRect const): Added. * UIProcess/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::setSheetRect): Added. (WebKit::WebInspectorProxy::platformSetSheetRect): Added. * UIProcess/gtk/WebInspectorProxyGtk.cpp: (WebKit::WebInspectorProxy::platformSetSheetRect): Added. * UIProcess/mac/WebInspectorProxyMac.mm: (-[WKWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added. (WebKit::WebInspectorProxy::platformSetSheetRect): Added. * UIProcess/win/WebInspectorProxyWin.cpp: (WebKit::WebInspectorProxy::platformSetSheetRect): Added. * UIProcess/wpe/WebInspectorProxyWPE.cpp: (WebKit::WebInspectorProxy::platformSetSheetRect): Added. * WebProcess/WebPage/RemoteWebInspectorUI.h: * WebProcess/WebPage/RemoteWebInspectorUI.cpp: (WebKit::RemoteWebInspectorUI::changeSheetRect): Added. * UIProcess/RemoteWebInspectorProxy.messages.in: * UIProcess/RemoteWebInspectorProxy.h: (WebKit::RemoteWebInspectorProxy::sheetRect const): Added. * UIProcess/RemoteWebInspectorProxy.cpp: (WebKit::RemoteWebInspectorProxy::setSheetRect): Added. (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added. * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp: (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added. * UIProcess/mac/RemoteWebInspectorProxyMac.mm: (-[WKRemoteWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added. (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow): (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added. 2019-04-10 Andy Estes [iOS] Let PDFHostViewController specify the background color to use for WKPDFView https://bugs.webkit.org/show_bug.cgi?id=196785 Reviewed by Tim Horton. * UIProcess/ios/WKPDFView.mm: (-[WKPDFView web_initWithFrame:webView:mimeType:]): 2019-04-10 Chris Dumez Unreviewed, rolling out r244146. Caused a few DeviceOrientation API test failures on iOS Reverted changeset: "Unable to run system Safari with trunk WebKit" https://bugs.webkit.org/show_bug.cgi?id=196777 https://trac.webkit.org/changeset/244146 2019-04-10 Devin Rousso Web Inspector: REGRESSION: lazy agents used outside of frontend/instrumentation can be accessed before being created https://bugs.webkit.org/show_bug.cgi?id=196725 Reviewed by Timothy Hatcher. * WebProcess/WebPage/WebInspector.cpp: (WebKit::WebInspector::showMainResourceForFrame): 2019-04-10 Youenn Fablet Clear Cache Storage structures before removing all related files https://bugs.webkit.org/show_bug.cgi?id=196650 Reviewed by Alex Christensen. Previously, we were clearing files in parallel to clearing the internal CacheStorage structures. To make things more deterministic, clear files/folders directly after CachesStorage structures have finished being cleared. * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::clearAllCaches): (WebKit::CacheStorage::Engine::clearCachesForOrigin): 2019-04-10 Alex Christensen Add SPI WKNavigationResponse._downloadAttribute https://bugs.webkit.org/show_bug.cgi?id=196755 Reviewed by Brady Eidson. * UIProcess/API/APINavigationResponse.h: * UIProcess/API/Cocoa/WKNavigationResponse.mm: (-[WKNavigationResponse _downloadAttribute]): * UIProcess/API/Cocoa/WKNavigationResponsePrivate.h: * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::decidePolicyForResponse): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForResponse): (WebKit::WebPageProxy::decidePolicyForResponseShared): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2019-04-10 Youenn Fablet SWClientConnection should not double hop to fire some events https://bugs.webkit.org/show_bug.cgi?id=196735 Reviewed by Alex Christensen. Removed unnecessary method. * WebProcess/Storage/WebSWClientConnection.cpp: * WebProcess/Storage/WebSWClientConnection.h: 2019-04-10 Per Arne Vollan [iOS] Fix iokit-get-properties sandbox violations https://bugs.webkit.org/show_bug.cgi?id=196782 Reviewed by Brent Fulgham. Add iokit properties to the WebContent sandbox on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-04-10 Tim Horton Add modern API for overriding the page's specified viewport configuration https://bugs.webkit.org/show_bug.cgi?id=167734 Reviewed by Simon Fraser. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: Plumb overrideViewportArguments in WebPageCreationParameters, so that if the process crashes (or swaps) they are maintained. * UIProcess/API/Cocoa/WKWebView.mm: (viewportArgumentsFromDictionary): (-[WKWebView _overrideViewportWithArguments:]): Add SPI to set override viewport arguments. Parse them into a ViewportArguments object and use the existing (now improved) overrideViewportArguments mechanism to take over the page's viewport arguments. * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * UIProcess/WebPageProxy.h: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::setOverrideViewportArguments): * WebProcess/WebPage/WebPage.cpp: Plumb overrideViewportArguments around more. 2019-04-10 Jiewen Tan Add runJavaScriptInFrame for WebPageProxy/WebPage https://bugs.webkit.org/show_bug.cgi?id=196750 Reviewed by Youenn Fablet. Tests of the new method will be covered by the internal counterpart. * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::loadData): * UIProcess/WebFrameProxy.h: Add a comment. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::runJavaScriptInMainFrame): (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld): Merge the above two runJavaScriptInMainFrame*. (WebKit::WebPageProxy::runJavaScriptInFrame): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadDataInFrame): Add an assertion. (WebKit::WebPage::runJavaScript): (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld): (WebKit::WebPage::runJavaScriptInFrame): (WebKit::WebPage::runJavaScriptInMainFrame): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2019-04-10 Chris Dumez Unable to run system Safari with trunk WebKit https://bugs.webkit.org/show_bug.cgi?id=196777 Reviewed by Alex Christensen. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): Add a linkedOnAfter check so that throwing exceptions when related web views use a different data store only happens for apps rebuilt using recent SDK. * UIProcess/Cocoa/VersionChecks.h: * UIProcess/Cocoa/VersionChecks.mm: (WebKit::linkedOnOrAfter): - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can be controlled by the caller. - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the 0 value for sdkVersion. 2019-04-10 Chris Dumez Regression(r240562) Audio sometimes keeps playing in previous process after a process-swap https://bugs.webkit.org/show_bug.cgi?id=196774 Reviewed by Alex Christensen. r240562 added logic to prevent flashing on navigation. When we receive the DidFailToSuspendAfterProcessSwap IPC from the previous process, we would delay closing the WebPage in that process until EnterAcceleratedCompositingMode IPC is received from the new process. The issue is that this was racy as we would receive the EnterAcceleratedCompositingMode IPC from the new process *before* receiving the DidFailToSuspendAfterProcessSwap IPC from the previous process, which which case we would fail to close the WebPage and audio could keep playing. To address the issue, the WebPageProxy keeps track of its last suspended page and notifies it whenever it receives the EnterAcceleratedCompositingMode IPC. If the suspended page already received the DidFailToSuspendAfterProcessSwap IPC, it will close the page. Otherwise, it will set a boolean data member indicating that we should not delay page closing when the DidFailToSuspendAfterProcessSwap is eventually received. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::SuspendedPageProxy): (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode): (WebKit::SuspendedPageProxy::didProcessRequestToSuspend): * UIProcess/SuspendedPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::suspendCurrentPageIfPossible): (WebKit::WebPageProxy::enterAcceleratedCompositingMode): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessPool.cpp: * UIProcess/WebProcessPool.h: 2019-04-10 Timothy Hatcher WKScrollView background color does not match WKWebView before content is loaded. https://bugs.webkit.org/show_bug.cgi?id=196745 rdar://problem/49750810 Reviewed by Megan Gardner. * UIProcess/API/Cocoa/WKWebView.mm: (scrollViewBackgroundColor): Default to _contentView.backgroundColor on invalid base color. (-[WKWebView _processDidExit]): Reset to _contentView.backgroundColor. (-[WKWebView setBackgroundColor:]): Call _updateScrollViewBackground since it can use _contentView.backgroundColor and it has changed. 2019-04-10 Megan Gardner Fix text autoscrolling when typing in modern webkit https://bugs.webkit.org/show_bug.cgi?id=196718 Reviewed by Tim Horton. For staging only. We need to turn off UIKit's scrolling behavior to land the changes we are making. To keep from the build ever breaking, I am temporarily circumventing the changes in UIKit. This will be removed once the next UIKit submission happens. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKUIWKTextInteractionAssistant scrollSelectionToVisible]): (-[WKContentView setUpTextSelectionAssistant]): 2019-04-10 Wenson Hsieh [iOSMac] Opt into modern compatibility mode by default https://bugs.webkit.org/show_bug.cgi?id=196763 Reviewed by Tim Horton. Achieve this by limiting legacy compatibility mode by default to non-iOSMac iOS only. * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.h: 2019-04-10 Alex Christensen RemoteObjectRegistry message receiver should be removed when WebPage::close is called instead of waiting until dealloc https://bugs.webkit.org/show_bug.cgi?id=196744 Reviewed by Chris Dumez. This is a similar problem to the one I fixed in r241306 so I piggy-backed on the same test. When you do a cross site navigation but the previous page is in a suspended process then you navigate back, you can get two WebPage objects in the same process with the same IDs. WebPage::close has been called on the old one which is supposed to make it so all the message receivers associated with it have been removed so we don't have any loss of communication, but we missed the RemoteObjectRegistry messages, which are owned by the ObjC bundle object wrapping the WebPage (which can keep it alive if a strong reference to it is held). To fix the assertion that happens in this case and the resulting communication breakage, teach the WebPage about these messages so it can tear down the message receiver with the others it removes at close time. * Shared/API/Cocoa/RemoteObjectRegistry.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (-[WKWebProcessPlugInBrowserContextController dealloc]): (-[WKWebProcessPlugInBrowserContextController _remoteObjectRegistry]): * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::addRemoteObjectRegistry): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::close): * WebProcess/WebPage/WebPage.h: 2019-04-10 Chris Dumez Unreviewed, drop SuspendedPageProxy data member that is unused after r244075. * UIProcess/SuspendedPageProxy.h: 2019-04-10 Antoine Quint Enable Pointer Events on watchOS https://bugs.webkit.org/show_bug.cgi?id=196771 Reviewed by Dean Jackson. * Configurations/FeatureDefines.xcconfig: 2019-04-10 Brady Eidson Background tabs are not fully reactivated after a link is opened from an external application. and https://bugs.webkit.org/show_bug.cgi?id=196705 Reviewed by Chris Dumez. If an app unparents a WKWebView right after activation but before the "applicationWillEnterForeground" notification is dispatched, then that WKWebView is in a broken state with a frozen layer tree. The WKApplicationStateTrackingView logic needs to be a little more resilient. * UIProcess/ios/WKApplicationStateTrackingView.mm: (-[WKApplicationStateTrackingView willMoveToWindow:]): When clearing the window, remember the current background state. (-[WKApplicationStateTrackingView didMoveToWindow]): If our last observed background state doesn't match the current background state then fake the relevant notification. (-[WKApplicationStateTrackingView _applicationDidEnterBackground]): Remember that we've observed a backgrounding. (-[WKApplicationStateTrackingView _applicationWillEnterForeground]): Remember that we've observed a foregrounding. 2019-04-10 Diego Pino Garcia Unreviewed, build fix for r244097 * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::actualPrepareToSuspend): (WebKit::NetworkProcess::resume): Added guards for ENABLE(SERVICE_WORKER) 2019-04-09 Keith Rollin Unreviewed build maintenance -- update .xcfilelists. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: 2019-04-09 Zalan Bujtas [AutoSizing] Avoid making text paragraphs scroll horizontally when there is a wide table https://bugs.webkit.org/show_bug.cgi?id=196743 Reviewed by Tim Horton. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setViewLayoutSize): 2019-04-09 Youenn Fablet Close service worker database on network process suspension https://bugs.webkit.org/show_bug.cgi?id=196623 Reviewed by Alex Christensen. Close service worker database when preparing to suspend. On resume, push changes if any is needed. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::actualPrepareToSuspend): (WebKit::NetworkProcess::cancelPrepareToSuspend): (WebKit::NetworkProcess::processDidResume): * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _sendNetworkProcessWillSuspendImminently]): (-[WKProcessPool _sendNetworkProcessDidResume]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently): (WebKit::WebProcessPool::sendNetworkProcessDidResume): * UIProcess/WebProcessPool.h: 2019-04-09 Daniel Bates [iPad] Should open popover when the spacebar is pressed https://bugs.webkit.org/show_bug.cgi?id=196360 Reviewed by Brent Fulgham. Pressing the spacebar should open the popover for a focused popup button (e.g. , no keyboard is needed. Instead we should create the peripheral as part of the logic in the UI process to focus a new element before we call -reloadInputViews. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView inputView]): Extract logic to allocate the peripheral from here and moved it to createInputPeripheralWithView(). (-[WKContentView accessoryTab:]): While I am here, add a FIXME comment to explain why we need to end the input sessions and nullify the input peripheral before we tell the web process to switch focus as opposed to letting this happen after the web process tells us it focused a new element. (createInputPeripheralWithView): Added. (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): Write in terms of createInputPeripheralWithView(). Create the input peripheral after becoming first responder because creating the peripheral has known side-effects: for popup buttons it tells the popup controller to present the popover. For key input to popovers to work from the get-go, the content view must be the first responder. See for more details. 2019-03-28 Víctor Manuel Jáquez Leal Silence lot of warnings when compiling with clang https://bugs.webkit.org/show_bug.cgi?id=196310 Reviewed by Michael Catanzaro. * UIProcess/API/glib/WebKitInjectedBundleClient.cpp: add missing override clause. * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: add missing override clause. 2019-03-27 Ryosuke Niwa [macOS] Select element doesn't show popup if select element had lost focus while popup was previosuly shown https://bugs.webkit.org/show_bug.cgi?id=196336 Reviewed by Tim Horton. The bug was caused by WebPopupMenu::hide never notifying PopupClient that the popup had been dismissed. This resulted in RenderMenuList::m_popupIsVisible to be never reset. Also fixed a bug in WebPopupMenuProxyMac::hidePopupMenu that this function was never dismissing the popup as the selector "dismissPopUp", on the contrary to its name, does not dimiss the popup. Send cancelTracking to NSMenu instead, which DOES dismiss the popup. Tests: fast/forms/select/mac-wk2/blur-dismisses-select-popup.html fast/forms/select/mac-wk2/open-select-popup-after-dismissing-by-blur.html * UIProcess/mac/WebPopupMenuProxyMac.mm: (WebKit::WebPopupMenuProxyMac::hidePopupMenu): * WebProcess/WebCoreSupport/WebPopupMenu.cpp: (WebKit::WebPopupMenu::hide): 2019-03-27 Dean Jackson [ARKit] Black view when opening a 3D model usdz file in new tab https://bugs.webkit.org/show_bug.cgi?id=196333 Reviewed by Tim Horton. When opening a new WKSystemPreviewView, we were exiting if there was no presentingViewController. This code was unnecessary, and causing blank content when opening a new tab. * UIProcess/ios/WKSystemPreviewView.mm: (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]): Remove the code looking for a presentingViewController. 2019-03-27 Wenson Hsieh Need a way to include WebKitAdditions code in WebKit API headers https://bugs.webkit.org/show_bug.cgi?id=196173 Reviewed by Tim Horton. Introduce a mechanism that allows us to insert code from WebKitAdditions into public or private SDK headers using `#import`s of the form: ``` #if USE(APPLE_INTERNAL_SDK) #import #endif ``` The resulting header in the built products directory will contain the contents of the imported file inserted in place of the `#if USE(APPLE_INTERNAL_SDK) … #endif` block; however, when building with the Apple internal SDK, the additions header content will be imported by the usual means. * mac/postprocess-framework-headers.sh: * mac/replace-webkit-additions-includes.py: Added. Add a step when post-processing framework headers to replace instances of `#if USE(APPLE_INTERNAL_SDK) … #endif` with the text content of the additions files. The replacement script first searches in the built products directory for the matching additions file, and falls back to the SDK if no matching file is found. If neither are present (e.g. a build using the public SDK), then the block is simply replaced by the empty string. (read_content_from_webkit_additions): (main): 2019-03-27 Andy Estes REGRESSION (r242686): package-root creates roots with broken symlinks in WebKit.framework/XPCServices/ https://bugs.webkit.org/show_bug.cgi?id=196317 Reviewed by Dan Bernstein. Removed some remnants of the Storage Process. * Configurations/BaseTarget.xcconfig: * Resources/SandboxProfiles/ios/com.apple.WebKit.Storage.sb: Removed. * WebKit.xcodeproj/project.pbxproj: 2019-03-27 Keith Rollin Include the CFNetworking task UUID to the NSError when a resource-load fails https://bugs.webkit.org/show_bug.cgi?id=196156 Reviewed by Alex Christensen. In order to help track the connection between a failed resource-load and a user-visible error message, include the CFNetworking task UUID in the associated error as an element of the userInfo property. This can then be pulled out and reported in the logging at the point the error is reported to the user. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]): 2019-03-27 Chris Dumez [ iOS Sim ] REGRESSION (r242277) Layout Test http/tests/cookies/same-site/lax-samesite-cookie-after-cross-site-history-load.php is a flaky timeout https://bugs.webkit.org/show_bug.cgi?id=195425 Reviewed by Alex Christensen. When process-swapping on history navigation, we lookup the WebProcessProxy we'd like to use from the process identifier that is saved on the WebBackForwardListItem, to try and load the item in the process in which it was previously loaded. However, we were failing to check if the WebProcess in question was still running so we could potentially try to use a process that's already exited. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::processForNavigationInternal): 2019-03-27 Zalan Bujtas [ContentChangeObserver] Always dispatch the synthetic click asynchronously https://bugs.webkit.org/show_bug.cgi?id=196278 Reviewed by Simon Fraser. This patch ensures that all completeSyntheticClick() calls happen in an asynchronous manner (unless the feature is turned off). * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::dispatchSyntheticMouseMove): (WebKit::WebPage::handleSyntheticClick): 2019-03-27 Tim Horton Fix some more deprecation warnings in WKDrawingView https://bugs.webkit.org/show_bug.cgi?id=196282 Reviewed by Wenson Hsieh. * Platform/spi/ios/PencilKitSPI.h: * SourcesCocoa.txt: * UIProcess/ios/PencilKitSoftLink.h: * UIProcess/ios/PencilKitSoftLink.mm: * UIProcess/ios/WKContentViewInteraction.mm: * UIProcess/ios/WKDrawingCoordinator.h: * UIProcess/ios/WKDrawingCoordinator.mm: (-[WKDrawingCoordinator initWithContentView:]): (-[WKDrawingCoordinator currentInk]): (-[WKDrawingCoordinator undoManagerForInkPicker:]): (-[WKDrawingCoordinator containingViewForInkPicker:]): (-[WKDrawingCoordinator inkPickerDidToggleRuler:]): (-[WKDrawingCoordinator inkPickerDidChangeInk:]): (-[WKDrawingCoordinator installInkPickerForDrawing:]): (-[WKDrawingCoordinator uninstallInkPicker]): (-[WKDrawingCoordinator inkPicker]): Deleted. (-[WKDrawingCoordinator didChangeRulerState:]): Deleted. (-[WKDrawingCoordinator didChangeInk:]): Deleted. * UIProcess/ios/WKDrawingView.mm: (-[WKDrawingView _canvasViewWillBeginDrawing:]): * UIProcess/ios/WKInkPickerView.h: Removed. * UIProcess/ios/WKInkPickerView.mm: Removed. * WebKit.xcodeproj/project.pbxproj: Adopt the new names. 2019-03-27 Carlos Garcia Campos Geolocation request not complete when watch request was started in a different web process https://bugs.webkit.org/show_bug.cgi?id=195996 Reviewed by Alex Christensen. In WebGeolocationManagerProxy::startUpdating() we do nothing when the provider is already updating. We should reply with a DidChangePosition using the last known position, if available. If we are updating, but we still don't have a known position, the request will be completed when WebGeolocationManagerProxy::providerDidChangePosition() is called since it always notifies all web processes. * UIProcess/WebGeolocationManagerProxy.cpp: (WebKit::WebGeolocationManagerProxy::providerDidChangePosition): Cache the position. (WebKit::WebGeolocationManagerProxy::startUpdating): Reply using cached position if already known. * UIProcess/WebGeolocationManagerProxy.h: (WebKit::WebGeolocationManagerProxy::lastPosition const): Return cached position. * WebProcess/WebCoreSupport/WebGeolocationClient.cpp: (WebKit::WebGeolocationClient::lastPosition): Remove the FIXME since we don't want this feature. 2019-03-26 Brent Fulgham [macOS] Correct kerberos-related sandbox violations https://bugs.webkit.org/show_bug.cgi?id=196279 Reviewed by Per Arne Vollan. We need to allow communications with a Kerberos-related service on macOS until is fixed. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: 2019-03-26 Chris Dumez [macOS] The network process is not exiting reliably when the WebProcessPool is destroyed https://bugs.webkit.org/show_bug.cgi?id=196277 Reviewed by Alex Christensen. When, an AuxiliaryProcess receives the AuxiliaryProcess::Terminate IPC, it calls stopRunLoop() to exit. WebProcess overrides AuxiliaryProcess::stopRunLoop() to call exit(0) on the main thread. Other auxiliary processes such as the NetworkProcess would end up calling platformStopRunLoop(). On iOS and iOSMac, platformStopRunLoop() calls XPCServiceExit(), which makes sense since auxiliary processes run their run loop by calling xpc_main(). However, on macOS, platformStopRunLoop() was calling RunLoop::main().stop() to exit instead, which was unreliable as demonstrated by the test app attached to the radar. Updating platformStopRunLoop() to call XPCServiceExit() on macOS fixes the problem and I now see the NetworkProcess exiting reliably there. This is the approach I have chosen in this patch since it appears to be reliable and it makes the code consistent on all Cocoa platforms. * Shared/AuxiliaryProcess.cpp: * Shared/Cocoa/AuxiliaryProcessCocoa.mm: (WebKit::AuxiliaryProcess::platformStopRunLoop): * Shared/ios/AuxiliaryProcessIOS.mm: (WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted. 2019-03-26 Keith Rollin Inhibit CFNetwork logging in private sessions https://bugs.webkit.org/show_bug.cgi?id=196268 Reviewed by Alex Christensen. Before performing any logging, the NetworkProcess checks to see if it's performing an operation associated with a private (ephemeral) browsing session. If so, it skips the logging. However, networking layers below the NetworkProcess don't know about private browsing, so they would still perform their own logging. CFNetwork now has a flag that lets us control that, so set it to False if private browsing. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::configurationForSessionID): 2019-03-26 Chris Dumez Add basic layout test coverage for File Picker on iOS https://bugs.webkit.org/show_bug.cgi?id=196265 Reviewed by Wenson Hsieh. Add layout test infrastructure to test the file picker on iOS. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _dismissFilePicker]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView dismissFilePicker]): (-[WKContentView _contentsOfUserInterfaceItem:]): * UIProcess/ios/forms/WKFileUploadPanel.h: * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel currentAvailableActionTitles]): 2019-03-26 Daniel Bates [iOS][WK2] Use a better concept to describe the reason we defer zooming a focused element: selectabiltiy https://bugs.webkit.org/show_bug.cgi?id=196264 Reviewed by Wenson Hsieh. Rename shouldDeferZoomingToSelectionWhenRevealingFocusedElement() to mayContainSelectableText() to describe the criterion that we will use to decide whether to defer zooming or not. We defer zooming only for elements that may support text selection on initial focus because we do not have an up-to-date selection rect at that time. For element, like (or other form fields that fall back on text field behavior),