2019-06-05 Brent Fulgham [iOS] Update sandboxes to address iokit-get-property errors https://bugs.webkit.org/show_bug.cgi?id=198494 and Reviewed by Alexey Proskuryakov. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-06-05 Wenson Hsieh Upstream content mode support into open source from WebKitAdditions https://bugs.webkit.org/show_bug.cgi?id=198484 Reviewed by Andy Estes. Move code for handling WKContentMode into open source. No change in behavior, for internal builds. * Shared/API/Cocoa/WebKit.apinotes: * Shared/WebContentMode.h: Renamed from Source/WebKit/Shared/WebCompatibilityMode.h. * Shared/WebPreferences.yaml: * UIProcess/API/APINavigation.h: (API::Navigation::setEffectiveContentMode): (API::Navigation::effectiveContentMode const): (API::Navigation::setEffectiveCompatibilityMode): Deleted. (API::Navigation::effectiveCompatibilityMode const): Deleted. * UIProcess/API/APINavigationClient.h: (API::NavigationClient::shouldBypassContentModeSafeguards const): (API::NavigationClient::shouldBypassCompatibilityModeSafeguards const): Deleted. * UIProcess/API/APIWebsitePolicies.cpp: (API::WebsitePolicies::copy const): * UIProcess/API/APIWebsitePolicies.h: * UIProcess/API/Cocoa/WKNavigation.h: * UIProcess/API/Cocoa/WKNavigation.mm: (-[WKNavigation effectiveContentMode]): * UIProcess/API/Cocoa/WKWebpagePreferences.h: * UIProcess/API/Cocoa/WKWebpagePreferences.mm: (WebKit::contentMode): (WebKit::webContentMode): (-[WKWebpagePreferences _allowSiteSpecificQuirksToOverrideCompatibilityMode]): (-[WKWebpagePreferences _setAllowSiteSpecificQuirksToOverrideCompatibilityMode:]): (-[WKWebpagePreferences setPreferredContentMode:]): (-[WKWebpagePreferences preferredContentMode]): * UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h: * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::shouldBypassContentModeSafeguards const): (WebKit::NavigationState::NavigationClient::shouldBypassCompatibilityModeSafeguards const): Deleted. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::effectiveContentModeAfterAdjustingPolicies): (WebKit::WebPageProxy::effectiveCompatibilityModeAfterAdjustingPolicies): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::desktopClassBrowsingSupported): (WebKit::webViewSizeIsNarrow): (WebKit::desktopClassBrowsingRecommendedForRequest): (WebKit::desktopClassBrowsingRecommended): (WebKit::WebPageProxy::effectiveContentModeAfterAdjustingPolicies): * WebKit.xcodeproj/project.pbxproj: 2019-06-05 Tim Horton Remove some unused selection code https://bugs.webkit.org/show_bug.cgi?id=198451 Reviewed by Wenson Hsieh. * Platform/spi/ios/UIKitSPI.h: * Shared/ios/GestureTypes.h: * UIProcess/ios/WKContentViewInteraction.mm: (toGestureType): (toUIWKGestureType): * UIProcess/ios/WKPDFView.mm: (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::selectWithGesture): (WebKit::WebPage::selectTextWithGranularityAtPoint): (WebKit::canShrinkToTextSelection): Deleted. (WebKit::hasCustomLineHeight): Deleted. (WebKit::WebPage::rangeForWebSelectionAtPosition): Deleted. 2019-06-05 Chris Dumez Unreviewed assertion fix for macOS after r246097. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::processPoolForCookieStorageOperations): 2019-06-01 Antoine Quint [Pointer Events] Add support for chorded button interactions https://bugs.webkit.org/show_bug.cgi?id=198462 Reviewed by Dean Jackson. Update to use -2 instead of -1 for NoButton. * Shared/API/c/WKEvent.h: * Shared/WebEvent.h: 2019-06-05 Michael Catanzaro REGRESSION(r245796): [WPE][GTK] Web process crash on startup https://bugs.webkit.org/show_bug.cgi?id=198485 Reviewed by Chris Dumez. * UIProcess/API/glib/WebKitURISchemeRequest.cpp: (webkitURISchemeRequestCreate): 2019-06-05 Carlos Garcia Campos [GTK][WPE] Re-enable process warming https://bugs.webkit.org/show_bug.cgi?id=198526 Reviewed by Michael Catanzaro. It was disabled in r243490 because bubblewrap sandbox needs a valid WebsiteDataStore before launching the web process. We can use the default WebsiteDataStore from the WebProcessPool and only use the prewarmed process later if the given WebsiteDataStore is the same as the WebProcessPool one. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::tryTakePrewarmedProcess): Do not use the prewarmed process if WebsiteDataStore is different than the one used to launch the process when sandboxing is enabled. * UIProcess/glib/WebProcessPoolGLib.cpp: (WebKit::WebProcessPool::platformInitialize): Do not disable process warming. * UIProcess/glib/WebProcessProxyGLib.cpp: (WebKit::WebProcessProxy::platformGetLaunchOptions): Use the WebsiteDataStore from the WebProcessPool if process is prewarmed and sandboxing is enabled. 2019-06-04 Chris Dumez Cookies set via [WKHTTPCookieStore setCookie:] on store right after constructing WKWebView get lost https://bugs.webkit.org/show_bug.cgi?id=198553 Reviewed by Geoffrey Garen. If you call [WKHTTPCookieStore setCookie:] right after you construct the WKWebView and before the WebContent process has finished launching, then WebsiteDataStore::processPoolForCookieStorageOperations() would return null, even though there is already a view/page/WebProcessProxy/WebProcessPool for this data store. As a result, the cookie would get added to the WebsiteDataStore's m_pendingCookies but it will not be used since we've already previously launched a network process when we constructed the web view. The reason processPoolForCookieStorageOperations() would return null is because WebsiteDataStore::processPools() relies on WebProcessLifetimeObserver::processes() but processes only register themselves with the WebProcessLifetimeObservers when they have pages *and* after they are finished launching. This patch updates processPoolForCookieStorageOperations() to fallback to iterating over all process pools and find a process pool with a process using the current data store and which has pages. This way, even if the process is still launching, we'll properly find its associated process pool. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::processPoolForCookieStorageOperations): 2019-06-04 Michael Catanzaro Fix miscellaneous build warnings https://bugs.webkit.org/show_bug.cgi?id=198544 Reviewed by Don Olmstead. Carefully silence -Wsign-compare warnings. * NetworkProcess/cache/NetworkCacheData.cpp: (WebKit::NetworkCache::readOrMakeSalt): 2019-06-04 Youenn Fablet getUserMedia requests should be processed sequentially in UIProcess https://bugs.webkit.org/show_bug.cgi?id=198430 Reviewed by Eric Carlson. Before the patch, we process all incoming gum/gdm requests in parallel. We now queueu them and process them one at a time. This allows to take into consideration state changes triggered by one request for the next one. In particular, if a user grants a request, this might grant the next one as well. To implement that, we keep a reference of the current request to process. We queue other requests happening whenever another request comes. When the request is processed, we look at the next one in the queue. To ensure we do not stop processing the queue for no good reason, some refactoring is done: - queue processing happens when sending back IPC response to WebProcess. - denyRequest/grantRequest are consistently called in the manager proxy. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::invalidatePendingRequests): Invalidate pregranted requests as well. (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest): Renamed from userMediaAccessWasDenied to denyRequest. This method is now consistently used whenever the manager proxy wants to deny the request. It does the IPC to the WebProcess and triggers processing of the next request. (WebKit::UserMediaPermissionRequestManagerProxy::grantRequest): Renamed from userMediaAccessWasGranted to grantRequest. (WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest): This method is now consistently used whenever the manager proxy wants to deny the request. It does the IPC to the WebProcess and triggers processing of the next request. (WebKit::UserMediaPermissionRequestManagerProxy::rejectionTimerFired): We now keep a queue of request instead of request IDs to make the deny code path more consistent. (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): (WebKit::UserMediaPermissionRequestManagerProxy::processNextUserMediaRequestIfNeeded): (WebKit::UserMediaPermissionRequestManagerProxy::startProcessingUserMediaPermissionRequest): (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest): To make sure we do not process a different request, we keep a pointer to the request and compare it with the current media request. (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionInvalidRequest): (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest): (WebKit::UserMediaPermissionRequestManagerProxy::viewIsBecomingVisible): * UIProcess/UserMediaPermissionRequestManagerProxy.h: (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest): * UIProcess/UserMediaPermissionRequestProxy.cpp: (WebKit::setDeviceAsFirst): (WebKit::UserMediaPermissionRequestProxy::allow): (WebKit::UserMediaPermissionRequestProxy::deny): * UIProcess/UserMediaPermissionRequestProxy.h: 2019-06-04 Commit Queue Unreviewed, rolling out r246086. https://bugs.webkit.org/show_bug.cgi?id=198549 Causing Internal build failures (Requested by ShawnRoberts on #webkit). Reverted changeset: "Remove some unused selection code" https://bugs.webkit.org/show_bug.cgi?id=198451 https://trac.webkit.org/changeset/246086 2019-06-04 Tim Horton Turn on background color estimation for all link indicators https://bugs.webkit.org/show_bug.cgi?id=198547 Reviewed by Dean Jackson. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::computeAndSendEditDragSnapshot): (WebKit::linkIndicatorPositionInformation): 2019-06-04 Tim Horton Remove some unused selection code https://bugs.webkit.org/show_bug.cgi?id=198451 Reviewed by Wenson Hsieh. * Platform/spi/ios/UIKitSPI.h: * Shared/ios/GestureTypes.h: * UIProcess/ios/WKContentViewInteraction.mm: (toGestureType): (toUIWKGestureType): * UIProcess/ios/WKPDFView.mm: (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::selectWithGesture): (WebKit::WebPage::selectTextWithGranularityAtPoint): (WebKit::canShrinkToTextSelection): Deleted. (WebKit::hasCustomLineHeight): Deleted. (WebKit::WebPage::rangeForWebSelectionAtPosition): Deleted. 2019-06-04 Sihui Liu WKWebsiteDataStore API fails to fetch web storage data for non-persistent data store https://bugs.webkit.org/show_bug.cgi?id=198317 Reviewed by Alex Christensen. Use LocalStorageNameSpace instead of SessionStorageNameSpace for localStorage in ephemeral session or websiteDataStore. Reland r245943 as test has been fixed in r246012. * NetworkProcess/WebStorage/StorageManager.cpp: (WebKit::StorageManager::StorageArea::isEphemeral const): (WebKit::StorageManager::StorageArea::removeListener): (WebKit::StorageManager::StorageArea::setItems): (WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded const): (WebKit::StorageManager::LocalStorageNamespace::~LocalStorageNamespace): (WebKit::StorageManager::LocalStorageNamespace::getOrCreateStorageArea): (WebKit::StorageManager::LocalStorageNamespace::clearAllStorageAreas): (WebKit::StorageManager::LocalStorageNamespace::ephemeralOrigins const): (WebKit::StorageManager::LocalStorageNamespace::cloneTo): (WebKit::StorageManager::StorageManager): (WebKit::StorageManager::cloneSessionStorageNamespace): (WebKit::StorageManager::getLocalStorageOrigins): (WebKit::StorageManager::getLocalStorageOriginDetails): (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin): (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince): (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins): (WebKit::StorageManager::createLocalStorageMap): (WebKit::StorageManager::createTransientLocalStorageMap): (WebKit::StorageManager::createSessionStorageMap): (WebKit::StorageManager::destroyStorageMap): (WebKit::StorageManager::getValues): (WebKit::StorageManager::setItem): (WebKit::StorageManager::removeItem): (WebKit::StorageManager::clear): (WebKit::StorageManager::suspend): (WebKit::StorageManager::resume): (WebKit::StorageManager::StorageArea::isSessionStorage const): Deleted. * NetworkProcess/WebStorage/StorageManager.h: (): Deleted. * WebProcess/WebStorage/StorageAreaMap.cpp: (WebKit::StorageAreaMap::dispatchStorageEvent): (WebKit::StorageAreaMap::dispatchSessionStorageEvent): (WebKit::StorageAreaMap::connect): * WebProcess/WebStorage/StorageNamespaceImpl.cpp: (WebKit::StorageNamespaceImpl::createEphemeralLocalStorageNamespace): (WebKit::StorageNamespaceImpl::createLocalStorageNamespace): * WebProcess/WebStorage/StorageNamespaceImpl.h: * WebProcess/WebStorage/WebStorageNamespaceProvider.cpp: (WebKit::WebStorageNamespaceProvider::createLocalStorageNamespace): 2019-06-04 Alex Christensen Uploading third-party applications from /Applications needs additional syscall access https://bugs.webkit.org/show_bug.cgi?id=198537 Reviewed by Brent Fulgham. * WebProcess/com.apple.WebProcess.sb.in: 2019-06-04 Chris Dumez Lazily construct the NetworkHTTPSUpgradeChecker https://bugs.webkit.org/show_bug.cgi?id=198500 Reviewed by Alex Christensen. Lazily construct the NetworkHTTPSUpgradeChecker since the feature is off by default and this avoids unnecessarily opening its database in the common case. * NetworkProcess/NetworkProcess.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::networkHTTPSUpgradeChecker): 2019-06-04 Youenn Fablet REGRESSION (r245913) [ Debug ] ASSERTION FAILED: m_swConnectionsByIdentifier.contains(connection.serverConnectionIdentifier()) Layout Test http/wpt/service-workers/update-service-worker.https.html is a flaky crash https://bugs.webkit.org/show_bug.cgi?id=198434 Reviewed by Alex Christensen. Iterate through the connectionID-based connection map instead of the sessionID-based map to notify them their connection is lost. * WebProcess/Network/NetworkProcessConnection.cpp: (WebKit::NetworkProcessConnection::didClose): 2019-06-04 Chris Dumez [iOS] UIProcess' background task expiration handler may get called after the app is foreground again https://bugs.webkit.org/show_bug.cgi?id=198380 Reviewed by Geoff Garen. UIProcess' background task expiration handler may get called after the app is foreground again. When this happens, we already have a foreground assertion on behalf of the WebContent process, and the view is visible. We would send the WillSuspendImminently IPC to the WebContent process, which would freeze its layers, even though it is visible on screen. To address the issue, we now check if the app is visible in the expiration handler. If it is visible, we do not notify clients of imminent suspension. Instead, we end the background task right away and call _updateBackgroundTask asynchronously to start a new background task if necessary. * UIProcess/ios/ProcessAssertionIOS.mm: (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]): 2019-06-04 Carlos Garcia Campos [GTK] Crash when re-entering AC mode after r245957 https://bugs.webkit.org/show_bug.cgi?id=198522 Reviewed by Žan Doberšek. When AcceleratedBackingStoreWayland::displayBuffer() is called and we have already left AC mode, we early dispatch the image and release it. The problem is that images are reused, so the given image can be the committed one. In that case we end up freeing it again in the next AcceleratedBackingStoreWayland::paint() call. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::displayBuffer): Do not release the given image if it's the committed one. 2019-06-03 Chris Dumez [iOS] Do not prevent app suspension for more than 20 seconds after getting backgrounded https://bugs.webkit.org/show_bug.cgi?id=198488 Reviewed by Geoff Garen. Do not prevent app suspension for more than 20 seconds after getting backgrounded on iOS. We do this by implementing our own expiration handler which notifies our child processes of their imminent suspension before ending the background task that was preventing suspension. * UIProcess/ios/ProcessAssertionIOS.mm: (isBackgroundState): (-[WKProcessAssertionBackgroundTaskManager init]): (-[WKProcessAssertionBackgroundTaskManager _scheduleTimeoutTask]): (-[WKProcessAssertionBackgroundTaskManager _cancelTimeoutTask]): (-[WKProcessAssertionBackgroundTaskManager _backgroundTaskExpired]): (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]): (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]): 2019-06-03 Wenson Hsieh Implement an internal switch to turn idempotent text autosizing and viewport rules off https://bugs.webkit.org/show_bug.cgi?id=198460 Reviewed by Tim Horton. * Shared/WebPreferences.yaml: Add new preferences to control viewport shrink-to-fit-content and idempotent text autosizing. * Shared/WebPreferencesDefaultValues.cpp: Add the non-iOS implementation of defaultTextAutosizingUsesIdempotentMode, and also wrap these functions in the WebKit namespace. (WebKit::defaultTextAutosizingUsesIdempotentMode): (defaultPassiveTouchListenersAsDefaultOnDocument): Deleted. (defaultCustomPasteboardDataEnabled): Deleted. * Shared/WebPreferencesDefaultValues.h: Move some existing default preference value helper functions into the WebKit namespace. * Shared/ios/WebPreferencesDefaultValuesIOS.mm: Copied from Source/WebKit/Shared/WebPreferencesDefaultValues.cpp. Add an iOS-specific file for WebPreferencesDefaultValues, so that we can check for the user interface idiom. (WebKit::defaultTextAutosizingUsesIdempotentMode): * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::immediatelyShrinkToFitContent): Add an early return for the case where shrink-to-fit-content is explicitly disabled via the new preference. 2019-06-03 Rob Buis Implement imagesrcset and imagesizes attributes on link rel=preload https://bugs.webkit.org/show_bug.cgi?id=192950 Reviewed by Youenn Fablet. Add a runtime flag for link preload responsive images. * Shared/WebPreferences.yaml: 2019-06-03 Darin Adler Finish cleanup of String::number for floating point https://bugs.webkit.org/show_bug.cgi?id=198471 Reviewed by Yusuke Suzuki. * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp: (WebKit::submitTopList): Use makeString instead of StringBuilder since it is more terse and possibly more efficient as well. * UIProcess/API/APIUserScript.cpp: (API::UserScript::generateUniqueURL): Ditto. * UIProcess/API/APIUserStyleSheet.cpp: (API::UserStyleSheet::generateUniqueURL): Ditto. 2019-06-03 Fujii Hironori REGRESSION(r240862) [WinCairo][WK2] position:fixed elements don't show https://bugs.webkit.org/show_bug.cgi?id=198478 Reviewed by Carlos Garcia Campos. All position:fixed elements didn't show in WinCairo WebKit2 since r240862 which turns acceleratedCompositingEnabled on for WebKit2. WinCairo WebKit2 doesn't have accelerated compositing support yet. Let's do the same with GTK port. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): Conditioned out the code enabling acceleratedCompositingEnabled for PLATFORM(WIN). 2019-06-03 Carlos Garcia Campos REGRESSION(r244182): [CoordinatedGraphics] Related view doesn't receive graphic updates https://bugs.webkit.org/show_bug.cgi?id=198418 Reviewed by Žan Doberšek. This is because we need a DisplayRefreshMonitor per drawing area, but the one from the first ThreradedCompositor is always reused because they use the same display ID. * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode): Use a unique display ID derived from WebPage's ID. (WebKit::DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingMode): Use the primary display ID. * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp: (WebKit::LayerTreeHost::LayerTreeHost): Get the current web page display ID instead of inventing one. (WebKit::LayerTreeHost::setIsDiscardable): Do not change display ID. 2019-06-01 Dean Jackson Provide an action to save an image on a link sheet https://bugs.webkit.org/show_bug.cgi?id=198464 Reviewed by Wenson Hsieh. When providing the set of default actions for a link sheet, if an URL to an image was provided then offer the action to save that image to Photos. * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant defaultActionsForLinkSheet:]): 2019-06-01 Konstantin Tokarev Remove include directives unused since r245186 https://bugs.webkit.org/show_bug.cgi?id=198463 Reviewed by Don Olmstead. * NetworkProcess/cache/NetworkCacheBlobStorage.cpp: 2019-05-31 Megan Gardner Ensure keyboard editing is up to date https://bugs.webkit.org/show_bug.cgi?id=198444 Reviewed by Ryosuke Niwa. In order for the keyboard cut/copy/undo/redo/etc buttons to be up to date based on the state of the selection, we need to let the input delegate know when the selection has changed. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _selectionChanged]): 2019-05-31 Sihui Liu Remove outdated FIXME in StorageManager https://bugs.webkit.org/show_bug.cgi?id=198049 Reviewed by Geoffrey Garen. Previously StorageManager messages were dispatched and handled in the same thread, so we could perform a message check. Now they are on different thread, and we would not be able to verify those parameters when dispatching the message. * NetworkProcess/WebStorage/StorageManager.cpp: (WebKit::StorageManager::createLocalStorageMap): (WebKit::StorageManager::createTransientLocalStorageMap): (WebKit::StorageManager::createSessionStorageMap): (WebKit::StorageManager::destroyStorageMap): 2019-05-31 Jiewen Tan Teach AuxiliaryProcess about LoadOptimizer https://bugs.webkit.org/show_bug.cgi?id=198443 Reviewed by Brent Fulgham. * Shared/ios/AuxiliaryProcessIOS.mm: (WebKit::AuxiliaryProcess::platformInitialize): * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::AuxiliaryProcess::platformInitialize): 2019-05-31 Youenn Fablet Add an option to mute audio capture automatically when page is not visible https://bugs.webkit.org/show_bug.cgi?id=198307 Reviewed by Eric Carlson. Add API to set the new runtime flag. Make source proxy factories implement this automatic muting. * Shared/WebPreferences.yaml: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _interruptAudioOnPageVisibilityChangeEnabled]): (-[WKPreferences _setInterruptAudioOnPageVisibilityChangeEnabled:]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::setAudioCapturePageState): (WebKit::UserMediaCaptureManager::setVideoCapturePageState): * WebProcess/cocoa/UserMediaCaptureManager.h: 2019-05-31 Wenson Hsieh [iOS] Autocorrection menu font is Times New Roman when using font-family: UICTFontTextStyle* https://bugs.webkit.org/show_bug.cgi?id=198427 Reviewed by Tim Horton. When UICTFontTextStyle* is specified as the font-family in an editable element, text in autocorrection bubbles always uses Times New Roman font. This is because we send a font family name, font size, and font attributes to the UI process when computing autocorrection data for UIKit, and then assemble this information into a UIFont object via +[UIFont fontWithFamilyName:traits:size:]. However, in the case where UICTFontTextStyle* is specified as the font-family in CSS, the font family that we send to the UI process ends up being ".AppleSystemUIFont", which +fontWithFamilyName:traits:size: fails to map to the system font as intended. To fix this, we propagate font information to the UI process by encoding the UIFont itself via IPC, which serializes the font descriptor, and then deserializes into a UIFont in the UI process. This allows the system font to be returned in -fontForCaretSelection, which is invoked by UIKit when determining the font for the autocorrection bubble. See below for more details. Test: AutocorrectionTests.FontAtCaretWhenUsingUICTFontTextStyle * Shared/ios/WebAutocorrectionData.h: Copied from Source/WebKit/UIProcess/AutoCorrectionCallback.h. * Shared/ios/WebAutocorrectionData.mm: Renamed from Source/WebKit/UIProcess/AutoCorrectionCallback.h. (WebKit::WebAutocorrectionData::encode const): (WebKit::WebAutocorrectionData::decode): Introduce WebAutocorrectionData, a struct containing information used to show autocorrection UI on iOS (i.e. highlights and the bubble). This consists of a list of rects, along with a UIFont. * SourcesCocoa.txt: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: Refactor requestAutocorrectionData to request a WebAutocorrectionData instead, and also use the new async IPC reply mechanism. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView requestAutocorrectionRectsForString:withCompletionHandler:]): (-[WKContentView fontForCaretSelection]): Grab the UIFont directly from the WebAutocorrectionData. Also, address a FIXME by scaling the font size by the content scale. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::requestAutocorrectionData): (WebKit::WebPageProxy::autocorrectionDataCallback): Deleted. (WebKit::WebPageProxy::autocorrectionContextCallback): Deleted. Remove some IPC callbacks that are now unused. * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestAutocorrectionData): 2019-05-31 Ryosuke Niwa [iOS] Reveal the focused element when it's immediately above software keyboard https://bugs.webkit.org/show_bug.cgi?id=198412 Reviewed by Wenson Hsieh. When _zoomToRevealFocusedElement is called with forceScroll set to NO (happens when input type is none or drawing or when the platform is iPad), we don't force scrolling to reveal the focused element when it's entirely visible. This can be misleading in cases where there is more content right beneath it relevant for editing operations. Zoom & scroll to reveal the focused element when the said element is within 50px of the software keyboard. * Platform/spi/ios/UIKitSPI.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): 2019-05-31 Chris Dumez Unreviewed, rolling out r245899. Seems to be causing crashes on iosmac Reverted changeset: "[iOS] UIProcess' background task expiration handler may get called after the app is foreground again" https://bugs.webkit.org/show_bug.cgi?id=198380 https://trac.webkit.org/changeset/245899 2019-05-31 Ryosuke Niwa iOS: Main frame should be scrollable when pinch zoomed or software keyboard is up https://bugs.webkit.org/show_bug.cgi?id=198244 Reviewed by Simon Fraser. This is a follow up to r245006. Even when overflow: hidden is specified on the document body, we still need to make it scrollable when the page is pinch zoomed or there is a content inset e.g. for software keyboard. Otherwise, the user won't be able to get to the content that is outside the visual viewport when pinch zoomed or the parts of the page that is not outside the visual viewport due to the scrolling caused by the software keyboard being brought up. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _didCommitLayerTree:]): 2019-05-31 Geoffrey Garen Some WeakPtr typedef cleanup https://bugs.webkit.org/show_bug.cgi?id=198431 Reviewed by Chris Dumez. Use "using" instead of "typedef", since using is preferred in C++ for better compatibility with templates. * UIProcess/WebAuthentication/AuthenticatorManager.h: 2019-05-31 Commit Queue Unreviewed, rolling out r245953. https://bugs.webkit.org/show_bug.cgi?id=198436 Broke quip (Requested by rniwa on #webkit). Reverted changeset: "iOS: Main frame should be scrollable when pinch zoomed or software keyboard is up" https://bugs.webkit.org/show_bug.cgi?id=198244 https://trac.webkit.org/changeset/245953 2019-05-31 Tim Horton Optionally respect device management restrictions when loading from the network https://bugs.webkit.org/show_bug.cgi?id=198318 Reviewed by Alex Christensen. * Configurations/Network-iOS.entitlements: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Add some entitlements and sandbox holes required to talk to DeviceManagement. * NetworkProcess/NetworkCORSPreflightChecker.cpp: (WebKit::NetworkCORSPreflightChecker::wasBlockedByRestrictions): * NetworkProcess/NetworkCORSPreflightChecker.h: * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::wasBlockedByRestrictions): * NetworkProcess/NetworkLoad.h: * NetworkProcess/PingLoad.cpp: (WebKit::PingLoad::wasBlockedByRestrictions): * NetworkProcess/PingLoad.h: * Shared/WebErrors.cpp: (WebKit::wasBlockedByRestrictionsError): * Shared/WebErrors.h: * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::create): (WebKit::NetworkDataTask::failureTimerFired): * NetworkProcess/NetworkDataTask.h: * Shared/API/APIError.h: * Shared/API/c/WKErrorRef.cpp: (WKErrorGetErrorCode): * Shared/API/c/WKErrorRef.h: Plumb a new error for loads that are blocked by device management restrictions. * NetworkProcess/NetworkLoadParameters.h: * NetworkProcess/NetworkResourceLoadParameters.cpp: (WebKit::NetworkResourceLoadParameters::encode const): (WebKit::NetworkResourceLoadParameters::decode): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): Plumb a new bit that indicates whether a load is for the main resource of a frame. We will only apply device management restrictions to main resources. * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::privateSessionParameters): (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): Plumb a new bit indicating whether a network session should respect device mangement restrictions. * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): (WebKit::NetworkDataTaskCocoa::resume): Defer resuming the load until we have a reply from DeviceManagement framework about whether the URL should be blocked. If it is blocked, instead fail the load. * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): (WebKit::NetworkSessionCocoa::deviceManagementPolicyMonitor): Cache a single DMFWebsitePolicyMonitor instance per NetworkSession. * UIProcess/API/APIWebsiteDataStore.cpp: (API::WebsiteDataStore::defaultDataStoreConfiguration): The default data store is persistent; its configuration should reflect that. * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _setAllowsAnySSLCertificateForServiceWorker:]): Style. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _initWithConfiguration:]): Make it possible to create a non-persistent WKWebsiteDataStore from a configuration, and ensure that it does not have any persistent storage directories set. * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: (-[_WKWebsiteDataStoreConfiguration init]): (-[_WKWebsiteDataStoreConfiguration initWithNonPersistentConfiguration]): (-[_WKWebsiteDataStoreConfiguration isPersistent]): (-[_WKWebsiteDataStoreConfiguration _setWebStorageDirectory:]): (-[_WKWebsiteDataStoreConfiguration _setIndexedDBDatabaseDirectory:]): (-[_WKWebsiteDataStoreConfiguration _setWebSQLDatabaseDirectory:]): (-[_WKWebsiteDataStoreConfiguration _setCookieStorageFile:]): (-[_WKWebsiteDataStoreConfiguration _setResourceLoadStatisticsDirectory:]): (-[_WKWebsiteDataStoreConfiguration _setCacheStorageDirectory:]): (-[_WKWebsiteDataStoreConfiguration _setServiceWorkerRegistrationDirectory:]): (-[_WKWebsiteDataStoreConfiguration deviceManagementRestrictionsEnabled]): (-[_WKWebsiteDataStoreConfiguration setDeviceManagementRestrictionsEnabled:]): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: (WebKit::WebsiteDataStoreConfiguration::copy): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: (WebKit::WebsiteDataStoreConfiguration::isPersistent const): (WebKit::WebsiteDataStoreConfiguration::setPersistent): (WebKit::WebsiteDataStoreConfiguration::perOriginStorageQuota const): (WebKit::WebsiteDataStoreConfiguration::deviceManagementRestrictionsEnabled const): (WebKit::WebsiteDataStoreConfiguration::setDeviceManagementRestrictionsEnabled): (WebKit::WebsiteDataStoreConfiguration::perOriginStorageQuota): Deleted. Make it possible to create a _WKWebsiteDataStoreConfiguration that will create a non-persistent data store. Add a bit to _WKWebsiteDataStoreConfiguration that controls whether the network session will respect device management restrictions. * WebKit.xcodeproj/project.pbxproj: * WebKit/NetworkProcess/cocoa/DeviceManagementSoftLink.h: * WebKit/NetworkProcess/cocoa/DeviceManagementSoftLink.mm: * WebKit/Platform/spi/Cocoa/DeviceManagementSPI.h: Add some soft-linking and SPI headers. 2019-05-31 Ryan Haddad Unreviewed, rolling out r245943. Caused API test WKWebView.LocalStorageProcessSuspends to fail on release bots. Reverted changeset: "WKWebsiteDataStore API fails to fetch web storage data for non-persistent data store" https://bugs.webkit.org/show_bug.cgi?id=198317 https://trac.webkit.org/changeset/245943 2019-05-31 Ryan Haddad Unreviewed, rolling out r245946. Breaks the watchOS build. Reverted changeset: "Add an option to mute audio capture automatically when page is not visible" https://bugs.webkit.org/show_bug.cgi?id=198307 https://trac.webkit.org/changeset/245946 2019-05-31 Carlos Garcia Campos [GTK] WPERenderer: ensure we complete the last frame when leaving AC mode https://bugs.webkit.org/show_bug.cgi?id=198372 Reviewed by Michael Catanzaro. It can happen that we leave AC mode after a new image is received from the web process but before it's committed. It can also happen that we receive a new image from the web process right after we have left AC mode. In both cases we need to complete the frame to ensure we don't leave the wayland compositor waiting forever for a frame to be completed. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::update): Complete any pending image when a new surface is used. (WebKit::AcceleratedBackingStoreWayland::displayBuffer): Complete the given image and return early if we already left AC mode. * UIProcess/gtk/AcceleratedBackingStoreWayland.h: 2019-05-31 Carlos Garcia Campos [CoordinatedGraphics] WPERenderer: do not release the host file descritor when initializing the render target https://bugs.webkit.org/show_bug.cgi?id=198371 Reviewed by Michael Catanzaro. We are assuming that there will always be only one target for a web page. In the GTK port we destroy the render target when leaving AC mode, and a new one is created when re-entering AC mode. Since the file descriptor is released on the first target and adopted by libwpe, the second target passes -1 as host fd to libwpe, and the new surface created by the target is not properly registered in the wayland compositor. That means that frame requests for the new target are simply ignored by the wayland compositor, it returns early on surfacxe frame when the surface doesn't have a view backend client. * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::hostFileDescriptor const): Rename it and make it const. * WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.cpp: (WebKit::AcceleratedSurfaceLibWPE::initialize): Pass a duplicated file descriptor to wpe_renderer_backend_egl_target_create(). 2019-05-31 Carlos Garcia Campos [GTK] Fix memory leak introduced in r245807 https://bugs.webkit.org/show_bug.cgi?id=198369 Reviewed by Michael Catanzaro. We should destroy the wpe_view_backend_exportable_fdo created in AcceleratedBackingStoreWayland. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::~AcceleratedBackingStoreWayland): 2019-05-31 Carlos Garcia Campos REGRESSION(r244182): [GTK] Web view no longer updated after re-entering AC mode https://bugs.webkit.org/show_bug.cgi?id=198367 Reviewed by Sergio Villar Senin. This happens because we leave accelerated compositing mode when a rendering update is scheduled in RenderingUpdateScheduler. The ThreadedDisplayRefreshMonitor is destroyed without completing the frame, so that the RenderingUpdateScheduler is left scheduled forever, ignoring any new schedule request. We need to ensure we complete the frame request before destroying the display refresh monitor to leave the RenderingUpdateScheduler in a consistent state. * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp: (WebKit::ThreadedDisplayRefreshMonitor::invalidate): 2019-05-30 Ryosuke Niwa iOS: Main frame should be scrollable when pinch zoomed or software keyboard is up https://bugs.webkit.org/show_bug.cgi?id=198244 Reviewed by Simon Fraser. This is a follow up to r245006. Even when overflow: hidden is specified on the document body, we still need to make it scrollable when the page is pinch zoomed or there is a content inset e.g. for software keyboard. Otherwise, the user won't be able to get to the content that is outside the visual viewport when pinch zoomed or the parts of the page that is not outside the visual viewport due to the scrolling caused by the software keyboard being brought up. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _didCommitLayerTree:]): 2019-05-30 Youenn Fablet Add an option to mute audio capture automatically when page is not visible https://bugs.webkit.org/show_bug.cgi?id=198307 Reviewed by Eric Carlson. Add API to set the new runtime flag. Make source proxy factories implement this automatic muting. * Shared/WebPreferences.yaml: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _interruptAudioOnPageVisibilityChangeEnabled]): (-[WKPreferences _setInterruptAudioOnPageVisibilityChangeEnabled:]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::setAudioCapturePageState): (WebKit::UserMediaCaptureManager::setVideoCapturePageState): * WebProcess/cocoa/UserMediaCaptureManager.h: 2019-05-30 Sihui Liu WKWebsiteDataStore API fails to fetch web storage data for non-persistent data store https://bugs.webkit.org/show_bug.cgi?id=198317 Reviewed by Alex Christensen. Use LocalStorageNameSpace instead of SessionStorageNameSpace for localStorage in ephemeral session or websiteDataStore. * NetworkProcess/WebStorage/StorageManager.cpp: (WebKit::StorageManager::StorageArea::isEphemeral const): (WebKit::StorageManager::StorageArea::removeListener): (WebKit::StorageManager::StorageArea::setItems): (WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded const): (WebKit::StorageManager::LocalStorageNamespace::~LocalStorageNamespace): (WebKit::StorageManager::LocalStorageNamespace::getOrCreateStorageArea): (WebKit::StorageManager::LocalStorageNamespace::clearAllStorageAreas): (WebKit::StorageManager::LocalStorageNamespace::ephemeralOrigins const): (WebKit::StorageManager::LocalStorageNamespace::cloneTo): (WebKit::StorageManager::StorageManager): (WebKit::StorageManager::cloneSessionStorageNamespace): (WebKit::StorageManager::getLocalStorageOrigins): (WebKit::StorageManager::getLocalStorageOriginDetails): (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin): (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince): (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins): (WebKit::StorageManager::createLocalStorageMap): (WebKit::StorageManager::createTransientLocalStorageMap): (WebKit::StorageManager::createSessionStorageMap): (WebKit::StorageManager::destroyStorageMap): (WebKit::StorageManager::getValues): (WebKit::StorageManager::setItem): (WebKit::StorageManager::removeItem): (WebKit::StorageManager::clear): (WebKit::StorageManager::suspend): (WebKit::StorageManager::resume): (WebKit::StorageManager::StorageArea::isSessionStorage const): Deleted. * NetworkProcess/WebStorage/StorageManager.h: (): Deleted. * WebProcess/WebStorage/StorageAreaMap.cpp: (WebKit::StorageAreaMap::dispatchStorageEvent): (WebKit::StorageAreaMap::dispatchSessionStorageEvent): (WebKit::StorageAreaMap::connect): * WebProcess/WebStorage/StorageNamespaceImpl.cpp: (WebKit::StorageNamespaceImpl::createEphemeralLocalStorageNamespace): (WebKit::StorageNamespaceImpl::createLocalStorageNamespace): * WebProcess/WebStorage/StorageNamespaceImpl.h: * WebProcess/WebStorage/WebStorageNamespaceProvider.cpp: (WebKit::WebStorageNamespaceProvider::createLocalStorageNamespace): 2019-05-30 Youenn Fablet REGRESSION (r245873) [Mac WK2] Layout Test http/wpt/service-workers/update-service-worker.https.html is a flaky crash after running new test https://bugs.webkit.org/show_bug.cgi?id=198379 Reviewed by Alex Christensen. This case can happen when network process is crashing. Given the WebSWClientConnection may be kept alive, it might reregister itself but in that case will never be unregistered. Remove the WebSWClientConnection from the NetworkProcessConnection corresponding map on destruction time. Covered by no longer crashing tests. * WebProcess/Network/NetworkProcessConnection.cpp: (WebKit::NetworkProcessConnection::removeSWClientConnection): * WebProcess/Network/NetworkProcessConnection.h: * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::~WebSWClientConnection): 2019-05-30 Chris Dumez Network process crash when decoding SecItemResponseData https://bugs.webkit.org/show_bug.cgi?id=198388 Reviewed by Alex Christensen. * Shared/cf/ArgumentCodersCF.cpp: (IPC::decode): When decoding the elements inside a CFArrayRef, if decoding was successful but the CFTypeRef element is still null then skip it instead of trying to append it to the array. A CFArray container is not allowed to contain null. Some of our decoders for CFTypeRef types may not initialize the element even if the decode() function returns true. For example, the decoders for CFArrayRef and CFDictionaryRef return true if the encoded container was null but do not create a container. * Shared/mac/SecItemResponseData.cpp: (WebKit::SecItemResponseData::SecItemResponseData): nit: The wrong parameter was being moved. This is more efficient. (WebKit::SecItemResponseData::encode const): nit: Drop unnecessary .get(). * UIProcess/mac/SecItemShimProxy.cpp: (WebKit::SecItemShimProxy::secItemRequest): nit: Use nullptr instead of 0. 2019-05-30 Sihui Liu Stop StorageManager when network process is ready to suspend https://bugs.webkit.org/show_bug.cgi?id=198201 Reviewed by Youenn Fablet. To avoid local storage database operations that can hold lock to database files, suspend thread of StorageManager when network process is about to suspend. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::actualPrepareToSuspend): (WebKit::NetworkProcess::resume): * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::~NetworkSession): * NetworkProcess/WebStorage/StorageManager.cpp: (WebKit::StorageManager::suspend): (WebKit::StorageManager::resume): * NetworkProcess/WebStorage/StorageManager.h: 2019-05-30 Wenson Hsieh Missing caret when focusing an editable field if the selection was set when WKWebView wasn't first responder https://bugs.webkit.org/show_bug.cgi?id=198356 Reviewed by Tim Horton. In this bug, the DOM selection is initially set by script in a web view that is not the first responder. Then, either the user begins editing by tapping somewhere such that the selection does not change, or an editable element is programmatically focused and the client allows programmatic focus to show the keyboard. This is because the selection clipping rect used by the UI process when computing the bounds of the caret view is empty, causing the entire caret to be clipped. This is due to two related issues: first, no updated editor state is sent to the UI process after the element is focused, if the selection has not also changed. This means that while the selection geometry is sent over to the UI process, the selection clipping rect (a member of the EditorState's PostLayoutData called "focusedElementRect") becomes stale in the UI process, since the there was no focused element when the previously computed editor state was sent to the UI process. To fix this, we schedule a full editor state update when an element is focused, to ensure that the selection is eventually updated in the UI process. Secondly, even once the editor state update is sent to the UI process, we will actually avoid updating any text selection views, since there is no change in WKSelectionDrawingInfo, which currently consists of a selection type, and either a caret rect or a list of selection rects. However, since selection drawing is also affected by the selection clipping rect, it seems reasonable to add the selection clipping rect to the drawing info, and trigger a selection update if this selection clipping rect has changed. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (WebKit::WKSelectionDrawingInfo::WKSelectionDrawingInfo): Add selectionClippingRect to WKSelectionDrawingInfo, and check against it when comparing two drawing infos. (WebKit::operator==): (WebKit::operator<<): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::elementDidFocus): Schedule an editor state update when focusing an element. In many cases, an editor state update has already been scheduled when focusing an element, so this becomes a no-op; however, in this scenario, it delivers updated selection clipping rects (i.e. the focused element rect) and other updated information to the UI process. 2019-05-30 David Quesada REGRESSION (r245756) [Mac] 2 TestWebKitAPI.DownloadProgress* and TestWebKitAPI._WKDownload.DownloadMonitorCancel are flaky timeouts https://bugs.webkit.org/show_bug.cgi?id=198298 rdar://problem/51182393 Reviewed by Alexey Proskuryakov. When canceling a download, there has always been a race condition between: (A) the execution of Download::didCancel() within the block passed to -[NSURLSessionDownloadTask cancelByProducingResumeData:] within Download::platformCancelNetworkLoad(), and (B) the invocation of -[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:] If A happens before B, the block calls didCancel() on the download, which reports the cancellation to the UI process and tears down the download. When B happens, WKNetworkSessionDelegate gracefully handles the fact that the Download has been removed from the map, and nothing else happens. Life is good. If B happens before A, -URLSession:task:didCompleteWithError: invokes Download::didFail(), which reports a download failure (*not* a cancellation) to the UI process and tears down the Download and DownloadProxy. On release builds, this can leave the tests waiting for a cancellation until they time out. When A happens, the block calls Download::didCancel(). This messages the UI process, which results in a debug assertion failure from an unhandled message since the DownloadProxy was torn down when the failure was reported. Meanwhile, the network process hits a debug assertion in DownloadManager::downloadFinished() when trying to remove the Download *again*. r245756 made the bad case (B before A) more likely by adding a delay before didCancel() is called. Make this race condition impossible by eliminating the didCancel() from the cancellation block, and instead relying on -URLSession:task:didCompleteWithError: to report the download as canceled. This also effectively coalesces calls to platformCancelNetworkLoad(), which, if called multiple times before CFNetwork reports that the download was canceled, could cause multiple calls to didCancel(), resulting in the same assertion failures seen in the B-before-A case. No new tests, as recreating this race condition in the test scenario would require additional machinery, and is no longer even possible since we don't depend on the calling of the cancellation handler in order to report the Download as canceled. * NetworkProcess/Downloads/Download.cpp: (WebKit::Download::cancel): * NetworkProcess/Downloads/Download.h: (WebKit::Download::wasCanceled const): * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::platformCancelNetworkLoad): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]): 2019-05-30 Chris Dumez [iOS] UIProcess' background task expiration handler may get called after the app is foreground again https://bugs.webkit.org/show_bug.cgi?id=198380 Reviewed by Geoffrey Garen. UIProcess' background task expiration handler may get called after the app is foreground again. When this happens, we already have a foreground assertion on behalf of the WebContent process, and the view is visible. We would send the WillSuspendImminently IPC to the WebContent process, which would freeze its layers, even though it is visible on screen. To address the issue, we now check if the app is visible in the expiration handler. If it is visible, we do not notify clients of imminent suspension. Instead, we end the background task right away and call _updateBackgroundTask asynchronously to start a new background task if necessary. * UIProcess/ios/ProcessAssertionIOS.mm: (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]): 2019-05-30 Chris Dumez [iOS] Third-party extensions using WKWebView are unable to render anything https://bugs.webkit.org/show_bug.cgi?id=198359 Reviewed by Brent Fulgham and Geoff Garen. Third-party extensions using WKWebView are unable to render anything because we do not get notified when the extension's visibility changes. Because we do not recognize the extension showing the WebView to be foreground, we do not take a process assertion on behalf of the child processes and they get suspended before they get a chance to render anything. The root of the issue is that WebKit was relying on BKSApplicationStateMonitor.handler to get notified when the extension's state switches between foreground and background. However, the handler never gets called unless the extension has an appropriate entitlement. To address the issue, we now use the same logic for extensions and we do for view services. I have verified that the _UIViewServiceHostDidEnterBackgroundNotification / _UIViewServiceHostWillEnterForegroundNotification notifications get sent to the extensions (even third-party). We also properly detect MobileSafari as host application and are able to get MobileSafari's foreground state accurately. * UIProcess/ApplicationStateTracker.mm: 2019-05-30 Wenson Hsieh Rare crash under `WebPage::shouldIgnoreMetaViewport const` when shrinking to fit content https://bugs.webkit.org/show_bug.cgi?id=198374 Reviewed by Tim Horton. This is a speculative fix for the crash; what appears to be happening is that the shrink-to-fit-content timer is somehow being scheduled after the page has already been closed. We can probably fix this by bailing when scheduling shrink-to-fit-content if m_isClosed is true. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::scheduleShrinkToFitContent): (WebKit::WebPage::immediatelyShrinkToFitContent): 2019-05-30 Truitt Savell Unreviewed, rolling out r245881. Broke 13 Layout tests on WK2 Reverted changeset: "WKWebsiteDataStore API fails to fetch web storage data for non-persistent data store" https://bugs.webkit.org/show_bug.cgi?id=198317 https://trac.webkit.org/changeset/245881 2019-05-30 Philippe Normand Unreviewed, WPE without a11y support build fix. * UIProcess/wpe/WebPageProxyWPE.cpp: Include atk headers only when enabled. 2019-05-29 Wenson Hsieh Remove some logic to suppress the text selection assistant during drop https://bugs.webkit.org/show_bug.cgi?id=198354 Reviewed by Tim Horton. This logic was originally added to hide the ranged selection after performing a drop in editable content. However, after r245803, we (1) no longer show the keyboard and/or text selection views when dropping, and (2) the final selection is now a caret, so it's no longer necessary to suppress the selection assistant. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView dropInteraction:performDrop:]): (-[WKContentView dropInteraction:concludeDrop:]): 2019-05-29 Sihui Liu WKWebsiteDataStore API fails to fetch web storage data for non-persistent data store https://bugs.webkit.org/show_bug.cgi?id=198317 Reviewed by Alex Christensen. Use LocalStorageNameSpace instead of SessionStorageNameSpace for localStorage in ephemeral session or websiteDataStore. * NetworkProcess/WebStorage/StorageManager.cpp: (WebKit::StorageManager::StorageArea::isEphemeral const): (WebKit::StorageManager::StorageArea::removeListener): (WebKit::StorageManager::StorageArea::setItems): (WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded const): (WebKit::StorageManager::LocalStorageNamespace::~LocalStorageNamespace): (WebKit::StorageManager::LocalStorageNamespace::getOrCreateStorageArea): (WebKit::StorageManager::LocalStorageNamespace::clearAllStorageAreas): (WebKit::StorageManager::LocalStorageNamespace::ephemeralOrigins const): (WebKit::StorageManager::LocalStorageNamespace::cloneTo): (WebKit::StorageManager::StorageManager): (WebKit::StorageManager::cloneSessionStorageNamespace): (WebKit::StorageManager::getLocalStorageOrigins): (WebKit::StorageManager::getLocalStorageOriginDetails): (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin): (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince): (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins): (WebKit::StorageManager::createLocalStorageMap): (WebKit::StorageManager::createTransientLocalStorageMap): (WebKit::StorageManager::createSessionStorageMap): (WebKit::StorageManager::destroyStorageMap): (WebKit::StorageManager::getValues): (WebKit::StorageManager::setItem): (WebKit::StorageManager::removeItem): (WebKit::StorageManager::clear): (WebKit::StorageManager::StorageArea::isSessionStorage const): Deleted. * NetworkProcess/WebStorage/StorageManager.h: (): Deleted. * WebProcess/WebStorage/StorageAreaMap.cpp: (WebKit::StorageAreaMap::dispatchStorageEvent): (WebKit::StorageAreaMap::dispatchSessionStorageEvent): (WebKit::StorageAreaMap::connect): * WebProcess/WebStorage/StorageNamespaceImpl.cpp: (WebKit::StorageNamespaceImpl::createEphemeralLocalStorageNamespace): (WebKit::StorageNamespaceImpl::createLocalStorageNamespace): * WebProcess/WebStorage/StorageNamespaceImpl.h: * WebProcess/WebStorage/WebStorageNamespaceProvider.cpp: (WebKit::WebStorageNamespaceProvider::createLocalStorageNamespace): 2019-05-29 Don Olmstead Remove ENABLE definitions from WebKit config files https://bugs.webkit.org/show_bug.cgi?id=197858 Reviewed by Simon Fraser. Remove ENABLE flags that were present in the config files. Add the ENABLE flags to FeatureDefines.xcconfig instead. * Configurations/FeatureDefines.xcconfig: * WebKit2Prefix.h: * config.h: 2019-05-29 Youenn Fablet Reestablish WebSWClientConnection in case of network process crash https://bugs.webkit.org/show_bug.cgi?id=198333 Reviewed by Alex Christensen. WebSWClientConnection now takes a RefPtr so that on network process crash, it will set it back to null. On the next call that needs the connection, WebSWClientConnection will reinitialize its underlying IPC connection and its own identifier. Make sure that all code paths requiring this initialization are covered. * WebProcess/Network/NetworkProcessConnection.cpp: (WebKit::NetworkProcessConnection::didClose): (WebKit::NetworkProcessConnection::serviceWorkerConnectionForSession): (WebKit::NetworkProcessConnection::isRegisteredActiveSWClientConnection): (WebKit::NetworkProcessConnection::initializeSWClientConnection): * WebProcess/Network/NetworkProcessConnection.h: * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::WebSWClientConnection): (WebKit::WebSWClientConnection::~WebSWClientConnection): (WebKit::WebSWClientConnection::initializeConnectionIfNeeded): (WebKit::WebSWClientConnection::ensureConnectionAndSend): (WebKit::WebSWClientConnection::scheduleJobInServer): (WebKit::WebSWClientConnection::finishFetchingScriptInServer): (WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer): (WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer): (WebKit::WebSWClientConnection::registerServiceWorkerClient): (WebKit::WebSWClientConnection::unregisterServiceWorkerClient): (WebKit::WebSWClientConnection::didResolveRegistrationPromise): (WebKit::WebSWClientConnection::matchRegistration): (WebKit::WebSWClientConnection::runOrDelayTaskForImport): (WebKit::WebSWClientConnection::whenRegistrationReady): (WebKit::WebSWClientConnection::getRegistrations): (WebKit::WebSWClientConnection::startFetch): (WebKit::WebSWClientConnection::cancelFetch): (WebKit::WebSWClientConnection::continueDidReceiveFetchResponse): (WebKit::WebSWClientConnection::connectionToServerLost): (WebKit::WebSWClientConnection::syncTerminateWorker): (WebKit::WebSWClientConnection::serverConnectionIdentifier const): (WebKit::WebSWClientConnection::updateThrottleState): * WebProcess/Storage/WebSWClientConnection.h: 2019-05-29 Said Abou-Hallawa [iOS] WebPage::positionInformation() may set InteractionInformationAtPosition.isImage to true but leave image unset https://bugs.webkit.org/show_bug.cgi?id=198202 Reviewed by Tim Horton. r192037 added the flags isLink and isImage to InteractionInformationAtPosition. It also made WebPage::positionInformation() set isImage to true but before ensuring there is a valid image at the position. Safari WebKit additions assumes if isImage is true then the image has to hold a valid ShareableBitmap pointer. Since WebPage::positionInformation() is the only place that sets isImage, the fix is to set isImage to true only after passing all the image validation checks. Since WebPage::positionInformation() is a little bit difficult to read (182 lines), It was re-factored by splitting it to static functions. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::focusedElementPositionInformation): (WebKit::linkIndicatorPositionInformation): (WebKit::dataDetectorLinkPositionInformation): (WebKit::imagePositionInformation): (WebKit::boundsPositionInformation): (WebKit::elementPositionInformation): (WebKit::selectionPositionInformation): (WebKit::textInteractionPositionInformation): (WebKit::WebPage::positionInformation): 2019-05-29 Geoffrey Garen WeakPtr breaks vtables when upcasting to base classes https://bugs.webkit.org/show_bug.cgi?id=188799 Reviewed by Youenn Fablet. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::networkSession): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * Shared/WebBackForwardListItem.cpp: (WebKit::WebBackForwardListItem::suspendedPage const): * Shared/WebBackForwardListItem.h: (WebKit::WebBackForwardListItem::suspendedPage const): Deleted. Moved functions out of line to avoid #include explosion for .get(). * UIProcess/Authentication/cocoa/SecKeyProxyStore.h: (WebKit::SecKeyProxyStore::get const): (WebKit::SecKeyProxyStore::weakPtrFactory const): Deleted. Adopted CanMakeWeakPtr. * UIProcess/WebAuthentication/AuthenticatorManager.h: * UIProcess/WebProcessProxy.cpp: It takes an extra using declaration to disambiguate multiple CanMakeWeakPtr base classes now. (WebKit::WebProcessProxy::processPool const): * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::processPool const): Deleted. Moved functions out of line to avoid #include explosion for .get(). 2019-05-29 Ryan Haddad Unreviewed, rolling out r245857. Breaks internal builds. Reverted changeset: "WeakPtr breaks vtables when upcasting to base classes" https://bugs.webkit.org/show_bug.cgi?id=188799 https://trac.webkit.org/changeset/245857 2019-05-29 Chris Dumez [iOS] The WebContent process needs proper entitlement to do secure drawing https://bugs.webkit.org/show_bug.cgi?id=198343 Reviewed by Tim Horton. The WebContent process needs proper entitlement to do secure drawing on iOS. * Configurations/WebContent-iOS.entitlements: 2019-05-29 Youenn Fablet UserMediaCaptureManager should remove a source from its map once the source is ended https://bugs.webkit.org/show_bug.cgi?id=198337 Reviewed by Eric Carlson. When the source is stopped, for instance using MediaStreamTrack.stop, remove the source from UserMediaCaptureManager sources map. This makes sure the map will not grow over time. Add an if check to ensure that the source is still there before processing an incoming IPC call. When UIProcess tells us the capture is finished (typically capture failed), remove the entry on WebProcess side as well. * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::createCaptureSource): (WebKit::UserMediaCaptureManager::sourceStopped): (WebKit::UserMediaCaptureManager::captureFailed): (WebKit::UserMediaCaptureManager::sourceMutedChanged): (WebKit::UserMediaCaptureManager::sourceSettingsChanged): (WebKit::UserMediaCaptureManager::storageChanged): (WebKit::UserMediaCaptureManager::ringBufferFrameBoundsChanged): (WebKit::UserMediaCaptureManager::audioSamplesAvailable): (WebKit::UserMediaCaptureManager::remoteVideoSampleAvailable): (WebKit::UserMediaCaptureManager::sourceEnded): (WebKit::UserMediaCaptureManager::applyConstraintsSucceeded): (WebKit::UserMediaCaptureManager::applyConstraintsFailed): 2019-05-29 Youenn Fablet UserMediaCaptureManagerProxy::SourceProxy should directly have access to its IPC connection https://bugs.webkit.org/show_bug.cgi?id=198335 Reviewed by Eric Carlson. Previously, SourceProxy was getting its IPC connection by going through its manager, then its process proxy. As some calls can be done from a background thread, it is safer to directly make SourceProxy own a Ref of its IPC connection. * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::SourceProxy::SourceProxy): (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): 2019-05-28 Geoffrey Garen WeakPtr breaks vtables when upcasting to base classes https://bugs.webkit.org/show_bug.cgi?id=188799 Reviewed by Youenn Fablet. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::networkSession): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * Shared/WebBackForwardListItem.cpp: (WebKit::WebBackForwardListItem::suspendedPage const): * Shared/WebBackForwardListItem.h: (WebKit::WebBackForwardListItem::suspendedPage const): Deleted. Moved functions out of line to avoid #include explosion for .get(). * UIProcess/Authentication/cocoa/SecKeyProxyStore.h: (WebKit::SecKeyProxyStore::get const): (WebKit::SecKeyProxyStore::weakPtrFactory const): Deleted. Adopted CanMakeWeakPtr. * UIProcess/WebAuthentication/AuthenticatorManager.h: * UIProcess/WebProcessProxy.cpp: It takes an extra using declaration to disambiguate multiple CanMakeWeakPtr base classes now. (WebKit::WebProcessProxy::processPool const): * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::processPool const): Deleted. Moved functions out of line to avoid #include explosion for .get(). 2019-05-29 Youenn Fablet Modernize getting proxies of UserMediaCaptureManagerProxy https://bugs.webkit.org/show_bug.cgi?id=198336 Reviewed by Eric Carlson. No change of behavior, use HashMap::get instead of find. * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::startProducingData): (WebKit::UserMediaCaptureManagerProxy::stopProducingData): (WebKit::UserMediaCaptureManagerProxy::capabilities): (WebKit::UserMediaCaptureManagerProxy::setMuted): (WebKit::UserMediaCaptureManagerProxy::applyConstraints): 2019-05-29 Andy Estes [watchOS] Remove an unneeded #import https://bugs.webkit.org/show_bug.cgi?id=198339 Reviewed by Wenson Hsieh. * UIProcess/ios/forms/WKTimePickerViewController.mm: 2019-05-29 Brent Fulgham Correct flaky WebAuthN test cases https://bugs.webkit.org/show_bug.cgi?id=198308 Reviewed by David Kilzer. Correct offset math in the MockHidConnection implementation. The write position of the payload buffer was computed using the value of 'size()', which is set to the full capacity of the vector after a 'grow()' operation. Tests: http/wpt/webauthn * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::feedReports): 2019-05-28 Fujii Hironori [WinCairo] REGRESSION(r245186) Crash in NetworkCache::IOChannel::read in http/tests/IndexedDB some tests https://bugs.webkit.org/show_bug.cgi?id=197941 Reviewed by Don Olmstead. http/tests/IndexedDB some tests were crashing in NetworkCache::IOChannel::read in order to allocate a buffer with std::numeric_limits::max() as the size. IOChannel::read should check the file size, and calculate the read size. * NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp: (WebKit::NetworkCache::IOChannel::read): Limit the read buffer size by calling FileSystem::getFileSize. 2019-05-28 Brent Fulgham Fix sandbox violation when using QuickLook on iOS https://bugs.webkit.org/show_bug.cgi?id=198312 Reviewed by Alexey Proskuryakov. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-05-28 Tim Horton Horizontal scrollbar flashes after scrolling vertically with keyboard https://bugs.webkit.org/show_bug.cgi?id=197942 Reviewed by Dean Jackson. * UIProcess/ios/WKKeyboardScrollingAnimator.mm: (axesForDelta): (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]): Only flash relevant axes. * Platform/spi/ios/UIKitSPI.h: 2019-05-28 Alex Christensen Build Fix. * UIProcess/WKImagePreviewViewController.mm: (-[WKImagePreviewViewController IGNORE_WARNINGS_END]): (-[WKImagePreviewViewController previewActionItems]): Deleted. 2019-05-28 Tim Horton REGRESSION(r245795): causing internal testers to exit early after 50 crashes. https://bugs.webkit.org/show_bug.cgi?id=198310 Reviewed by Simon Fraser. * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (WebKit::touchActionsForPoint): Initialize hitView to nil. 2019-05-28 Brent Fulgham Remove dead code from sandboxes https://bugs.webkit.org/show_bug.cgi?id=198300 Reviewed by Alexey Proskuryakov. SSIA. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2019-05-28 Brent Fulgham Update sandbox rules for more News use cases https://bugs.webkit.org/show_bug.cgi?id=198236 Reviewed by Alexey Proskuryakov. Update the WebContent and Network process sandboxes so that News has the same set of allowed service access as regular WebKit views. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2019-05-27 Carlos Garcia Campos [GTK] Use WPEBackend-fdo for accelerating compositing in Wayland instead of the nested compositor https://bugs.webkit.org/show_bug.cgi?id=197944 Reviewed by Michael Catanzaro. The WPEBackend-fdo implementation is quite similar to our Wayland nested compositor, but more efficient (using linux dmabuf, resource caching, etc.). This allows us to share even more code with WPE port too. * PlatformGTK.cmake: * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp: (WebKit::ThreadedCompositor::forceRepaint): WPE doesn't support force repaint yet. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): Use USE(WPE_RENDERER) instead of PLATFORM(WPE). (WebKit::WebPageCreationParameters::decode): Ditto. * Shared/WebPageCreationParameters.h: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): Ditto. (WebKit::WebProcessCreationParameters::decode): Ditto. * Shared/WebProcessCreationParameters.h: * SourcesGTK.txt: * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::hostFileDescriptor): Implement it when using WPE just calling webkitWebViewBaseRenderHostFileDescriptor(). * UIProcess/API/gtk/PageClientImpl.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseCreateWebPage): Initialize the web page after the accelerated backing store is created, since it's used now during intialization. (webkitWebViewBaseRenderHostFileDescriptor): Return AcceleratedBackingStore::renderHostFileDescriptor() * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): Use USE(WPE_RENDERER) instead of PLATFORM(WPE). * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): Remove wayland display name initialization. * UIProcess/glib/WebProcessPoolGLib.cpp: (WebKit::WebProcessPool::platformInitializeWebProcess): Initialize wayland display name when not using WPE here now. In case of using WPE, initialize hostClientFileDescriptor and implementationLibraryName. * UIProcess/glib/WebProcessProxyGLib.cpp: (WebKit::WebProcessProxy::platformGetLaunchOptions): Remove unused wayland socket command line process parameter. * UIProcess/gtk/AcceleratedBackingStore.h: (WebKit::AcceleratedBackingStore::renderHostFileDescriptor): Return -1 by default. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::create): When using WPE call wpe_fdo_initialize_for_egl_display() and check we have the required extensions. (WebKit::AcceleratedBackingStoreWayland::AcceleratedBackingStoreWayland): When using WPE initialize the view backend. (WebKit::AcceleratedBackingStoreWayland::~AcceleratedBackingStoreWayland): When using WPE release the EGL images still in use and the view texture. (WebKit::AcceleratedBackingStoreWayland::renderHostFileDescriptor): Call wpe_view_backend_get_renderer_host_fd(). (WebKit::AcceleratedBackingStoreWayland::displayBuffer): Create the view texture if needed, save the pending image and schedule a redraw. (WebKit::AcceleratedBackingStoreWayland::paint): When using WPE commit the pending image and use it as target of the view texture. * UIProcess/gtk/AcceleratedBackingStoreWayland.h: * UIProcess/gtk/HardwareAccelerationManager.cpp: (WebKit::HardwareAccelerationManager::HardwareAccelerationManager): When using WPE disable hardware acceleration if wpe_fdo_initialize_for_egl_display() fails. * UIProcess/gtk/WaylandCompositor.cpp: * UIProcess/gtk/WaylandCompositor.h: * WebProcess/WebPage/AcceleratedSurface.cpp: (WebKit::AcceleratedSurface::create): Create an AcceleratedSurfaceLibWPE for GTK port when using WPE and shared display is Wayland. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.cpp: (WebKit::AcceleratedSurfaceLibWPE::initialize): Use the shared display for compositing instead of shared display. * WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.h: * WebProcess/WebProcess.h: * WebProcess/glib/WebProcessGLib.cpp: (WebKit::WebProcess::platformInitializeWebProcess): Initialize the wpe display when using WPE. 2019-05-27 Wenson Hsieh [iOS] Dropping in an editable element should result in a ranged selection https://bugs.webkit.org/show_bug.cgi?id=198267 Reviewed by Tim Horton. When drag and drop was first implemented for iOS in iOS 11, selection behavior when dropping into editable elements matched that of macOS, by leaving the inserted content selected after performing the drop. However, in other parts of the platform (e.g. Notes), both the keyboard and selection views are not shown after a drop. Instead of matching macOS behavior, WebKit on iOS should match the rest of the platform. This is a little tricky, since we use the selection range after a drop to create a TextIndicator snapshot when creating a drag preview. To resolve this, we refactor some of the logic introduced in r245778 to remember the DOM range to snapshot before collapsing the range to the end of the inserted content. Tested by adjusting some existing API tests. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]): Remove some logic that currently presents the keyboard while the user is performing a drop that focuses an editable element. * WebProcess/WebPage/WebPage.h: Add a member variable to keep track of which range should be snapshotted when generating a drop preview. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::didConcludeDrop): (WebKit::WebPage::didConcludeEditDrag): Collapse the selection range to the end after an edit drag (i.e., a drop in an editable area that inserted content). (WebKit::WebPage::computeAndSendEditDragSnapshot): 2019-05-27 Chris Dumez Unreviewed Win Cairo build fix after r245796. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::getAllStorageAccessEntries): 2019-05-27 Chris Dumez Unreviewed Win Cairo build fix after r245796. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::decode): 2019-05-27 Chris Dumez Use a strongly-typed identifier for pages https://bugs.webkit.org/show_bug.cgi?id=198206 Reviewed by Youenn Fablet. * WebKit/*: 2019-05-27 Antoine Quint [Pointer Events] Test at pointerevents/ios/touch-action-none-in-overflow-scrolling-touch.html times out https://bugs.webkit.org/show_bug.cgi?id=198275 Reviewed by Antti Koivisto. Only WKCompositingView instances may have associated touch-action data, so we should filter out any hit-testing view that isn't a WKCompositingView when finding the view that should hit-test when looking for touch-action information. * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (WebKit::touchActionsForPoint): 2019-05-27 Carlos Garcia Campos Unreviewed. Update OptionsGTK.cmake and NEWS for 2.25.1 release * gtk/NEWS: Add release notes for 2.25.1. 2019-05-27 Carlos Garcia Campos Unreviewed. Fix GTK distcheck Remove symbols that are not longer present in the library. * webkitglib-symbols.map: 2019-05-26 Simon Fraser Move VelocityData to WebCore https://bugs.webkit.org/show_bug.cgi?id=198261 Reviewed by Antti Koivisto. Move VelocityData and HistoricalVelocityData to WebCore for future use in overflow scroll. VisibleContentRectUpdateInfo can now store a VelocityData (its timestamp is used as the timetamp for the entire update). * Shared/VisibleContentRectUpdateInfo.cpp: (WebKit::VisibleContentRectUpdateInfo::encode const): (WebKit::VisibleContentRectUpdateInfo::decode): (WebKit::operator<<): * Shared/VisibleContentRectUpdateInfo.h: (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo): (WebKit::VisibleContentRectUpdateInfo::scrollVelocity const): (WebKit::VisibleContentRectUpdateInfo::enclosedInScrollableAncestorView const): (WebKit::VisibleContentRectUpdateInfo::timestamp const): (WebKit::operator==): (WebKit::VisibleContentRectUpdateInfo::horizontalVelocity const): Deleted. (WebKit::VisibleContentRectUpdateInfo::verticalVelocity const): Deleted. (WebKit::VisibleContentRectUpdateInfo::scaleChangeRate const): Deleted. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Shared/WebCoreArgumentCoders.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): (WebKit::HistoricalVelocityData::VelocityData::VelocityData): Deleted. (WebKit::HistoricalVelocityData::HistoricalVelocityData): Deleted. (WebKit::HistoricalVelocityData::velocityForNewData): Deleted. (WebKit::HistoricalVelocityData::clear): Deleted. (WebKit::HistoricalVelocityData::append): Deleted. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::dynamicViewportSizeUpdate): (WebKit::WebPage::viewportConfigurationChanged): (WebKit::adjustVelocityDataForBoundedScale): (WebKit::WebPage::updateVisibleContentRects): 2019-05-26 John Wilander Resource Load Statistics: Downgrade document.referrer to the referrer's eTLD+1 if the page was navigated to with a prevalent resource referrer containing link decoration https://bugs.webkit.org/show_bug.cgi?id=198227 Reviewed by Alex Christensen. This patch adds a call back to the UI process if the network process finds the navigational data transfer was done by a prevalent resource and we need to adjust something for the page. Currently, that adjustment is to downgrade document.referrer. The patch also removes an unused completion handler. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didCommitCrossSiteLoadWithDataTransfer): (WebKit::NetworkProcess::committedCrossSiteLoadWithLinkDecoration): Deleted. New name since we no longer only look for link decoration but also other means of navigational data transfer. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::didCommitCrossSiteLoadWithDataTransfer): (WebKit::NetworkProcessProxy::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource): (WebKit::NetworkProcessProxy::committedCrossSiteLoadWithLinkDecoration): Deleted. New name since we no longer only look for link decoration but also other means of navigational data transfer. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebPageProxy.cpp: (WebKit::checkIfNavigationContainsDataTransfer): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource): (WebKit::isNonUniqueNavigationWithLinkDecoration): Deleted. New name since we no longer only look for link decoration but also other means of navigational data transfer. * UIProcess/WebPageProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::didCommitCrossSiteLoadWithDataTransfer): (WebKit::WebProcessPool::committedCrossSiteLoadWithLinkDecoration): Deleted. New name since we no longer only look for link decoration but also other means of navigational data transfer. * UIProcess/WebProcessPool.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::wasLoadedWithDataTransferFromPrevalentResource): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2019-05-26 Wenson Hsieh [iOS] Dropped text, attachments, and images should animate into place https://bugs.webkit.org/show_bug.cgi?id=198243 Reviewed by Tim Horton. Adds support for targeted drop animations on iOS in modern WebKit by adopting UIKit SPI introduced in to allow updating the drop preview mid-flight. To get the animation right, we refactor and augment existing logic for taking snapshots after performing a drop in an editable content. Currently, upon dropping in editable content, we first snapshot the web view and temporarily cover the real web view with this snapshot. When the TextIndicator data arrives that contains (1) a snapshot of the visible part of the web view ignoring the selection, and (2) a snapshot of just the selected contents after drop, we crossfade from the web view snapshot to the snapshot in (1) using a hard-coded time delay (~500ms), and target the drop preview to the drag caret rect. During this process, snapshot (2) is completely ignored. This was effectively a halfway implemention of the desired effect of animating the dropped content into place and crossfading to the final content; before UIKit implemented updateable drag previews, the full implementation was not possible in modern WebKit (without using synchronous IPC). Now that we're able to update the drag preview in the middle of the drop animation, we can now utilize snapshot (2) above and clean up some parts of the drop animation in editable content. See below for more details. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _doAfterReceivingEditDragSnapshotForTesting:]): Add a testing hook to perform the given block after any pending edit drag snapshot has been received. See TestWebKitAPI changes for more detail. * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: Split up the existing DidConcludeEditDrag IPC message into two messages: WillReceiveEditDragSnapshot and DidReceiveEditDragSnapshot. This allows us to defer cleaning up the drag session state during an edit drop, until after the final edit drag snapshot has been received. * UIProcess/ios/DragDropInteractionState.h: Add some new methods to help manage the lifecycle of drop preview provider blocks. * UIProcess/ios/DragDropInteractionState.mm: (WebKit::createTargetedDragPreview): Drive-by fix: make this return a RetainPtr. (WebKit::DragDropInteractionState::prepareForDelayedDropPreview): Stores a drop preview provider, given to us by UIKit. (WebKit::DragDropInteractionState::deliverDelayedDropPreview): Invokes the stored drop preview providers with given text indicator data. This is invoked after snapshots are taken following an edit drag (this is additionally after all images in the inserted fragment have finished loading). (WebKit::DragDropInteractionState::clearAllDelayedItemPreviewProviders): Invokes all stored drop preview providers with a nil preview. This is invoked in any case where drag session cleanup occurs earlier than normal (e.g., if the web process crashes during drop), and ensures that the handlers are always invoked when cleaning up the drag session. (WebKit::DragDropInteractionState::previewForDragItem const): (WebKit::DragDropInteractionState::dragAndDropSessionsDidEnd): Call clearAllDelayedItemPreviewProviders. * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::willReceiveEditDragSnapshot): (WebKit::PageClientImpl::didReceiveEditDragSnapshot): (WebKit::PageClientImpl::didConcludeEditDrag): Deleted. More plumbing (see changes to DidConcludeEditDrag above). * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanupInteraction]): (-[WKContentView cleanUpDragSourceSessionState]): (-[WKContentView _willReceiveEditDragSnapshot]): (-[WKContentView _didReceiveEditDragSnapshot:]): Set _waitingForEditDragSnapshot to YES in the gap between when -_willReceiveEditDragSnapshot is invoked, and when -_didReceiveEditDragSnapshot is invoked. If _waitingForEditDragSnapshot is YES, we bail out of -cleanUpDragSourceSessionState, and instead clean up drag session state after the edit drag snapshot is received. (-[WKContentView _deliverDelayedDropPreviewIfPossible:]): (-[WKContentView _didPerformDragOperation:]): (-[WKContentView textEffectsWindow]): Drive-by fix to remove a workaround for a deprecation warning. (-[WKContentView dropInteraction:item:willAnimateDropWithAnimator:]): (-[WKContentView dropInteraction:concludeDrop:]): Implement this hook to ensure that the unselected content snapshot view and visible content snapshot view are guaranteed to be removed from the view after a drop in editable content, even if the drag edit snapshot arrives after the drop is concluded. (-[WKContentView dropInteraction:previewForDroppingItem:withDefault:]): (-[WKContentView _dropInteraction:delayedPreviewProviderForDroppingItem:previewProvider:]): Implement the new UIKit SPI here. UIKit hands us a preview provider here, which we can invoke at a later time to update the drop preview. We do this in _didReceiveEditDragSnapshot. (-[WKContentView _doAfterReceivingEditDragSnapshotForTesting:]): (-[WKContentView _didConcludeEditDrag:]): Deleted. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::willReceiveEditDragSnapshot): (WebKit::WebPageProxy::didReceiveEditDragSnapshot): (WebKit::WebPageProxy::didConcludeDrop): (WebKit::WebPageProxy::didConcludeEditDrag): Deleted. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::didFinishLoadingImageForElement): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didFinishLoadingImageForElement): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::didConcludeDrop): If an edit drag has been concluded, there's no need to hang on to pending dropped image elements anymore; clear out the set here. (WebKit::WebPage::didConcludeEditDrag): After concluding an edit drag, we try to deliver two web content snapshots to the UI process, so that the UI process can assemble a targeted drop preview for UIKit. One snapshot is of the visible content area, not including any selected content. The other snapshot is of the selected content only. However, when dropping images (or a text selection containing images), these images may not yet have been loaded. If that is the case, these images will appear to be missing from these snapshots. To ensure that we don't take this snapshot too early, defer it until all image elements in the dropped content range have finished loading. We can tell that all dropped images have finished loading by using a new client hook that is invoked when an image has finished loading. (WebKit::WebPage::didFinishLoadingImageForElement): (WebKit::WebPage::computeAndSendEditDragSnapshot): Snapshot the selected content and send it to the UI process. 2019-05-24 Youenn Fablet REGRESSION (r245715?) [WK2] Layout Test http/wpt/cache-storage/cache-storage-networkprocess-crash.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=198222 Reviewed by Alex Christensen. In case a connection gets closed, handle all of its async reply completion handlers. This ensures they handlers are called in case the connection does not get destroyed until a much later stage. * Platform/IPC/Connection.cpp: (IPC::Connection::~Connection): (IPC::Connection::connectionDidClose): (IPC::addAsyncReplyHandler): (IPC::clearAsyncReplyHandlers): (IPC::CompletionHandler Remove unused member in WebsiteDataRecord https://bugs.webkit.org/show_bug.cgi?id=198231 Reviewed by Brent Fulgham. The data member 'originsWithCredentials' in WebsiteDataRecord is no longer needed since origins with credentials are now stored in the 'origins' member. * UIProcess/WebsiteData/WebsiteDataRecord.cpp: (WebKit::WebsiteDataRecord::addOriginWithCredential): Deleted. * UIProcess/WebsiteData/WebsiteDataRecord.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::fetchDataAndApply): 2019-05-24 David Quesada Crash under WebCore::TimerBase::~TimerBase after a download is canceled https://bugs.webkit.org/show_bug.cgi?id=197927 rdar://problem/50822728 Reviewed by Ryosuke Niwa. * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::platformCancelNetworkLoad): CFNetwork makes no guarantees about what thread is used to call the completion block passed to -[NSURLSessionDownloadTask cancelByProducingResumeData], and in some cases, it can be called on a background queue. This eventually causes the Download to be deallocated on the background queue, which triggers a release assertion failure in ~TimerBase. When CFNetwork finishes canceling the download, we should move to the main thread before calling didCancel(). 2019-05-24 Youenn Fablet Update messages_unittest.py after r245715 https://bugs.webkit.org/show_bug.cgi?id=198214 Reviewed by Alexey Proskuryakov. Update expected results for messages.py output.i Small refactoring to messages.py: instead of calling the completionHandler in case of decoding error with AsyncReply errors, call cancelReply directly as it does the same thing. * Scripts/webkit/MessageReceiverSuperclass-expected.cpp: (Messages::WebPage::TestAsyncMessage::callReply): (Messages::WebPage::TestAsyncMessage::cancelReply): (Messages::WebPage::TestAsyncMessageWithMultipleArguments::callReply): (Messages::WebPage::TestAsyncMessageWithMultipleArguments::cancelReply): * Scripts/webkit/messages.py: 2019-05-23 Ross Kirsling Socket-based RWI should be able to inspect a JSContext https://bugs.webkit.org/show_bug.cgi?id=198197 Reviewed by Don Olmstead. * UIProcess/socket/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorClient::inspect): * UIProcess/socket/RemoteInspectorClient.h: * UIProcess/socket/RemoteInspectorProtocolHandler.cpp: (WebKit::RemoteInspectorProtocolHandler::inspect): (WebKit::RemoteInspectorProtocolHandler::targetListChanged): (WebKit::RemoteInspectorProtocolHandler::platformStartTask): * UIProcess/socket/RemoteInspectorProtocolHandler.h: Have the RWI client actually pass the debuggableType to WebInspectorUI. 2019-05-22 Stephanie Lewis release builds of webkit cannot be used to generate a dyld shared cache https://bugs.webkit.org/show_bug.cgi?id=198150 Reviewed by Dan Bernstein. Restrict the -not_for_dyld_shared_cache linker flag to macosx * Configurations/WebKit.xcconfig: 2019-05-23 Zalan Bujtas [Hittest] Move hittesting from RenderView to Document https://bugs.webkit.org/show_bug.cgi?id=198192 Reviewed by Antti Koivisto. * WebProcess/WebPage/ViewGestureGeometryCollector.cpp: (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::determinePrimarySnapshottedPlugIn): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::dynamicViewportSizeUpdate): 2019-05-23 Youenn Fablet CacheStorageConnection callbacks should be completed on network connection close https://bugs.webkit.org/show_bug.cgi?id=195757 Reviewed by Alex Christensen. Update according new WebCore CacheStorageConnection interface. Use Async IPC replies so that the completion handlers are called on network crash. Allow to have specific error handling in case of cancelled reply or badly decoded message. This allows to reject the corresponding JS promise. * CMakeLists.txt: * DerivedSources-output.xcfilelist: * DerivedSources.make: * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::clearMemoryRepresentation): * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::requestSpace): (WebKit::CacheStorage::Caches::writeRecord): * NetworkProcess/cache/CacheStorageEngineConnection.cpp: (WebKit::CacheStorageEngineConnection::open): (WebKit::CacheStorageEngineConnection::remove): (WebKit::CacheStorageEngineConnection::caches): (WebKit::CacheStorageEngineConnection::retrieveRecords): (WebKit::CacheStorageEngineConnection::deleteMatchingRecords): (WebKit::CacheStorageEngineConnection::putRecords): * NetworkProcess/cache/CacheStorageEngineConnection.h: (IPC::AsyncReplyError::create): (IPC::AsyncReplyError::create): (IPC::AsyncReplyError::create): (IPC::AsyncReplyError::create): * NetworkProcess/cache/CacheStorageEngineConnection.messages.in: * Platform/IPC/ArgumentCoders.h: * Platform/IPC/Connection.h: (IPC::AsyncReplyError::create): * Scripts/webkit/messages.py: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Cache/WebCacheStorageConnection.cpp: (WebKit::WebCacheStorageConnection::open): (WebKit::WebCacheStorageConnection::remove): (WebKit::WebCacheStorageConnection::retrieveCaches): (WebKit::WebCacheStorageConnection::retrieveRecords): (WebKit::WebCacheStorageConnection::batchDeleteOperation): (WebKit::WebCacheStorageConnection::batchPutOperation): (WebKit::WebCacheStorageConnection::engineRepresentation): * WebProcess/Cache/WebCacheStorageConnection.h: * WebProcess/Cache/WebCacheStorageConnection.messages.in: Removed. * WebProcess/Network/NetworkProcessConnection.cpp: (WebKit::NetworkProcessConnection::didReceiveMessage): 2019-05-23 Sihui Liu Handling for non-persistent data should be consistent in computeNetworkProcessAccessTypeForDataFetch https://bugs.webkit.org/show_bug.cgi?id=198050 Reviewed by Youenn Fablet. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::computeNetworkProcessAccessTypeForDataFetch): 2019-05-23 Youenn Fablet Set default WebsiteDataStore storage quota based on StorageQuotaManager https://bugs.webkit.org/show_bug.cgi?id=198133 Reviewed by Geoffrey Garen. * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: 2019-05-23 Alex Christensen Deprecate more preview API https://bugs.webkit.org/show_bug.cgi?id=198152 Reviewed by Dean Jackson. This is working towards * UIProcess/API/Cocoa/WKPreviewActionItem.h: * UIProcess/API/Cocoa/WKPreviewActionItem.mm: * UIProcess/API/Cocoa/WKPreviewActionItemIdentifiers.h: * UIProcess/API/Cocoa/WKPreviewActionItemInternal.h: * UIProcess/API/Cocoa/WKPreviewElementInfo.h: * UIProcess/API/Cocoa/WKPreviewElementInfo.mm: * UIProcess/API/Cocoa/WKUIDelegate.h: * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h: (WebKit::ScrollingTreeScrollingNodeDelegateIOS::activeTouchActions const): * UIProcess/ios/WKContentViewInteraction.mm: (previewIdentifierForElementAction): (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]): (-[WKContentView _presentedViewControllerForPreviewItemController:]): (-[WKContentView _previewItemController:commitPreview:]): 2019-05-23 Antoine Quint [tvOS] Build broken by r245639 https://bugs.webkit.org/show_bug.cgi?id=198172 Unreviewed build fix. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::touchWithIdentifierWasRemoved): * UIProcess/WebPageProxy.h: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::touchWithIdentifierWasRemoved): Deleted. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::touchWithIdentifierWasRemoved): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::touchWithIdentifierWasRemoved): Deleted. 2019-05-23 Antoine Quint [tvOS] Build broken by r245639 https://bugs.webkit.org/show_bug.cgi?id=198172 Unreviewed build fix. * WebProcess/WebPage/WebPage.messages.in: 2019-05-23 Adrian Perez de Castro [WPE] Build fails with ENABLE_VIDEO=OFF and ENABLE_WEB_AUDIO=OFF https://bugs.webkit.org/show_bug.cgi?id=198125 Reviewed by Philippe Normand. * UIProcess/glib/WebProcessPoolGLib.cpp: Guard the inclusion of GStreamerCommon.h with USE(GSTREAMER). * WebProcess/glib/WebProcessGLib.cpp: Ditto. 2019-05-22 Antoine Quint [tvOS] Build broken by r245639 https://bugs.webkit.org/show_bug.cgi?id=198172 Unreviewed build fix. * UIProcess/ios/WKSyntheticTapGestureRecognizer.m: (-[WKSyntheticTapGestureRecognizer reset]): (-[WKSyntheticTapGestureRecognizer touchesEnded:withEvent:]): 2019-05-22 Youenn Fablet Use modern async IPC for EngineRepresentationCompleted and ClearMemoryRepresentationCompleted https://bugs.webkit.org/show_bug.cgi?id=198134 Reviewed by Alex Christensen. * NetworkProcess/cache/CacheStorageEngineConnection.cpp: (WebKit::CacheStorageEngineConnection::clearMemoryRepresentation): (WebKit::CacheStorageEngineConnection::engineRepresentation): * NetworkProcess/cache/CacheStorageEngineConnection.h: * NetworkProcess/cache/CacheStorageEngineConnection.messages.in: * WebProcess/Cache/WebCacheStorageConnection.cpp: (WebKit::WebCacheStorageConnection::clearMemoryRepresentation): (WebKit::WebCacheStorageConnection::engineRepresentation): (WebKit::WebCacheStorageConnection::clearMemoryRepresentationCompleted): Deleted. (WebKit::WebCacheStorageConnection::engineRepresentationCompleted): Deleted. * WebProcess/Cache/WebCacheStorageConnection.h: * WebProcess/Cache/WebCacheStorageConnection.messages.in: 2019-05-22 Ryosuke Niwa REGRESSION(r245148): Removing inputmode="none" does not bring up software keyboard https://bugs.webkit.org/show_bug.cgi?id=198141 Reviewed by Geoffrey Garen. r245148 changed _requiresKeyboardWhenFirstResponder to return NO when shouldShowAutomaticKeyboardUI returns NO with regards to software keyboard. This introduced a regression that removing inputmode="none" no longer brings up the software keyboard. Fixed the bug by making it return YES when inputmode="none" is present on an editable element in shouldShowAutomaticKeyboardUI, partially restoring the old behavior. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView shouldShowAutomaticKeyboardUI]): (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]): (-[WKContentView _requiresKeyboardWhenFirstResponder]): 2019-05-22 Tim Horton REGRESSION (r240552): PDF contents are not exposed to Accessibility (VO, etc.) https://bugs.webkit.org/show_bug.cgi?id=198146 Reviewed by Simon Fraser. * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::updateMockAccessibilityElementAfterCommittingLoad): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): (WebKit::WebPage::updateMockAccessibilityElementAfterCommittingLoad): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.h: * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm: (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]): (-[WKAccessibilityWebPageObjectBase setWebPage:]): (-[WKAccessibilityWebPageObjectBase setHasMainFramePlugin:]): In r240552, we changed to only defer to the main frame PluginView's accessibility tree if the cached "has a plugin" bit is true. That bit was only updated in WebPage::platformInitialize, which is long before we've actually loaded anything or have any clue if we're going to have a plugin. Instead, push updates every time we commit a load, which coincides with when we make other decisions based on having a plugin or not. Also, just use the existence of a PluginDocument to make the decision, instead of actually digging in to see if there's a PluginView, since PluginView comes in asynchronously. 2019-05-22 Ryosuke Niwa Crash in WebFrame::jsContext() when m_coreFrame is null https://bugs.webkit.org/show_bug.cgi?id=198067 Reviewed by Alex Christensen. Added missing null checks. Unfortunately no new tests since we don't have a reproducible test case. * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::jsContext): (WebKit::WebFrame::jsContextForWorld): 2019-05-22 Sihui Liu API Test landed in r245540 [Mac WK2] TestWebKitAPI.WKWebView.LocalStorageProcessCrashes is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=198090 Reviewed by Youenn Fablet. We used to dispatch StorageManager message to StorageManager's work queue, which required message handler to be added to queue before receiving first StorageManager message, otherwise network process would not know how to decode the message. After r245540, when netork process crashes and dom storage is accessed from web process after that, web process re-establishes its connection to network process, asks network process to add message handler, and then sends StorageManager message immediately. Because work queue message receiver is added on a background thread in network process, it is possible the StorageManager message is received before that. A safe and easy resolution is to not dispatch StorageManager message to work queue, so that we don't need to wait for the message receiver to be added. Handling message on the main thread also allows us to untying the knot that binds StorageManager and connection, which may be a preferred design in the future. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::webPageWasAdded): * NetworkProcess/WebStorage/StorageManager.cpp: (WebKit::StorageManager::processDidCloseConnection): (WebKit::StorageManager::createLocalStorageMap): (WebKit::StorageManager::createTransientLocalStorageMap): (WebKit::StorageManager::createSessionStorageMap): (WebKit::StorageManager::destroyStorageMap): (WebKit::didGetValues): (WebKit::StorageManager::getValues): (WebKit::StorageManager::setItem): (WebKit::StorageManager::setItems): (WebKit::StorageManager::removeItem): (WebKit::StorageManager::clear): (WebKit::StorageManager::processWillOpenConnection): Deleted. (WebKit::StorageManager::dispatchMessageToQueue): Deleted. (WebKit::StorageManager::dispatchSyncMessageToQueue): Deleted. * NetworkProcess/WebStorage/StorageManager.h: 2019-05-22 Antoine Quint [iOS] Compatibility mouse events aren't prevented by calling preventDefault() on pointerdown https://bugs.webkit.org/show_bug.cgi?id=198124 Reviewed by Tim Horton. In order to correctly prevent "compatibility" mouse events from being dispatched when the initial "pointerdown" event had preventDefault() called while handled, we need to pass the PointerID for the touch that triggered a tap gesture in the UI process down in the Web process and into the resulting PlatformMouseEvent. This means we need to identify the touch identifier, which is the same as the PointerID used for Pointer Events, in the single tap gesture recognizer, an instance of WKSyntheticTapGestureRecognizer. To do this, we subclass the -[UIResponder touchesEnded:withEvent:] method and track the touch identifier as the lastActiveTouchIdentifier, a new public property of WKSyntheticTapGestureRecognizer. To allow for this, we need the support of the content view's UIWebTouchEventsGestureRecognizer which is exposed to the WKSyntheticTapGestureRecognizer as its supportingWebTouchEventsGestureRecognizer property. This lastActiveTouchIdentifier property is cleared as the gesture recognizer is reset. This allows the content view to pass the PointerID down to the Web process starting from -[WKContentView _singleTapRecognized:], going through WebPageProxy::commitPotentialTap() and eventually WebPage::completeSyntheticClick(). While we used to tell the PointerCaptureController that a PointerID was no longer active when a given touch ended or was canceled (in WebKitAdditions code), we can no longer do this as the dispatch of a synthetic tap is performed asynchronously and will happen past the dispatch of "pointerup" and "pointercancel" Pointer Events. To clear inactive PointerIDs from the PointerCaptureController, we add a new touchWithIdentifierWasRemoved() method on the WebPage and its proxy. When the WKSyntheticTapGestureRecognizer resets and -[WKContentView _singleTapDidReset:] is called, we call that method which allows for only active PointerIDs to be tracked by the PointerCaptureController. * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): (-[WKContentView cleanupInteraction]): (-[WKContentView _singleTapDidReset:]): (-[WKContentView _singleTapRecognized:]): * UIProcess/ios/WKSyntheticTapGestureRecognizer.h: * UIProcess/ios/WKSyntheticTapGestureRecognizer.m: (-[WKSyntheticTapGestureRecognizer reset]): (-[WKSyntheticTapGestureRecognizer touchesEnded:withEvent:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::touchWithIdentifierWasRemoved): (WebKit::WebPageProxy::commitPotentialTap): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::dispatchSyntheticMouseMove): (WebKit::WebPage::handleSyntheticClick): (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver): (WebKit::WebPage::completeSyntheticClick): (WebKit::WebPage::commitPotentialTap): (WebKit::WebPage::touchWithIdentifierWasRemoved): 2019-05-22 Jiewen Tan [WebAuthN] Support Attestation Conveyance Preference https://bugs.webkit.org/show_bug.cgi?id=192722 Reviewed by Brent Fulgham. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested): * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp: (WebKit::CtapHidAuthenticator::continueMakeCredentialAfterResponseReceived const): * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp: (WebKit::U2fHidAuthenticator::continueRegisterCommandAfterResponseReceived): 2019-05-22 Zalan Bujtas [Paste] Add support for preferred presentation size when pasting an image https://bugs.webkit.org/show_bug.cgi?id=198132 Reviewed by Wenson Hsieh. * UIProcess/API/Cocoa/_WKElementAction.mm: (addToReadingList): * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant defaultActionsForLinkSheet:]): (-[WKActionSheetAssistant defaultActionsForImageSheet:]): 2019-05-22 Youenn Fablet Implement Feature policy self/none/* parsing https://bugs.webkit.org/show_bug.cgi?id=198078 Reviewed by Eric Carlson. Fix a case where completion handler might not always be called. * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp: (WebKit::UserMediaPermissionRequestManager::userMediaAccessWasGranted): 2019-05-22 Ross Kirsling Unreviewed fix for non-unified build after r245320. * WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::convertRectFromFrameClientToRootView): (WebKit::convertPointFromFrameClientToRootView): (WebKit::WebAutomationSessionProxy::computeElementLayout): 2019-05-22 Carlos Garcia Campos Unreviewed. Fix GTK unit tests after r245565 * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseDispose): Null check accessible before calling webkitWebViewAccessibleSetWebView(). 2019-05-21 Ross Kirsling [PlayStation] Don't call fcntl. https://bugs.webkit.org/show_bug.cgi?id=197961 Reviewed by Fujii Hironori. * Platform/IPC/unix/ConnectionUnix.cpp: (IPC::Connection::open): Use WTF::setNonBlock. 2019-05-21 Chris Dumez [PSON] Assertion hit when navigating back after a process swap forced by the client https://bugs.webkit.org/show_bug.cgi?id=198006 Reviewed by Alex Christensen. After r245198, we construct a SuspendedPageProxy when a process-swap is forced by the client and we delay to closing of the WebPage in the old WebProcess until it is safe to do so without flashing (by calling SuspendedPageProxy::closeWithoutFlashing()). The issue is that our logic deciding if we should reuse a SuspendedPageProxy's WebPage relied on the SuspendedPageProxy's m_suspensionState not being set to FailedToSuspend. In the case of a process-swap forced by the client with delayed page closing, the suspended state may be suspended but is still not usable because it is about to get closed. We would wrongly believe there is a WebPage to be reused so the ProvisionalPageProxy would construct a proxy for the main frame in its constructor, we would then hit the ASSERT(!m_mainFrame) assertion in ProvisionalPageProxy::didCreateMainFrame() when the WebContent process would unexpectedly create a main frame. To address the issue, stop relying on the suspended state to determine if we can reuse a WebPage or not and introduce a new pageIsClosedOrClosing() getter on the SuspendedPageProxy instead which indicates if the WebPage in the WebContent process has been closed or is about to be. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::ProvisionalPageProxy): * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode): (WebKit::SuspendedPageProxy::pageIsClosedOrClosing const): (WebKit::SuspendedPageProxy::didProcessRequestToSuspend): * UIProcess/SuspendedPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): 2019-05-21 Per Arne Vollan Sandbox violation is making the WebContent process crash https://bugs.webkit.org/show_bug.cgi?id=198089 Reviewed by Brent Fulgham. A new syscall rule needs to be added to the sandbox on iOS and macOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2019-05-21 Alex Christensen Mark WKUIDelegate webView:shouldPreviewElement: and webView:previewingViewControllerForElement:defaultActions: as deprecated https://bugs.webkit.org/show_bug.cgi?id=198083 Reviewed by Geoffrey Garen. * UIProcess/API/Cocoa/WKUIDelegate.h: 2019-05-21 Wenson Hsieh The cost of WebViewImpl::hasMarkedTextWithCompletionHandler should not increase with document size https://bugs.webkit.org/show_bug.cgi?id=198075 Reviewed by Tim Horton. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::hasMarkedTextWithCompletionHandler): Refactor hasMarkedTextWithCompletionHandler to use Editor::hasComposition, instead of computing the actual marked text range. The latter is more expensive and unnecessary, since it uses TextIterator from the document root to find editing offsets. This makes the cost of determining whether there is marked text proportional to the document size. This matches behavior in legacy WebKit, as well as iOS. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::hasMarkedText): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::hasMarkedText): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2019-05-21 Jiewen Tan [WebAuthN] Make WebAuthN default on only on macOS https://bugs.webkit.org/show_bug.cgi?id=198068 Reviewed by Brent Fulgham. * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.h: 2019-05-21 Pablo Saavedra Undefined reference platformCloseFrontendPageAndWindow() linking against libWPEWebKit-1.0.so after r245536 https://bugs.webkit.org/show_bug.cgi?id=198069 Reviewed by Ross Kirsling. * UIProcess/RemoteWebInspectorProxy.cpp: 2019-05-21 Sihui Liu REGRESSION(r245540): ASSERTION FAILED: identifier.isNull() || RunLoop::isMain() https://bugs.webkit.org/show_bug.cgi?id=198074 Reviewed by Youenn Fablet. * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp: (WebKit::LocalStorageDatabaseTracker::databasePath const): 2019-05-21 Antti Koivisto RTL/overflow scroll tests fail with async overflow enabled https://bugs.webkit.org/show_bug.cgi?id=196013 Reviewed by Simon Fraser. Add missing scroll offset <-> scroll position conversions. * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h: * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll): 2019-05-21 Carlos Garcia Campos [WPE] Add initial accessibility support using ATK https://bugs.webkit.org/show_bug.cgi?id=197413 Reviewed by Michael Catanzaro. Rename WebKitWebViewBaseAccessible as WebKitWebViewAccessible and move it to glib removing its dependency on GTK. WPEView now implements get_accessible to return its associated WebKitWebViewAccessible. * PlatformWPE.cmake: * SourcesGTK.txt: * SourcesWPE.txt: * UIProcess/API/glib/WebKitWebViewAccessible.cpp: Added. (webkitWebViewAccessibleInitialize): (webkitWebViewAccessibleRefStateSet): (webkitWebViewAccessibleGetIndexInParent): (webkit_web_view_accessible_class_init): (webkitWebViewAccessibleNew): (webkitWebViewAccessibleSetWebView): * UIProcess/API/glib/WebKitWebViewAccessible.h: Added. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseDispose): (webkitWebViewBaseGetAccessible): * UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp: Removed. * UIProcess/API/gtk/WebKitWebViewBaseAccessible.h: Removed. * UIProcess/API/wpe/PageClientImpl.cpp: (WebKit::PageClientImpl::accessible): * UIProcess/API/wpe/PageClientImpl.h: * UIProcess/API/wpe/WPEView.cpp: (WKWPE::m_backend): (WKWPE::View::~View): (WKWPE::View::accessible): * UIProcess/API/wpe/WPEView.h: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/wpe/WebPageProxyWPE.cpp: (WebKit::WebPageProxy::bindAccessibilityTree): Call atk_socket_embed() with the given plug ID. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/wpe/WebPageWPE.cpp: (WebKit::WebPage::platformInitialize): Create the WebKitWebPageAccessibilityObject and send BindAccessibilityTree message to the UI process. * WebProcess/wpe/WebProcessMainWPE.cpp: (WebKit::initializeAccessibility): Implement AtkUtil interface and initialize the atk bridge. 2019-05-20 Alex Christensen Revert r245501 https://bugs.webkit.org/show_bug.cgi?id=198007 That change did not fix but it caused so out it goes. * Shared/API/Cocoa/WKMain.h: Added. * Shared/API/Cocoa/WKMain.mm: Added. (WKXPCServiceMain): * Shared/EntryPointUtilities/Cocoa/AuxiliaryProcessMain.cpp: Added. (main): * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (main): Deleted. * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::ProcessLauncher::launchProcess): * WebKit.xcodeproj/project.pbxproj: 2019-05-20 Wenson Hsieh [iOS] Layout viewport size on google.com increases after rotating to landscape and back https://bugs.webkit.org/show_bug.cgi?id=198062 Reviewed by Maciej Stachowiak. During an animated resize (e.g. when rotating the device on iOS), we currently immediately trigger the new shrink-to-fit content size heuristic in the middle of dynamicViewportSizeUpdate, after the new view layout size has been applied to the viewport configuration but before we've issued a resize event to the page. Thus, on pages that use listen to the resize event and adjust their content accordingly to fit within the new layout width, we prematurely declare that the page has horizontally overflowed, and try to lay out at a larger width and scale down. This causes the page to unnecessarily shrink after rotating to landscale orientation and back. To fix this, we simply move the call to shrink-to-fit-content to the end of the dynamic viewport size update, such that the page has had a chance to adjust to the new layout size. Test: fast/events/ios/rotation/do-not-shrink-to-fit-content-after-rotation.html * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::dynamicViewportSizeUpdate): 2019-05-20 Ross Kirsling Make lossy LayoutUnit constructors explicit https://bugs.webkit.org/show_bug.cgi?id=191811 Reviewed by Antti Koivisto. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/ios/WebPageIOS.mm: Make usage of LayoutUnit(float) explicit. 2019-05-20 Per Arne Vollan [iOS] WebKit crash loop https://bugs.webkit.org/show_bug.cgi?id=198061 Reviewed by Brent Fulgham. A new syscall rule needs to be added to the sandbox on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-05-20 Sihui Liu Move Web Storage to Network Process https://bugs.webkit.org/show_bug.cgi?id=197636 Reviewed by Youenn Fablet. * CMakeLists.txt: * DerivedSources.make: * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage): (WebKit::NetworkConnectionToWebProcess::didClose): (WebKit::NetworkConnectionToWebProcess::webPageWasAdded): (WebKit::NetworkConnectionToWebProcess::webPageWasRemoved): (WebKit::NetworkConnectionToWebProcess::webProcessSessionChanged): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::networkSessionByConnection const): (WebKit::NetworkProcess::hasLocalStorage): (WebKit::NetworkProcess::fetchWebsiteData): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::filterForRegistrableDomains): (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains): (WebKit::NetworkProcess::webPageWasAdded): (WebKit::NetworkProcess::webPageWasRemoved): (WebKit::NetworkProcess::webProcessWasDisconnected): (WebKit::NetworkProcess::webProcessSessionChanged): (WebKit::NetworkProcess::getLocalStorageOriginDetails): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::NetworkSession): (WebKit::NetworkSession::~NetworkSession): * NetworkProcess/NetworkSession.h: (WebKit::NetworkSession::storageManager): * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::privateSessionParameters): (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/WebStorage/LocalStorageDatabase.cpp: Renamed from Source/WebKit/UIProcess/WebStorage/LocalStorageDatabase.cpp. (WebKit::LocalStorageDatabase::create): (WebKit::LocalStorageDatabase::LocalStorageDatabase): (WebKit::LocalStorageDatabase::~LocalStorageDatabase): (WebKit::LocalStorageDatabase::openDatabase): (WebKit::LocalStorageDatabase::tryToOpenDatabase): (WebKit::LocalStorageDatabase::migrateItemTableIfNeeded): (WebKit::LocalStorageDatabase::importItems): (WebKit::LocalStorageDatabase::setItem): (WebKit::LocalStorageDatabase::removeItem): (WebKit::LocalStorageDatabase::clear): (WebKit::LocalStorageDatabase::close): (WebKit::LocalStorageDatabase::itemDidChange): (WebKit::LocalStorageDatabase::scheduleDatabaseUpdate): (WebKit::LocalStorageDatabase::updateDatabase): (WebKit::LocalStorageDatabase::updateDatabaseWithChangedItems): (WebKit::LocalStorageDatabase::databaseIsEmpty): * NetworkProcess/WebStorage/LocalStorageDatabase.h: Renamed from Source/WebKit/UIProcess/WebStorage/LocalStorageDatabase.h. * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp: Renamed from Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp. (WebKit::LocalStorageDatabaseTracker::create): (WebKit::LocalStorageDatabaseTracker::LocalStorageDatabaseTracker): (WebKit::LocalStorageDatabaseTracker::~LocalStorageDatabaseTracker): (WebKit::LocalStorageDatabaseTracker::databasePath const): (WebKit::LocalStorageDatabaseTracker::didOpenDatabaseWithOrigin): (WebKit::LocalStorageDatabaseTracker::deleteDatabaseWithOrigin): (WebKit::LocalStorageDatabaseTracker::deleteAllDatabases): (WebKit::LocalStorageDatabaseTracker::databasesModifiedSince): (WebKit::LocalStorageDatabaseTracker::origins const): (WebKit::LocalStorageDatabaseTracker::originDetails): * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.h: Renamed from Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.h. * NetworkProcess/WebStorage/StorageManager.cpp: Renamed from Source/WebKit/UIProcess/WebStorage/StorageManager.cpp. (WebKit::StorageManager::StorageArea::securityOrigin const): (WebKit::StorageManager::StorageArea::isSessionStorage const): (WebKit::StorageManager::LocalStorageNamespace::storageManager const): (WebKit::StorageManager::TransientLocalStorageNamespace::create): (WebKit::StorageManager::TransientLocalStorageNamespace::~TransientLocalStorageNamespace): (WebKit::StorageManager::TransientLocalStorageNamespace::getOrCreateStorageArea): (WebKit::StorageManager::TransientLocalStorageNamespace::origins const): (WebKit::StorageManager::TransientLocalStorageNamespace::clearStorageAreasMatchingOrigin): (WebKit::StorageManager::TransientLocalStorageNamespace::clearAllStorageAreas): (WebKit::StorageManager::TransientLocalStorageNamespace::TransientLocalStorageNamespace): (WebKit::StorageManager::StorageArea::create): (WebKit::StorageManager::StorageArea::StorageArea): (WebKit::StorageManager::StorageArea::~StorageArea): (WebKit::StorageManager::StorageArea::addListener): (WebKit::StorageManager::StorageArea::removeListener): (WebKit::StorageManager::StorageArea::hasListener const): (WebKit::StorageManager::StorageArea::clone const): (WebKit::StorageManager::StorageArea::setItem): (WebKit::StorageManager::StorageArea::removeItem): (WebKit::StorageManager::StorageArea::clear): (WebKit::StorageManager::StorageArea::items const): (WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded const): (WebKit::StorageManager::StorageArea::dispatchEvents const): (WebKit::StorageManager::LocalStorageNamespace::create): (WebKit::StorageManager::LocalStorageNamespace::LocalStorageNamespace): (WebKit::StorageManager::LocalStorageNamespace::~LocalStorageNamespace): (WebKit::StorageManager::LocalStorageNamespace::getOrCreateStorageArea): (WebKit::StorageManager::LocalStorageNamespace::didDestroyStorageArea): (WebKit::StorageManager::LocalStorageNamespace::clearStorageAreasMatchingOrigin): (WebKit::StorageManager::LocalStorageNamespace::clearAllStorageAreas): (WebKit::StorageManager::SessionStorageNamespace::isEmpty const): (WebKit::StorageManager::SessionStorageNamespace::allowedConnections const): (WebKit::StorageManager::SessionStorageNamespace::origins const): (WebKit::StorageManager::SessionStorageNamespace::clearStorageAreasMatchingOrigin): (WebKit::StorageManager::SessionStorageNamespace::clearAllStorageAreas): (WebKit::StorageManager::SessionStorageNamespace::create): (WebKit::StorageManager::SessionStorageNamespace::SessionStorageNamespace): (WebKit::StorageManager::SessionStorageNamespace::~SessionStorageNamespace): (WebKit::StorageManager::SessionStorageNamespace::addAllowedConnection): (WebKit::StorageManager::SessionStorageNamespace::removeAllowedConnection): (WebKit::StorageManager::SessionStorageNamespace::getOrCreateStorageArea): (WebKit::StorageManager::SessionStorageNamespace::cloneTo): (WebKit::StorageManager::create): (WebKit::StorageManager::StorageManager): (WebKit::StorageManager::~StorageManager): (WebKit::StorageManager::createSessionStorageNamespace): (WebKit::StorageManager::destroySessionStorageNamespace): (WebKit::StorageManager::addAllowedSessionStorageNamespaceConnection): (WebKit::StorageManager::removeAllowedSessionStorageNamespaceConnection): (WebKit::StorageManager::cloneSessionStorageNamespace): (WebKit::StorageManager::processWillOpenConnection): (WebKit::StorageManager::processDidCloseConnection): (WebKit::StorageManager::getSessionStorageOrigins): (WebKit::StorageManager::deleteSessionStorageOrigins): (WebKit::StorageManager::deleteSessionStorageEntriesForOrigins): (WebKit::StorageManager::getLocalStorageOrigins): (WebKit::StorageManager::getLocalStorageOriginDetails): (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin): (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince): (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins): (WebKit::StorageManager::createLocalStorageMap): (WebKit::StorageManager::createTransientLocalStorageMap): (WebKit::StorageManager::createSessionStorageMap): (WebKit::StorageManager::destroyStorageMap): (WebKit::StorageManager::getValues): (WebKit::StorageManager::setItem): (WebKit::StorageManager::removeItem): (WebKit::StorageManager::clear): (WebKit::StorageManager::applicationWillTerminate): (WebKit::StorageManager::findStorageArea const): (WebKit::StorageManager::getOrCreateLocalStorageNamespace): (WebKit::StorageManager::getOrCreateTransientLocalStorageNamespace): * NetworkProcess/WebStorage/StorageManager.h: Renamed from Source/WebKit/UIProcess/WebStorage/StorageManager.h. * NetworkProcess/WebStorage/StorageManager.messages.in: Renamed from Source/WebKit/UIProcess/WebStorage/StorageManager.messages.in. * NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm: Copied from Source/WebKit/UIProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm. (WebKit::LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup const): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * NetworkProcess/curl/NetworkSessionCurl.cpp: (WebKit::NetworkSessionCurl::NetworkSessionCurl): * NetworkProcess/soup/NetworkSessionSoup.cpp: (WebKit::NetworkSessionSoup::NetworkSessionSoup): * PlatformMac.cmake: * PlatformWin.cmake: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * Shared/WebsiteData/WebsiteData.cpp: (WebKit::WebsiteData::ownerProcess): * Sources.txt: * SourcesCocoa.txt: * UIProcess/API/C/WKKeyValueStorageManager.cpp: (WKKeyValueStorageManagerGetKeyValueStorageOrigins): (WKKeyValueStorageManagerGetStorageDetailsByOrigin): (WKKeyValueStorageManagerDeleteEntriesForOrigin): (WKKeyValueStorageManagerDeleteAllEntries): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::hasLocalStorage): (WebKit::NetworkProcessProxy::getLocalStorageDetails): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::createNewPage): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): (WebKit::WebsiteDataStore::platformInitialize): (WebKit::WebsiteDataStore::platformDestroy): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::WebsiteDataStore): (WebKit::computeNetworkProcessAccessTypeForDataFetch): (WebKit::WebsiteDataStore::fetchDataAndApply): (WebKit::WebsiteDataStore::removeData): (WebKit::WebsiteDataStore::hasLocalStorageForTesting const): (WebKit::WebsiteDataStore::parameters): (WebKit::WebsiteDataStore::getLocalStorageDetails): (WebKit::m_client): Deleted. (WebKit::WebsiteDataStore::cloneSessionData): Deleted. (WebKit::WebsiteDataStore::webPageWasAdded): Deleted. (WebKit::WebsiteDataStore::webPageWasInvalidated): Deleted. (WebKit::WebsiteDataStore::webProcessWillOpenConnection): Deleted. (WebKit::WebsiteDataStore::webPageWillOpenConnection): Deleted. (WebKit::WebsiteDataStore::webPageDidCloseConnection): Deleted. (WebKit::WebsiteDataStore::webProcessDidCloseConnection): Deleted. * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::resolvedLocalStorageDirectory const): (WebKit::WebsiteDataStore::storageManager): Deleted. * WebKit.xcodeproj/project.pbxproj: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::setPrivateBrowsingEnabled): * WebProcess/Network/NetworkProcessConnection.cpp: (WebKit::NetworkProcessConnection::didReceiveMessage): * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createWindow): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::close): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::createWebPage): (WebKit::WebProcess::removeWebPage): (WebKit::WebProcess::ensureNetworkProcessConnection): (WebKit::WebProcess::networkProcessConnectionClosed): (WebKit::WebProcess::registerStorageAreaMap): (WebKit::WebProcess::unregisterStorageAreaMap): (WebKit::WebProcess::storageAreaMap const): (WebKit::WebProcess::enablePrivateBrowsingForTesting): * WebProcess/WebProcess.h: * WebProcess/WebStorage/StorageAreaMap.cpp: (WebKit::StorageAreaMap::StorageAreaMap): (WebKit::StorageAreaMap::~StorageAreaMap): (WebKit::StorageAreaMap::setItem): (WebKit::StorageAreaMap::removeItem): (WebKit::StorageAreaMap::clear): (WebKit::StorageAreaMap::loadValuesIfNeeded): (WebKit::StorageAreaMap::connect): (WebKit::StorageAreaMap::disconnect): * WebProcess/WebStorage/StorageAreaMap.h: (WebKit::StorageAreaMap::identifier const): 2019-05-20 Ross Kirsling [WinCairo] Implement Remote Web Inspector Client. https://bugs.webkit.org/show_bug.cgi?id=197434 Reviewed by Don Olmstead. * PlatformWin.cmake: * UIProcess/RemoteWebInspectorProxy.cpp: * UIProcess/RemoteWebInspectorProxy.h: * UIProcess/socket/RemoteInspectorClient.cpp: Added. * UIProcess/socket/RemoteInspectorClient.h: Added. * UIProcess/socket/RemoteInspectorProtocolHandler.cpp: Added. * UIProcess/socket/RemoteInspectorProtocolHandler.h: Added. * UIProcess/win/RemoteWebInspectorProxyWin.cpp: Added. * UIProcess/win/WebView.cpp: (WebKit::WebView::WebView): 2019-05-20 Per Arne Vollan [macOS] STP can't launch any WebContent processes https://bugs.webkit.org/show_bug.cgi?id=198045 Reviewed by Brent Fulgham. This is caused by a syscall sandbox violation. * WebProcess/com.apple.WebProcess.sb.in: 2019-05-20 Zhifei Fang Allow WebContent mach-lookup AGXCompilerService https://bugs.webkit.org/show_bug.cgi?id=198031 Reviewed by Per Arne Vollan. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-05-20 Sihui Liu [ Mac WK2 iOS Sim] Layout Test http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=196307 Reviewed by Alex Christensen. Delay dumping statistics if there is data being removed. * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: (WebKit::ResourceLoadStatisticsStore::removeDataRecords): * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: (WebKit::ResourceLoadStatisticsStore::dataRecordsBeingRemoved const): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::dumpResourceLoadStatistics): (WebKit::WebResourceLoadStatisticsStore::tryDumpResourceLoadStatistics): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: 2019-05-20 Ludovico de Nittis [WPE][Qt] Use C++17 instead of C++14 https://bugs.webkit.org/show_bug.cgi?id=197415 Reviewed by Philippe Normand. There was a regression introduced with the commit https://bugs.webkit.org/show_bug.cgi?id=197131 The WPE Qt port was not updated to C++17 and this leaded to a compilation error. * PlatformWPE.cmake: 2019-05-20 Carlos Garcia Campos [GTK] Use a repeating timer to populate emoji chooser https://bugs.webkit.org/show_bug.cgi?id=197984 Reviewed by Michael Catanzaro. It ensures the emoji chooser popover is shown as soon as it's requested. * UIProcess/API/gtk/WebKitEmojiChooser.cpp: (webkitEmojiChooserSetupSectionBox): (webkitEmojiChooserSetupRecent): (webkitEmojiChooserSetupEmojiSections): (webkitEmojiChooserConstructed): 2019-05-19 Antoine Quint [Pointer Events] Listening to a "pointerover", "pointerenter", "pointerout" or "pointerleave" event alone does not fire the event on iOS https://bugs.webkit.org/show_bug.cgi?id=197882 Reviewed by Dean Jackson. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::updateTouchEventTracking): 2019-05-19 Alex Christensen Revert r240956 https://bugs.webkit.org/show_bug.cgi?id=198007 Reviewed by Alexey Proskuryakov. r240956 made SafariForWebKitDevelopment crash when using WebKit nightly builds. Since it's not needed and the binary reduction wasn't too big, just revert that revision. * Shared/API/Cocoa/WKMain.h: Removed. * Shared/API/Cocoa/WKMain.mm: Removed. * Shared/EntryPointUtilities/Cocoa/AuxiliaryProcessMain.cpp: Removed. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (main): * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: 2019-05-18 Jiewen Tan [WebAuthN] Allow authenticators that support both CTAP and U2F to try U2F if CTAP fails in authenticatorGetAssertion https://bugs.webkit.org/show_bug.cgi?id=197974 Reviewed by Brent Fulgham. Authenticators that support both CTAP and U2F protocols can be used in a U2F enabled browser to create a credential in U2F format. When such authenticator is used to login in WebKit, it will be treated as a CTAP authenticator. Since the previous credential is in U2F format, the authenticator will not consider that as a valid credential when CTAP requests come along for that U2F credential. Therefore the previous created U2F credential will not be asked at all, and users will not be able to login. This situation is not well documented in the CTAP/WebAuthN spec yet. To workaround the above issue, an authenticator that supports both protocols will be downgraded to a U2F authenticator to ask a potential U2F credential once a valid error is returned regarding to the first CTAP request. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): * UIProcess/WebAuthentication/Authenticator.h: * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::downgrade): * UIProcess/WebAuthentication/AuthenticatorManager.h: * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::parseRequest): (WebKit::MockHidConnection::feedReports): * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp: (WebKit::CtapHidAuthenticator::makeCredential): (WebKit::CtapHidAuthenticator::getAssertion): (WebKit::CtapHidAuthenticator::continueGetAssertionAfterResponseReceived): (WebKit::CtapHidAuthenticator::tryDowngrade): (WebKit::CtapHidAuthenticator::continueGetAssertionAfterResponseReceived const): Deleted. * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h: 2019-05-17 Don Olmstead [CMake] Use builtin FindICU https://bugs.webkit.org/show_bug.cgi?id=197934 Reviewed by Michael Catanzaro. Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES. * CMakeLists.txt: 2019-05-17 Alex Christensen Enable legacy EME for iOS WKWebView https://bugs.webkit.org/show_bug.cgi?id=197964 Reviewed by Wenson Hsieh. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): 2019-05-17 Antoine Quint Add a website policy to disable the legacy -webkit-overflow-scrolling:touch behavior https://bugs.webkit.org/show_bug.cgi?id=197943 Reviewed by Brent Fulgham. * Shared/WebsiteLegacyOverflowScrollingTouchPolicy.h: Added. * Shared/WebsitePoliciesData.cpp: (WebKit::WebsitePoliciesData::encode const): (WebKit::WebsitePoliciesData::decode): (WebKit::WebsitePoliciesData::applyToDocumentLoader): * Shared/WebsitePoliciesData.h: * UIProcess/API/APIWebsitePolicies.cpp: (API::WebsitePolicies::copy const): (API::WebsitePolicies::data): * UIProcess/API/APIWebsitePolicies.h: * WebKit.xcodeproj/project.pbxproj: 2019-05-17 Alex Christensen Add SPI to set a list of hosts to which to send custom header fields cross-origin https://bugs.webkit.org/show_bug.cgi?id=197397 Reviewed by Geoff Garen. * Shared/API/APIObject.h: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * Shared/WebsitePoliciesData.cpp: (WebKit::WebsitePoliciesData::decode): * Shared/WebsitePoliciesData.h: * SourcesCocoa.txt: * UIProcess/API/APICustomHeaderFields.h: Added. * UIProcess/API/APIWebsitePolicies.cpp: (API::WebsitePolicies::WebsitePolicies): (API::WebsitePolicies::copy const): (API::WebsitePolicies::data): * UIProcess/API/APIWebsitePolicies.h: * UIProcess/API/C/WKWebsitePolicies.cpp: (WKWebsitePoliciesCopyCustomHeaderFields): (WKWebsitePoliciesSetCustomHeaderFields): * UIProcess/API/Cocoa/WKWebpagePreferences.mm: (-[WKWebpagePreferences _customHeaderFields]): (-[WKWebpagePreferences _setCustomHeaderFields:]): * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: * UIProcess/API/Cocoa/_WKCustomHeaderFields.h: Added. * UIProcess/API/Cocoa/_WKCustomHeaderFields.mm: Added. (-[_WKCustomHeaderFields init]): (-[_WKCustomHeaderFields dealloc]): (-[_WKCustomHeaderFields fields]): (-[_WKCustomHeaderFields setFields:]): (-[_WKCustomHeaderFields thirdPartyDomains]): (-[_WKCustomHeaderFields setThirdPartyDomains:]): (-[_WKCustomHeaderFields _apiObject]): * UIProcess/API/Cocoa/_WKCustomHeaderFieldsInternal.h: Added. * UIProcess/API/Cocoa/_WKWebsitePolicies.h: * UIProcess/API/Cocoa/_WKWebsitePolicies.mm: (-[_WKWebsitePolicies customHeaderFields]): Deleted. (-[_WKWebsitePolicies setCustomHeaderFields:]): Deleted. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::takeFocus): (WebKit::WebViewImpl::accessibilityAttributeValue): * WebKit.xcodeproj/project.pbxproj: 2019-05-17 Brady Eidson Avoid races in taking networking assertions for downloads by having both Networking and UIProcess do it. and https://bugs.webkit.org/show_bug.cgi?id=197995 Reviewed by Chris Dumez. There's a fairly indeterminant time gap between when the UIProcess decides a load becomes a download and when the NetworkProcess Download object is created, and therefore the download assertion to be taken. The time gap can be long enough for the Networking process to suspend before the download actually starts. There's the reverse race when the UIProcess tells a download to stop, as well. By having both the UIProcess and NetworkProcess take an assertion on behalf of the NetworkProcess we avoid the race. * NetworkProcess/Downloads/DownloadMap.cpp: (WebKit::DownloadMap::add): (WebKit::DownloadMap::remove): * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::convertToDownload): * UIProcess/Downloads/DownloadProxyMap.cpp: (WebKit::DownloadProxyMap::createDownloadProxy): (WebKit::DownloadProxyMap::downloadFinished): (WebKit::DownloadProxyMap::invalidate): * UIProcess/Downloads/DownloadProxyMap.h: 2019-05-17 Keith Rollin Re-enable generate-xcfilelists https://bugs.webkit.org/show_bug.cgi?id=197933 Reviewed by Jonathan Bedard. The following two tasks have been completed, and we can re-enable generate-xcfilelists: Bug 197619 Temporarily disable generate-xcfilelists (197619) Bug 197622 Rewrite generate-xcfilelists in Python (197622) * Scripts/check-xcfilelists.sh: 2019-05-17 Commit Queue Unreviewed, rolling out r245401. https://bugs.webkit.org/show_bug.cgi?id=197990 Causing internal build failures (Requested by ShawnRoberts on #webkit). Reverted changeset: "Add SPI to set a list of hosts to which to send custom header fields cross-origin" https://bugs.webkit.org/show_bug.cgi?id=197397 https://trac.webkit.org/changeset/245401 2019-05-17 Commit Queue Unreviewed, rolling out r245418. https://bugs.webkit.org/show_bug.cgi?id=197989 New API test causing crashes on Mojave testers (Requested by ShawnRoberts on #webkit). Reverted changeset: "Add a unit test for client certificate authentication" https://bugs.webkit.org/show_bug.cgi?id=197800 https://trac.webkit.org/changeset/245418 2019-05-17 Antti Koivisto [iOS] Respect scrolling="no" on composited frames https://bugs.webkit.org/show_bug.cgi?id=197972 Reviewed by Simon Fraser. * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h: * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren): Disallow scrolling based on canHaveScrollbars, similar to main frame. (WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollView const): Factor into a function. 2019-05-17 Carlos Garcia Campos Unreviewed. Fix variations shown in GTK emoji chooser after r245460. We are tno showing the variations in the sub-popover because of a missing parameter in webkitEmojiChooserAddEmoji() call. * UIProcess/API/gtk/WebKitEmojiChooser.cpp: (webkitEmojiChooserShowVariations): Pass prepend parameter to webkitEmojiChooserAddEmoji(). 2019-05-16 Carlos Garcia Campos [GTK] Need WebKitContextMenuItemType to open emoji picker https://bugs.webkit.org/show_bug.cgi?id=176760 Reviewed by Michael Catanzaro. Add a default implementation to show the emoji chooser when requested by the application, either using the context menu or keyboard shortcuts. GtkEmojiChooser is private in GTK, so we include our own copy, adapted to the WebKit coding style. The emoji chooser is always shown by default when using GTK >= 3.24 for any editable content. I'm going to add public API in a follow up patch to be able to use your own chooser, or even prevent the default chooser from being shown, similar to what we do for other UI elements like file chooser, color chooser, print dialog, etc. * Shared/API/glib/WebKitContextMenuActions.cpp: (webkitContextMenuActionGetActionTag): Handle insert emoji action. (webkitContextMenuActionGetForContextMenuItem): Ditto. (webkitContextMenuActionGetLabel): Ditto. * SourcesGTK.txt: * UIProcess/API/gtk/WebKitContextMenuActions.h: * UIProcess/API/gtk/WebKitEmojiChooser.cpp: Added. (webkitEmojiChooserAddEmoji): (webkitEmojiChooserAddRecentItem): (emojiActivated): (emojiDataHasVariations): (webkitEmojiChooserShowVariations): (emojiLongPressed): (emojiPressed): (emojiPopupMenu): (verticalAdjustmentChanged): (webkitEmojiChooserSetupSectionBox): (scrollToSection): (webkitEmojiChooserSetupSectionButton): (webkitEmojiChooserSetupRecent): (webkitEmojiChooserEnsureEmptyResult): (webkitEmojiChooserSearchChanged): (webkitEmojiChooserSetupFilters): (webkitEmojiChooserInitializeEmojiMaxWidth): (webkitEmojiChooserConstructed): (webkitEmojiChooserShow): (webkit_emoji_chooser_class_init): (webkitEmojiChooserNew): * UIProcess/API/gtk/WebKitEmojiChooser.h: Added. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate): Add a timer to release the emoji chooser if not used after 2 minutes. (_WebKitWebViewBasePrivate::releaseEmojiChooserTimerFired): Destroy the emoji chooser. (emojiChooserEmojiPicked): Complete the operation using the given emoji text. (emojiChooserClosed): Complete the operation if needed using an empty string. (webkitWebViewBaseShowEmojiChooser): Create the emoji chooser if needed and show it. * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: * UIProcess/WebPageProxy.h: Add showEmojiPicker(). * UIProcess/WebPageProxy.messages.in: Add ShowEmojiPicker message. * UIProcess/gtk/KeyBindingTranslator.cpp: (WebKit::insertEmojiCallback): Add GtkInsertEmoji command. (WebKit::KeyBindingTranslator::KeyBindingTranslator): Connect to insert-emoji signal. * UIProcess/gtk/WebPageProxyGtk.cpp: (WebKit::WebPageProxy::showEmojiPicker): Call webkitWebViewBaseShowEmojiChooser(). * WebProcess/WebCoreSupport/WebContextMenuClient.h: Override insertEmoji() for GTK port. * WebProcess/WebCoreSupport/WebEditorClient.h: Add insertEmoji() for GTK port. * WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp: (WebKit::WebContextMenuClient::insertEmoji): Call WebPage::showEmojiPicker(). * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp: (WebKit::WebEditorClient::handleGtkEditorCommand): Call WebPage::showEmojiPicker() if command is GtkInsertEmoji. (WebKit::WebEditorClient::executePendingEditorCommands): Handle Gtk specific commands. (WebKit::WebEditorClient::handleKeyboardEvent): Use a reference instead of a pointer for Frame. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/gtk/WebPageGtk.cpp: (WebKit::WebPage::showEmojiPicker): Send ShowEmojiPicker message to the UI process. 2019-05-16 John Wilander Storage Access API: Call completion handlers in NetworkConnectionToWebProcess::hasStorageAccess() and NetworkConnectionToWebProcess::requestStorageAccess() when feature is off https://bugs.webkit.org/show_bug.cgi?id=197967 Reviewed by Brent Fulgham. NetworkConnectionToWebProcess::hasStorageAccess() and NetworkConnectionToWebProcess::requestStorageAccess() should call their completion handlers when there is no Resource Load Statistics object, i.e. when Resource Load Statistics is off. This happens for ephemeral sessions which made code for federated login providers hang, waiting for the result to document.hasStorageAccess(). The existing layout test case was augmented to use an ephemeral session. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::hasStorageAccess): (WebKit::NetworkConnectionToWebProcess::requestStorageAccess): 2019-05-16 Alex Christensen Add a unit test for client certificate authentication https://bugs.webkit.org/show_bug.cgi?id=197800 Reviewed by Youenn Fablet. * Shared/cf/ArgumentCodersCF.cpp: Move SPI declarations to SecuritySPI.h. 2019-05-16 Alex Christensen Add SPI to set a list of hosts to which to send custom header fields cross-origin https://bugs.webkit.org/show_bug.cgi?id=197397 Reviewed by Geoff Garen. * Shared/API/APIObject.h: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * Shared/WebsitePoliciesData.cpp: (WebKit::WebsitePoliciesData::decode): * Shared/WebsitePoliciesData.h: * SourcesCocoa.txt: * UIProcess/API/APICustomHeaderFields.h: Added. * UIProcess/API/APIWebsitePolicies.cpp: (API::WebsitePolicies::WebsitePolicies): (API::WebsitePolicies::copy const): (API::WebsitePolicies::data): * UIProcess/API/APIWebsitePolicies.h: * UIProcess/API/C/WKWebsitePolicies.cpp: (WKWebsitePoliciesCopyCustomHeaderFields): (WKWebsitePoliciesSetCustomHeaderFields): * UIProcess/API/Cocoa/WKWebpagePreferences.mm: (-[WKWebpagePreferences _customHeaderFields]): (-[WKWebpagePreferences _setCustomHeaderFields:]): * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: * UIProcess/API/Cocoa/_WKCustomHeaderFields.h: Added. * UIProcess/API/Cocoa/_WKCustomHeaderFields.mm: Added. (-[_WKCustomHeaderFields init]): (-[_WKCustomHeaderFields dealloc]): (-[_WKCustomHeaderFields fields]): (-[_WKCustomHeaderFields setFields:]): (-[_WKCustomHeaderFields thirdPartyDomains]): (-[_WKCustomHeaderFields setThirdPartyDomains:]): (-[_WKCustomHeaderFields _apiObject]): * UIProcess/API/Cocoa/_WKCustomHeaderFieldsInternal.h: Added. * UIProcess/API/Cocoa/_WKWebsitePolicies.h: * UIProcess/API/Cocoa/_WKWebsitePolicies.mm: (-[_WKWebsitePolicies customHeaderFields]): Deleted. (-[_WKWebsitePolicies setCustomHeaderFields:]): Deleted. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::takeFocus): (WebKit::WebViewImpl::accessibilityAttributeValue): * WebKit.xcodeproj/project.pbxproj: 2019-05-16 Ryan Walklin [WPE] Rendering on a HiDPI display looks scaled up instead of rendered at 2x https://bugs.webkit.org/show_bug.cgi?id=185764 Reviewed by Carlos Garcia Campos. Add a function to the wpe_view_backend_client struct which accepts a device scale factor configured through wpe_view_backend_dispatch_set_device_scale_factor() and calls setIntrinsicDeviceScaleFactor for the the current View.Page object. The function definition has been added in libwpe 1.3. * UIProcess/API/wpe/WPEView.cpp: (WKWPE::m_backend): Add set_device_scale_factor implementation declared by libwpe. 2019-05-15 Devin Rousso Web Inspector: user gesture toggle should also force user interaction flag https://bugs.webkit.org/show_bug.cgi?id=197269 Reviewed by Joseph Pecoraro. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::userIsInteracting const): Added. (WebKit::WebChromeClient::setUserIsInteracting): Added. * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::userIsInteracting const): Added. (WebKit::WebPage::setUserIsInteracting): Added. 2019-05-15 Brent Fulgham Revise sandbox to allow IOKit properties needed by Metal and LaunchServices https://bugs.webkit.org/show_bug.cgi?id=197924 Reviewed by Per Arne Vollan. Update sandbox to allow access to some IOKit properties to avoid sandbox violations that could lower performance or increase launch times: * WebProcess/com.apple.WebProcess.sb.in: 2019-05-15 Chris Dumez Unreviewed, fix assertion introduced in r245339. * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::CachedProcess::CachedProcess): 2019-05-15 Sihui Liu Add assertions to help diagnose crash at WebProcessProxy::processPool() https://bugs.webkit.org/show_bug.cgi?id=197856 Reviewed by Chris Dumez. * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::CachedProcess::CachedProcess): * UIProcess/WebProcessLifetimeObserver.cpp: (WebKit::WebProcessLifetimeObserver::addWebPage): (WebKit::WebProcessLifetimeObserver::removeWebPage): * UIProcess/WebProcessLifetimeObserver.h: (WebKit::WebProcessLifetimeObserver::hasProcess const): 2019-05-15 Wenson Hsieh inputmode="numeric" should show a number pad with digits 0-9, instead of the numeric keyplane https://bugs.webkit.org/show_bug.cgi?id=197916 Reviewed by Timothy Hatcher. Use UIKeyboardTypeNumberPad instead of UIKeyboardTypeNumbersAndPunctuation when presenting a keyboard for a field with inputmode="numeric". While the WhatWG specification merely requires the UA to display a keyboard "capable of numeric input", it suggests that the keyboard should be "useful for PIN entry", which loosely implies a number pad. This is also generally in line with feedback from web developers. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView textInputTraits]): 2019-05-15 Don Olmstead Add USE(LIBWPE) for AcceleratedSurface https://bugs.webkit.org/show_bug.cgi?id=197918 Reviewed by Michael Catanzaro. Renamed AcceleratedSurfaceWPE to AcceleratedSurfaceLibWPE since it just uses the libwpe APIs. * PlatformWPE.cmake: * SourcesWPE.txt: * WebProcess/WebPage/AcceleratedSurface.cpp: (WebKit::AcceleratedSurface::create): * WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.cpp: Renamed from Source/WebKit/WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp. (WebKit::AcceleratedSurfaceLibWPE::create): (WebKit::AcceleratedSurfaceLibWPE::AcceleratedSurfaceLibWPE): (WebKit::AcceleratedSurfaceLibWPE::~AcceleratedSurfaceLibWPE): (WebKit::AcceleratedSurfaceLibWPE::initialize): (WebKit::AcceleratedSurfaceLibWPE::finalize): (WebKit::AcceleratedSurfaceLibWPE::window const): (WebKit::AcceleratedSurfaceLibWPE::surfaceID const): (WebKit::AcceleratedSurfaceLibWPE::clientResize): (WebKit::AcceleratedSurfaceLibWPE::willRenderFrame): (WebKit::AcceleratedSurfaceLibWPE::didRenderFrame): * WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.h: Renamed from Source/WebKit/WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.h. 2019-05-15 Youenn Fablet getUserMedia sandbox extensions should not be revoked when a getUserMedia allowed request is being processed https://bugs.webkit.org/show_bug.cgi?id=197851 Reviewed by Alex Christensen. Before the patch, stopping capture in a document and quickly triggering a new capture might fail as the UIProcess would grant access and revoke sandbox access based on the fact the page is no longer capturing. To fix that issue, keep a state in the UIProcess to not revoke sandbox extensions in case of capture being started. Add an IPC message back to tell UIProcess when an allowed capture is finished. Just after doing that, make sure the document is updating the media state to UIProcess, which will trigger proper sandbox extension handling. This should also trigger the case of an allowed getUserMedia call that fails to start for some reason. In that case, the patch will automatically trigger a document media state refresh which will trigger a sandbox revokation. Covered by added test that exercise a newly added debug assertion. This assertion ensures that we revoke extensions while a document is not capturing. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy): (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess): (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged): * UIProcess/UserMediaPermissionRequestManagerProxy.h: * UIProcess/UserMediaProcessManager.cpp: (WebKit::UserMediaProcessManager::willCreateMediaStream): (WebKit::UserMediaProcessManager::revokeSandboxExtensionsIfNeeded): * UIProcess/UserMediaProcessManager.h: * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::isCapturingAudio const): (WebKit::WebPageProxy::isCapturingVideo const): * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp: (WebKit::UserMediaPermissionRequestManager::userMediaAccessWasGranted): * WebProcess/MediaStream/UserMediaPermissionRequestManager.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::userMediaAccessWasGranted): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebProcess.cpp: (WebKit::checkDocumentsCaptureStateConsistency): (WebKit::WebProcess::revokeUserMediaDeviceSandboxExtensions): 2019-05-15 Chris Dumez [WK2][iOS] UIProcess may get killed because it is taking too long to release its background task after expiration https://bugs.webkit.org/show_bug.cgi?id=197893 Reviewed by Alex Christensen. The UIProcess may get killed because it is taking too long to release its background task after its expiration handler was called. The reason is that the background task's expiration handler was sequentially sending a ProcessWillSuspendImminently synchronous IPC to each of its child processes and only then ends the background task. By the time we receive the response from all child processes, it may be too late and we get killed. To address the issue, we now: 1. Send the ProcessWillSuspendImminently asynchronously so that all processes can do their processing in parallel 2. After 2 seconds, the UIProcess releases the background task (We get killed after ~5 seconds) Also, to make sure that the UIProcess supends promptly, we now make sure we never start a new background task *after* the app has been backgrounded. The intention of our background task is too finish critical work (like releasing locked files) after the app gets backgrounded, not to start new work and delay process suspension. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::processWillSuspendImminently): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::sendProcessWillSuspendImminently): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::sendProcessWillSuspendImminently): * UIProcess/ios/ProcessAssertionIOS.mm: (-[WKProcessAssertionBackgroundTaskManager init]): (-[WKProcessAssertionBackgroundTaskManager _scheduleReleaseTask]): (-[WKProcessAssertionBackgroundTaskManager _cancelPendingReleaseTask]): (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::didReceiveSyncMessage): (WebKit::WebProcess::processWillSuspendImminently): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2019-05-15 Jiewen Tan [WebAuthN] Make WebAuthN default on https://bugs.webkit.org/show_bug.cgi?id=197805 Reviewed by Darin Adler. * Shared/WebPreferences.yaml: 2019-05-15 Youenn Fablet Reuse existing WebPageProxy quota handler for NetworkProcessProxy quota requests https://bugs.webkit.org/show_bug.cgi?id=197463 Reviewed by Alex Christensen. Add a getter to know whether websitedatastore client implements the quota delegate. If not, find the most visible page that is the same origin as the quota request and reuse the existing exceededDatabasQuota delegate. This approach allows to call the delegate even if the quota request comes from a service worker. If no such page is found, the quota will not be increased. Refactoring to make sure we are calling the delegate once a previous call to that delegate is completed. Covered by API test. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::requestStorageSpace): * UIProcess/WebPageProxy.cpp: (WebKit::StorageRequests::add): (WebKit::StorageRequests::processNext): (WebKit::StorageRequests::areBeingProcessed const): (WebKit::StorageRequests::setAreBeingProcessed): (WebKit::StorageRequests::StorageRequests): (WebKit::StorageRequests::~StorageRequests): (WebKit::StorageRequests::singleton): (WebKit::WebPageProxy::forMostVisibleWebPageIfAny): (WebKit::WebPageProxy::didChangeMainDocument): (WebKit::WebPageProxy::exceededDatabaseQuota): (WebKit::WebPageProxy::requestStorageSpace): (WebKit::WebPageProxy::makeStorageSpaceRequest): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::forWebPages): * UIProcess/WebProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStoreClient.h: (WebKit::WebsiteDataStoreClient::implementsRequestStorageSpaceHandler const): 2019-05-15 Youenn Fablet Constant crashes under WebPage::isThrottleable() after r245299 https://bugs.webkit.org/show_bug.cgi?id=197902 Reviewed by Alex Christensen. Update throttle state after a run loop iteration when page state changes to make sure the pageMap does not have null pages. Add appNapEnabled preference that is used by added API test. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updateThrottleState): * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _setAppNapEnabled:]): (-[WKPreferences _appNapEnabled]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: 2019-05-15 Alex Christensen Allow NSFileCoordinator to be called from WebContent process https://bugs.webkit.org/show_bug.cgi?id=197895 Reviewed by Brent Fulgham. * WebProcess/com.apple.WebProcess.sb.in: Expand sandbox to allow use of com.apple.FileCoordination mach service like we do on iOS. 2019-05-15 Devin Rousso Web Automation: elements larger than the viewport have incorrect in-view center point https://bugs.webkit.org/show_bug.cgi?id=195696 Reviewed by Simon Fraser. Original patch by Brian Burg . This seems to be an omission in the specification. While it does mention that the in-view center point (IVCP) must be within the viewport, the algorithm never intersects the element bounding box with the viewport rect. * WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::computeElementLayout): This code is incorrect. For `CoordinateSystem::LayoutViewport`, coordinates should be in root view coordinates so that it can be later converted to screen and synthesized as a HID event in screen coordinates. Intersect the element rect and the viewport rect before finding the center point of the part of the element that's visible in the viewport. (WebKit::convertRectFromFrameClientToRootView): Added. (WebKit::convertPointFromFrameClientToRootView): Added. Added helpers to properly account for scroll contents position on iOS. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement): Now that we determine whether the element is inside the viewport much earlier, if the element has no `inViewCenterPoint`, we can return a `TargetOutOfBounds` instead of a more "generic" `ElementNotInteractable`. (WebKit::WebAutomationSession::simulateMouseInteraction): Rename `locationInView` -> `locationInViewport`. (WebKit::WebAutomationSession::simulateTouchInteraction): This code is incorrect. The `unobscuredContentRect` is in screen coordinates, but we are trying to see if (x, y) is outside the size of the viewport assumed to be at (0, 0). Grab the visual viewport rect and see if the location exceeds the viewport size. * UIProcess/Automation/ios/WebAutomationSessionIOS.mm: (WebKit::operator<<): Add logging helper for `TouchInteraction` enum. (WebKit::WebAutomationSession::platformSimulateTouchInteraction): Move local variable. * UIProcess/Automation/SimulatedInputDispatcher.cpp: (WebKit::SimulatedInputDispatcher::transitionInputSourceToState): Fix a typo in logging. * UIProcess/Automation/Automation.json: Simplify enum name. * Platform/Logging.h: Add logging channel to dump fully resolved interaction details. 2019-05-14 Ross Kirsling Unreviewed restoration of non-unified build. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: * NetworkProcess/cache/NetworkCacheFileSystem.cpp: * UIProcess/WebProcessProxy.cpp: 2019-05-14 Youenn Fablet A service worker process should app nap when all its clients app nap https://bugs.webkit.org/show_bug.cgi?id=185626 Reviewed by Alex Christensen. Compute whether a given web process can be throttled on every page throttling change. Send that information to network process which stores that information in WebSWServerConnection. Every WebSWServerToContextConnection throttle state is then computed based on all WebSWServerConnection that have a client that matches the registrable domain of the context connection. * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::registerServiceWorkerClient): (WebKit::WebSWServerConnection::unregisterServiceWorkerClient): (WebKit::WebSWServerConnection::hasMatchingClient const): (WebKit::WebSWServerConnection::computeThrottleState const): (WebKit::WebSWServerConnection::setThrottleState): (WebKit::WebSWServerConnection::updateThrottleState): (WebKit::WebSWServerConnection::serverToContextConnectionCreated): * NetworkProcess/ServiceWorker/WebSWServerConnection.h: (WebKit::WebSWServerConnection::isThrottleable const): * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: (WebKit::WebSWServerToContextConnection::setThrottleState): * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: (WebKit::WebSWServerToContextConnection::isThrottleable const): * UIProcess/ServiceWorkerProcessProxy.cpp: * UIProcess/ServiceWorkerProcessProxy.h: * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::WebSWClientConnection): (WebKit::WebSWClientConnection::updateThrottleState): * WebProcess/Storage/WebSWClientConnection.h: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::setThrottleState): (WebKit::WebSWContextManagerConnection::isThrottleable const): * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/Storage/WebSWContextManagerConnection.messages.in: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updateUserActivity): (WebKit::WebPage::isThrottleable const): * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::arePagesThrottleable const): * WebProcess/WebProcess.h: 2019-05-14 Chris Dumez Crash under WebKit::WebProcessProxy::didBecomeUnresponsive() https://bugs.webkit.org/show_bug.cgi?id=197883 Reviewed by Alex Christensen. Protect |this| in didBecomeUnresponsive() and didExceedCPULimit() since we call client delegates and those may cause |this| to get destroyed. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didBecomeUnresponsive): (WebKit::WebProcessProxy::didExceedCPULimit): 2019-05-14 Chris Dumez The network process tries to take a process assertion when NetworkProcess::processWillSuspendImminently() is called https://bugs.webkit.org/show_bug.cgi?id=197888 Reviewed by Geoffrey Garen. When actualPrepareToSuspend() in the Network process is called set the 'IsSuspended' flag on the SQLite database tracker and unset the flag when the process resume. This is consistent with what we already do in the WebProcess and makes sure that the network process does not try and take on a new assertion due to locked files when getting notified it is about to get suspended. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::actualPrepareToSuspend): (WebKit::NetworkProcess::processWillSuspendImminently): (WebKit::NetworkProcess::resume): 2019-05-14 Chris Dumez Update TBA macros for API / SPI that has already shipped https://bugs.webkit.org/show_bug.cgi?id=197841 Reviewed by Geoffrey Garen. * Configurations/WebKit.xcconfig: Disable header postprocessing when building for macOS Mojave * Shared/API/Cocoa/_WKRenderingProgressEvents.h: * UIProcess/API/C/WKPage.h: * UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h: * UIProcess/API/Cocoa/WKBrowsingContextController.h: * UIProcess/API/Cocoa/WKBrowsingContextGroup.h: * UIProcess/API/Cocoa/WKBrowsingContextHistoryDelegate.h: * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegate.h: * UIProcess/API/Cocoa/WKBrowsingContextPolicyDelegate.h: * UIProcess/API/Cocoa/WKConnection.h: * UIProcess/API/Cocoa/WKNavigationActionPrivate.h: * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * UIProcess/API/Cocoa/WKProcessGroup.h: * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKTypeRefWrapper.h: * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/Cocoa/WKView.h: (WK_CLASS_DEPRECATED_WITH_REPLACEMENT): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/API/Cocoa/_WKAttachment.h: * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h: * UIProcess/API/Cocoa/_WKDownload.h: * UIProcess/API/Cocoa/_WKFormInputSession.h: * UIProcess/API/Cocoa/_WKInspector.h: * UIProcess/API/Cocoa/_WKInternalDebugFeature.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsitePolicies.h: * WebProcess/API/Cocoa/WKWebProcess.h: * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h: * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h: 2019-05-14 Commit Queue Unreviewed, rolling out r245281. https://bugs.webkit.org/show_bug.cgi?id=197887 Broke API Test TestWebKitAPI.Challenge.ClientCertificate (Requested by aakashjain on #webkit). Reverted changeset: "Add a unit test for client certificate authentication" https://bugs.webkit.org/show_bug.cgi?id=197800 https://trac.webkit.org/changeset/245281 2019-05-14 Daniel Bates [iOS] Cannot scroll to beginning of document after scrolling to end of document and vice versa via key commands https://bugs.webkit.org/show_bug.cgi?id=197848 Reviewed by Brent Fulgham. Following the fix for , UIKit no longer emits a keyup event for a Command- modified key. This breaks WebKit's own implementation of key command handling for scrolling to the beginning or end of the document (triggered using Command + Arrow Up and Command + Arrow Down, respectively) because it watches for keyup events to reset state after initiating a scroll. If state is not reset then the scroll key command logic becomes confused and may not perform a subsequent scroll. It seems like we can actually get away with supporting these key commands and future Command modified commands by preemptively reseting state on keydown if the Command modifier is held down. If this does not work out then we can do something more complicated. * UIProcess/ios/WKKeyboardScrollingAnimator.mm: (-[WKKeyboardScrollingAnimator handleKeyEvent:]): 2019-05-14 Brent Fulgham Protect current WebFrame during form submission https://bugs.webkit.org/show_bug.cgi?id=197459 Reviewed by Alex Christensen. The 'continueWillSubmitForm' method calls a completion handler that might affect the state of the current frame. Ensure the frame is valid for the scope of the function. * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::continueWillSubmitForm): 2019-05-14 Daniel Bates [iOS] Cannot tab or shift + tab out of address bar on google.com https://bugs.webkit.org/show_bug.cgi?id=197859 Reviewed by Darin Adler. Non-editable elements can participate in tab cycling via the HTML tabindex attribute. We should allow setting the initial focus to such an element when transitioning from the chrome (e.g. address bar) to the web page. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]): 2019-05-14 Alex Christensen Add a unit test for client certificate authentication https://bugs.webkit.org/show_bug.cgi?id=197800 Reviewed by Youenn Fablet. * Shared/cf/ArgumentCodersCF.cpp: Move SPI declarations to SecuritySPI.h. 2019-05-13 Wenson Hsieh Followup to r245267: fix some more deprecated uses of -[UIApplication interfaceOrientation] https://bugs.webkit.org/show_bug.cgi?id=197867 Reviewed by Simon Fraser. Add a helper method on WKContentView that asks the view's window's scene for an interface orientation; then, use this helper from various places in WebKit instead of invoking -[UIApplication interfaceOrientation] directly. No change in behavior. * UIProcess/ios/WKContentView.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView interfaceOrientation]): * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm: (-[WKDataListSuggestionsPicker initWithInformation:inView:]): * UIProcess/ios/forms/WKFormColorPicker.mm: (-[WKColorPicker initWithView:]): * UIProcess/ios/forms/WKFormInputControl.mm: (-[WKDateTimePicker initWithView:datePickerMode:]): * UIProcess/ios/forms/WKFormSelectPicker.mm: (-[WKMultipleSelectPicker initWithView:]): * UIProcess/ios/forms/WKFormSelectPopover.mm: (-[WKSelectPopover initWithView:hasGroups:]): 2019-05-13 Wenson Hsieh [iOS] When running layout tests that tap in the same location, subsequent tests fail to fire click handlers https://bugs.webkit.org/show_bug.cgi?id=197821 Reviewed by Tim Horton. After r244775, when running back-to-back layout tests on iOS that simulate taps in the same location, the double tap gesture recognizer for recognizing double clicks ends up recognizing instead of the single tap gesture recognizer in the subsequent test. This means that click handlers in the subsequent test will fail to recognize, unless the element with the click handler is also accompanied by a dblclick handler. To avoid this, we reset the double click gesture recognizer when navigating; this has the additional effect of making it such that the second page doesn't end up observing a dblclick when the first click was only sent to the first page. * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): (-[WKContentView _didStartProvisionalLoadForMainFrame]): 2019-05-13 Wenson Hsieh Unreviewed, fix some deprecation warnings when using a recent SDK * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm: (-[WKDataListSuggestionsPicker initWithInformation:inView:]): 2019-05-13 Jiewen Tan [WebAuthN] InvalidStateError should be reported to sites https://bugs.webkit.org/show_bug.cgi?id=193269 Reviewed by Brent Fulgham. This patch implements step 20 about InvalidStateError of the spec: https://www.w3.org/TR/webauthn/#createCredential. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::respondReceived): * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp: (WebKit::CtapHidAuthenticator::continueMakeCredentialAfterResponseReceived const): 2019-05-13 Jer Noble Take out MediaPlayback UI assertion when any WebProcess is playing audible media https://bugs.webkit.org/show_bug.cgi?id=197798 Reviewed by Chris Dumez. To keep the system from suspending the UIProcess (and all the other constellation of processes that are necessary to play media), take a UIProcess assertion with the MediaPlayback reason whenever there is a WebContent process that is playing audible media. * Platform/spi/ios/AssertionServicesSPI.h: * UIProcess/ProcessAssertion.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::updatePlayingMediaDidChange): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::setWebProcessIsPlayingAudibleMedia): (WebKit::WebProcessPool::clearWebProcessIsPlayingAudibleMedia): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::webPageMediaStateDidChange): * UIProcess/WebProcessProxy.h: * UIProcess/ios/ProcessAssertionIOS.mm: (WebKit::toBKSProcessAssertionReason): (WebKit::ProcessAssertion::ProcessAssertion): * WebProcess/WebProcess.h: 2019-05-13 Per Arne Vollan [iOS] Crash when trying to QuickLook https://bugs.webkit.org/show_bug.cgi?id=197853 Reviewed by Brent Fulgham. This is caused by a syscall sandbox violation. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-05-13 Brent Fulgham Correct the sandbox to allow loading libraries from /Library/Apple https://bugs.webkit.org/show_bug.cgi?id=197844 Reviewed by Per Arne Vollan. Grant access to '/Library/Apple' as an appropriate place to load system frameworks. * WebProcess/com.apple.WebProcess.sb.in: 2019-05-13 Chris Dumez Unreviewed, rolling out r245240. Broke the build Reverted changeset: "Update TBA macros for API / SPI that has already shipped" https://bugs.webkit.org/show_bug.cgi?id=197841 https://trac.webkit.org/changeset/245240 2019-05-13 Youenn Fablet Use kDNSServiceFlagsKnownUnique for DNSServiceRegisterRecord only on platforms supporting it https://bugs.webkit.org/show_bug.cgi?id=197802 Reviewed by Eric Carlson. * NetworkProcess/webrtc/NetworkMDNSRegister.cpp: (WebKit::NetworkMDNSRegister::registerMDNSName): 2019-05-13 Don Olmstead decidePolicyForInstallMissingMediaPluginsPermissionRequest requires GStreamer https://bugs.webkit.org/show_bug.cgi?id=197843 Reviewed by Alex Christensen. * UIProcess/API/wpe/PageClientImpl.cpp: ENABLE(VIDEO) && USE(GSTREAMER) * UIProcess/WebPageProxy.h: Cleanup the declaration. 2019-05-13 Don Olmstead Move StorageManager.cpp into WebKit/Sources.txt https://bugs.webkit.org/show_bug.cgi?id=197842 Reviewed by Michael Catanzaro. StorageManager.cpp is used by all ports so it should just go into Sources.txt. * PlatformMac.cmake: * PlatformWin.cmake: * Sources.txt: * SourcesCocoa.txt: * SourcesGTK.txt: * SourcesWPE.txt: 2019-05-13 Chris Dumez Update TBA macros for API / SPI that has already shipped https://bugs.webkit.org/show_bug.cgi?id=197841 Reviewed by Alex Christensen. * Shared/API/Cocoa/_WKRenderingProgressEvents.h: * UIProcess/API/C/WKPage.h: * UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h: * UIProcess/API/Cocoa/WKBrowsingContextController.h: * UIProcess/API/Cocoa/WKBrowsingContextGroup.h: * UIProcess/API/Cocoa/WKBrowsingContextHistoryDelegate.h: * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegate.h: * UIProcess/API/Cocoa/WKBrowsingContextPolicyDelegate.h: * UIProcess/API/Cocoa/WKConnection.h: * UIProcess/API/Cocoa/WKNavigationActionPrivate.h: * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * UIProcess/API/Cocoa/WKProcessGroup.h: * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKTypeRefWrapper.h: * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/Cocoa/WKView.h: (WK_CLASS_DEPRECATED_WITH_REPLACEMENT): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/API/Cocoa/_WKAttachment.h: * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h: * UIProcess/API/Cocoa/_WKDownload.h: * UIProcess/API/Cocoa/_WKFormInputSession.h: * UIProcess/API/Cocoa/_WKInspector.h: * UIProcess/API/Cocoa/_WKInternalDebugFeature.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsitePolicies.h: * WebProcess/API/Cocoa/WKWebProcess.h: * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h: * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h: 2019-05-13 Chris Fleizach AX: Need an entitlement for WebContent to send accessibility notifications https://bugs.webkit.org/show_bug.cgi?id=197832 Reviewed by Brent Fulgham. In order to send accessibility notifications on iOS, we need to be able to look up this port. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-05-13 Michael Catanzaro Unreviewed, fix unused variable warnings in release builds * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::clearWebProcessHasUploads): 2019-05-12 Takashi Komori [Curl] Suppress extra didReceiveAuthenticationChallenge call when accessing a server which checks basic auth. https://bugs.webkit.org/show_bug.cgi?id=197650 Reviewed by Fujii Hironori. * NetworkProcess/curl/NetworkDataTaskCurl.cpp: (WebKit::NetworkDataTaskCurl::restartWithCredential): 2019-05-10 Chris Dumez [PSON] Prevent flashing when the process-swap is forced by the client https://bugs.webkit.org/show_bug.cgi?id=197799 Reviewed by Geoffrey Garen. When the process-swap is forced by the client, we would not construct a SuspendedPageProxy for the previous page, which would cause a white/black flash upon navigation on macOS. The reason we did not construct a SuspendedPageProxy is that it would be unsafe to keep the page around in this case because other windows might have an opener link to the page when the swap is forced and we need those opener / openee links to get severed. The new approach to maintain the Web facing behavior without flashing is to create a suspended page proxy for the previous page when the process swap is forced by the client. We then close the page as soon as we can do so without flashing (when pageEnteredAcceleratedCompositingMode() has been called). * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::SuspendedPageProxy): (WebKit::SuspendedPageProxy::close): (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode): (WebKit::SuspendedPageProxy::closeWithoutFlashing): (WebKit::SuspendedPageProxy::didProcessRequestToSuspend): * UIProcess/SuspendedPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::suspendCurrentPageIfPossible): (WebKit::WebPageProxy::commitProvisionalPage): * UIProcess/WebPageProxy.h: 2019-05-10 Brent Fulgham Streamline test-and-clear operation for ContextMenu https://bugs.webkit.org/show_bug.cgi?id=197795 Reviewed by Wenson Hsieh. Rather than performing a check when entering the function, doing work, then clearing the member variable, perform the check and clear in a single operation. Only perform the selection if the menu exists. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didSelectItemFromActiveContextMenu): 2019-05-10 Megan Gardner Returning incorrect marked text rects https://bugs.webkit.org/show_bug.cgi?id=197758 Reviewed by Tim Horton. We are not returning marked text rects in the correct view coordinate space. This is the same translation we are applying to the caret rects. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::platformEditorState const): 2019-05-10 Wenson Hsieh Let WebKit clients supply an application name for user agent in modern compatibility mode https://bugs.webkit.org/show_bug.cgi?id=197782 Reviewed by Beth Dakin. Add plumbing for a new private property on WKWebpagePreferences. * UIProcess/API/APIWebsitePolicies.cpp: (API::WebsitePolicies::copy const): * UIProcess/API/APIWebsitePolicies.h: * UIProcess/API/Cocoa/WKWebpagePreferences.mm: (-[WKWebpagePreferences _applicationNameForUserAgentWithModernCompatibility]): (-[WKWebpagePreferences _setApplicationNameForUserAgentWithModernCompatibility:]): * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: 2019-05-10 Chris Dumez The active tab sometimes app naps even though it should not https://bugs.webkit.org/show_bug.cgi?id=197791 Reviewed by Geoffrey Garen. The WebPage constructor was initializing m_activityState but not calling updateThrottleState(). As a result, we would not take a UserActivity even when warranted by the initial activity state. * WebProcess/WebPage/WebPage.cpp: 2019-05-10 Fujii Hironori [WinCairo] storage/indexeddb tests are timing out https://bugs.webkit.org/show_bug.cgi?id=196289 Reviewed by Alex Christensen. storage/indexeddb tests were timing out for WinCairo port because WebKit::NetworkCache classes were not implemented yet for Windows. Implement WebKit::NetworkCache classes by using WTF::FileSystem functions. * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::readFile): Use IOChannel::isOpened() to check the channel is opened instead of checking the file descriptor. * NetworkProcess/cache/NetworkCacheBlobStorage.cpp: (WebKit::NetworkCache::BlobStorage::add): (WebKit::NetworkCache::BlobStorage::remove): * NetworkProcess/cache/NetworkCacheData.cpp: (WebKit::NetworkCache::Data::mapToFile const): (WebKit::NetworkCache::mapFile): (WebKit::NetworkCache::adoptAndMapFile): (WebKit::NetworkCache::makeSalt): (WebKit::NetworkCache::readOrMakeSalt): * NetworkProcess/cache/NetworkCacheData.h: (WebKit::NetworkCache::Data::isEmpty const): (WebKit::NetworkCache::Data::size const): * NetworkProcess/cache/NetworkCacheDataCurl.cpp: (WebKit::NetworkCache::Data::Data): (WebKit::NetworkCache::Data::empty): (WebKit::NetworkCache::Data::data const): (WebKit::NetworkCache::Data::isNull const): (WebKit::NetworkCache::Data::apply const): (WebKit::NetworkCache::Data::subrange const): (WebKit::NetworkCache::concatenate): (WebKit::NetworkCache::Data::adoptMap): Deleted. * NetworkProcess/cache/NetworkCacheFileSystem.cpp: (WebKit::NetworkCache::traverseDirectory): (WebKit::NetworkCache::fileTimes): (WebKit::NetworkCache::updateFileModificationTimeIfNeeded): (WebKit::NetworkCache::isSafeToUseMemoryMapForPath): * NetworkProcess/cache/NetworkCacheIOChannel.h: (WebKit::NetworkCache::IOChannel::isOpened const): (WebKit::NetworkCache::IOChannel::fileDescriptor const): Deleted. * NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp: (WebKit::NetworkCache::IOChannel::IOChannel): (WebKit::NetworkCache::IOChannel::~IOChannel): (WebKit::NetworkCache::runTaskInQueue): (WebKit::NetworkCache::IOChannel::read): (WebKit::NetworkCache::IOChannel::write): 2019-05-10 Chris Dumez Do not wait until requestPermission() is called to fire deviceorientation events if permission was already granted https://bugs.webkit.org/show_bug.cgi?id=197750 Reviewed by Geoffrey Garen. The UIProcess remembers previous device orientation permission decisions per origin for the duration of the browsing session. However, the WebContent process was not aware of previous decisions and would therefore not fire any deviceorientation / devicemotion events until the JS has called requestPermission(). This patches addresses this problem by having the UIProcess communicate any previous permission decision for the origin via WebSitePolicies. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.cpp: (WebKit::WebDeviceOrientationAndMotionAccessController::shouldAllowAccess): (WebKit::WebDeviceOrientationAndMotionAccessController::cachedDeviceOrientationPermission const): (WebKit::WebDeviceOrientationAndMotionAccessController::deviceOrientationPermission const): Deleted. * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.h: 2019-05-10 Chris Dumez Add WKWebViewConfiguration._canShowWhileLocked SPI https://bugs.webkit.org/show_bug.cgi?id=197777 Reviewed by Tim Horton. * Platform/mac/LayerHostingContext.h: * Platform/mac/LayerHostingContext.mm: (WebKit::LayerHostingContext::createForExternalHostingProcess): * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::copy const): * UIProcess/API/APIPageConfiguration.h: (API::PageConfiguration::canShowWhileLocked const): (API::PageConfiguration::setCanShowWhileLocked): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration _setCanShowWhileLocked:]): (-[WKWebViewConfiguration _canShowWhileLocked]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm: (WebKit::PlatformCALayerRemoteCustom::PlatformCALayerRemoteCustom): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::canShowWhileLocked const): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_canShowWhileLocked): (WebKit::m_shrinkToFitContentTimer): Deleted. * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::canShowWhileLocked const): 2019-05-10 Michael Catanzaro Fix a bunch of compiler warnings https://bugs.webkit.org/show_bug.cgi?id=197785 Reviewed by Don Olmstead. Guard Cocoa-specific format modifier to avoid -Wformat warning. * NetworkProcess/AdClickAttributionManager.cpp: (WebKit::AdClickAttributionManager::fireConversionRequest): 2019-05-10 Chris Fleizach AX: Crash at WebKit: WebKit::WebSpeechSynthesisClient::speak https://bugs.webkit.org/show_bug.cgi?id=197761 Reviewed by Per Arne Vollan. It's valid for the incoming voice to be nil, so we need to protect against that. Tests: fast/speechsynthesis/speech-synthesis-real-client-version.html * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp: (WebKit::WebSpeechSynthesisClient::speak): 2019-05-10 Michael Catanzaro [WPE][GTK] Add webkit_frame_get_id() API https://bugs.webkit.org/show_bug.cgi?id=197270 Reviewed by Carlos Garcia Campos. It's as simple as can be: just an API to return the ID of a frame. * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp: (webkit_frame_get_id): * WebProcess/InjectedBundle/API/gtk/WebKitFrame.h: * WebProcess/InjectedBundle/API/wpe/WebKitFrame.h: * WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-1.0-sections.txt: 2019-05-10 Michael Catanzaro [WPE][GTK] Add WebKitWebPage::did-associate-form-controls-for-frame and deprecate original did-associate-form-controls https://bugs.webkit.org/show_bug.cgi?id=197271 Reviewed by Youenn Fablet. * WebProcess/InjectedBundle/API/c/WKBundlePageFormClient.h: * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: (webkit_web_page_class_init): * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): * WebProcess/InjectedBundle/APIInjectedBundleFormClient.h: (API::InjectedBundle::FormClient::didAssociateFormControls): * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp: (WebKit::InjectedBundlePageFormClient::didAssociateFormControls): * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::didAssociateFormControls): * WebProcess/WebCoreSupport/WebChromeClient.h: 2019-05-09 Rob Buis Limit number of prefetches of a given page https://bugs.webkit.org/show_bug.cgi?id=197736 Reviewed by Darin Adler. Limit prefetches for same url to 1. * NetworkProcess/cache/PrefetchCache.cpp: (WebKit::PrefetchCache::store): 2019-05-09 Alex Christensen Unreviewed, rolling out most of r245151. Caused assertions in High Sierra Reverted most of changeset: "Remove now-unnecessary Connection::sendMessageWithReply" https://bugs.webkit.org/show_bug.cgi?id=197747 https://trac.webkit.org/changeset/245151 2019-05-09 Daniel Bates [iOS] Lazily request keyboard on first hardware keydown when a non-editable element is focused https://bugs.webkit.org/show_bug.cgi?id=197746 Reviewed by Brent Fulgham. Be even lazier. We only need to create a keyboard if an editable element is focused or on the first hardware keydown when a non-editable element is focused. We currently do the former. Let's also do the latter. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanupInteraction]): Reset bookkeeping. (-[WKContentView _requiresKeyboardWhenFirstResponder]): Further condition the result on whether we have seen a hardware keydown event in a non-editable element. (-[WKContentView _handleKeyUIEvent:]): If this is the first hardware key event we've seen then update state and call -reloadInputView. -reloadInputView will call us back in -_requiresKeyboardWhenFirstResponder and we will now return YES. So, it will create the keyboard. (-[WKContentView _hardwareKeyboardAvailabilityChanged]): Reset bookkeeping. 2019-05-08 Dean Jackson Guard long press link preview with a USE macro rather than complicated includes https://bugs.webkit.org/show_bug.cgi?id=197728 Reviewed by Wenson Hsieh. It was getting complicated to manage the coordination between WebKitAdditions and WebKit without having to split up the includes into multiple files or have lots of duplication. Instead, WebKitAdditions will now define a USE macro which can be used in various places through WebKit. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView dragInteraction:itemsForBeginningSession:]): (-[WKContentView _contentsOfUserInterfaceItem:]): (previewIdentifierForElementAction): (-[WKContentView shouldUsePreviewForLongPress]): (-[WKContentView _registerPreview]): (-[WKContentView _unregisterPreview]): (shouldUsePreviewForLongPress): Deleted. (-[WKContentView _registerPreviewLongPress]): Deleted. (-[WKContentView _unregisterPreviewLongPress]): Deleted. 2019-05-09 Alex Christensen Remove now-unnecessary Connection::sendMessageWithReply https://bugs.webkit.org/show_bug.cgi?id=197747 Reviewed by Tim Horton. The WebProcess messages that use it already do the right thing with CompletionHandlers and can be replaced by sendWithAsyncReply. The SecItemShim message that uses it can be replaced by sendSync. This patch only increases responsiveness when clearing website data and removes the need for a WorkQueue dedicated entirely to the SecItemShim. * Platform/IPC/Connection.cpp: (IPC::Connection::invalidate): (IPC::Connection::processIncomingSyncReply): (IPC::Connection::connectionDidClose): (IPC::Connection::sendMessageWithReply): Deleted. * Platform/IPC/Connection.h: (IPC::Connection::send): (IPC::Connection::sendWithReply): Deleted. * Shared/mac/SecItemResponseData.h: * Shared/mac/SecItemShim.cpp: (WebKit::sendSecItemRequest): (WebKit::workQueue): Deleted. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::fetchWebsiteData): (WebKit::WebProcessProxy::deleteWebsiteData): (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins): * WebProcess/WebProcess.messages.in: 2019-05-09 Dean Jackson Build fix for iOS. * UIProcess/WKImagePreviewViewController.mm: 2019-05-09 Alex Christensen Remove unnecessary test SPI after r244883 https://bugs.webkit.org/show_bug.cgi?id=197575 Reviewed by Tim Horton. We now have two ways of doing the same thing. Let's remove the one that's only for testing, and make the tests clean up like an application would. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::removeCredential): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::removeCredential): Deleted. * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _removeCredential:forProtectionSpace:completionHandler:]): Deleted. * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::removeCredential): Deleted. * UIProcess/WebProcessPool.h: 2019-05-09 Daniel Bates REGRESSION (r241734): 1% slower PLT on iPad https://bugs.webkit.org/show_bug.cgi?id=197745 Reviewed by Per Arne Vollan. For now, only create a keyboard when WKContentView becomes first responder if a hardware keyboard is attached or an editable element is focused to recover the 1% loss when a keyboard is not attached. We can do better and by that I mean be lazier. We'll do this . In r241734 we unified the key event handling code paths so we use exactly one for both software and hardware key events. We took a simple approach of always requesting UIKit to create a keyboard when the WKContentView becomes first responder. We did this so that we could continue listening for hardware key events even when a non-editable element is focused and dispatch DOM events. As it turns out, always creating a keyboard is expensive and caused a ~1% slowdown in page load time on iPad. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _requiresKeyboardWhenFirstResponder]): Only create a keyboard if a hardware keyboard is attached or an editable element is focused. (-[WKContentView _hardwareKeyboardAvailabilityChanged]): Reload all input view (this will cause keyboard creation) if -_requiresKeyboardWhenFirstResponder returns YES. 2019-05-09 Daniel Bates [iOS] Unable to commit search on MSN.com, qq.com, or sina.com.cn using enter key (hardware or software keyboard) https://bugs.webkit.org/show_bug.cgi?id=197632 Reviewed by Brent Fulgham. Fixes an issue where it is not possible to submit a
with target = "_blank": a form that opens a new window. By default we only allow popups to open if they were user initiated (like when a person clicks on a link). We achieve this by putting a token on the stack, called the UserGestureToken when WebCore processes an event from WebKit. So long as this token is on the stack we consider all requests to open a popup to be user initiated. And we implicitly submit a form when pressing the Return key in an HTML input element during the processing of a TextInputEvent dispatched as part of inserting a '\n' into the field. On Mac, the keydown dispatches a TextInputEvent synchronously. However on iOS text insertion, and hence a dispatch of a TextInputEvent event, occurs asynchronously with respect to the keydown event. So, by the time the UI process calls back to the WebProcess to perform the text insertion of '\n' we have long since popped the UserGestureToken off the stack and hence we disallow opening a popup. To fix this, when -insertText is called we query the keyboard to determine if it's being called by the keyboard. If it is then we can assume that this is part of key event handling and hence was initiated by the user. We can pass along this detail to the WebProcess for it to push a new UserGestureToken onto the stack. For now we only track whether text inserted by the keyboard was user initiated or not. In we will fix this up for all editing commands. * Platform/spi/ios/UIKitSPI.h: Expose SPI. * Shared/Cocoa/InsertTextOptions.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): Encode and decode whether we are processing a user gesture. * Shared/Cocoa/InsertTextOptions.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView insertText:]): Query the keyboard to determine whether it called us or the embedding client did. We only want to privilege user initiated actions (the keyboard). * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::insertTextAsync): Push a UserGestureToken onto the stack that is initialized depending on whether we are or are not processing a user gesture. 2019-05-09 Antoine Quint pointerevents/ios/touch-action-none-in-overflow-scrolling-touch.html is a timeout https://bugs.webkit.org/show_bug.cgi?id=197738 Reviewed by Antti Koivisto. We clear the touch actions for a given touch identifier when the matching touch is released in -[WKContentViewInteraction _handleTouchActionsForTouchEvent:]. This happens before -[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:] is called and thus, which we correctly respected the touch actions during the panning gesture, we would not be able to respect them during the deceleration animation. This caused the test to fail because it would check that no scrolling happened after the panning gesture completed, ie. during the deceleration animation. To work around this, we now store the touch actions for a given UIScrollView interaction in the ScrollingTreeScrollingNodeDelegateIOS object when the interaction starts. * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h: (WebKit::ScrollingTreeScrollingNodeDelegateIOS::activeTouchActions const): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::clearActiveTouchActions): * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): (-[WKScrollingNodeScrollViewDelegate _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::computeActiveTouchActionsForGestureRecognizer): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::activeTouchActionsForGestureRecognizer const): Deleted. 2019-05-08 Antoine Quint [iOS] Correctly handle overlapping regions for elements with a touch-action property https://bugs.webkit.org/show_bug.cgi?id=194813 Reviewed by Antti Koivisto. We now use WebKit::touchActionsForPoint() to determine the touch actions for a given touch using its location in -[WKContentViewInteraction _handleTouchActionsForTouchEvent:]. We then record these touch actions for the touch's identifier on the RemoteScrollingCoordinatorProxy. Then, as we interact with a UIScrollView, we get its gesture recognizer and get its active touch identifier through the new -[WKContentViewInteraction activeTouchIdentifierForGestureRecognizer:] method, and query the RemoteScrollingCoordinatorProxy for the touch actions matching that touch identifier. Tests: pointerevents/ios/touch-action-none-overlap.html pointerevents/ios/touch-action-pan-x-overlap.html pointerevents/ios/touch-action-pan-y-overlap.html pointerevents/ios/touch-action-pinch-zoom-overlap.html * UIProcess/PageClient.h: (WebKit::PageClient::activeTouchIdentifierForGestureRecognizer): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: Maintain a touch identifier to touch actions map. (WebKit::RemoteScrollingCoordinatorProxy::activeTouchActionsForTouchIdentifier const): (WebKit::RemoteScrollingCoordinatorProxy::setTouchActionsForTouchIdentifier): (WebKit::RemoteScrollingCoordinatorProxy::clearTouchActionsForTouchIdentifier): (WebKit::RemoteScrollingCoordinatorProxy::touchActionDataAtPoint const): Deleted. (WebKit::RemoteScrollingCoordinatorProxy::touchActionDataForScrollNodeID const): Deleted. (WebKit::RemoteScrollingCoordinatorProxy::setTouchDataForTouchIdentifier): Deleted. (WebKit::RemoteScrollingCoordinatorProxy::clearTouchDataForTouchIdentifier): Deleted. * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h: * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): (-[WKScrollingNodeScrollViewDelegate _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::activeTouchActionsForGestureRecognizer const): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::touchActionData const): Deleted. * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::activeTouchIdentifierForGestureRecognizer): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView activeTouchIdentifierForGestureRecognizer:]): (-[WKContentView _handleTouchActionsForTouchEvent:]): 2019-05-08 Megan Gardner Add quirks to emulate undo and redo in hidden editable areas on some websites https://bugs.webkit.org/show_bug.cgi?id=197452 Reviewed by Alex Christensen. We need to make our own undo manager to allow undo even when the manager is empty. This is to interface with rich editing websites that don't actually interface with our undo abilities. Then we need to generate synthetic undo and redo in the web process. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::isCurrentURLHost const): * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentView.mm: (-[WKNSUndoManager initWithContentView:]): (-[WKNSUndoManager canUndo]): (-[WKNSUndoManager canRedo]): (-[WKNSUndoManager undo]): (-[WKNSUndoManager redo]): (-[WKContentView undoManager]): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView generateSyntheticUndoRedo:]): (-[WKContentView hasHiddenContentEditable]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::generateSyntheticUndoRedo): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleEditingKeyboardEvent): (WebKit::WebPage::generateSyntheticUndoRedo): 2019-05-08 Alex Christensen Add SPI to set HSTS storage directory https://bugs.webkit.org/show_bug.cgi?id=197259 Reviewed by Brady Eidson. It is with great sadness that I lament the design of this SPI, which is necessitated by the process-global nature of the SPI that I must call and the time at which I must call it (before any networking calls have been made). I'm also not thrilled about the fact that the unit test infrastructure I developed for this in r244594 cannot be used because the SPI that I must call does not work on iOS simulator or Mac. I have verified the SPI is being called and that when called on iOS, and that CFNetwork does the right thing with it. * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: (-[_WKProcessPoolConfiguration setHSTSStorageDirectory:]): (-[_WKProcessPoolConfiguration hstsStorageDirectory]): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): 2019-05-08 Daniel Bates Pass insertTextAsync options as a struct https://bugs.webkit.org/show_bug.cgi?id=197710 Reviewed by Brent Fulgham. WebPageProxy::insertTextAsync() is becoming unwieldy to work with given the large number of optional arguments that can be passed to it. Let's pass a struct instead. * Shared/Cocoa/InsertTextOptions.cpp: Added. (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Shared/Cocoa/InsertTextOptions.h: Added. * Shared/EditingRange.h: Add EnumTrait so that we can encode the EditingRangeIsRelativeTo enumeration. * SourcesCocoa.txt: Add a new file. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::insertText): Update code now that we pass a struct. (WebKit::WebViewImpl::setMarkedText): Ditto. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::insertTextAsync): Ditto. * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView insertText:]): Ditto. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::insertDictatedTextAsync): Ditto. * WebKit.xcodeproj/project.pbxproj: Add new files. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::insertTextAsync): Ditto. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Ditto. 2019-05-08 Timothy Hatcher Add plumbing for inactive system colors in RenderTheme cache. https://bugs.webkit.org/show_bug.cgi?id=197699 rdar://problem/49406936 Reviewed by Tim Horton. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::effectiveAppearanceIsInactive): * UIProcess/PageClient.h: (WebKit::PageClient::effectiveAppearanceIsInactive const): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): (WebKit::WebPageProxy::useInactiveAppearance const): (WebKit::WebPageProxy::effectiveAppearanceDidChange): * UIProcess/WebPageProxy.h: * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::effectiveAppearanceIsInactive const): * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageSetUseDarkAppearance): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_shrinkToFitContentTimer): (WebKit::WebPage::effectiveAppearanceDidChange): Renamed from setUseDarkAppearance. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/gtk/WebPageGtk.cpp: (WebKit::WebPage::effectiveAppearanceDidChange): Renamed from setUseDarkAppearance. 2019-05-08 Chris Dumez Regression: Crash at WebKit: PAL::HysteresisActivity::start https://bugs.webkit.org/show_bug.cgi?id=197666 Reviewed by Geoffrey Garen. We've recently made it so that the WebContent process destroys its WebSQLiteDatabaseTracker when preparing for process suspension and then re-constructs it when resuming. The issue is that the WebSQLiteDatabaseTracker internal implementation was calling callOnMainThread() and capturing |this| to start/stop its HysteresisActivity. As a result, |this| could be dead by the time we're on the main thread and we'd crash. To address the issue, we no longer destroy the WebSQLiteDatabaseTracker when preparing to suspend. Instead, we set a 'isSuspended' flag on the WebSQLiteDatabaseTracker so that it stops notifying the WebProcess of changes. Also clean up the class a bit so that: 1. The constructor takes in a WTF::Function instead of a NetworkProcess / WebProcess reference. This is provides better layering. The WebSQLiteDatabaseTracker should not need to know anything about those objects. 2. Use RunLoop::main().dispatch() instead of callOnMainThread() since we're in WebKit2 code. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::NetworkProcess): * Shared/WebSQLiteDatabaseTracker.cpp: (WebKit::WebSQLiteDatabaseTracker::WebSQLiteDatabaseTracker): (WebKit::WebSQLiteDatabaseTracker::~WebSQLiteDatabaseTracker): (WebKit::WebSQLiteDatabaseTracker::willBeginFirstTransaction): (WebKit::WebSQLiteDatabaseTracker::didFinishLastTransaction): (WebKit::WebSQLiteDatabaseTracker::hysteresisUpdated): Deleted. * Shared/WebSQLiteDatabaseTracker.h: * WebProcess/WebProcess.cpp: (WebKit::m_nonVisibleProcessCleanupTimer): (WebKit::WebProcess::initializeSQLiteDatabaseTracker): (WebKit::WebProcess::cancelPrepareToSuspend): (WebKit::WebProcess::processDidResume): (WebKit::m_webSQLiteDatabaseTracker): Deleted. * WebProcess/WebProcess.h: 2019-05-08 Tim Horton iOS: Selection is dismissed even if click is preventDefault()'d https://bugs.webkit.org/show_bug.cgi?id=197686 Reviewed by Wenson Hsieh. We currently unconditionally dismiss the selection on any tap; however if a site preventDefault()s on click, we shouldn't perform the default action of dismissing the selection. Instead of clearing the selection in the UI process, clear it in the Web content process if we don't dispatch a synthetic click; the normal WebCore machinery will handle it in the case that we do. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _singleTapRecognized:]): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::commitPotentialTapFailed): (WebKit::WebPage::selectWithGesture): (WebKit::WebPage::clearSelection): (WebKit::WebPage::selectTextWithGranularityAtPoint): 2019-05-08 Alexander Mikhaylenko [GTK] Support navigation gesture on touchscreens https://bugs.webkit.org/show_bug.cgi?id=197690 Reviewed by Michael Catanzaro. Touch events generate scroll events that are handled in webkitWebViewBaseHandleWheelEvent(), bypassing webkitWebViewBaseScrollEvent(). Because of that, ViewGestureController never receives them. Hence pass scroll events to ViewGestureController in webkitWebViewBaseHandleWheelEvent() instead. For touch events, gesture progress calculation has to take window width into account to make the page perfectly follow finger, and deltas are additionally divided by Scrollbar::pixelsPerLineStep(), so compensate for that. For touchpad events, change delta multiplier to 10 to match GTK behavior, and introduce a 400px base width so the swipe speed doesn't change from the previous behavior. Because of the multiplier change, threshold for triggering the gesture with touchpad is now 4 times larger. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseHandleWheelEvent): Move ViewGestureController bits here. (webkitWebViewBaseScrollEvent): Removed ViewGestureController bits. * UIProcess/gtk/ViewGestureControllerGtk.cpp: (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe): Allow events from touchscreen devices. (WebKit::isTouchEvent): Added. (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventGetScrollingDeltas): Change delta multipliers. (WebKit::ViewGestureController::SwipeProgressTracker::handleEvent): Change delta multipliers, account for view width for touchscreen events. 2019-05-08 Wenson Hsieh [iOS] Add a quirk to synthesize mouse events when modifying the selection https://bugs.webkit.org/show_bug.cgi?id=197683 Reviewed by Tim Horton. Introduces support for dispatching synthetic mouse events when modifying the selection on some websites. See below for more details. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::selectAll): * UIProcess/WebPageProxy.h: Instead of executing a "SelectAll" editing command using the generic WebPage::executeEditCommand method, introduce a separate method for selectAll that executes the "SelectAll" edit command and then does some platform-specific work. See platformDidSelectAll. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView selectAllForWebView:]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::selectAll): (WebKit::WebPage::shouldDispatchSyntheticMouseEventsWhenModifyingSelection const): Add a helper method to determine whether the quirk should be enabled. (WebKit::WebPage::platformDidSelectAll): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::elementRectInRootViewCoordinates): Move this function closer to the top of the file so that it can be used in dispatchSyntheticMouseEventsForSelectionGesture. (WebKit::WebPage::clearSelection): (WebKit::WebPage::dispatchSyntheticMouseEventsForSelectionGesture): Add a helper method to dispatch a synthetic mouse event for a given selection gesture type. Used in several places in WebPageIOS to synthesize and dispatch mouse events during selection. (WebKit::WebPage::updateSelectionWithTouches): When changing the selection with selection handles, fake mousedown when the user first touches down on the selection handle; mousemove as the user is moving the handle around; and finally, mouseup when the user lets go. (WebKit::WebPage::extendSelection): (WebKit::WebPage::platformDidSelectAll): When tapping "Select All" and/or "Select" in the callout menu, fake a mousedown at the selection start, then a mousemove at selection end, and finally, a mouseup at selection end. (WebKit::WebPage::getFocusedElementInformation): 2019-05-08 Alexander Mikhaylenko [GTK] Pinch Zooming has no maximum https://bugs.webkit.org/show_bug.cgi?id=194865 Reviewed by Michael Catanzaro. Set maximum zoom to 3.0, reflecting the value on macOS and iOS. * UIProcess/gtk/GestureController.cpp: (WebKit::GestureController::ZoomGesture::scaleChanged): 2019-05-08 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/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::retrieveCacheEntry): (WebKit::NetworkResourceLoader::didReceiveResponse): (WebKit::NetworkResourceLoader::didReceiveBuffer): (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry): (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/NetworkSession.h: (WebKit::NetworkSession::prefetchCache): (WebKit::NetworkSession::clearPrefetchCache): * 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::clearExpiredEntries): * NetworkProcess/cache/PrefetchCache.h: Added. (WebKit::PrefetchCache::Entry::releaseBuffer): * Shared/WebPreferences.yaml: * Sources.txt: * WebKit.xcodeproj/project.pbxproj: 2019-05-07 Chris Dumez Simplify logic to prevent App Nap in WebPage https://bugs.webkit.org/show_bug.cgi?id=197674 Reviewed by Geoff Garen. Simplify logic to prevent App Nap in WebPage. We do not need both m_userActivityHysteresis and m_userActivity since UserActivity is already a HysteresisActivity. We had 2 levels of HysteresisActivity stacked on top of one another. Also rename "process suppression" to "app nap" as I find it clearer. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updateThrottleState): (WebKit::WebPage::mouseEvent): (WebKit::WebPage::wheelEvent): (WebKit::WebPage::keyEvent): (WebKit::WebPage::updatePreferences): (WebKit::m_userActivityHysteresis): Deleted. (WebKit::WebPage::updateUserActivity): Deleted. * WebProcess/WebPage/WebPage.h: 2019-05-07 Carlos Garcia Campos REGRESSION(r244230): Web Automation: use null instead of empty string as success result of scripts when alert is open https://bugs.webkit.org/show_bug.cgi?id=197655 Reviewed by Devin Rousso. This regressed in r244230, the case of an alert open while running a script is now handled in WebKit side, but an empty string is returned as a result, which is not a valid JSON serialized string. That made all user prompts tests to fail. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::willShowJavaScriptDialog): Use null as script result instead of an empty string. 2019-05-07 Ryan Haddad Unreviewed, rolling out r245038. Breaks internal builds. Reverted changeset: "Add SPI to set a list of hosts to which to send custom header fields cross-origin" https://bugs.webkit.org/show_bug.cgi?id=197397 https://trac.webkit.org/changeset/245038 2019-05-07 Jiewen Tan [WebAuthN] A new request should always suppress the pending request if any https://bugs.webkit.org/show_bug.cgi?id=191517 Reviewed by Brent Fulgham. Previously we blocked new WebAuthN requests whenever a pending request was in progress to prevent background tabs from DoS foreground tabs. However, in r244938, the WebAuthN API was changed to restrict request handling to the focused document. Therefore, we no longer have a risk of DoS. Apart from the vanished benefit, this behavoir actually blocks new pages to use WebAuthN API in the period between [the previous initating page is closed, the pending request is hanedled/timeout]. Also, it makes sense to have the current focused document preempt the pending request. Therefore, the policy will be to always cancel any pending requests whenever a new request is made. This will enforce the policy of handling only one request at a time. Note that the current implementation doesn't explicitly cancel pending requests in the Authenticators, which means that we could receive responses from the Authenticator that were meant for a previous (now cancelled) request. A follow-up patch (see Bug 191523) will implement an Authenticator feature to support immediate cancellation. In the meantime, to protect the atomicity of the request/response pair, i.e., preventing an old response being used for a new request, there are two safeguards: 1) In web process, each request to UI process is paired with an incremental ID, and therefore an old response from UI process would have a different ID than the current request, which will then be ignored. 2) In UI process, all responses from authenticators will be piped to the main run loop for processing. Therefore, when the new request comes in, the old response is either processed or waiting in the pipe. To prevent the latter being processed, the new request will immediately destroy any authenticators bound to the old response in the current run loop. Hence, in the next run loop when dealing the old response, the lambda will have no where to hand the response over. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::makeCredential): (WebKit::AuthenticatorManager::getAssertion): (WebKit::AuthenticatorManager::clearStateAsync): (WebKit::AuthenticatorManager::clearState): (WebKit::AuthenticatorManager::timeOutTimerFired): * UIProcess/WebAuthentication/AuthenticatorManager.h: * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp: (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential): (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion): (WebKit::WebAuthenticatorCoordinatorProxy::requestReply): * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h: * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in: * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.messages.in: 2019-05-07 Per Arne Vollan [macOS] Crash with sandbox error https://bugs.webkit.org/show_bug.cgi?id=197675 Reviewed by Geoffrey Garen. This crash is caused by missing syscall rules in the sandbox. * WebProcess/com.apple.WebProcess.sb.in: 2019-05-07 Alex Christensen Add SPI to set a list of hosts to which to send custom header fields cross-origin https://bugs.webkit.org/show_bug.cgi?id=197397 Reviewed by Geoff Garen. * Shared/API/APIObject.h: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * Shared/WebsitePoliciesData.cpp: (WebKit::WebsitePoliciesData::decode): * Shared/WebsitePoliciesData.h: * SourcesCocoa.txt: * UIProcess/API/APICustomHeaderFields.h: Added. * UIProcess/API/APIWebsitePolicies.cpp: (API::WebsitePolicies::WebsitePolicies): (API::WebsitePolicies::copy const): (API::WebsitePolicies::data): * UIProcess/API/APIWebsitePolicies.h: * UIProcess/API/C/WKWebsitePolicies.cpp: (WKWebsitePoliciesCopyCustomHeaderFields): (WKWebsitePoliciesSetCustomHeaderFields): * UIProcess/API/Cocoa/WKWebpagePreferences.mm: (-[WKWebpagePreferences _customHeaderFields]): (-[WKWebpagePreferences _setCustomHeaderFields:]): * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: * UIProcess/API/Cocoa/_WKCustomHeaderFields.h: Added. * UIProcess/API/Cocoa/_WKCustomHeaderFields.mm: Added. (-[_WKCustomHeaderFields init]): (-[_WKCustomHeaderFields dealloc]): (-[_WKCustomHeaderFields fields]): (-[_WKCustomHeaderFields setFields:]): (-[_WKCustomHeaderFields thirdPartyDomains]): (-[_WKCustomHeaderFields setThirdPartyDomains:]): (-[_WKCustomHeaderFields _apiObject]): * UIProcess/API/Cocoa/_WKCustomHeaderFieldsInternal.h: Added. * UIProcess/API/Cocoa/_WKWebsitePolicies.h: * UIProcess/API/Cocoa/_WKWebsitePolicies.mm: (-[_WKWebsitePolicies customHeaderFields]): Deleted. (-[_WKWebsitePolicies setCustomHeaderFields:]): Deleted. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::takeFocus): (WebKit::WebViewImpl::accessibilityAttributeValue): * WebKit.xcodeproj/project.pbxproj: 2019-05-07 Adrian Perez de Castro [GTK][WPE] Cannot build documentation with gtk-doc https://bugs.webkit.org/show_bug.cgi?id=197663 Reviewed by Philippe Normand. * UIProcess/API/glib/WebKitSettings.cpp: (webkit_settings_class_init): Escape content which gets wrongly interpreted as SGML tags by gtk-doc as Markdown preformatted content, which fits well for the tag names in the documentation for the WebKitSettings:enable-media property. 2019-05-07 John Wilander Storage Access API: Make two changes requested by developers and complete refactoring and cleanup https://bugs.webkit.org/show_bug.cgi?id=197648 Reviewed by Chris Dumez. Developers have requested two minor changes to the Storage Access API: - Only consume the user gesture when the user explicitly denies access. - Make document.hasStorageAccess() return true instead of false when the feature is off. In addition to this, we have refactoring and cleanup to do. Namely: - Make use of WebCore::RegistrableDomain all the way. - Remove dead code in WebKit::NetworkProcess since the calls now go through NetworkConnectionToWebProcess. - Introduce boolean enums for state handling. - Break out the Storage Access API functionality into a supplement of WebCore::Document. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships): (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess): (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener): (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess): (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal): (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt const): These changes are due to the new enums WebCore::StorageAccessWasGranted and WebCore::StorageAccessPromptWasShown. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess): (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener): (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess): (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal): (WebKit::ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt): These changes are due to the new enums WebCore::StorageAccessWasGranted and WebCore::StorageAccessPromptWasShown. * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: These changes are due to the new enums WebCore::StorageAccessWasGranted and WebCore::StorageAccessPromptWasShown. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess): (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess): (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler): These changes are due to the new enums WebCore::StorageAccessWasGranted and WebCore::StorageAccessPromptWasShown. (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted): Deleted. This function is now no longer exposed and its functionality could be folded into the existing WebResourceLoadStatisticsStore::requestStorageAccess() which is more clearly named. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::hasStorageAccess): (WebKit::NetworkConnectionToWebProcess::requestStorageAccess): These changes are due to the new enums WebCore::StorageAccessWasGranted and WebCore::StorageAccessPromptWasShown. * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::hasStorageAccessForFrame): Deleted. (WebKit::NetworkProcess::hasStorageAccess): Deleted. (WebKit::NetworkProcess::requestStorageAccess): Deleted. (WebKit::NetworkProcess::requestStorageAccessGranted): Deleted. (WebKit::NetworkProcess::grantStorageAccess): Deleted. (WebKit::NetworkProcess::removeAllStorageAccess): Deleted. These functions were left behind in the move of ITP to the network process. This communication goes through WebKit::NetworkConnectionToWebProcess since a while back. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * Scripts/webkit/messages.py: Instructions for derived IPC code on how to include the new enums WebCore::StorageAccessWasGranted and WebCore::StorageAccessPromptWasShown. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::hasStorageAccessForFrame): Deleted. (WebKit::NetworkProcessProxy::hasStorageAccess): Deleted. (WebKit::NetworkProcessProxy::requestStorageAccess): Deleted. (WebKit::NetworkProcessProxy::grantStorageAccess): Deleted. (WebKit::NetworkProcessProxy::removeAllStorageAccess): Deleted. These functions were left behind in the move of ITP to the network process. This communication goes through WebKit::NetworkConnectionToWebProcess since a while back. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::hasStorageAccess): Deleted. (WebKit::WebsiteDataStore::requestStorageAccess): Deleted. (WebKit::WebsiteDataStore::grantStorageAccess): Deleted. These functions were left behind in the move of ITP to the network process. This communication goes through WebKit::NetworkConnectionToWebProcess since a while back. * UIProcess/WebsiteData/WebsiteDataStore.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::hasStorageAccess): (WebKit::WebChromeClient::requestStorageAccess): These changes are due to the new enums WebCore::StorageAccessWasGranted and WebCore::StorageAccessPromptWasShown. They also receive WebCore::RegistrableDomain objects instead of Strings now. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::hasStorageAccess): (WebKit::WebPage::requestStorageAccess): These changes are due to the new enums WebCore::StorageAccessWasGranted and WebCore::StorageAccessPromptWasShown. They also receive WebCore::RegistrableDomain objects instead of Strings now. * WebProcess/WebPage/WebPage.h: 2019-05-07 John Wilander Change IsITPFirstPartyWebsiteDataRemovalEnabled from DEFAULT_EXPERIMENTAL_FEATURES_ENABLED to true. https://bugs.webkit.org/show_bug.cgi?id=197667 Reviewed by Brent Fulgham. * Shared/WebPreferences.yaml: 2019-05-07 Tim Horton iOSMac Share Sheet shows up at the wrong place https://bugs.webkit.org/show_bug.cgi?id=197649 Reviewed by Megan Gardner. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _showShareSheet:inRect:completionHandler:]): (-[WKContentView _hoverGestureRecognizerChanged:]): Pass the last mouse-over location as the presentation location for the share sheet, if we don't have a rect to present from. Centering the popover like we do on iPad doesn't work so well (at all) with a macOS context menu. 2019-05-07 Chris Dumez Rename ConnectionMac.mm to ConnectionCocoa.mm since it is used on both macOS and iOS https://bugs.webkit.org/show_bug.cgi?id=197661 Reviewed by Alexey Proskuryakov. * Platform/IPC/cocoa/ConnectionCocoa.mm: Renamed from Source/WebKit/Platform/IPC/mac/ConnectionMac.mm. (IPC::ConnectionTerminationWatchdog::createConnectionTerminationWatchdog): (IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog): (IPC::ConnectionTerminationWatchdog::watchdogTimerFired): (IPC::Connection::platformInvalidate): (IPC::Connection::cancelReceiveSource): (IPC::Connection::terminateSoon): (IPC::Connection::platformInitialize): (IPC::Connection::open): (IPC::Connection::sendMessage): (IPC::Connection::platformCanSendOutgoingMessages const): (IPC::Connection::sendOutgoingMessage): (IPC::Connection::initializeSendSource): (IPC::Connection::resumeSendSource): (IPC::createMessageDecoder): (IPC::readFromMachPort): (IPC::Connection::receiveSourceEventHandler): (IPC::Connection::identifier const): (IPC::Connection::getAuditToken): (IPC::Connection::kill): (IPC::AccessibilityProcessSuspendedNotification): (IPC::Connection::willSendSyncMessage): (IPC::Connection::didReceiveSyncReply): (IPC::Connection::remoteProcessID const): * Platform/IPC/cocoa/ImportanceAssertion.h: Renamed from Source/WebKit/Platform/IPC/mac/ImportanceAssertion.h. (IPC::ImportanceAssertion::ImportanceAssertion): (IPC::ImportanceAssertion::~ImportanceAssertion): * Platform/IPC/cocoa/MachMessage.cpp: Renamed from Source/WebKit/Platform/IPC/mac/MachMessage.cpp. (IPC::MachMessage::create): (IPC::MachMessage::MachMessage): (IPC::MachMessage::~MachMessage): (IPC::MachMessage::messageSize): (IPC::MachMessage::leakDescriptors): * Platform/IPC/cocoa/MachMessage.h: Renamed from Source/WebKit/Platform/IPC/mac/MachMessage.h. (IPC::MachMessage::size const): (IPC::MachMessage::header): (IPC::MachMessage::messageReceiverName const): (IPC::MachMessage::messageName const): * Platform/IPC/cocoa/MachPort.h: Renamed from Source/WebKit/Platform/IPC/mac/MachPort.h. (IPC::MachPort::MachPort): (IPC::MachPort::encode const): (IPC::MachPort::decode): (IPC::MachPort::port const): (IPC::MachPort::disposition const): * PlatformMac.cmake: * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: 2019-05-07 Antti Koivisto with overflow:hidden shouldn't be keyboard scrollable on iOS https://bugs.webkit.org/show_bug.cgi?id=197659 Reviewed by Antoine Quint. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView isScrollableForKeyboardScrollViewAnimator:]): Disable also keyboard scrolling when touch scrolling is disabled. 2019-05-07 Wenson Hsieh [macOS] Avoid crashing the UI process when writing empty data to the pasteboard https://bugs.webkit.org/show_bug.cgi?id=197644 Reviewed by Tim Horton. Test: WebKit.WKWebProcessPlugInDoNotCrashWhenCopyingEmptyClientData * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::setBufferForType): Make this function robust by not attempting to create a shared memory buffer in the case where the given data buffer is empty. 2019-05-07 Carlos Garcia Campos [GTK] Crash in webkitWebViewBaseSetEnableBackForwardNavigationGesture https://bugs.webkit.org/show_bug.cgi?id=197653 Reviewed by Žan Doberšek. We still need to null-check the ViewGestureController there, since it can be called with a running process but not yet attached when using a related view. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSetEnableBackForwardNavigationGesture): 2019-05-07 Antti Koivisto with overflow:hidden CSS is scrollable on iOS https://bugs.webkit.org/show_bug.cgi?id=153852 Reviewed by Antoine Quint. Disable touch scrolling of the main scroll view when has overflow:hidden. This already works for subframes where we don't create a scrollview in the first place. The patch also adds a test for that. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _didCommitLayerTree:]): Update scrollability after scrolling tree commits. * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::hasScrollableMainFrame const): Base the decision on root ScrollingTreeScrollingNode::canHaveScrollbars() which is computed from overflow. This matches Mac where wheel event dispatch is similarly blocked based on this property. * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: 2019-05-06 James Savage Improve coordination for creating UIWindow instances. https://bugs.webkit.org/show_bug.cgi?id=197578. . Reviewed by Wenson Hsieh. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (makeWindowFromView): Pull out window creation. (-[WKFullScreenWindowController enterFullScreen]): Call new helper function. 2019-05-06 Tim Horton _overrideViewportWithArguments does not work when called before loading https://bugs.webkit.org/show_bug.cgi?id=197638 Reviewed by Wenson Hsieh. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::setOverrideViewportArguments): 2019-05-06 Chris Dumez ASSERT at WebKit::NetworkCache::makeSafeToUseMemoryMapForPath under Storage::StoreBodyAsBlob when running WebDriver tests https://bugs.webkit.org/show_bug.cgi?id=197635 Reviewed by Geoffrey Garen. We need to make sure the the path at blobPathString exists before calling FileSystem::makeSafeToUseMemoryMapForPath(). If the blob does not already exist when BlobStorage::add() is called, what will create it is the call to Data::mapToFile(). * NetworkProcess/cache/NetworkCacheBlobStorage.cpp: (WebKit::NetworkCache::BlobStorage::add): 2019-05-06 Wenson Hsieh Occasional crashes in layout tests when firing the shrink-to-fit-content timer https://bugs.webkit.org/show_bug.cgi?id=197629 Reviewed by Tim Horton. Fixes several crashing layout tests by stopping the shrink-to-fit-content timer when the page closes. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::close): 2019-05-04 Per Arne Vollan -[WKWebsiteDataStore removeDataOfTypes:forDataRecords:completionHandler:] doesn't delete _WKWebsiteDataTypeCredentials https://bugs.webkit.org/show_bug.cgi?id=197510 Reviewed by Alex Christensen. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::fetchWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::registrableDomainsWithWebsiteData): 2019-05-06 Keith Rollin Temporarily disable generate-xcfilelists https://bugs.webkit.org/show_bug.cgi?id=197619 Reviewed by Alex Christensen. We need to perform a significant update to the generate-xcfilelist scripts. This work involves coordinated work with another facility. If the work does not occur in tandem, the build will be broken. To avoid this, disable the invoking of the scripts during the transition. The checking will be restored once the new scripts are in place. * Scripts/check-xcfilelists.sh: 2019-05-06 Chris Dumez Unreviewed build fix after r244984. * WebProcess/cocoa/WebProcessCocoa.mm: 2019-05-06 Chris Dumez Prewarmed WebContent processes never app nap https://bugs.webkit.org/show_bug.cgi?id=197630 Reviewed by Geoffrey Garen. Do not require actually having a WebPage in the WebContent process to App Nap. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updateThrottleState): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2019-05-06 Daniel Bates Fix the build after r244975 (https://bugs.webkit.org/show_bug.cgi?id=197474) Actually make use of the Keyboard Event when building with USE(UIKIT_KEYBOARD_ADDITIONS) and substitute -> for . since it's now passed by reference. * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm: (WebKit::WebEditorClient::handleInputMethodKeydown): 2019-05-06 Jer Noble Adopt AVStreamDataParser.audiovisualMIMETypes https://bugs.webkit.org/show_bug.cgi?id=197581 Reviewed by Eric Carlson. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::WebProcess::platformTerminate): (WebKit::WebProcess::setMediaMIMETypes): 2019-05-06 Chris Dumez Terminate service workers that use too much CPU / power https://bugs.webkit.org/show_bug.cgi?id=197626 Reviewed by Geoffrey Garen. Terminate service worker processes that use over 50% CPU on average over the last 8 minutes, similarly to what we do for background WebContent processes. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didExceedCPULimit): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeProcess): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updateCPULimit): (WebKit::WebProcess::updateCPUMonitorState): 2019-05-06 Daniel Bates Google Docs & Yahoo! Japan: Can’t compose characters with Chinese or Japanese keyboard https://bugs.webkit.org/show_bug.cgi?id=197474 Reviewed by Ryosuke Niwa. Adopt UIKit SPI (added in ) to ask the Input Manager to handle the key event. If the Input Manager handled it then we pass along this information to WebCore, just as we do for Mac, so that it can alter its event handling logic. Otherwise, we handle the event as we do now. A large part of this patch is fixing up #if defs to compile more Mac code when building on iOS. * Platform/spi/ios/UIKitSPI.h: Expose more SPI. * Shared/NativeWebKeyboardEvent.h: * Shared/WebEvent.h: * Shared/WebEventConversion.cpp: (WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent): * Shared/WebKeyboardEvent.cpp: (WebKit::WebKeyboardEvent::WebKeyboardEvent): (WebKit::WebKeyboardEvent::encode const): (WebKit::WebKeyboardEvent::decode): * Shared/ios/NativeWebKeyboardEventIOS.mm: (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent): * Shared/ios/WebIOSEventFactory.h: * Shared/ios/WebIOSEventFactory.mm: (WebIOSEventFactory::createWebKeyboardEvent): Compile more Mac code on iOS. Just like on Mac we maintain some bookkeeping on whether an event was handled by the Input Manager. * UIProcess/Automation/ios/WebAutomationSessionIOS.mm: (WebKit::WebAutomationSession::sendSynthesizedEventsToPage): Pass NativeWebKeyboardEvent::HandledByInputMethod::No to keep the behavior we have now. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanupInteraction]): (-[WKContentView shouldSuppressUpdateCandidateView]): Added. Used to tell UIKit whether to suppress updating/showing the candidate view. (-[WKContentView setMarkedText:selectedRange:]): Bookkeeping to track whether we need to delay showing/updating the inline candidate view. The concept in UIKit is deferment, but at the time of writing its simply a request to delay the update for 0.4 seconds. We opt into this delay only for the first key that begins marked text (i.e. the transition from no marked text to marked text). We do this because we may not have up-to-date editor state at the time UIKit is ready to show/update the inline candidate view for us to answer -textFirstRect and -textLastRect, which UIKit calls as part of computing the frame rect for the inline candidate view on screen. Once we receive up-to-date editor state, in -selectionChanged, we tell UIKit to layout the keyboard, which ultimately causes it to re-compute the frame rect for the inline candidate view and show it. (-[WKContentView handleKeyWebEvent:]): Pass NativeWebKeyboardEvent::HandledByInputMethod::No to keep the behavior we have now. (-[WKContentView handleKeyWebEvent:withCompletionHandler:]): Ask the keyboard to handle the event using the Input Manager. If it was handled then there is no need to delay calling the completion handler, call it, then tell the web process about the key event and that it was already handled by the Input Manager. (-[WKContentView _selectionChanged]): Tell the keyboard to update the candidate view, if needed. * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm: (WebKit::WebEditorClient::handleInputMethodKeydown): Mark the event as default handled if the UI process told us that the event was handled by the Input Manager just like we do on Mac. 2019-05-06 Alex Christensen Null check m_mainFrame in WebPageProxy.cpp https://bugs.webkit.org/show_bug.cgi?id=197618 Reviewed by Geoffrey Garen. It's already null checked in some places, and the places where it isn't are causing crashes. Let's fix all of them. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::createNewPage): 2019-05-06 Brent Fulgham Use more efficient path resolution logic https://bugs.webkit.org/show_bug.cgi?id=197389 Reviewed by Maciej Stachowiak. The code in SandboxExtensionsCocoa.mm 'resolveSymlinksInPath' is pretty inefficient, and tries to reproduce (badly) logic that is already provided by the operating system. To make matters worse, 'resolvePathForSandboxExtension' was effectively performing the work of fully resolving symlinks twice, since NSString's 'stringByStandardizingPath' method does some of this already. Instead, we should just use NSString's 'stringByResolvingSymlinksInPath', which does the symlink resolution using more efficient logic than our 'resolveSymlinksInPath' code. * Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::resolveSymlinksInPath): Removed. (WebKit::resolvePathForSandboxExtension): Remove redundant call to 'resolveSymlinksInPath', and switches from 'stringByStandardizingPath' to 'stringByResolvingSymlinksInPath', which can take the place of both calls. (WebKit::stringByResolvingSymlinksInPath): Switch to call 'stringByResolvingSymlinksInPath'. 2019-05-06 Wenson Hsieh Introduce SPI to request modern compatibility mode but defer to site-specific quirks https://bugs.webkit.org/show_bug.cgi?id=197614 Reviewed by Tim Horton. Add plumbing for a new _allowSiteSpecificQuirksToOverrideCompatibilityMode SPI property on WKWebpagePreferences. * UIProcess/API/APIWebsitePolicies.cpp: (API::WebsitePolicies::copy const): * UIProcess/API/APIWebsitePolicies.h: * UIProcess/API/Cocoa/WKWebpagePreferences.mm: (-[WKWebpagePreferences _allowSiteSpecificQuirksToOverrideCompatibilityMode]): (-[WKWebpagePreferences _setAllowSiteSpecificQuirksToOverrideCompatibilityMode:]): * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: * UIProcess/WebPageProxy.cpp: Use currentRequest instead of originalRequest; see internal change for more details. (WebKit::WebPageProxy::decidePolicyForNavigationAction): 2019-05-06 Ryan Haddad Unreviewed, rolling out r244917. Caused TestWebKitAPI.WKWebView.InitializingWebViewWithEphemeralStorageDoesNotLog failure on debug bots. Reverted changeset: "Use more efficient path resolution logic" https://bugs.webkit.org/show_bug.cgi?id=197389 https://trac.webkit.org/changeset/244917 2019-05-04 Alex Christensen Revert r244953 and r244954 because they broke internal builds. https://bugs.webkit.org/show_bug.cgi?id=197534 * Platform/spi/ios/PDFKitSPI.h: * Platform/spi/ios/UIKitSPI.h: Added. (currentUserInterfaceIdiomIsPad): * Shared/DocumentEditingContext.mm: * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm: * Shared/ios/NativeWebKeyboardEventIOS.mm: * Shared/ios/NativeWebTouchEventIOS.mm: * Shared/ios/WebIconUtilities.mm: * UIProcess/API/Cocoa/NSAttributedString.mm: * UIProcess/API/Cocoa/WKWebView.mm: * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/ApplicationStateTracker.mm: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: * UIProcess/Cocoa/WKShareSheet.mm: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: * UIProcess/Gamepad/ios/UIGamepadProviderIOS.mm: * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm: * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h: * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: * UIProcess/WKImagePreviewViewController.mm: * UIProcess/_WKTouchEventGenerator.mm: * UIProcess/ios/DragDropInteractionState.h: * UIProcess/ios/InputViewUpdateDeferrer.mm: * UIProcess/ios/PageClientImplIOS.mm: * UIProcess/ios/SmartMagnificationController.mm: * UIProcess/ios/TextCheckerIOS.mm: * UIProcess/ios/ViewGestureControllerIOS.mm: * UIProcess/ios/WKActionSheet.mm: * UIProcess/ios/WKActionSheetAssistant.mm: * UIProcess/ios/WKContentView.mm: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: * UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm: * UIProcess/ios/WKKeyboardScrollingAnimator.mm: * UIProcess/ios/WKPDFPageNumberIndicator.mm: * UIProcess/ios/WKPDFView.mm: * UIProcess/ios/WKPasswordView.mm: * UIProcess/ios/WKScrollView.h: * UIProcess/ios/WKScrollView.mm: * UIProcess/ios/WKSyntheticTapGestureRecognizer.h: * UIProcess/ios/WKWebEvent.mm: * UIProcess/ios/WebDataListSuggestionsDropdownIOS.h: * UIProcess/ios/WebPageProxyIOS.mm: * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: * UIProcess/ios/forms/WKFileUploadPanel.mm: * UIProcess/ios/forms/WKFocusedFormControlView.h: * UIProcess/ios/forms/WKFormColorControl.mm: * UIProcess/ios/forms/WKFormColorPicker.mm: * UIProcess/ios/forms/WKFormInputControl.mm: * UIProcess/ios/forms/WKFormPopover.mm: * UIProcess/ios/forms/WKFormSelectControl.h: * UIProcess/ios/forms/WKFormSelectControl.mm: * UIProcess/ios/forms/WKFormSelectPicker.mm: * UIProcess/ios/forms/WKFormSelectPopover.mm: * UIProcess/ios/forms/WKNumberPadViewController.mm: * UIProcess/ios/forms/WKQuickboardListViewController.h: * UIProcess/ios/forms/WKSelectMenuListViewController.mm: * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: * UIProcess/ios/fullscreen/WKFullscreenStackView.mm: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: * WebProcess/WebPage/ios/WebPageIOS.mm: * WebProcess/cocoa/WebProcessCocoa.mm: 2019-05-04 Alex Christensen Merge the three UIKitSPI.h files into a single one in PAL https://bugs.webkit.org/show_bug.cgi?id=197534 Reviewed by Darin Adler. * Platform/spi/ios/PDFKitSPI.h: * Platform/spi/ios/UIKitSPI.h: Removed. * Shared/DocumentEditingContext.mm: * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm: * Shared/ios/NativeWebKeyboardEventIOS.mm: * Shared/ios/NativeWebTouchEventIOS.mm: * Shared/ios/WebIconUtilities.mm: * UIProcess/API/Cocoa/NSAttributedString.mm: * UIProcess/API/Cocoa/WKWebView.mm: * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/ApplicationStateTracker.mm: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: * UIProcess/Cocoa/WKShareSheet.mm: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: * UIProcess/Gamepad/ios/UIGamepadProviderIOS.mm: * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm: * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h: * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: * UIProcess/WKImagePreviewViewController.mm: * UIProcess/_WKTouchEventGenerator.mm: * UIProcess/ios/DragDropInteractionState.h: * UIProcess/ios/InputViewUpdateDeferrer.mm: * UIProcess/ios/PageClientImplIOS.mm: * UIProcess/ios/SmartMagnificationController.mm: * UIProcess/ios/TextCheckerIOS.mm: * UIProcess/ios/ViewGestureControllerIOS.mm: * UIProcess/ios/WKActionSheet.mm: * UIProcess/ios/WKActionSheetAssistant.mm: * UIProcess/ios/WKContentView.mm: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: * UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm: * UIProcess/ios/WKKeyboardScrollingAnimator.mm: * UIProcess/ios/WKPDFPageNumberIndicator.mm: * UIProcess/ios/WKPDFView.mm: * UIProcess/ios/WKPasswordView.mm: * UIProcess/ios/WKScrollView.h: * UIProcess/ios/WKScrollView.mm: * UIProcess/ios/WKSyntheticTapGestureRecognizer.h: * UIProcess/ios/WKWebEvent.mm: * UIProcess/ios/WebDataListSuggestionsDropdownIOS.h: * UIProcess/ios/WebPageProxyIOS.mm: * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: * UIProcess/ios/forms/WKFileUploadPanel.mm: * UIProcess/ios/forms/WKFocusedFormControlView.h: * UIProcess/ios/forms/WKFormColorControl.mm: * UIProcess/ios/forms/WKFormColorPicker.mm: * UIProcess/ios/forms/WKFormInputControl.mm: * UIProcess/ios/forms/WKFormPopover.mm: * UIProcess/ios/forms/WKFormSelectControl.h: * UIProcess/ios/forms/WKFormSelectControl.mm: * UIProcess/ios/forms/WKFormSelectPicker.mm: * UIProcess/ios/forms/WKFormSelectPopover.mm: * UIProcess/ios/forms/WKNumberPadViewController.mm: * UIProcess/ios/forms/WKQuickboardListViewController.h: * UIProcess/ios/forms/WKSelectMenuListViewController.mm: * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: * UIProcess/ios/fullscreen/WKFullscreenStackView.mm: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: * WebProcess/WebPage/ios/WebPageIOS.mm: * WebProcess/cocoa/WebProcessCocoa.mm: 2019-05-03 Wenson Hsieh REGRESSION (r244897): Caret may appear wider than normal after zooming to focus an editable element https://bugs.webkit.org/show_bug.cgi?id=197579 Reviewed by Tim Horton. Fixes a couple of flaky tests (CaretSelectionRectAfterRestoringFirstResponderWithRetainActiveFocusedState and CaretSelectionRectAfterRestoringFirstResponder) that began failing after r244897. These tests both begin by focusing an editable element, which causes the web view to zoom in. The tests subsequently check that the caret rect is {{ 16, 13 }, { 2, 15 }}. While the specified caret rect (coming from EditorState) is {{ 16, 13 }, { 3, 15 }}, the narrower caret rect is used because we take measures to preserve the width of the caret relative to the view (see the inverse scaling logic in -[WKContentView selectedTextRange] for more details). See below for more details. * UIProcess/ios/WKContentViewInteraction.h: Remove _isZoomingToRevealFocusedElement, now that we don't need it anymore (see -observeValueForKeyPath:). * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanupInteraction]): (-[WKContentView observeValueForKeyPath:ofObject:change:context:]): Stop bailing from a selection update when changing scale, while zooming to reveal the focused element. This check was added in r239441 to prevent UIWKTextInteractionAssistant's selection scrolling logic from interfering with WKContentView-driven logic for zooming to the focused element. However, since r244141, this is no longer necessary since selection scrolling is only driven by code in the web process. This new update while zooming to reveal the focused element ensures that the WKTextRange returned by -selectedTextRange after zooming will have a width that is inversely scaled using the content view's current scale, such that it has a consistent width (relative to the web view) across different scales. (-[WKContentView _zoomToRevealFocusedElement]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::layerTreeCommitComplete): Remove any attempt here to notify PageClient about editor states after focus. This logic was actually incorrect, since it didn't ensure that the layer tree commit that is being completed actually contained an editor state; as such, the "editor state" received here could be stale. 2019-05-03 Zalan Bujtas [iOS] outlook.live.com: Compose email frame not fully visible and not scrollable https://bugs.webkit.org/show_bug.cgi?id=197573 Reviewed by Wenson Hsieh. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::adjustLayoutSizeIfNeeded): (WebKit::WebPage::setViewportConfigurationViewLayoutSize): (WebKit::WebPage::dynamicViewportSizeUpdate): (WebKit::WebPage::immediatelyShrinkToFitContent): 2019-05-03 Dean Jackson Make imageForElementActionType a class method on _WKElementAction https://bugs.webkit.org/show_bug.cgi?id=197588 Reviewed by Wenson Hsieh. Make this helper function a class method, so that it can be more easily detected. * UIProcess/API/Cocoa/_WKElementAction.h: * UIProcess/API/Cocoa/_WKElementAction.mm: (+[_WKElementAction imageForElementActionType:]): (_WKUIImageForElementActionType): Deleted. 2019-05-03 Chris Dumez Unresponsive Service Worker processes should get killed https://bugs.webkit.org/show_bug.cgi?id=197580 Reviewed by Geoffrey Garen. Enable the background responsiveness logic for service worker processes so that they get killed if they becomes unresponsive. The logic was previously not enabling the timer for service worker processes because it required having a page. * UIProcess/BackgroundProcessResponsivenessTimer.cpp: (WebKit::BackgroundProcessResponsivenessTimer::shouldBeActive const): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didBecomeUnresponsive): (WebKit::WebProcessProxy::didFinishLaunching): 2019-05-03 Youenn Fablet [iOS] set the default maximum camera count to 1 for enumerateDevices https://bugs.webkit.org/show_bug.cgi?id=197566 Reviewed by Eric Carlson. The previous number for iOS was 2 as there is a front and a back camera. Since we are by default setting deviceIds to "", it is better to just have one, as it might confuse applications to have two devices with the same ID. Covered by updated test. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): 2019-05-03 Daniel Bates Pass KeyboardEvent by reference in more places https://bugs.webkit.org/show_bug.cgi?id=197480 Reviewed by Wenson Hsieh. * WebProcess/WebCoreSupport/WebEditorClient.cpp: (WebKit::WebEditorClient::handleKeyboardEvent): (WebKit::WebEditorClient::handleInputMethodKeydown): * WebProcess/WebCoreSupport/WebEditorClient.h: * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp: (WebKit::WebEditorClient::handleKeyboardEvent): (WebKit::WebEditorClient::handleInputMethodKeydown): * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm: (WebKit::WebEditorClient::handleKeyboardEvent): (WebKit::WebEditorClient::handleInputMethodKeydown): * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: (WebKit::WebEditorClient::handleKeyboardEvent): (WebKit::WebEditorClient::handleInputMethodKeydown): * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp: (WebKit::WebEditorClient::handleKeyboardEvent): (WebKit::WebEditorClient::handleInputMethodKeydown): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleEditingKeyboardEvent): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::handleEditingKeyboardEvent): * WebProcess/WebPage/win/WebPageWin.cpp: (WebKit::WebPage::handleEditingKeyboardEvent): 2019-05-03 Youenn Fablet Enable Fetch Keep Alive by default https://bugs.webkit.org/show_bug.cgi?id=197331 Reviewed by Geoffrey Garen. * Shared/WebPreferences.yaml: 2019-05-03 Devin Rousso REGRESSION(r230367): a "." is prepended before cookies set without an explicit domain https://bugs.webkit.org/show_bug.cgi?id=197268 Reviewed by Alex Christensen. RFC 2965 states "If an explicitly specified value does not start with a dot, the user agent supplies a leading dot.", so we should only be adding a leading "." if a `domain` is provided. In order to not regress r230367, also delete all cookies for the non-"."-prefixed domain. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::addSingleCookie): (WebKit::WebAutomationSession::deleteAllCookies): * UIProcess/WebCookieManagerProxy.h: * UIProcess/WebCookieManagerProxy.cpp: (WebKit::WebCookieManagerProxy::deleteCookiesForHostnames): Added. (WebKit::WebCookieManagerProxy::deleteCookiesForHostname): Deleted. * UIProcess/API/C/WKCookieManager.cpp: (WKCookieManagerDeleteCookiesForHostname): * NetworkProcess/Cookies/WebCookieManager.messages.in: * NetworkProcess/Cookies/WebCookieManager.h: * NetworkProcess/Cookies/WebCookieManager.cpp: (WebKit::WebCookieManager::deleteCookiesForHostnames): Added. (WebKit::WebCookieManager::deleteCookiesForHostname): Deleted. Since the underlying `NetworkStorageSession` accepts a list of domains, extend that support to allow the IPC to send a list of domains as well, but still keep the C API the same. 2019-05-03 Sihui Liu Add assertion to check whether shm files have maximum FileProtection of CompleteUnlessOpen https://bugs.webkit.org/show_bug.cgi?id=197390 Reviewed by Geoffrey Garen. Move data protection check to WebCore so it can be applied to database files. * NetworkProcess/cache/NetworkCacheBlobStorage.cpp: (WebKit::NetworkCache::BlobStorage::add): * NetworkProcess/cache/NetworkCacheFileSystem.cpp: (WebKit::NetworkCache::makeSafeToUseMemoryMapForPath): Deleted. * NetworkProcess/cache/NetworkCacheFileSystem.h: * NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm: Removed. * SourcesCocoa.txt: * UIProcess/API/APIContentRuleListStore.cpp: (API::openAndMapOrCopyContentRuleList): (API::compiledToFile): 2019-05-03 Chris Dumez ASSERTION FAILED: [weakThis->m_view window] == weakThis->m_targetWindowForMovePreparation https://bugs.webkit.org/show_bug.cgi?id=197574 Reviewed by Tim Horton. Tweak the assertion so that it holds even if the WebView gets closed because the completion handler has been called. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::prepareForMoveToWindow): 2019-05-03 Brent Fulgham Use more efficient path resolution logic https://bugs.webkit.org/show_bug.cgi?id=197389 Reviewed by Maciej Stachowiak. The code in SandboxExtensionsCocoa.mm 'resolveSymlinksInPath' is pretty inefficient, and tries to reproduce (badly) logic that is already provided by the operating system. To make matters worse, 'resolvePathForSandboxExtension' was effectively performing the work of fully resolving symlinks twice, since NSString's 'stringByStandardizingPath' method does some of this already. Instead, we should just use NSString's 'stringByResolvingSymlinksInPath', which does the symlink resolution using more efficient logic than our 'resolveSymlinksInPath' code. * Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::resolveSymlinksInPath): Removed. (WebKit::resolvePathForSandboxExtension): Remove redundant call to 'resolveSymlinksInPath', and switches from 'stringByStandardizingPath' to 'stringByResolvingSymlinksInPath', which can take the place of both calls. (WebKit::stringByResolvingSymlinksInPath): Switch to call 'stringByResolvingSymlinksInPath'. 2019-05-02 Dean Jackson Need additional UIPreviewAction information in WKImagePreviewViewController https://bugs.webkit.org/show_bug.cgi?id=197540 Reviewed by Wenson Hsieh. Include a WebKitAdditions file to provide a macro for additional UIPreviewAction information. While here, take the opportunity to move from the deprecated UIViewControllerPreviewAction to the newer UIPreviewAction. * UIProcess/WKImagePreviewViewController.mm: (-[WKImagePreviewViewController previewActionItems]): 2019-05-02 Dean Jackson Provide UIImages for element actions https://bugs.webkit.org/show_bug.cgi?id=197539 Reviewed by Wenson Hsieh. Use an additions include to export a function that relates a UIImage to a _WKElementAction. * UIProcess/API/Cocoa/_WKElementAction.h: * UIProcess/API/Cocoa/_WKElementAction.mm: (_WKUIImageForElementActionType): 2019-05-03 Jay Mulani Expose full screen controller SPI to check if full screen is open and close full screen https://bugs.webkit.org/show_bug.cgi?id=197263 Reviewed by Jer Noble. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView closeFullScreenWindowController]): (-[WKWebView fullScreenWindowController]): * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: 2019-05-03 Youenn Fablet LayoutTest imported/w3c/web-platform-tests/xhr/event-upload-progress-crossorigin.htm is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=182849 Reviewed by Alex Christensen. In case of restarting the load after a redirection, which now happens in case of following cross origin redirections with same-origin credentials, make sure to update the request as would do NetworkLoad. This is in particular important to preserve the request body. Covered by WPT updated test. * NetworkProcess/NetworkLoad.cpp: (WebKit::updateRequest): (WebKit::NetworkLoad::updateRequestAfterRedirection const): (WebKit::NetworkLoad::continueWillSendRequest): * NetworkProcess/NetworkLoad.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::continueWillSendRequest): 2019-05-03 Commit Queue Unreviewed, rolling out r244881. https://bugs.webkit.org/show_bug.cgi?id=197559 Breaks compilation of jsconly on linux, breaking compilation for jsc-i386-ews, jsc-mips-ews and jsc-armv7-ews (Requested by guijemont on #webkit). Reverted changeset: "[CMake] Refactor WEBKIT_MAKE_FORWARDING_HEADERS into WEBKIT_COPY_FILES" https://bugs.webkit.org/show_bug.cgi?id=197174 https://trac.webkit.org/changeset/244881 2019-05-02 Wenson Hsieh REGRESSION: Layout test editing/selection/ios/selection-after-changing-text-with-callout-menu.html is failing https://bugs.webkit.org/show_bug.cgi?id=197532 Reviewed by Ryosuke Niwa. Fixes layout tests that began failing after r244546. See below for details. * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree): Partially reverts a change in r244546, after which we commit the layer tree and scroll before updating the page's editor state. The purpose of this change was to ensure that UI process-side element focus scrolling logic would not conflict with web-process-driven scrolling logic. Instead, we split the existing logic in WebPageProxy::editorStateChanged into two pieces: one that updates the editor state (by setting m_editorState), and a second that dispatches updates to PageClient when the first editor state is received after focusing an element. During a layer tree commit in the UI process, we first update the editor state, then commit the layer tree and apply scroll position changes, and finally scroll to reveal the focused element if necessary. When an editor state is delivered to the UI process in an out-of-band update (i.e. not in a layer tree commit), simply dispatch the initial editor state for a focused element immediately. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::scheduleFullEditorStateUpdate): Add an IPC message to schedule an editor state update in the next remote layer tree commit. See below for more details. (WebKit::WebPageProxy::editorStateChanged): (WebKit::WebPageProxy::dispatchDidReceiveEditorStateAfterFocus): * UIProcess/WebPageProxy.h: * UIProcess/gtk/WebPageProxyGtk.cpp: (WebKit::WebPageProxy::updateEditorState): (WebKit::WebPageProxy::editorStateChanged): Deleted. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView willFinishIgnoringCalloutBarFadeAfterPerformingAction]): Additionally ensure that an editor state update is scheduled. This addresses a potential source of flakiness in the layout test editing/selection/ios/selection-after-changing-text-with-callout-menu.html, where an editor state update may only be scheduled after the next layout timer fires (this is the case in custom callout menu actions that change the DOM but do not otherwise trigger any editing commands). In the problematic scenario, the client could make a change that triggers layout soon; but before the layout timer fires, the timer for the next remote layer tree commit could fire, such that the next layer tree commit would not contain the relevant editor state. This extra step ensures that we always *schedule* an editor state update when performing a callout menu action that does not automatically dismiss, so that we can prevent the callout bar from dismissing during the correct scope. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::layerTreeCommitComplete): (WebKit::WebPageProxy::updateEditorState): Rename editorStateChanged to updateEditorState, and make the editorStateChanged codepath only executed when an out-of-band editor state update is delivered to the UI process. (WebKit::WebPageProxy::dispatchDidReceiveEditorStateAfterFocus): Notify the UI process that the initial editor state has been received; this prompts us to scroll to reveal the focused element, if needed. (WebKit::WebPageProxy::editorStateChanged): Deleted. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::updateEditorState): (WebKit::WebPageProxy::editorStateChanged): Deleted. * UIProcess/win/WebPageProxyWin.cpp: (WebKit::WebPageProxy::updateEditorState): (WebKit::WebPageProxy::editorStateChanged): Deleted. * UIProcess/wpe/WebPageProxyWPE.cpp: (WebKit::WebPageProxy::updateEditorState): (WebKit::WebPageProxy::editorStateChanged): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2019-05-02 Timothy Hatcher NSAttributedString conversion in a loop returns nil and WKUnknownError every other time. https://bugs.webkit.org/show_bug.cgi?id=197523 Reviewed by Darin Adler. Caching the WKWebView was loading about:blank to unload the previous content. This was causing subsequent rapid conversions to fail since the blank load would be confused with the real content loading. Loading a blank page wasn't really needed, it just helped keep the cached view in a cleaner state. Instead of adding complexity to track the extra navigation, we can eliminate the blank load. Ultimately a process swap will likely happen on the next navigation, and unused cached views are closed quickly -- so stale content isn't held around too long. This also avoids extra work and speeds up conversions a bit. * UIProcess/API/Cocoa/NSAttributedString.mm: (+[_WKAttributedStringWebViewCache cacheWebView:]): Don't load about:blank when caching. * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::getContentsAsAttributedString): Use rangeOfContents() for a fail safe way to get the range needed. 2019-05-02 John Wilander Make both filterForRegistrableDomains() in WebKit::NetworkProcess use WebCore::RegistrableDomain::uncheckedCreateFromHost() https://bugs.webkit.org/show_bug.cgi?id=197521 Reviewed by Brent Fulgham. * NetworkProcess/NetworkProcess.cpp: (WebKit::filterForRegistrableDomains): 2019-05-02 Per Arne Vollan -[WKWebsiteDataStore removeDataOfTypes:forDataRecords:completionHandler:] doesn't delete _WKWebsiteDataTypeCredentials https://bugs.webkit.org/show_bug.cgi?id=197510 Reviewed by Alex Christensen. When asked to delete persistent credentials for a set of origins, send a message to the network process with the list of origins. The network process will then delete all persistent credentials from these origins from NSURLCredentialStorage. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::removeCredentialsWithOrigins): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::removeCredentialsWithOrigins): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::removeData): 2019-05-02 Don Olmstead [CMake] Refactor WEBKIT_MAKE_FORWARDING_HEADERS into WEBKIT_COPY_FILES https://bugs.webkit.org/show_bug.cgi?id=197174 Reviewed by Alex Christensen. Replace WEBKIT_MAKE_FORWARDING_HEADERS with WEBKIT_COPY_FILES and make dependencies for framework headers explicit. * CMakeLists.txt: * PlatformWin.cmake: 2019-05-02 Per Arne Vollan [macOS] Fix syscall sandbox violation https://bugs.webkit.org/show_bug.cgi?id=197517 Reviewed by Brent Fulgham. A syscall needs to be added to the sandbox on macOS. * WebProcess/com.apple.WebProcess.sb.in: 2019-05-02 Alex Christensen Safe browsing warning should update colors when a user switches between light and dark appearance https://bugs.webkit.org/show_bug.cgi?id=197443 Reviewed by Tim Horton. We draw the WKSafeBrowsingExclamationPoint ourselves, so we need to call setNeedsDisplay when viewDidChangeEffectiveAppearance is called. Instead of setting NSView.layer.backgroundColor we need to make an NSView subclass I call WKSafeBrowsingBox and we need to set its layer's backgroundColor in updateLayer, otherwise the CGColor isn't updated from the NSColor. * UIProcess/Cocoa/WKSafeBrowsingWarning.h: * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: (colorForItem): (-[WKSafeBrowsingExclamationPoint viewDidChangeEffectiveAppearance]): (-[WKSafeBrowsingBox setSafeBrowsingBackgroundColor:]): (-[WKSafeBrowsingBox updateLayer]): (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]): (-[WKSafeBrowsingWarning addContent]): (-[WKSafeBrowsingWarning showDetailsClicked]): (setBackground): Deleted. 2019-05-02 Frederic Wang [GTK][WPE] Disable "thin", "thick", "medium" values of mfrac@linethickness at runtime https://bugs.webkit.org/show_bug.cgi?id=196142 This patch introduces some experimental runtime flag to let users disable MathML features that are removed from MathML Core [1]. For now, these features are only disabled on GTK and WPE ports. [1] https://mathml-refresh.github.io/mathml-core/ Reviewed by Rob Buis. * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.h: 2019-05-01 Wenson Hsieh Add the ability to import WebKitAdditions snippets in WebKit.apinotes https://bugs.webkit.org/show_bug.cgi?id=197487 Reviewed by Tim Horton. * Shared/API/Cocoa/WebKit.apinotes: Import a new WebKitAdditions file. * WebKit.xcodeproj/project.pbxproj: Check all files in Headers/ and PrivateHeaders/ that need replacement, not simply anything ending with ".h". * mac/replace-webkit-additions-includes.py: (main): Teach the replacement script to handle files in Headers/ or PrivateHeaders/ that don't end in ".h". 2019-05-01 Alex Christensen Protect against null crash in fetchDiskCacheEntries https://bugs.webkit.org/show_bug.cgi?id=197399 Reviewed by Antti Koivisto. If the call to Entry::decodeStorageRecord returns nullptr in Storage::traverse, do not call the traverseHandler, which expects that when it is called with nullptr that is the end of the traversal. * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::traverse): 2019-05-01 Wenson Hsieh [iOS] Add a version of viewport shrink-to-fit heuristics that preserves page layout https://bugs.webkit.org/show_bug.cgi?id=197342 Reviewed by Tim Horton. This patch introduces a new shrink-to-fit heuristic that attempts to lay out the contents of the page at a larger width in order to shrink content to fit the viewport. This is similar to existing shrink-to-fit behaviors used for viewport sizing in multitasking mode, except that it not only scales the view, but additionally expands the layout size, such that the overall layout of the page is preserved. In fact, the reason we ended up reverting the existing flavor of shrink-to-fit in all cases except for multitasking was that page layout was not preserved, which caused elements that poke out of the viewport to make the rest of the page look out of proportion — see and related radars. Covered by 5 new layout tests, and by adjusting a couple of existing layout tests. See comments below for more details. * Platform/Logging.h: Add a new ViewportSizing logging channel. This will only log on pages that overflow the viewport and shrink to fit as a result. * Shared/WebPreferences.yaml: Turn IgnoreViewportScalingConstraints off by default. This preference currently controls whether we allow shrink-to-fit behaviors, and is only used by Safari when it is in multitasking mode. The value of this preference is currenly *on* by default, and is turned off almost immediately during every page load after the first visible content rect update, wherein visibleContentRectUpdateInfo.allowShrinkToFit() is false. However, this sometimes causes a brief jitter during page load; to fix this, make the default value for IgnoreViewportScalingConstraints false, and change the logic in WebPage::updateVisibleContentRects to setCanIgnoreScalingConstraints to true if either the IgnoreViewportScalingConstraints preference (not only affected by an internal debug switch) is true, or WKWebView SPI is used to enable the behavior. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad): (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad): Add a new hook for WebFrameLoaderClient to call into WebPage when document load finishes. Also, tweak dispatchDidFinishLoad to take a WebFrame& instead of a WebFrame* in a drive-by fix (the frame is assumed to be non-null anyways). * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): (WebKit::WebPage::didFinishDocumentLoad): (WebKit::WebPage::didFinishLoad): When finishing document load or finishing the overall load, kick off the shrink-to-fit timer; when committing a load, cancel the timer. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::setViewportConfigurationViewLayoutSize): Don't allow the minimum effective device width from the client to stomp over any minimum effective device width set as a result of the new shrink-to-fit heuristic; on some pages that load quickly, this can result in a race where the minimum effective device width (i.e. a value that lower-bounds the minimum layout width) is first set by the shrink-to-fit heuristic, and then set to an incorrect value by the client. In the near future, web view SPI used to set the minimum effective device width should actually be removed altogether, since the new shrink-to-fit heuristic supersedes any need for the client to fiddle with the minimum effective device width. (WebKit::WebPage::dynamicViewportSizeUpdate): When performing a dynamic viewport size update, additionally re-run the shrink-to-fit heuristic. This allows the minimum layout size of the viewport to be updated, if necessary. An example of where this matters is when a web page is *below* a tablet/desktop layout breakpoint in portrait device orientation, but then exceeds this layout breakpoint in landscape orientation. In this scenario, rotating the device should swap between these two page layouts. (WebKit::WebPage::resetViewportDefaultConfiguration): (WebKit::WebPage::scheduleShrinkToFitContent): (WebKit::WebPage::shrinkToFitContentTimerFired): (WebKit::WebPage::immediatelyShrinkToFitContent): Leverage the existing capability for a viewport to have a "minimum effective device width" to grant the viewport a larger layout size than it would normally have, and then scale down to fit within the bounds of the view. One challenge with this overall approach is that laying out at a larger width may cause the page to lay out even wider in response, which may actually worsen horizontal scrolling. To mitigate this, we only attempt to lay out at the current content width once; if laying out at this width reduced the amount of horizontal scrolling by any amount, then proceed with this layout width; otherwise, revert to the previous layout width. (WebKit::WebPage::shouldIgnoreMetaViewport const): Pull some common logic out into a readonly getter. (WebKit::WebPage::updateVisibleContentRects): See the comment below WebPreferences.yaml, above. 2019-05-01 Dean Jackson Link Previews that use WKImagePreviewViewController are not always scaled correctly https://bugs.webkit.org/show_bug.cgi?id=197450 Reviewed by Wenson Hsieh. Tell the UIImageView that we create in WKImagePreviewViewController to use a filling scaling method. * UIProcess/WKImagePreviewViewController.mm: (-[WKImagePreviewViewController initWithCGImage:defaultActions:elementInfo:]): 2019-05-01 Darin Adler WebKit has too much of its own UTF-8 code and should rely more on ICU's UTF-8 support https://bugs.webkit.org/show_bug.cgi?id=195535 Reviewed by Alexey Proskuryakov. * Shared/API/APIString.h: Removed uneeded includes and also switched to #pragma once. * Shared/API/c/WKString.cpp: Moved include of UTF8Conversion.h here. (WKStringGetUTF8CStringImpl): Updated for changes to return values. 2019-05-01 Shawn Roberts Unreviewed, rolling out r244821. Causing Reverted changeset: "WebKit has too much of its own UTF-8 code and should rely more on ICU's UTF-8 support" https://bugs.webkit.org/show_bug.cgi?id=195535 https://trac.webkit.org/changeset/244821 2019-05-01 Youenn Fablet Kept alive loaders should use the redirected request in case of redirections https://bugs.webkit.org/show_bug.cgi?id=197337 Reviewed by Alex Christensen. Instead of using the request, the redirected request should be used in case of redirection. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::m_shouldCaptureExtraNetworkLoadMetrics): (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): 2019-04-29 Darin Adler WebKit has too much of its own UTF-8 code and should rely more on ICU's UTF-8 support https://bugs.webkit.org/show_bug.cgi?id=195535 Reviewed by Alexey Proskuryakov. * Shared/API/APIString.h: Removed uneeded includes and also switched to #pragma once. * Shared/API/c/WKString.cpp: Moved include of UTF8Conversion.h here. (WKStringGetUTF8CStringImpl): Updated for changes to return values. 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),