Regression(PSON) Scroll position is not always restored properly when navigating...
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-01-18  Chris Dumez  <cdumez@apple.com>
2
3         Regression(PSON) Scroll position is not always restored properly when navigating back
4         https://bugs.webkit.org/show_bug.cgi?id=193578
5         <rdar://problem/47386331>
6
7         Reviewed by Tim Horton.
8
9         Fix issues causing the scroll position to not be restored at all (or incorrectly) when
10         navigating back cross-site with PSON enabled. Also make sure that the swipe gesture
11         snapshot really stays up until we've restored the scroll position.
12
13         Note that even after those changes, I can still sometimes reproduce a white flash when
14         swiping back to Google search results (scroll position being correct now). This is
15         tracked by <rdar://problem/47071684> and happens even if I disable PSON entirely.
16
17         * Shared/SessionState.cpp:
18         (WebKit::FrameState::encode const):
19         (WebKit::FrameState::decode):
20         * Shared/SessionState.h:
21         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
22         (WebKit::toFrameState):
23         (WebKit::applyFrameState):
24         obscuredInsets is present on the HistoryItem in the WebProcess but was never passed to
25         or stored by the UIProcess on the WebBackForwardListItem. obscuredInsets is needed to
26         properly restore the scrollPosition (position was 70px off on my iPad without this).
27         With PSON enabled, if you swipe back cross-process and the previous page was not put
28         into PageCache, then the HistoryItem is gone on the WebProcess side. What happens is
29         that the UIProcess sends its WebBackForwardListItem to the WebProcess, which restores
30         the HistoryItem there, and then asks it to load it. The obscuredInsets was getting lost
31         in the process since the UIProcess never knew about it.
32
33         * UIProcess/Cocoa/ViewGestureController.cpp:
34         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
35         Drop logic that was causing the ViewGestureController to not wait for the scroll position
36         to be restored before taking down the snapshot, when UI-side compositing is enabled.
37         If you look at the comment above the code, you'll see that the code in question was meant
38         to impact only the non-UI side compositing code path. As a matter of fact, when the code
39         was reviewed at https://bugs.webkit.org/show_bug.cgi?id=151224, it was protected by a
40         #if PLATFORM(MAC), before getting modified the wrong way before landing. In practice, we
41         would have often restored the scroll position by the time the load is finished so it would
42         not cause a flash in most cases. However, with PSON enabled and the layer tree freezing we
43         do on process-swap, the first post-scroll restoration layer tree commit may now occur a
44         little bit later and we would lose the race more often.
45
46         * UIProcess/WebProcessProxy.cpp:
47         (WebKit::WebProcessProxy::updateBackForwardItem):
48         * UIProcess/WebProcessProxy.h:
49         When adding PageCache support to PSON, we used to navigate the "suspended" page to
50         about:blank. This would lead to unwanted WebProcessProxy::updateBackForwardItem()
51         calls from the WebProcess which we wanted to ignore. We thus added logic to ignore
52         updateBackForwardItem() IPC from the old WebProcess after a swap. The issue with this
53         is that we sometimes miss/ignore legit updates to the HistoryItem from the old process,
54         in particular with regards to the scroll position and the pageScaleFactor. So if you
55         swiped and then quickly enough did a cross-site navigation, the UIProcess'
56         WebBackForwardList would not get updated with the latest scroll position and we would
57         thus fail to restore it later on. To address the issue, we now stop ignoring updates
58         from the old WebProcess after a swap. This logic is no longer needed since we no longer
59         navigate the old page to about:blank after a swap, we merely suspend it "in place".
60
61 2019-01-18  Wenson Hsieh  <wenson_hsieh@apple.com>
62
63         Remove some last vestiges of assisted node terminology in WebKit
64         https://bugs.webkit.org/show_bug.cgi?id=193572
65
66         Reviewed by Tim Horton.
67
68         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
69         * UIProcess/ios/WKContentViewInteraction.mm:
70         (-[WKContentView gestureRecognizerShouldBegin:]):
71         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
72         (-[WKContentView _showKeyboard]):
73         (-[WKContentView _hideKeyboard]):
74
75         Add a FIXME about invoking `-reloadInputViews` on watchOS when the focused element is blurred.
76
77         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
78         (-[WKContentView _elementDidBlur]):
79         (-[WKContentView updateCurrentFocusedElementInformation:]):
80         (-[WKContentView _startAssistingKeyboard]): Deleted.
81         (-[WKContentView _stopAssistingKeyboard]): Deleted.
82         * WebProcess/WebPage/ios/WebPageIOS.mm:
83         (WebKit::WebPage::getFocusedElementInformation):
84
85 2019-01-18  Youenn Fablet  <youenn@apple.com>
86
87         Add a new SPI to request for cache storage quota increase
88         https://bugs.webkit.org/show_bug.cgi?id=193323
89
90         Reviewed by Alex Christensen.
91
92         Add a delegate on the WebSiteDataStore for WebKit to ask for quota update.
93         The current SPI is currently CacheStorage specific but future work should
94         make it so that other storage like IDB use the same mechanism.
95         By default, quota remains unchanged if delegate is not implemented.
96
97         * NetworkProcess/NetworkProcess.cpp:
98         * UIProcess/API/Cocoa/WKStorageQuotaDelegatePrivate.h: Added.
99         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
100         (WebsiteDataStoreQuotaManager::WebsiteDataStoreQuotaManager):
101         (-[WKWebsiteDataStore _quotaDelegate]):
102         (-[WKWebsiteDataStore set_quotaDelegate:]):
103         * UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h:
104         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
105         * UIProcess/Network/NetworkProcessProxy.cpp:
106         (WebKit::NetworkProcessProxy::requestCacheStorageSpace):
107         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
108         (WebKit::WebsiteDataStore::WebsiteDataStore):
109         * UIProcess/WebsiteData/WebsiteDataStore.h:
110         (WebKit::WebsiteDataStore::quotaManager):
111         (WebKit::WebsiteDataStore::setQuotaManager):
112         * UIProcess/WebsiteData/WebsiteDataStoreQuotaManager.h: Added.
113         (WebKit::WebsiteDataStoreQuotaManager::~WebsiteDataStoreQuotaManager):
114         (WebKit::WebsiteDataStoreQuotaManager::requestCacheStorageSpace):
115         * WebKit.xcodeproj/project.pbxproj:
116
117 2019-01-18  Philippe Normand  <pnormand@igalia.com>
118
119         [WPE] Add Qt extension
120         https://bugs.webkit.org/show_bug.cgi?id=191464
121
122         Reviewed by Carlos Garcia Campos.
123
124         This new extension is a QML plugin embedding a WPE ViewBackend
125         implementation. It provides a public API very similar to Qt's
126         WebView module. It comes with a simple mini-browser implemented in
127         QML.
128
129         QtWPE is known to work with the Wayland-EGL (in GNOME and Weston
130         compositors) and EGLFS QPAs.
131
132         * PlatformWPE.cmake:
133         * UIProcess/API/wpe/qt/WPEQmlExtensionPlugin.cpp: Added.
134         (WPEQmlExtensionPlugin::registerTypes):
135         * UIProcess/API/wpe/qt/WPEQmlExtensionPlugin.h: Added.
136         * UIProcess/API/wpe/qt/WPEQtView.cpp: Added.
137         (WPEQtView::WPEQtView):
138         (WPEQtView::~WPEQtView):
139         (WPEQtView::geometryChanged):
140         (WPEQtView::configureWindow):
141         (WPEQtView::createOffscreen):
142         (WPEQtView::backendCreated):
143         (WPEQtView::notifyUrlChangedCallback):
144         (WPEQtView::notifyTitleChangedCallback):
145         (WPEQtView::notifyLoadProgressCallback):
146         (WPEQtView::notifyLoadChangedCallback):
147         (WPEQtView::notifyLoadFailedCallback):
148         (WPEQtView::updatePaintNode):
149         (WPEQtView::url const):
150         (WPEQtView::setUrl):
151         (WPEQtView::loadProgress const):
152         (WPEQtView::title const):
153         (WPEQtView::canGoBack const):
154         (WPEQtView::isLoading const):
155         (WPEQtView::canGoForward const):
156         (WPEQtView::goBack):
157         (WPEQtView::goForward):
158         (WPEQtView::reload):
159         (WPEQtView::stop):
160         (WPEQtView::loadHtml):
161         (WPEQtView::jsAsyncReadyCallback):
162         (WPEQtView::handleJsResult):
163         (WPEQtView::runJavaScript):
164         (WPEQtView::mousePressEvent):
165         (WPEQtView::mouseReleaseEvent):
166         (WPEQtView::hoverEnterEvent):
167         (WPEQtView::hoverLeaveEvent):
168         (WPEQtView::hoverMoveEvent):
169         (WPEQtView::wheelEvent):
170         (WPEQtView::keyPressEvent):
171         (WPEQtView::keyReleaseEvent):
172         (WPEQtView::touchEvent):
173         * UIProcess/API/wpe/qt/WPEQtView.h: Added.
174         * UIProcess/API/wpe/qt/WPEQtViewBackend.cpp: Added.
175         (configureCallback):
176         (WPEQtViewBackend::WPEQtViewBackend):
177         (WPEQtViewBackend::~WPEQtViewBackend):
178         (WPEQtViewBackend::configureGlibEglDisplay):
179         (WPEQtViewBackend::configureEglDisplay):
180         (WPEQtViewBackend::initialize):
181         (WPEQtViewBackend::backend const):
182         (WPEQtViewBackend::resize):
183         (WPEQtViewBackend::getTexture):
184         (WPEQtViewBackend::initSurface):
185         (WPEQtViewBackend::displayImage):
186         (WPEQtViewBackend::modifiers const):
187         (WPEQtViewBackend::dispatchHoverEnterEvent):
188         (WPEQtViewBackend::dispatchHoverLeaveEvent):
189         (WPEQtViewBackend::dispatchHoverMoveEvent):
190         (WPEQtViewBackend::dispatchMousePressEvent):
191         (WPEQtViewBackend::dispatchMouseReleaseEvent):
192         (WPEQtViewBackend::dispatchWheelEvent):
193         (WPEQtViewBackend::dispatchKeyEvent):
194         (WPEQtViewBackend::dispatchTouchEvent):
195         * UIProcess/API/wpe/qt/WPEQtViewBackend.h: Added.
196         * UIProcess/API/wpe/qt/WPEQtViewLoadRequest.cpp: Added.
197         (WPEQtViewLoadRequest::WPEQtViewLoadRequest):
198         (WPEQtViewLoadRequest::~WPEQtViewLoadRequest):
199         (WPEQtViewLoadRequest::url const):
200         (WPEQtViewLoadRequest::status const):
201         (WPEQtViewLoadRequest::errorString const):
202         * UIProcess/API/wpe/qt/WPEQtViewLoadRequest.h: Added.
203         * UIProcess/API/wpe/qt/WPEQtViewLoadRequestPrivate.h: Added.
204         (WPEQtViewLoadRequestPrivate::WPEQtViewLoadRequestPrivate):
205         (WPEQtViewLoadRequestPrivate::~WPEQtViewLoadRequestPrivate):
206         * UIProcess/API/wpe/qt/qmldir: Added.
207
208 2019-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
209
210         [iOS] Content offset jumps erratically when autoscrolling near scroll view content inset areas
211         https://bugs.webkit.org/show_bug.cgi?id=193494
212         <rdar://problem/46859627>
213
214         Reviewed by Simon Fraser and Tim Horton.
215
216         Adds `contentInsets` to `VisibleContentRectUpdateInfo`. This keeps track of the visible content insets
217         surrounding the unobscured content rect. See WebCore ChangeLog for more details.
218
219         * Shared/VisibleContentRectUpdateInfo.cpp:
220         (WebKit::VisibleContentRectUpdateInfo::encode const):
221         (WebKit::VisibleContentRectUpdateInfo::decode):
222         (WebKit::operator<<):
223         * Shared/VisibleContentRectUpdateInfo.h:
224         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
225         (WebKit::VisibleContentRectUpdateInfo::contentInsets const):
226         (WebKit::operator==):
227         * UIProcess/API/Cocoa/WKWebView.mm:
228         (-[WKWebView _computedObscuredInset]):
229         (-[WKWebView _computedContentInset]):
230         (-[WKWebView _computedUnobscuredSafeAreaInset]):
231
232         We don't care about source compatibility with iOS 10 and below anymore, so we should change these >= iOS 11
233         target checks to simply `PLATFORM(IOS)`.
234
235         (-[WKWebView _updateVisibleContentRects]):
236
237         Compute the visible content insets on all sides of the unobscured content rect. These insets are scaled to
238         content coordinates.
239
240         * UIProcess/ios/WKContentView.h:
241         * UIProcess/ios/WKContentView.mm:
242         (floatBoxExtent):
243
244         Add a helper to convert `UIEdgeInsets` to `WebCore::FloatBoxExtent`, and use it in a few places below.
245
246         (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
247         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): Deleted.
248         * WebProcess/WebPage/ios/WebPageIOS.mm:
249         (WebKit::WebPage::updateVisibleContentRects):
250
251         Update the Page's content insets.
252
253 2019-01-17  Truitt Savell  <tsavell@apple.com>
254
255         Unreviewed, rolling out r240124.
256
257         This commit broke an internal build.
258
259         Reverted changeset:
260
261         "SDK_VARIANT build destinations should be separate from non-
262         SDK_VARIANT builds"
263         https://bugs.webkit.org/show_bug.cgi?id=189553
264         https://trac.webkit.org/changeset/240124
265
266 2019-01-17  John Wilander  <wilander@apple.com>
267
268         Add infrastructure to enable/disable ITP Debug Mode through Preferences
269         https://bugs.webkit.org/show_bug.cgi?id=193510
270         <rdar://problem/47330969>
271
272         Reviewed by Dean Jackson.
273
274         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
275         (WebKit::ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode):
276         (WebKit::ResourceLoadStatisticsMemoryStore::setResourceLoadStatisticsDebugMode):
277         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode):
278             These functions are now suited for runtime switching of ITP Debug Mode.
279         * Shared/WebPreferences.yaml:
280             Changed name from ResourceLoadStatisticsDebugMode to ItpDebugModeEnabled.
281         * UIProcess/API/Cocoa/WKPreferences.mm:
282         (-[WKPreferences _setItpDebugModeEnabled:]):
283         (-[WKPreferences _itpDebugModeEnabled]):
284             New private preferences functions.
285         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
286         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
287         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
288             Removed support for old experimental user default. Added a new one that's
289             not connected to any UI, i.e. merely for command line debugging where
290             ITP Debug Mode needs to be on all the time.
291
292 2019-01-17  Tim Horton  <timothy_horton@apple.com>
293
294         Adopt NSTextCheckingSuppressInitialCapitalizationKey
295         https://bugs.webkit.org/show_bug.cgi?id=193545
296
297         Reviewed by Dean Jackson.
298
299         * UIProcess/mac/TextCheckerMac.mm:
300         (WebKit::TextChecker::checkTextOfParagraph):
301         (WebKit::TextChecker::getGuessesForWord):
302
303 2019-01-17  Jer Noble  <jer.noble@apple.com>
304
305         SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds
306         https://bugs.webkit.org/show_bug.cgi?id=189553
307
308         Reviewed by Tim Horton.
309
310         * Configurations/Base.xcconfig:
311         * Configurations/BaseTarget.xcconfig:
312         * Configurations/SDKVariant.xcconfig: Added.
313
314 2019-01-16  Dean Jackson  <dino@apple.com>
315
316         (iPad) Link tapping is sluggish on many sites
317         https://bugs.webkit.org/show_bug.cgi?id=193522
318         <rdar://problem/47102987>
319
320         Reviewed by Wenson Hsieh.
321
322         Some WKWebView clients might set the initial zoom scale of the page to
323         something other than 1, which disables the "fast tap" behaviour.
324         The fix is very simple -- just check against the initial scale rather
325         than 1.
326
327         The most likely regression from this would be pages designed for desktop,
328         but provide a viewport tag saying width=device-width and initial-scale.
329         They might stop allowing double-tap-to-zoom.
330
331         * UIProcess/API/Cocoa/WKWebView.mm:
332         (-[WKWebView _allowsDoubleTapGestures]): Check against initial page scale.
333
334 2019-01-17  Alex Christensen  <achristensen@webkit.org>
335
336         Stop using NetworkStorageSession::storageSession in WebCore
337         https://bugs.webkit.org/show_bug.cgi?id=193529
338
339         Reviewed by Tim Horton.
340
341         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
342         (WebKit::NetworkConnectionToWebProcess::createSocketStream):
343         * NetworkProcess/NetworkProcess.h:
344         * NetworkProcess/NetworkSocketStream.cpp:
345         (WebKit::NetworkSocketStream::create):
346         (WebKit::NetworkSocketStream::NetworkSocketStream):
347         * NetworkProcess/NetworkSocketStream.h:
348         * NetworkProcess/NetworkStorageSessionProvider.h: Added.
349         * WebKit.xcodeproj/project.pbxproj:
350         * WebProcess/Network/WebSocketProvider.cpp:
351         (WebKit::WebSocketProvider::createSocketStreamHandle):
352         * WebProcess/Network/WebSocketProvider.h:
353         * WebProcess/WebPage/WebCookieJar.cpp:
354         (WebKit::WebCookieJar::WebCookieJar):
355         * WebProcess/WebPage/WebCookieJar.h:
356
357 2019-01-16  Youenn Fablet  <youenn@apple.com>
358
359         Add a new SPI for controlling getUserMedia
360         https://bugs.webkit.org/show_bug.cgi?id=192793
361
362         Reviewed by Eric Carlson.
363
364         Some weaknesses of the current getUserMedia/enumerateDevices SPI were found.
365         In particular:
366         - The hash salt should be handled by WebKit not by apps using WebKit.
367         - No need to expose the frame URL, only the top level origin is needed.
368         - The names of the callback are changed to improve the intent of these callbacks.
369         Addressed these by creating a new SPI which will replace the current one.
370         The current SPI will be removed later on.
371
372         Did some refactoring by making the callbacks not return false.
373         Instead, implement the default behavior inside the request objects as deny methods.
374         Some further refactoring will be done as a follow-up to better align the C API with the Cocoa API.
375
376         * UIProcess/API/APIUIClient.h:
377         (API::UIClient::decidePolicyForUserMediaPermissionRequest):
378         (API::UIClient::checkUserMediaPermissionForOrigin):
379         * UIProcess/API/C/WKPage.cpp:
380         (WKPageSetPageUIClient):
381         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
382         * UIProcess/API/Cocoa/WKWebView.mm:
383         (-[WKWebView _mediaCaptureState]):
384         (-[WKWebView _setMediaCaptureMuted:]):
385         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
386         * UIProcess/API/glib/WebKitUIClient.cpp:
387         * UIProcess/Cocoa/MediaCaptureUtilities.h: Added.
388         * UIProcess/Cocoa/MediaCaptureUtilities.mm: Added.
389         * UIProcess/Cocoa/UIDelegate.h:
390         * UIProcess/Cocoa/UIDelegate.mm:
391         (WebKit::UIDelegate::setDelegate):
392         (WebKit::requestUserMediaAuthorizationForFrame):
393         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
394         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
395         (WebKit::UIDelegate::UIClient::mediaCaptureStateDidChange):
396         * UIProcess/UserMediaPermissionCheckProxy.h:
397         (WebKit::UserMediaPermissionCheckProxy::deny):
398         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
399         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
400         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
401         * UIProcess/UserMediaPermissionRequestProxy.h:
402
403 2019-01-16  Youenn Fablet  <youenn@apple.com>
404
405         Pipe cache quota request from Network Process to UIProcess
406         https://bugs.webkit.org/show_bug.cgi?id=193296
407
408         Reviewed by Alex Christensen.
409
410         When cache storage hits quota for a given origin, pipe the request back to NetworkProcess.
411         No record will be put until the quota request is answered.
412         The request is sent from CacheStorage::Caches to CacheStorage::Engine and to NetworkProcess.
413         NetworkProcess then sends it to NetworkProcessProxy.
414         Currently NetworkProcessProxy just answers by keeping the quota as it is.
415         In the future, NetworkProcessProxy should make a delegate call to let the app using WebKit
416         make a decision on the quota. This will allow prompting user to bump it as done for other data.
417
418         * NetworkProcess/NetworkProcess.cpp:
419         (WebKit::NetworkProcess::requestCacheStorageSpace):
420         * NetworkProcess/NetworkProcess.h:
421         * NetworkProcess/cache/CacheStorageEngine.cpp:
422         (WebKit::CacheStorage::Engine::~Engine):
423         (WebKit::CacheStorage::Engine::from):
424         (WebKit::CacheStorage::Engine::Engine):
425         (WebKit::CacheStorage::Engine::requestSpace):
426         (WebKit::CacheStorage::Engine::requestSpaceCompleted):
427         * NetworkProcess/cache/CacheStorageEngine.h:
428         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
429         (WebKit::CacheStorage::Cache::put):
430         (WebKit::CacheStorage::Cache::retryPuttingPendingRecords):
431         * NetworkProcess/cache/CacheStorageEngineCache.h:
432         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
433         (WebKit::CacheStorage::Caches::requestSpace):
434         (WebKit::CacheStorage::Caches::notifyCachesOfRequestSpaceEnd):
435         * NetworkProcess/cache/CacheStorageEngineCaches.h:
436         (WebKit::CacheStorage::Caches::isRequestingSpace const):
437         * UIProcess/Network/NetworkProcessProxy.cpp:
438         (WebKit::NetworkProcessProxy::requestCacheStorageSpace):
439         * UIProcess/Network/NetworkProcessProxy.h:
440         * UIProcess/Network/NetworkProcessProxy.messages.in:
441
442 2019-01-16  Alex Christensen  <achristensen@webkit.org>
443
444         sendBeacon to previously-unvisited https domain always fails
445         https://bugs.webkit.org/show_bug.cgi?id=193508
446
447         Reviewed by Geoffrey Garen.
448
449         * NetworkProcess/PingLoad.cpp:
450         (WebKit::PingLoad::didReceiveChallenge):
451         If a ping load is doing a TLS handshake, continue if the server has good certificates.
452
453 2019-01-16  Youenn Fablet  <youenn@apple.com>
454
455         ASSERTION FAILED: m_networkLoadInformationByID.contains(identifier) in WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics
456         https://bugs.webkit.org/show_bug.cgi?id=189097
457         <rdar://problem/43856423>
458
459         Reviewed by Alex Christensen.
460
461         In case where the inspector is launched, it will instruct the NetworkConnectionToWebProcess to start capturing network metrics.
462         If this happens in the middle of a load, addNetworkLoadInformationMetrics might fail since addNetworkLoadInformation will not be called.
463         To fix this issue, store whether to capture metrics at NetworkResourceLoader level.
464
465         To ensure that the case of switching back and forth capture of metrics, disable loader capture of metrics whenver NetworkConnectionToWebProcess is asked to.
466
467         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
468         (WebKit::NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled):
469         * NetworkProcess/NetworkConnectionToWebProcess.h:
470         (WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics):
471         * NetworkProcess/NetworkResourceLoader.cpp:
472         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
473         (WebKit::NetworkResourceLoader::shouldCaptureExtraNetworkLoadMetrics const):
474         * NetworkProcess/NetworkResourceLoader.h:
475
476 2019-01-16  Alex Christensen  <achristensen@webkit.org>
477
478         Revert r239938
479         https://bugs.webkit.org/show_bug.cgi?id=193267
480         <rdar://problem/47297304>
481
482         * Configurations/WebContent-iOS.entitlements:
483
484 2019-01-16  Chris Dumez  <cdumez@apple.com>
485
486         Regression(r240046) Several API tests are crashing
487         https://bugs.webkit.org/show_bug.cgi?id=193509
488
489         Reviewed by Geoffrey Garen.
490
491         The crashes would happen because loadRequestShared() would take a WebProcessProxy& in parameter but
492         then call reattachToWebProcess() if the page is not valid, which would replace m_process and invalidate
493         our process reference.
494
495         To address the issue, move the reattachToWebProcess() call to loadRequest(), before calling
496         loadRequestShared(). Also, update *Shared() methods to take a Ref<WebProcessProxy>&& instead
497         of a WebProcessProxy& in parameter. Since we call client delegates, we need to make sure
498         our process stays alive.
499
500         * UIProcess/ProvisionalPageProxy.cpp:
501         (WebKit::ProvisionalPageProxy::loadData):
502         (WebKit::ProvisionalPageProxy::loadRequest):
503         (WebKit::ProvisionalPageProxy::didCreateMainFrame):
504         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
505         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
506         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
507         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
508         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
509         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
510         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
511         (WebKit::ProvisionalPageProxy::startURLSchemeTask):
512         (WebKit::ProvisionalPageProxy::backForwardGoToItem):
513         * UIProcess/WebPageProxy.cpp:
514         (WebKit::WebPageProxy::loadRequest):
515         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
516         (WebKit::WebPageProxy::loadData):
517         (WebKit::WebPageProxy::loadDataWithNavigationShared):
518         (WebKit::WebPageProxy::didPerformDragControllerAction):
519         (WebKit::WebPageProxy::findPlugin):
520         (WebKit::WebPageProxy::didCreateMainFrame):
521         (WebKit::WebPageProxy::didCreateSubframe):
522         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
523         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
524         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
525         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared):
526         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
527         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
528         (WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
529         (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared):
530         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
531         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
532         (WebKit::WebPageProxy::didCommitLoadForFrame):
533         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
534         (WebKit::WebPageProxy::didFinishLoadForFrame):
535         (WebKit::WebPageProxy::didFailLoadForFrame):
536         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
537         (WebKit::WebPageProxy::didReceiveTitleForFrame):
538         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
539         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
540         (WebKit::WebPageProxy::didRunInsecureContentForFrame):
541         (WebKit::WebPageProxy::frameDidBecomeFrameSet):
542         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
543         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
544         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
545         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
546         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
547         (WebKit::WebPageProxy::decidePolicyForResponse):
548         (WebKit::WebPageProxy::decidePolicyForResponseShared):
549         (WebKit::WebPageProxy::unableToImplementPolicy):
550         (WebKit::WebPageProxy::willSubmitForm):
551         (WebKit::WebPageProxy::didNavigateWithNavigationData):
552         (WebKit::WebPageProxy::didNavigateWithNavigationDataShared):
553         (WebKit::WebPageProxy::didPerformClientRedirect):
554         (WebKit::WebPageProxy::didPerformClientRedirectShared):
555         (WebKit::WebPageProxy::didPerformServerRedirect):
556         (WebKit::WebPageProxy::didUpdateHistoryTitle):
557         (WebKit::WebPageProxy::createNewPage):
558         (WebKit::WebPageProxy::runJavaScriptAlert):
559         (WebKit::WebPageProxy::runJavaScriptConfirm):
560         (WebKit::WebPageProxy::runJavaScriptPrompt):
561         (WebKit::WebPageProxy::unavailablePluginButtonClicked):
562         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
563         (WebKit::WebPageProxy::runOpenPanel):
564         (WebKit::WebPageProxy::printFrame):
565         (WebKit::WebPageProxy::backForwardGoToItem):
566         (WebKit::WebPageProxy::backForwardGoToItemShared):
567         (WebKit::WebPageProxy::learnWord):
568         (WebKit::WebPageProxy::ignoreWord):
569         (WebKit::WebPageProxy::didReceiveEvent):
570         (WebKit::WebPageProxy::editingRangeCallback):
571         (WebKit::WebPageProxy::rectForCharacterRangeCallback):
572         (WebKit::WebPageProxy::focusedFrameChanged):
573         (WebKit::WebPageProxy::frameSetLargestFrameChanged):
574         (WebKit::WebPageProxy::exceededDatabaseQuota):
575         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
576         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
577         (WebKit::WebPageProxy::enumerateMediaDevicesForFrame):
578         (WebKit::WebPageProxy::startURLSchemeTask):
579         (WebKit::WebPageProxy::startURLSchemeTaskShared):
580         (WebKit::WebPageProxy::stopURLSchemeTask):
581         (WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
582         * UIProcess/WebPageProxy.h:
583
584 2019-01-16  Chris Dumez  <cdumez@apple.com>
585
586         Regression(PSON) View becomes blank after click a cross-site download link
587         https://bugs.webkit.org/show_bug.cgi?id=193361
588         <rdar://problem/47099573>
589
590         Reviewed by Geoffrey Garen.
591
592         The issue tracked by rdar://problem/47099573 is that a provisional load may get
593         canceled (or converted into a download) *after* we've decided to process-swap.
594         In such cases, the view should keep displaying the current site and it should
595         still be interactive. However, with the previous PSON model, the view (pageProxy)
596         would have already swapped to the new process and would end up displaying the
597         initially empty document.
598
599         To address the issue, this patch introduces the concept of a provisional load
600         in the UIProcess, handled by a ProvisionalPageProxy which has its own privisional
601         process. The WebPageProxy owns the ProvisionalPageProxy but we do not commit the
602         provisional page until after the load was committed in the new process. This means
603         that the view / WebPageProxy keeps using the old process and displays the current
604         content until a load has committed in the provisional page. If no load commits
605         in the provisional process (e.g. because the load is cancelled or converted into
606         a download), then we merely destroy the ProvisionalPageProxy and terminate its
607         process, without impacting the WebPageProxy.
608
609         * Shared/WebPageCreationParameters.cpp:
610         (WebKit::WebPageCreationParameters::encode const):
611         (WebKit::WebPageCreationParameters::decode):
612         * Shared/WebPageCreationParameters.h:
613         Rename isSwapFromSuspended to isProcessSwap for clarity as we always want to
614         delay attaching the drawing area in case of a process-swap, no matter what
615         now that the previous process is kept alive until the provisional load is
616         committed in the new process.
617
618         * Shared/WebPolicyAction.h:
619         Drop Suspend policy action. At decidePolicyForNavigationAction time, in case of
620         process-swap, we now tell the previous process to simply ignore the load, while
621         we create a ProvisionalPageProxy to do the new load in a new process.
622         Suspension of the previous page in the old process, happens later, when a load
623         is actually committed in the new process.
624
625         * Sources.txt:
626         Add new ProvisionalPageProxy file.
627
628         * UIProcess/API/Cocoa/WKWebView.mm:
629         (-[WKWebView _killWebContentProcessAndResetState]):
630         When calling _killWebContentProcessAndResetState on a WKWebView, kill both the current
631         process and the provisional one, to maintain previous behavior in our API tests.
632
633         * UIProcess/API/gtk/PageClientImpl.cpp:
634         (WebKit::PageClientImpl::createDrawingAreaProxy):
635         * UIProcess/API/gtk/PageClientImpl.h:
636         * UIProcess/API/wpe/PageClientImpl.cpp:
637         (WebKit::PageClientImpl::createDrawingAreaProxy):
638         * UIProcess/API/wpe/PageClientImpl.h:
639         * UIProcess/AcceleratedDrawingAreaProxy.cpp:
640         (WebKit::AcceleratedDrawingAreaProxy::AcceleratedDrawingAreaProxy):
641         (WebKit::AcceleratedDrawingAreaProxy::didUpdateBackingStoreState):
642         (WebKit::AcceleratedDrawingAreaProxy::sendUpdateBackingStoreState):
643         (WebKit::AcceleratedDrawingAreaProxy::waitForAndDispatchDidUpdateBackingStoreState):
644         (WebKit::AcceleratedDrawingAreaProxy::setNativeSurfaceHandleForCompositing):
645         (WebKit::AcceleratedDrawingAreaProxy::destroyNativeSurfaceHandleForCompositing):
646         * UIProcess/AcceleratedDrawingAreaProxy.h:
647         * UIProcess/Cocoa/WebViewImpl.h:
648         * UIProcess/Cocoa/WebViewImpl.mm:
649         (WebKit::WebViewImpl::createDrawingAreaProxy):
650         * UIProcess/DrawingAreaProxy.cpp:
651         (WebKit::DrawingAreaProxy::DrawingAreaProxy):
652         (WebKit::DrawingAreaProxy::~DrawingAreaProxy):
653         (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired):
654         * UIProcess/DrawingAreaProxy.h:
655         (WebKit::DrawingAreaProxy::process):
656         * UIProcess/DrawingAreaProxyImpl.cpp:
657         (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl):
658         (WebKit::DrawingAreaProxyImpl::update):
659         * UIProcess/DrawingAreaProxyImpl.h:
660         * UIProcess/PageClient.h:
661         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
662         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
663         (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
664         (WebKit::RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy):
665         (WebKit::RemoteLayerTreeDrawingAreaProxy::deviceScaleFactorDidChange):
666         (WebKit::RemoteLayerTreeDrawingAreaProxy::sendUpdateGeometry):
667         (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidStart):
668         (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidEnd):
669         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
670         (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState):
671         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
672         * UIProcess/ios/PageClientImplIOS.h:
673         * UIProcess/ios/PageClientImplIOS.mm:
674         (WebKit::PageClientImpl::createDrawingAreaProxy):
675         * UIProcess/ios/WKContentView.h:
676         * UIProcess/ios/WKContentView.mm:
677         (-[WKContentView _createDrawingAreaProxy:]):
678         * UIProcess/mac/PageClientImplMac.h:
679         * UIProcess/mac/PageClientImplMac.mm:
680         (WebKit::PageClientImpl::createDrawingAreaProxy):
681         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
682         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
683         (WebKit::TiledCoreAnimationDrawingAreaProxy::TiledCoreAnimationDrawingAreaProxy):
684         (WebKit::TiledCoreAnimationDrawingAreaProxy::deviceScaleFactorDidChange):
685         (WebKit::TiledCoreAnimationDrawingAreaProxy::colorSpaceDidChange):
686         (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
687         (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence):
688         (WebKit::TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry):
689         (WebKit::TiledCoreAnimationDrawingAreaProxy::adjustTransientZoom):
690         (WebKit::TiledCoreAnimationDrawingAreaProxy::commitTransientZoom):
691         (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing):
692         * UIProcess/mac/WebPageProxyMac.mm:
693         * UIProcess/win/PageClientImpl.cpp:
694         (WebKit::PageClientImpl::createDrawingAreaProxy):
695         * UIProcess/win/PageClientImpl.h:
696         * UIProcess/win/PageClientImpl.cpp:
697         (WebKit::PageClientImpl::createDrawingAreaProxy):
698         * UIProcess/win/PageClientImpl.h:
699         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
700         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
701         Pass the drawing area's associated process when constructing it and store it as a member
702         in addition to the page. This is necessary now that a page can be associated with 2
703         WebProcesses at a time, each having its own drawing area.
704
705         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
706         (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded):
707         Pass the process.
708
709         * UIProcess/ProvisionalPageProxy.cpp: Added.
710         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
711         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
712         (WebKit::ProvisionalPageProxy::processDidTerminate):
713         (WebKit::ProvisionalPageProxy::takeDrawingArea):
714         (WebKit::ProvisionalPageProxy::cancel):
715         (WebKit::ProvisionalPageProxy::processDidFinishLaunching):
716         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch):
717         (WebKit::ProvisionalPageProxy::initializeWebPage):
718         (WebKit::ProvisionalPageProxy::loadData):
719         (WebKit::ProvisionalPageProxy::loadRequest):
720         (WebKit::ProvisionalPageProxy::goToBackForwardItem):
721         (WebKit::ProvisionalPageProxy::didCreateMainFrame):
722         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
723         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
724         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
725         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
726         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
727         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
728         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
729         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
730         (WebKit::ProvisionalPageProxy::startURLSchemeTask):
731         (WebKit::ProvisionalPageProxy::backForwardGoToItem):
732         (WebKit::ProvisionalPageProxy::didReceiveMessage):
733         (WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
734         * UIProcess/ProvisionalPageProxy.h: Added.
735         (WebKit::ProvisionalPageProxy::page):
736         (WebKit::ProvisionalPageProxy::mainFrame const):
737         (WebKit::ProvisionalPageProxy::process):
738         (WebKit::ProvisionalPageProxy::processSwapRequestedByClient const):
739         (WebKit::ProvisionalPageProxy::navigationID const):
740         (WebKit::ProvisionalPageProxy::drawingArea const):
741         New WebPageProxy-like class which is owned by the WebPageProxy and proxies IPC from
742         the provisional process.
743
744         * UIProcess/SuspendedPageProxy.cpp:
745         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
746         (WebKit::SuspendedPageProxy::unsuspend):
747         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
748         Unregister the SuspendedPageProxy as an IPC message receiver a little bit earlier
749         when we're going to unsuspend it. This avoids conflicting with the ProvisionalPageProxy
750         which tries to register itself as an IPC message receiver for the same pageID when
751         a process-swap occurs and we're switching to a suspended page.
752
753         * UIProcess/WebFrameProxy.cpp:
754         (WebKit::WebFrameProxy::isMainFrame const):
755         WebFrameProxy::isMainFrame() relies on checking that the frame is the WebPageProxy's m_mainFrame.
756         Now that the WebPageProxy can have a ProvisionalPageProxy, also check if it is the ProvisionalPageProxy's
757         m_mainFrame to maintain previous behavior.
758
759         * UIProcess/WebPageProxy.cpp:
760         (WebKit::WebPageProxy::provisionalDrawingArea const):
761         Add getter for the provisional drawing area. We normally only deal with the page's current drawing area, but
762         the ViewGestureController needs access to the provisional once to display the swipe gesture snapshot.
763
764         (WebKit::WebPageProxy::swapToWebProcess):
765         swapToWebProcess() no longer takes care of unsuspending the SuspendedPage because we now call swapToWebProcess()
766         later, when a load is actually committed in the provisional page / process. swapToWebProcess() now also needs
767         to initialize some data members such as the drawing area and the main frame as it is transferring them over from
768         the ProvisionalPageProxy which started the provisional load.
769
770         (WebKit::WebPageProxy::finishAttachingToWebProcess):
771         We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
772         committed in the provisional process.
773
774         (WebKit::WebPageProxy::setDrawingArea):
775         (WebKit::WebPageProxy::initializeWebPage):
776         - We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
777           committed in the provisional process.
778         - Factor some code out to WebPageProxy::setDrawingArea() so that it can be shared with swapToWebProcess().
779
780         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
781         (WebKit::WebPageProxy::loadRequest):
782         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
783         Only call setPendingAPIRequestURL() in loadRequestWithNavigation() only if ShouldTreatAsContinuingLoad is not
784         Yes. This avoids hitting some assertions as this was already called during the first API call if needed.
785
786         (WebKit::WebPageProxy::loadData):
787         (WebKit::WebPageProxy::loadDataWithNavigationShared):
788         (WebKit::WebPageProxy::stopLoading):
789         (WebKit::WebPageProxy::reload):
790         (WebKit::WebPageProxy::didPerformDragControllerAction):
791         (WebKit::WebPageProxy::findPlugin):
792         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
793         In case of process swap, tell the previous process to ignore the load instead of suspending it right away.
794         Suspension now happens later, only if we end up committing the provisional load in the new process.
795         Also discard the SuspendedPage if it failed to suspend (we only reuse its process in this case). This used
796         to happen a bit later but it is clearer if we do this as early as possible I think.
797
798         (WebKit::WebPageProxy::commitProvisionalPage):
799         When the load is committed in the new process, we call WebPageProxy::commitProvisionalPage(). It takes care of:
800         - Actually swapping the WebPageProxy to the new process by calling processDidTerminate() / swapToWebProcess().
801         - Suspending the current page.
802         - Letting the client know the load is comitted
803         - Destroy the ProvisionalPageProxy.
804         This work used to happen earlier in continueNavigationInNewProcess().
805
806         (WebKit::WebPageProxy::continueNavigationInNewProcess):
807         Moved some of the logic to commitProvisionalPage(). We now merely start the load in a new ProvisionalPageProxy,
808         without actually having the WebPageProxy switch to the new process yet.
809
810         (WebKit::WebPageProxy::didCreateMainFrame):
811         (WebKit::WebPageProxy::didCreateSubframe):
812         (WebKit::WebPageProxy::didCreateWindow):
813         Drop some code that is no longer needed, now that the ProvisionalPageProxy takes care of this.
814
815         (WebKit::WebPageProxy::didDestroyNavigation):
816         On process-swap, when telling the previous process to ignore the load and starting the new load in a new
817         ProvisionalPageProxy, the previous WebPage attempts to destroy the navigation. In this case, we ignore
818         the call since the navigation is merely taken over by the ProvisionalPageProxy.
819
820         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
821         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
822         Moved some PSON logic to the ProvisionalPageProxy instead.
823
824         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
825         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared):
826         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
827         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
828         (WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
829         (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared):
830
831         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
832         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
833         When didFailProvisionalLoadForFrame() is called for a ProvisionalPageProxy, destroy it.
834
835         (WebKit::WebPageProxy::didCommitLoadForFrame):
836         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
837         (WebKit::WebPageProxy::didFinishLoadForFrame):
838         (WebKit::WebPageProxy::didFailLoadForFrame):
839         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
840         (WebKit::WebPageProxy::didReceiveTitleForFrame):
841         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
842         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
843         (WebKit::WebPageProxy::didRunInsecureContentForFrame):
844         (WebKit::WebPageProxy::frameDidBecomeFrameSet):
845         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
846         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
847         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
848         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
849         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
850         (WebKit::WebPageProxy::decidePolicyForResponse):
851         (WebKit::WebPageProxy::decidePolicyForResponseShared):
852         (WebKit::WebPageProxy::unableToImplementPolicy):
853         (WebKit::WebPageProxy::willSubmitForm):
854         (WebKit::WebPageProxy::didNavigateWithNavigationData):
855         (WebKit::WebPageProxy::didNavigateWithNavigationDataShared):
856         (WebKit::WebPageProxy::didPerformClientRedirect):
857         (WebKit::WebPageProxy::didPerformClientRedirectShared):
858         (WebKit::WebPageProxy::didPerformServerRedirect):
859         (WebKit::WebPageProxy::didUpdateHistoryTitle):
860         (WebKit::WebPageProxy::createNewPage):
861         (WebKit::WebPageProxy::runJavaScriptAlert):
862         (WebKit::WebPageProxy::runJavaScriptConfirm):
863         (WebKit::WebPageProxy::runJavaScriptPrompt):
864         (WebKit::WebPageProxy::unavailablePluginButtonClicked):
865         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
866         (WebKit::WebPageProxy::runOpenPanel):
867         (WebKit::WebPageProxy::printFrame):
868         (WebKit::WebPageProxy::backForwardGoToItem):
869         (WebKit::WebPageProxy::backForwardGoToItemShared):
870         (WebKit::WebPageProxy::learnWord):
871         (WebKit::WebPageProxy::ignoreWord):
872         (WebKit::WebPageProxy::didReceiveEvent):
873         (WebKit::WebPageProxy::editingRangeCallback):
874         (WebKit::WebPageProxy::rectForCharacterRangeCallback):
875         (WebKit::WebPageProxy::focusedFrameChanged):
876         (WebKit::WebPageProxy::frameSetLargestFrameChanged):
877
878         (WebKit::WebPageProxy::provisionalProcessDidTerminate):
879         Cancel the provisiona load and destroy the ProvisionalPageProxy if
880         the provisional process crashes.
881
882         (WebKit::WebPageProxy::resetState):
883         Drop some code that is no longer needed.
884
885         (WebKit::WebPageProxy::creationParameters):
886         - Move the hasRegisteredServiceWorkers flag initialization from the call site to here now that we have
887         more than one call site. This was just some bad factoring.
888         - Take the process in parameter now that we page can be associated with several processes at a time.
889
890         (WebKit::WebPageProxy::exceededDatabaseQuota):
891         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
892         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
893         (WebKit::WebPageProxy::enumerateMediaDevicesForFrame):
894         (WebKit::WebPageProxy::startURLSchemeTask):
895         (WebKit::WebPageProxy::startURLSchemeTaskShared):
896         (WebKit::WebPageProxy::stopURLSchemeTask):
897         (WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
898         (WebKit::WebPageProxy::checkURLReceivedFromCurrentOrPreviousWebProcess):
899         (WebKit::WebPageProxy::willAcquireUniversalFileReadSandboxExtension):
900         * UIProcess/WebPageProxy.h:
901         (WebKit::WebPageProxy::visitedLinkStore):
902         (WebKit::WebPageProxy::provisionalPageProxy const):
903
904         * UIProcess/WebProcessProxy.cpp:
905         (WebKit::WebProcessProxy::hasProvisionalPageWithID const):
906         (WebKit::WebProcessProxy::updateBackForwardItem):
907         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
908         (WebKit::WebProcessProxy::didFinishLaunching):
909         (WebKit::WebProcessProxy::canTerminateChildProcess):
910         * UIProcess/WebProcessProxy.h:
911         (WebKit::WebProcessProxy::addProvisionalPageProxy):
912         (WebKit::WebProcessProxy::removeProvisionalPageProxy):
913         Before updating a BackForwardListItem, we normally make sure the process has a WebPageProxy with the
914         item's pageID. We have to tweak the logic because there may now be no WebPageProxy with this pageID
915         associated with this process yet, because it is still a ProvisionalPageProxy.        
916
917         * UIProcess/WebURLSchemeHandler.cpp:
918         (WebKit::WebURLSchemeHandler::startTask):
919         * UIProcess/WebURLSchemeHandler.h:
920         * UIProcess/WebURLSchemeTask.cpp:
921         (WebKit::WebURLSchemeTask::create):
922         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
923         (WebKit::WebURLSchemeTask::didPerformRedirection):
924         (WebKit::WebURLSchemeTask::didReceiveResponse):
925         (WebKit::WebURLSchemeTask::didReceiveData):
926         (WebKit::WebURLSchemeTask::didComplete):
927         (WebKit::WebURLSchemeTask::pageDestroyed):
928         * UIProcess/WebURLSchemeTask.h:
929         Pass the process when constructing a WebURLSchemeTask and store it as a data member in addition to
930         the page. This is necessary now that a WebPageProxy can be associated with several WebProcesses.
931
932         * UIProcess/ios/ViewGestureControllerIOS.mm:
933         (WebKit::ViewGestureController::endSwipeGesture):
934         Use the provisional drawing area to display the swipe snapshot as it may differ from the one currently
935         associated with the page in case of process swap.
936
937         * WebKit.xcodeproj/project.pbxproj:
938         Add ProvisionalPageProxy class.
939
940         * WebProcess/WebPage/WebFrame.cpp:
941         (WebKit::toPolicyAction):
942         (WebKit::WebFrame::didReceivePolicyDecision):
943         * WebProcess/WebPage/WebPage.cpp:
944         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
945         (WebKit::WebPage::reinitializeWebPage):
946         (WebKit::WebPage::didReceivePolicyDecision):
947         Stop dealing with WebPolicyAction::Suspend as it no longer exists.
948
949         (WebKit::WebPage::didCompletePageTransition):
950
951         (WebKit::WebPage::setIsSuspended):
952         Suspend the Page when setIsSuspended(true) is called, now that there is no longer a WebPolicyAction::Suspend.
953         setIsSuspended(true) IPC is sent when we actually commit the provisional page.
954
955         * WebProcess/WebPage/WebPage.h:
956
957 2019-01-16  Tim Horton  <timothy_horton@apple.com>
958
959         Frequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded()
960         https://bugs.webkit.org/show_bug.cgi?id=193468
961         <rdar://problem/38645869>
962
963         Reviewed by Zalan Bujtas.
964
965         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
966         (WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded):
967         Adjust the null-check a bit; Zalan pointed out that the layout could
968         be responsible for the Frame/RenderView going away, so we should bail
969         *after* layout, not before.
970
971 2019-01-15  Fujii Hironori  <Hironori.Fujii@sony.com>
972
973         Unreviewed WinCairo build fix.
974
975         * WebProcess/WebPage/WebPageInspectorTargetController.cpp:
976         (WebKit::WebPageInspectorTargetController::connectInspector): Use 'auto' instead of unprefixed InspectorTarget.
977         (WebKit::WebPageInspectorTargetController::disconnectInspector): Ditto.
978         (WebKit::WebPageInspectorTargetController::sendMessageToTargetBackend): Ditto.
979
980 2019-01-15  Alex Christensen  <achristensen@webkit.org>
981
982         Reduce use of NetworkStorageSession::defaultStorageSession in WebCore
983         https://bugs.webkit.org/show_bug.cgi?id=193368
984
985         Reviewed by Geoff Garen.
986
987         * WebProcess/Plugins/PluginView.cpp:
988         (WebKit::PluginView::getAuthenticationInfo):
989
990 2019-01-15  Alex Christensen  <achristensen@webkit.org>
991
992         Remove more NetworkProcess::singleton use
993         https://bugs.webkit.org/show_bug.cgi?id=193484
994
995         Reviewed by Geoffrey Garen.
996
997         This removes the use of NetworkProcess::singleton in the LegacyCustomProtocolManager.
998         This is the kind of awful duct tape code that keeps me awake at night, but it's necessary
999         because we can't quite remove LegacyCustomProtocolManager yet but we need to allow more than
1000         one NetworkProcess object.  To make it work well enough until we remove LegacyCustomProtocolManager,
1001         use the last NetworkProcess object that has been created.
1002
1003         * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
1004         (newestNetworkProcess):
1005         (LegacyCustomProtocolManager::networkProcessCreated):
1006         (+[WKCustomProtocol canInitWithRequest:]):
1007         (-[WKCustomProtocol initWithRequest:cachedResponse:client:]):
1008         (-[WKCustomProtocol startLoading]):
1009         (-[WKCustomProtocol stopLoading]):
1010         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
1011         (WebKit::LegacyCustomProtocolManager::LegacyCustomProtocolManager):
1012         (WebKit::LegacyCustomProtocolManager::startLoading):
1013         (WebKit::LegacyCustomProtocolManager::stopLoading):
1014         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
1015         * NetworkProcess/NetworkProcess.cpp:
1016         (WebKit::NetworkProcess::NetworkProcess):
1017
1018 2019-01-15  Alex Christensen  <achristensen@webkit.org>
1019
1020         Fix WinCairo build after r240014
1021         https://bugs.webkit.org/show_bug.cgi?id=161106
1022
1023         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1024
1025 2019-01-15  Ryosuke Niwa  <rniwa@webkit.org>
1026
1027         VisualViewport API should be updated upon opening of keyboard
1028         https://bugs.webkit.org/show_bug.cgi?id=193475
1029
1030         Reviewed by Simon Fraser.
1031
1032         The bug was caused by the changes to unobscuredContentRectRespectingInputViewBounds not updating the visual viewport
1033         unless it caused a layout to happen. Added a code to update the visual viewport in WebPage::updateVisibleContentRects.
1034
1035         Also fixed the bug that VisibleContentRectUpdateInfo::operator== was not checking differences in
1036         unobscuredContentRectRespectingInputViewBounds which resulted in the visual viewport override not getting updated
1037         while the keyboard is getting brought up.
1038
1039         * Shared/VisibleContentRectUpdateInfo.h:
1040         (WebKit::operator==):
1041         * WebProcess/WebPage/ios/WebPageIOS.mm:
1042         (WebKit::WebPage::updateVisibleContentRects):
1043
1044 2019-01-15  Megan Gardner  <megan_gardner@apple.com>
1045
1046         Add Reveal support in iOSMac
1047         https://bugs.webkit.org/show_bug.cgi?id=193408
1048         <rdar://problem/47300699>
1049
1050         Reviewed by Tim Horton.
1051
1052         Add calls to DictionaryLookup from the appropriate places.
1053
1054         * UIProcess/PageClient.h:
1055         * UIProcess/ios/PageClientImplIOS.h:
1056         * UIProcess/ios/PageClientImplIOS.mm:
1057         (WebKit::PageClientImpl::didPerformDictionaryLookup):
1058         * UIProcess/ios/WebPageProxyIOS.mm:
1059         (WebKit::WebPageProxy::didPerformDictionaryLookup):
1060         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1061         (WebKit::WebPage::dictionaryPopupInfoForRange):
1062
1063 2019-01-15  Claudio Saavedra  <csaavedra@igalia.com>
1064
1065         [SOUP] Remove usage of NetworkProcess::singleton()
1066         https://bugs.webkit.org/show_bug.cgi?id=193444
1067
1068         Reviewed by Michael Catanzaro.
1069
1070         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1071         (WebKit::NetworkDataTaskSoup::download):
1072         (WebKit::NetworkDataTaskSoup::didWriteDownload):
1073         (WebKit::NetworkDataTaskSoup::didFinishDownload):
1074         (WebKit::NetworkDataTaskSoup::didFailDownload):
1075         * NetworkProcess/soup/NetworkSessionSoup.cpp:
1076         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
1077
1078 2019-01-15  Eric Carlson  <eric.carlson@apple.com>
1079
1080         Fix incorrect ASSERT added in r239840
1081         https://bugs.webkit.org/show_bug.cgi?id=193466
1082         <rdar://problem/47095142>
1083
1084         Reviewed by Youenn Fablet.
1085
1086         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
1087         (WebKit::UserMediaCaptureManager::Source::Source):
1088
1089 2019-01-15  Tim Horton  <timothy_horton@apple.com>
1090
1091         Frequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded()
1092         https://bugs.webkit.org/show_bug.cgi?id=193468
1093         <rdar://problem/38645869>
1094
1095         Reviewed by Beth Dakin.
1096
1097         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1098         (WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded):
1099         I'm not sure why this got *worse*, but we should null-check RenderView.
1100         It's OK to bail from scaleViewToFitDocumentIfNeeded, we'll re-do it
1101         the next time we paint (which will surely happen if we gain a RenderView).
1102
1103 2019-01-15  Chris Dumez  <cdumez@apple.com>
1104
1105         Unreviewed, rolling out r239993, r239995, r239997, and
1106         r239999.
1107
1108         Caused assertions under
1109         ViewGestureController::disconnectFromProcess()
1110
1111         Reverted changesets:
1112
1113         "Regression(PSON) View becomes blank after click a cross-site
1114         download link"
1115         https://bugs.webkit.org/show_bug.cgi?id=193361
1116         https://trac.webkit.org/changeset/239993
1117
1118         "Unreviewed iOS build fix after r239993."
1119         https://trac.webkit.org/changeset/239995
1120
1121         "Fix iOS build after r239993"
1122         https://bugs.webkit.org/show_bug.cgi?id=193361
1123         https://trac.webkit.org/changeset/239997
1124
1125         "Unreviewed, revert part of r239997 as it is not needed to fix
1126         the build."
1127         https://trac.webkit.org/changeset/239999
1128
1129 2019-01-15  Alex Christensen  <achristensen@webkit.org>
1130
1131         Stop using CookiesStrategy
1132         https://bugs.webkit.org/show_bug.cgi?id=161106
1133
1134         Reviewed by Don Olmstead and Antti Koivisto.
1135
1136         * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
1137         (WebKit::NetworkProcessPlatformStrategies::createCookiesStrategy): Deleted.
1138         * NetworkProcess/NetworkProcessPlatformStrategies.h:
1139         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1140         * Scripts/webkit/messages.py:
1141         * Sources.txt:
1142         * WebKit.xcodeproj/project.pbxproj:
1143         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1144         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
1145         (WebKit::WebAutomationSessionProxy::deleteCookie):
1146         * WebProcess/Plugins/PluginView.cpp:
1147         (WebKit::PluginView::cookiesForURL):
1148         (WebKit::PluginView::setCookiesForURL):
1149         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1150         (WebKit::WebPlatformStrategies::createCookiesStrategy): Deleted.
1151         (WebKit::WebPlatformStrategies::cookiesForDOM): Deleted.
1152         (WebKit::WebPlatformStrategies::setCookiesFromDOM): Deleted.
1153         (WebKit::WebPlatformStrategies::cookiesEnabled): Deleted.
1154         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue): Deleted.
1155         (WebKit::WebPlatformStrategies::getRawCookies): Deleted.
1156         (WebKit::WebPlatformStrategies::deleteCookie): Deleted.
1157         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1158         * WebProcess/WebPage/WebCookieJar.cpp: Added.
1159         (WebKit::WebCookieJar::cookies const):
1160         (WebKit::WebCookieJar::setCookies):
1161         (WebKit::WebCookieJar::cookiesEnabled const):
1162         (WebKit::WebCookieJar::cookieRequestHeaderFieldValue const):
1163         (WebKit::WebCookieJar::getRawCookies const):
1164         (WebKit::WebCookieJar::deleteCookie):
1165         * WebProcess/WebPage/WebCookieJar.h: Added.
1166         * WebProcess/WebPage/WebPage.cpp:
1167         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
1168
1169 2019-01-15  Per Arne Vollan  <pvollan@apple.com>
1170
1171         Remove reporting for iOS mach lookups confirmed in-use
1172         https://bugs.webkit.org/show_bug.cgi?id=193455
1173         <rdar://problem/47259551>
1174
1175         Reviewed by Brent Fulgham.
1176
1177         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1178
1179 2019-01-15  Tim Horton  <timothy_horton@apple.com>
1180
1181         Cannot tab out of WKWebView on macOS
1182         https://bugs.webkit.org/show_bug.cgi?id=161448
1183         <rdar://problem/28100085>
1184
1185         Reviewed by Dean Jackson.
1186
1187         * UIProcess/WebPageProxy.cpp:
1188         (WebKit::WebPageProxy::takeFocus):
1189         If the UIDelegate doesn't implement takeFocus, provide a simple default
1190         implementation that just uses AppKit's key view loop to move the focus.
1191
1192         * UIProcess/API/APIUIClient.h:
1193         (API::UIClient::takeFocus):
1194         * UIProcess/API/C/WKPage.cpp:
1195         (WKPageSetPageUIClient):
1196         * UIProcess/Cocoa/UIDelegate.h:
1197         * UIProcess/Cocoa/UIDelegate.mm:
1198         (WebKit::UIDelegate::UIClient::takeFocus):
1199         Make API::UIClient's takeFocus return a bool indicating whether the
1200         client implements it or not.
1201
1202         * UIProcess/PageClient.h:
1203         * UIProcess/mac/PageClientImplMac.h:
1204         * UIProcess/mac/PageClientImplMac.mm:
1205         (WebKit::PageClientImpl::takeFocus):
1206         Plumb takeFocus to WebViewImpl.
1207
1208         * UIProcess/Cocoa/WebViewImpl.h:
1209         * UIProcess/Cocoa/WebViewImpl.mm:
1210         (WebKit::WebViewImpl::takeFocus):
1211         Borrow the relevant portion of WebKitLegacy's implementation of takeFocus,
1212         shifting focus to the next/previous key view in the window.
1213
1214 2019-01-15  Youenn Fablet  <youenn@apple.com>
1215
1216         Remove the specific handling of ephemeral sessions from CacheStorage::Engine::from
1217         https://bugs.webkit.org/show_bug.cgi?id=193400
1218
1219         Reviewed by Alex Christensen.
1220
1221         It is no longer needed as we correctly handle ephemeral sessions removal.
1222
1223         * NetworkProcess/cache/CacheStorageEngine.cpp:
1224         (WebKit::CacheStorage::Engine::from):
1225
1226 2019-01-15  Alex Christensen  <achristensen@webkit.org>
1227
1228         Fix iOS build after r239993
1229         https://bugs.webkit.org/show_bug.cgi?id=193361
1230
1231         * UIProcess/ProvisionalPageProxy.h:
1232         * UIProcess/SuspendedPageProxy.h:
1233
1234 2019-01-15  Per Arne Vollan  <pvollan@apple.com>
1235
1236         [macOS] Adjust logging policy in WebKit's sandbox
1237         https://bugs.webkit.org/show_bug.cgi?id=193454
1238         <rdar://problem/47256325>
1239
1240         Reviewed by Brent Fulgham.
1241
1242         * WebProcess/com.apple.WebProcess.sb.in:
1243
1244 2019-01-15  Chris Dumez  <cdumez@apple.com>
1245
1246         Unreviewed iOS build fix after r239993.
1247
1248         * UIProcess/SuspendedPageProxy.h:
1249
1250 2019-01-15  Per Arne Vollan  <pvollan@apple.com>
1251
1252         Add allow directive for MTLCompilerService.xpc to PluginProcess and WebContent
1253         https://bugs.webkit.org/show_bug.cgi?id=193453
1254         <rdar://problem/47268166>
1255
1256         Reviewed by Brent Fulgham.
1257
1258         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
1259         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1260         * WebProcess/com.apple.WebProcess.sb.in:
1261
1262 2019-01-15  Chris Dumez  <cdumez@apple.com>
1263
1264         Regression(PSON) View becomes blank after click a cross-site download link
1265         https://bugs.webkit.org/show_bug.cgi?id=193361
1266         <rdar://problem/47099573>
1267
1268         Reviewed by Geoff Garen.
1269
1270         The issue tracked by rdar://problem/47099573 is that a provisional load may get
1271         canceled (or converted into a download) *after* we've decided to process-swap.
1272         In such cases, the view should keep displaying the current site and it should
1273         still be interactive. However, with the previous PSON model, the view (pageProxy)
1274         would have already swapped to the new process and would end up displaying the
1275         initially empty document.
1276
1277         To address the issue, this patch introduces the concept of a provisional load
1278         in the UIProcess, handled by a ProvisionalPageProxy which has its own privisional
1279         process. The WebPageProxy owns the ProvisionalPageProxy but we do not commit the
1280         provisional page until after the load was committed in the new process. This means
1281         that the view / WebPageProxy keeps using the old process and displays the current
1282         content until a load has committed in the provisional page. If no load commits
1283         in the provisional process (e.g. because the load is cancelled or converted into
1284         a download), then we merely destroy the ProvisionalPageProxy and terminate its
1285         process, without impacting the WebPageProxy.
1286
1287         * Shared/WebPageCreationParameters.cpp:
1288         (WebKit::WebPageCreationParameters::encode const):
1289         (WebKit::WebPageCreationParameters::decode):
1290         * Shared/WebPageCreationParameters.h:
1291         Rename isSwapFromSuspended to isProcessSwap for clarity as we always want to
1292         delay attaching the drawing area in case of a process-swap, no matter what
1293         now that the previous process is kept alive until the provisional load is
1294         committed in the new process.
1295
1296         * Shared/WebPolicyAction.h:
1297         Drop Suspend policy action. At decidePolicyForNavigationAction time, in case of
1298         process-swap, we now tell the previous process to simply ignore the load, while
1299         we create a ProvisionalPageProxy to do the new load in a new process.
1300         Suspension of the previous page in the old process, happens later, when a load
1301         is actually committed in the new process.
1302
1303         * Sources.txt:
1304         Add new ProvisionalPageProxy file.
1305
1306         * UIProcess/API/Cocoa/WKWebView.mm:
1307         (-[WKWebView _killWebContentProcessAndResetState]):
1308         When calling _killWebContentProcessAndResetState on a WKWebView, kill both the current
1309         process and the provisional one, to maintain previous behavior in our API tests.
1310
1311         * UIProcess/PageClient.h:
1312         Tiny build fix.
1313
1314         * UIProcess/ProvisionalPageProxy.cpp: Added.
1315         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
1316         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
1317         (WebKit::ProvisionalPageProxy::takeDrawingArea):
1318         (WebKit::ProvisionalPageProxy::cancel):
1319         (WebKit::ProvisionalPageProxy::initializeWebPage):
1320         (WebKit::ProvisionalPageProxy::loadDataWithNavigation):
1321         (WebKit::ProvisionalPageProxy::loadRequestWithNavigation):
1322         (WebKit::ProvisionalPageProxy::goToBackForwardItem):
1323         (WebKit::ProvisionalPageProxy::didCreateMainFrame):
1324         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
1325         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
1326         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
1327         (WebKit::ProvisionalPageProxy::didReceiveMessage):
1328         (WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
1329         * UIProcess/ProvisionalPageProxy.h: Added.
1330         (WebKit::ProvisionalPageProxy::page):
1331         (WebKit::ProvisionalPageProxy::mainFrame const):
1332         (WebKit::ProvisionalPageProxy::process):
1333         (WebKit::ProvisionalPageProxy::processSwapRequestedByClient const):
1334         (WebKit::ProvisionalPageProxy::navigationID const):
1335         Add new ProvisionalPageProxy class to wrap the provisional load in the new process
1336         after a swap. The provisional page is owned by the WebPageProxy and we only commit
1337         the provisional page when the load is committed. Until then, the WebPageProxy keeps
1338         using the old process and displaying the current content.
1339
1340         * UIProcess/SuspendedPageProxy.cpp:
1341         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
1342         (WebKit::SuspendedPageProxy::unsuspend):
1343         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
1344         Unregister the SuspendedPageProxy as an IPC message receiver a little bit earlier
1345         when we're going to unsuspend it. This avoids conflicting with the ProvisionalPageProxy
1346         which tries to register itself as an IPC message receiver for the same pageID when
1347         a process-swap occurs and we're switching to a suspended page.
1348
1349         * UIProcess/WebFrameProxy.cpp:
1350         (WebKit::WebFrameProxy::isMainFrame const):
1351         WebFrameProxy::isMainFrame() relies on checking that the frame is the WebPageProxy's m_mainFrame.
1352         Now that the WebPageProxy can have a ProvisionalPageProxy, also check if it is the ProvisionalPageProxy's
1353         m_mainFrame to maintain previous behavior.
1354
1355         * UIProcess/WebPageProxy.cpp:
1356         (WebKit::WebPageProxy::swapToWebProcess):
1357         swapToWebProcess() no longer takes care of unsuspending the SuspendedPage because we now call swapToWebProcess()
1358         later, when a load is actually committed in the provisional page / process. swapToWebProcess() now also needs
1359         to initialize some data members such as the drawing area and the main frame as it is transferring them over from
1360         the ProvisionalPageProxy which started the provisional load.
1361
1362         (WebKit::WebPageProxy::finishAttachingToWebProcess):
1363         We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
1364         committed in the provisional process.
1365
1366         (WebKit::WebPageProxy::initializeWebPage):
1367         - We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
1368           committed in the provisional process.
1369         - Factor some code out to WebPageProxy::setDrawingArea() so that it can be shared with swapToWebProcess().
1370
1371         (WebKit::WebPageProxy::loadRequestWithNavigation):
1372         Only call setPendingAPIRequestURL() in loadRequestWithNavigation() only if ShouldTreatAsContinuingLoad is not
1373         Yes. This avoids hitting some assertions as this was already called during the first API call if needed.
1374
1375         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1376         In case of process swap, tell the previous process to ignore the load instead of suspending it right away.
1377         Suspension now happens later, only if we end up committing the provisional load in the new process.
1378         Also discard the SuspendedPage if it failed to suspend (we only reuse its process in this case). This used
1379         to happen a bit later but it is clearer if we do this as early as possible I think.
1380
1381         (WebKit::WebPageProxy::commitProvisionalPage):
1382         When the load is committed in the new process, we call WebPageProxy::commitProvisionalPage(). It takes care of:
1383         - Actually swapping the WebPageProxy to the new process by calling processDidTerminate() / swapToWebProcess().
1384         - Suspending the current page.
1385         - Letting the client know the load is comitted
1386         - Destroy the ProvisionalPageProxy.
1387         This work used to happen earlier in continueNavigationInNewProcess().
1388
1389         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1390         Moved some of the logic to commitProvisionalPage(). We now merely start the load in a new ProvisionalPageProxy,
1391         without actually having the WebPageProxy switch to the new process yet.
1392
1393         (WebKit::WebPageProxy::didCreateMainFrame):
1394         (WebKit::WebPageProxy::didCreateWindow):
1395         Drop some code that is no longer needed, now that the ProvisionalPageProxy takes care of this.
1396
1397         (WebKit::WebPageProxy::didDestroyNavigation):
1398         On process-swap, when telling the previous process to ignore the load and starting the new load in a new
1399         ProvisionalPageProxy, the previous WebPage attempts to destroy the navigation. In this case, we ignore
1400         the call since the navigation is merely taken over by the ProvisionalPageProxy.
1401
1402         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
1403         Moved some PSON logic to the ProvisionalPageProxy instead.
1404
1405         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
1406         When didFailProvisionalLoadForFrame() is called for a ProvisionalPageProxy, destroy it.
1407
1408         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
1409         (WebKit::WebPageProxy::decidePolicyForResponse):
1410         Capture the process in the lambda, to make sure we send the policy decision to the same process that
1411         asked for it, so as to not get confused by process swaps.
1412
1413         (WebKit::WebPageProxy::resetState):
1414         Drop some code that is no longer needed.
1415
1416         (WebKit::WebPageProxy::creationParameters):
1417         Move the hasRegisteredServiceWorkers flag initialization from the call site to here now that we have
1418         more than one call site. This was just some bad factoring.
1419
1420         (WebKit::WebPageProxy::PageProcessOverride::PageProcessOverride):
1421         (WebKit::WebPageProxy::PageProcessOverride::~PageProcessOverride):
1422         * UIProcess/WebPageProxy.h:
1423         (WebKit::WebPageProxy::temporarilyOverrideProcess):
1424         Add utility class to temporarily override the WebPageProxy's m_process with the provisional one when
1425         the ProvisionalPageProxy interacts with the WebPageProxy.
1426
1427         * UIProcess/WebProcessProxy.cpp:
1428         (WebKit::WebProcessProxy::hasProvisionalPageWithID const):
1429         (WebKit::WebProcessProxy::updateBackForwardItem):
1430         Before updating a BackForwardListItem, we normally make sure the process has a WebPageProxy with the
1431         item's pageID. We have to tweak the logic because there may now be no WebPageProxy with this pageID
1432         associated with this process yet, because it is still a ProvisionalPageProxy.
1433
1434         (WebKit::WebProcessProxy::canTerminateChildProcess):
1435         Do not terminate the WebProcess if there are ProvisionalPageProxy objects using it.
1436
1437         * UIProcess/WebProcessProxy.h:
1438         (WebKit::WebProcessProxy::addProvisionalPageProxy):
1439         (WebKit::WebProcessProxy::removeProvisionalPageProxy):
1440
1441         * WebKit.xcodeproj/project.pbxproj:
1442
1443         * WebProcess/WebPage/WebFrame.cpp:
1444         (WebKit::toPolicyAction):
1445         (WebKit::WebFrame::didReceivePolicyDecision):
1446         Stop dealing with WebPolicyAction::Suspend as it no longer exists.
1447
1448         * WebProcess/WebPage/WebPage.cpp:
1449         (WebKit::WebPage::reinitializeWebPage):
1450         (WebKit::WebPage::didReceivePolicyDecision):
1451
1452         (WebKit::WebPage::setIsSuspended):
1453         Suspend the Page when setIsSuspended(true) is called, now that there is no longer a WebPolicyAction::Suspend.
1454         setIsSuspended(true) IPC is sent when we actually commit the provisional page.
1455
1456         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1457         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
1458
1459 2019-01-15  Brian Burg  <bburg@apple.com>
1460
1461         WebDriver: update Create Window implementation to support newest specification
1462         https://bugs.webkit.org/show_bug.cgi?id=193333
1463         <rdar://problem/45649489>
1464
1465         Reviewed by Carlos Garcia Campos.
1466
1467         Spec link: https://w3c.github.io/webdriver/#create-window
1468
1469         The command as specified returns a value indicating whether the new browsing context
1470         was presented as a new tab or new window. Add a new delegate method to query the current
1471         'presentation' of the browsing context. The presentation can change over time due to
1472         things such as screen orientation, so the value that is returned by the command only
1473         reflects how the browsing context was initially presented to the user.
1474
1475         This is covered by existing WPT and internal tests. More will be added when Selenium
1476         exposes this command in its various bindings.
1477
1478         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
1479         Add new SPI delegate method to query the 'presentation' (tab or window) for an automated WKWebView.
1480
1481         * UIProcess/API/APIAutomationSessionClient.h:
1482         (API::AutomationSessionClient::currentPresentationOfPage):
1483         * UIProcess/Cocoa/AutomationSessionClient.h:
1484         * UIProcess/Cocoa/AutomationSessionClient.mm:
1485         (WebKit::AutomationSessionClient::AutomationSessionClient):
1486         (WebKit::toImpl):
1487         (WebKit::AutomationSessionClient::currentPresentationOfPage):
1488         * UIProcess/Automation/WebAutomationSession.cpp:
1489         (WebKit::toProtocol):
1490         (WebKit::WebAutomationSession::createBrowsingContext):
1491         Add plumbing between ObjC delegate and C++.
1492
1493         * UIProcess/Automation/Automation.json:
1494         Include the initial presentation in the createBrowsingContext command result.
1495
1496 2019-01-14  Alex Christensen  <achristensen@webkit.org>
1497
1498         Split headerValueForVary into specialized functions for NetworkProcess and WebProcess/WebKitLegacy
1499         https://bugs.webkit.org/show_bug.cgi?id=193429
1500
1501         Reviewed by Joseph Pecoraro.
1502
1503         * NetworkProcess/cache/NetworkCache.cpp:
1504         (WebKit::NetworkCache::makeUseDecision):
1505         (WebKit::NetworkCache::Cache::retrieve):
1506         (WebKit::NetworkCache::Cache::makeEntry):
1507         (WebKit::NetworkCache::Cache::makeRedirectEntry):
1508         (WebKit::NetworkCache::Cache::update):
1509
1510 2019-01-14  Tim Horton  <timothy_horton@apple.com>
1511
1512         Fix a style mistake in PageClientImplMac
1513
1514         * UIProcess/mac/PageClientImplMac.h:
1515         Somehow these methods ended up above the members.
1516
1517 2019-01-14  Per Arne Vollan  <pvollan@apple.com>
1518
1519         [macOS] Remove reporting for mach lookups confirmed in-use
1520         https://bugs.webkit.org/show_bug.cgi?id=193415
1521         <rdar://problem/47266542>
1522
1523         Reviewed by Brent Fulgham.
1524
1525         Also, start denying the services which have not been confirmed to be in use.
1526
1527         * WebProcess/com.apple.WebProcess.sb.in:
1528
1529 2019-01-14  Commit Queue  <commit-queue@webkit.org>
1530
1531         Unreviewed, rolling out r239901, r239909, r239910, r239912,
1532         r239913, and r239914.
1533         https://bugs.webkit.org/show_bug.cgi?id=193407
1534
1535         These revisions caused an internal failure (Requested by
1536         Truitt on #webkit).
1537
1538         Reverted changesets:
1539
1540         "[Cocoa] Avoid importing directly from subumbrella frameworks"
1541         https://bugs.webkit.org/show_bug.cgi?id=186016
1542         https://trac.webkit.org/changeset/239901
1543
1544         "Tried to fix USE(APPLE_INTERNAL_SDK) builds after r239901."
1545         https://trac.webkit.org/changeset/239909
1546
1547         "Tried to fix the build."
1548         https://trac.webkit.org/changeset/239910
1549
1550         "Fixed iOS builds after r239910."
1551         https://trac.webkit.org/changeset/239912
1552
1553         "More build fixing."
1554         https://trac.webkit.org/changeset/239913
1555
1556         "Tried to fix USE(APPLE_INTERNAL_SDK) 32-bit builds."
1557         https://trac.webkit.org/changeset/239914
1558
1559 2019-01-14  Mark Lam  <mark.lam@apple.com>
1560
1561         Re-enable ability to build --cloop builds.
1562         https://bugs.webkit.org/show_bug.cgi?id=192955
1563         <rdar://problem/46882363>
1564
1565         Reviewed by Saam barati and Keith Miller.
1566
1567         * Configurations/FeatureDefines.xcconfig:
1568
1569 2019-01-14  Alex Christensen  <achristensen@webkit.org>
1570
1571         Remove unused networking entitlement from iOS WebProcess entitlements
1572         https://bugs.webkit.org/show_bug.cgi?id=193267
1573
1574         Reviewed by Dean Jackson.
1575
1576         * Configurations/WebContent-iOS.entitlements:
1577         This gave access to VPN stuff.  It's not needed any more.
1578
1579 2019-01-14  Youenn Fablet  <youenn@apple.com>
1580
1581         Enable MDNS ICE candidate support by default
1582         https://bugs.webkit.org/show_bug.cgi?id=193358
1583
1584         Reviewed by Geoffrey Garen.
1585
1586         * Shared/WebPreferences.yaml:
1587
1588 2019-01-11  Matt Rajca  <mrajca@apple.com>
1589
1590         Expose preference for site-specific quirks on iOS
1591         https://bugs.webkit.org/show_bug.cgi?id=193353
1592
1593         Reviewed by Dean Jackson.
1594
1595         * UIProcess/API/Cocoa/WKPreferences.mm:
1596         (-[WKPreferences _setNeedsSiteSpecificQuirks:]):
1597         (-[WKPreferences _needsSiteSpecificQuirks]):
1598         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1599
1600 2019-01-14  Wenson Hsieh  <wenson_hsieh@apple.com>
1601
1602         [iOS] Expose SPI to access the current sentence boundary and selection state
1603         https://bugs.webkit.org/show_bug.cgi?id=193398
1604         <rdar://problem/45893108>
1605
1606         Reviewed by Dean Jackson.
1607
1608         Expose SPI on WKWebView for internal clients to grab information about attributes at the current selection; so
1609         far, this only includes whether the selection is a caret or a range, and whether or not the start of the
1610         selection is at the start of a new sentence.
1611
1612         Test: EditorStateTests.ObserveSelectionAttributeChanges
1613
1614         * Shared/EditorState.cpp:
1615         (WebKit::EditorState::PostLayoutData::encode const):
1616         (WebKit::EditorState::PostLayoutData::decode):
1617         * Shared/EditorState.h:
1618
1619         Add a new bit in EditorState on iOS to compute whether or not the start of the selection is at the start of a
1620         new sentence. This is computed and set when sending post-layout data in `WebPageIOS.mm`.
1621
1622         * UIProcess/API/Cocoa/WKWebView.mm:
1623         (selectionAttributes):
1624         (-[WKWebView _didChangeEditorState]):
1625         (-[WKWebView _selectionAttributes]):
1626
1627         Make the new SPI property support KVO by invoking `-willChangeValueForKey:` and `-didChangeValueForKey:`
1628         whenever the selection attributes change.
1629
1630         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1631         * WebProcess/WebPage/ios/WebPageIOS.mm:
1632         (WebKit::WebPage::platformEditorState const):
1633
1634 2019-01-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1635
1636         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.23.3 release
1637
1638         * gtk/NEWS: Add release notes for 2.23.3.
1639
1640 2019-01-13  Dan Bernstein  <mitz@apple.com>
1641
1642         Fixed iOS builds after r239910.
1643
1644         * Platform/spi/ios/PDFKitSPI.h:
1645
1646 2019-01-13  Dan Bernstein  <mitz@apple.com>
1647
1648         Tried to fix the build.
1649
1650         * Platform/spi/ios/PDFKitSPI.h:
1651
1652 2019-01-13  Dan Bernstein  <mitz@apple.com>
1653
1654         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r239901.
1655
1656         Patch by Keith Rollin.
1657
1658         * Platform/IPC/mac/ConnectionMac.mm:
1659         * Shared/mac/ChildProcessMac.mm:
1660         (WebKit::ChildProcess::launchServicesCheckIn):
1661
1662 2019-01-12  Timothy Hatcher  <timothy@apple.com>
1663
1664         Have prefers-color-scheme: light always match on macOS versions before Mojave.
1665         https://bugs.webkit.org/show_bug.cgi?id=191655
1666         rdar://problem/46074680
1667
1668         Reviewed by Megan Gardner.
1669
1670         * Configurations/FeatureDefines.xcconfig: ENABLE_DARK_MODE_CSS_macosx for all OS versions.
1671         * UIProcess/Cocoa/WebViewImpl.mm:
1672         (WebKit::WebViewImpl::effectiveAppearanceIsDark):
1673         * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm:
1674
1675 2019-01-12  Dan Bernstein  <mitz@apple.com>
1676
1677         [Cocoa] Avoid importing directly from subumbrella frameworks
1678         https://bugs.webkit.org/show_bug.cgi?id=186016
1679         <rdar://problem/40591038>
1680
1681         Reviewed by Sam Weinig.
1682
1683         * Configurations/BaseTarget.xcconfig: Removed -iframework options from OTHER_CFLAGS and
1684           OTHER_CPLUSPLUSFLAGS.
1685         * UIProcess/Automation/mac/WebAutomationSessionMac.mm: Import Carbon.h instead of an
1686           HIToolbox header.
1687         * UIProcess/Cocoa/WebViewImpl.mm: Ditto.
1688         * UIProcess/mac/WKPrintingView.mm: Import Quartz.h instead of a PDFKit header.
1689         * UIProcess/mac/WKTextInputWindowController.mm: Import Carbon.h instead of an HIToolbox
1690           header.
1691         * WebProcess/Plugins/PDF/PDFAnnotationTextWidgetDetails.h: Import Quartz.h instead of a
1692           PDFKit header.
1693         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h: Ditto.
1694         * WebProcess/Plugins/PDF/PDFPlugin.mm: Ditto.
1695         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: Ditto.
1696         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm: Ditto.
1697         * WebProcess/Plugins/PDF/PDFPluginPasswordField.mm: Ditto.
1698         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: Ditto.
1699         * WebProcess/WebPage/mac/WebPageMac.mm: Ditto.
1700
1701 2019-01-11  Ryosuke Niwa  <rniwa@webkit.org>
1702
1703         Enable visual viewport API by default
1704         https://bugs.webkit.org/show_bug.cgi?id=193376
1705
1706         Reviewed by Simon Fraser.
1707
1708         Enable this feature by default since the remaining issue on iOS is mostly about test failures,
1709         not an issue with the core functionality of the API.
1710
1711         * Shared/WebPreferences.yaml:
1712
1713 2019-01-11  Brent Fulgham  <bfulgham@apple.com>
1714
1715         Allow WebContent process access to some drawing-related IOKit properties
1716         https://bugs.webkit.org/show_bug.cgi?id=193086
1717         <rdar://problem/46568088>
1718
1719         Reviewed by Eric Carlson.
1720
1721         Add one missing IOKit property, and revise the regexp used for another.
1722
1723         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1724
1725 2019-01-11  John Wilander  <wilander@apple.com>
1726
1727         Compile out Web API Statistics Collection
1728         https://bugs.webkit.org/show_bug.cgi?id=193370
1729         <rdar://problem/45388584>
1730
1731         Reviewed by Brent Fulgham.
1732
1733         * Configurations/FeatureDefines.xcconfig:
1734             Defined ENABLE_WEB_API_STATISTICS, off by default.
1735         * Shared/WebCoreArgumentCoders.cpp:
1736         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
1737             Skipped encoding of web API statistics.
1738         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
1739             Skipped decoding of web API statistics.
1740
1741 2019-01-11  Sihui Liu  <sihui_liu@apple.com>
1742
1743         IndexedDB: leak WebIDBConnectionToClient for retain cycle
1744         https://bugs.webkit.org/show_bug.cgi?id=193097
1745         <rdar://problem/46899601>
1746
1747         Reviewed by Brady Eidson.
1748
1749         Let WebIDBConnectionToClient hold reference to IPC::Connection instead of NetworkConnectionToWebProcess to break
1750         the cycle.
1751
1752         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
1753         (WebKit::WebIDBConnectionToClient::create):
1754         (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient):
1755         (WebKit::WebIDBConnectionToClient::messageSenderConnection):
1756         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
1757         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1758         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
1759
1760 2019-01-11  Sihui Liu  <sihui_liu@apple.com>
1761
1762         Make "Disable Web SQL" on by default
1763         https://bugs.webkit.org/show_bug.cgi?id=193354
1764         <rdar://problem/46524584>
1765
1766         Reviewed by Geoffrey Garen.
1767
1768         * Shared/WebPreferences.yaml:
1769
1770 2019-01-11  Devin Rousso  <drousso@apple.com>
1771
1772         Fix style CFNetworkSPI style checker warnings from r239698
1773         https://bugs.webkit.org/show_bug.cgi?id=193369
1774
1775         Reviewed by Joseph Pecoraro.
1776
1777         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1778         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
1779
1780 2019-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1781
1782         [iOS] Precision drop state thrashes when dragging near the top edge of an editable element
1783         https://bugs.webkit.org/show_bug.cgi?id=193364
1784         <rdar://problem/47214117>
1785
1786         Reviewed by Tim Horton.
1787
1788         On iOS, marking a UIDropProposal as precise offsets the hit-testing location of the drop by a small distance
1789         either upwards or downwards from the actual location of the user's finger. When dragging over an editable
1790         element, WebKit currently marks the drop proposal as precise; however, when dragging over the top edge of an
1791         editable element, what happens is that the hit-testing location is offset to a location outside of the editable
1792         element, which causes us to turn off precision drop mode; subsequently, turning off precision drop mode removes
1793         the offset, which causes us to hit-test within the editable element once again and re-enable precision mode, and
1794         the cycle continues.
1795
1796         In order to mitigate this, bail out of precision drop mode when dragging near the top or bottom edges of the
1797         highest editable root that contains the current drop caret position (or, if the drop caret is inside of a text
1798         form control, use the form control as the editable element instead).
1799
1800         * UIProcess/WebPageProxy.cpp:
1801         (WebKit::WebPageProxy::didPerformDragControllerAction):
1802         * UIProcess/WebPageProxy.h:
1803         (WebKit::WebPageProxy::currentDragCaretEditableElementRect const):
1804         * UIProcess/WebPageProxy.messages.in:
1805         * UIProcess/ios/WKContentViewInteraction.mm:
1806         (-[WKContentView dropInteraction:sessionDidUpdate:]):
1807
1808         Avoid precise mode when we're less than 25pt away from the top and bottom edge of the editable element rect.
1809         Since the drag location offset amount is a fixed offset in window coordinates, we first convert this minimum
1810         distance to the content view's coordinate space by dividing by the content scale factor.
1811
1812         * WebProcess/WebPage/WebPage.cpp:
1813         (WebKit::WebPage::performDragControllerAction):
1814
1815 2019-01-11  Tim Horton  <timothy_horton@apple.com>
1816
1817         REGRESSION (PSON): Firefox app lacks Open in New Tab in menu
1818         https://bugs.webkit.org/show_bug.cgi?id=193366
1819         <rdar://problem/46097212>
1820
1821         Reviewed by Simon Fraser.
1822
1823         A pair of unrelated changes broke Firefox's use of WKWebView internals
1824         to override the long-press menu. Maintain binary compatibility by
1825         introducing linked-on-or-after checks.
1826
1827         * UIProcess/Cocoa/VersionChecks.h:
1828         * UIProcess/WebProcessPool.cpp:
1829         (WebKit::WebProcessPool::createWebPage):
1830         Disable PSON in Firefox when linked against an SDK where PSON wasn't enabled by default.
1831         Because gestures are very stateful, we always swap them out when swapping
1832         processes (changing that behavior is fairly risky). Also, we don't always
1833         inform the client when we swap processes (only when the process actually crashes),
1834         so they currently don't re-adjust the gesture recognizers when a PSON swap occurs.
1835
1836         * UIProcess/ios/WKContentView.mm:
1837         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
1838         Synchronously install gesture recognizers under -init when linked against
1839         an SDK before the version that introduces lazy gesture recognizer installation.
1840         r237331 is an optimization that made us lazily install gestures when the
1841         view is parented, but Firefox (and potentially other clients) depend
1842         on them being installed synchronously in order to find and override them.
1843
1844 2019-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1845
1846         Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API
1847         https://bugs.webkit.org/show_bug.cgi?id=193109
1848         <rdar://problem/44807048>
1849
1850         Reviewed by Ryosuke Niwa.
1851
1852         Add a new SPI configuration flag to enable the UndoManager API. This is off by default.
1853
1854         * Shared/WebPreferences.yaml:
1855         * UIProcess/API/Cocoa/WKWebView.mm:
1856         (-[WKWebView _initializeWithConfiguration:]):
1857         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1858         (-[WKWebViewConfiguration init]):
1859         (-[WKWebViewConfiguration copyWithZone:]):
1860         (-[WKWebViewConfiguration _setUndoManagerAPIEnabled:]):
1861         (-[WKWebViewConfiguration _undoManagerAPIEnabled]):
1862         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1863
1864 2019-01-10  Jiewen Tan  <jiewen_tan@apple.com>
1865
1866         [WebAuthN] Change the nonce in the CTAP kInit command to weak random values
1867         https://bugs.webkit.org/show_bug.cgi?id=192061
1868         <rdar://problem/46471091>
1869
1870         Reviewed by Chris Dumez.
1871
1872         Change the nonce in the CTAP kInit command to weak random values as the nonce is mainly
1873         for being a probabilistically unique global identifier for hand shakes, instead of
1874         preventing replay attacks. Otherwise, it might exhaust system entropy unnecessarily.
1875
1876         The patch also removes all logging when debugging the test case flakiness.
1877
1878         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1879         (WebKit::AuthenticatorManager::respondReceived):
1880         (WebKit::AuthenticatorManager::initTimeOutTimer):
1881         (WebKit::AuthenticatorManager::timeOutTimerFired):
1882         * UIProcess/WebAuthentication/Cocoa/HidService.mm:
1883         (WebKit::HidService::deviceAdded):
1884         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
1885         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
1886         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
1887         (WebKit::MockHidConnection::send):
1888         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp:
1889         (WebKit::CtapHidAuthenticator::makeCredential):
1890         (WebKit::CtapHidAuthenticator::getAssertion):
1891         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
1892         (WebKit::CtapHidDriver::Worker::write):
1893         (WebKit::CtapHidDriver::Worker::read):
1894         (WebKit::CtapHidDriver::Worker::returnMessage):
1895         (WebKit::CtapHidDriver::transact):
1896         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
1897         (WebKit::CtapHidDriver::continueAfterResponseReceived):
1898
1899 2019-01-10  Timothy Hatcher  <timothy@apple.com>
1900
1901         Add WKBundlePage SPI to temporarily force light or dark appearance on a page.
1902         https://bugs.webkit.org/show_bug.cgi?id=193327
1903         rdar://problem/47093222
1904
1905         Reviewed by Tim Horton.
1906
1907         Tests: WebKit.ForceLightAppearanceInBundle API Test
1908
1909         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1910         (WKBundlePageSetUseDarkAppearance): Added.
1911         (WKBundlePageIsUsingDarkAppearance): Added.
1912         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
1913
1914 2019-01-10  Eric Carlson  <eric.carlson@apple.com>
1915
1916         DeviceID hash salt manager can be NULL
1917         https://bugs.webkit.org/show_bug.cgi?id=193334
1918         <rdar://problem/47179650>
1919
1920         Reviewed by Youenn Fablet.
1921
1922         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1923         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): No need to
1924         NULL-check websiteDataStore.deviceIdHashSaltStorage, it is a Ref.
1925         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): Ditto.
1926         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo): Ditto.
1927         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): Ditto.
1928
1929         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1930         (WebKit::WebsiteDataStore::WebsiteDataStore): m_deviceIdHashSaltStorage is a Ref.
1931         (WebKit::WebsiteDataStore::fetchDataAndApply): Ditto.
1932         (WebKit::WebsiteDataStore::removeData): Ditto.
1933         * UIProcess/WebsiteData/WebsiteDataStore.h:
1934         (WebKit::WebsiteDataStore::deviceIdHashSaltStorage): Ditto.
1935
1936 2019-01-10  Per Arne Vollan  <pvollan@apple.com>
1937
1938         [macOS] Add name of IORegistry key in sandbox.
1939         https://bugs.webkit.org/show_bug.cgi?id=193335
1940         <rdar://problem/47184951>
1941
1942         Reviewed by Alexey Proskuryakov.
1943
1944         The property IOGVAHEVCDecodeCapabilities was added in https://bugs.webkit.org/show_bug.cgi?id=193324.
1945         Also, the property IOGVAHEVCEncodeCapabilities needs to be added.
1946
1947         * WebProcess/com.apple.WebProcess.sb.in:
1948
1949 2019-01-10  Zalan Bujtas  <zalan@apple.com>
1950
1951         REGRESSION (r237658): Tap highlight limits cause the highlight to no longer show with legitimate button sizes
1952         https://bugs.webkit.org/show_bug.cgi?id=193294
1953         <rdar://problem/46006678>
1954
1955         Reviewed by Simon Fraser.
1956
1957         Input type elements should always paint tap highlight (ignore size heuristic). 
1958
1959         * UIProcess/PageClient.h:
1960         * UIProcess/WebPageProxy.h:
1961         * UIProcess/WebPageProxy.messages.in:
1962         * UIProcess/ios/PageClientImplIOS.h:
1963         * UIProcess/ios/PageClientImplIOS.mm:
1964         (WebKit::PageClientImpl::didGetTapHighlightGeometries):
1965         * UIProcess/ios/WKContentViewInteraction.h:
1966         * UIProcess/ios/WKContentViewInteraction.mm:
1967         (-[WKContentView _showTapHighlight]):
1968         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:nodeHasBuiltInClickHandling:]):
1969         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]): Deleted.
1970         * UIProcess/ios/WebPageProxyIOS.mm:
1971         (WebKit::WebPageProxy::didGetTapHighlightGeometries):
1972         * WebProcess/WebPage/ios/WebPageIOS.mm:
1973         (WebKit::WebPage::sendTapHighlightForNodeIfNecessary):
1974
1975 2019-01-10  Alexey Proskuryakov  <ap@apple.com>
1976
1977         Remove unneeded XPCService variant for plugin service
1978         https://bugs.webkit.org/show_bug.cgi?id=193326
1979
1980         Reviewed by Tim Horton.
1981
1982         * Configurations/PluginService.32.xcconfig: Removed.
1983         * Configurations/PluginService.64.xcconfig:
1984         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist: Removed.
1985         * PluginProcess/EntryPoint/mac/XPCService/PluginService.64.Info.plist: Copied from Source/WebKit/PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist.
1986         * WebKit.xcodeproj/project.pbxproj:
1987
1988 2019-01-10  Eric Carlson  <eric.carlson@apple.com>
1989
1990         Define page media state flags for display capture.
1991         https://bugs.webkit.org/show_bug.cgi?id=193230
1992         <rdar://problem/47095142>
1993
1994         Reviewed by Youenn Fablet.
1995
1996         * UIProcess/API/C/WKPage.cpp:
1997         (WKPageGetMediaState):
1998         * UIProcess/API/C/WKPagePrivate.h:
1999         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2000         (WebKit::UserMediaCaptureManager::Source::Source):
2001         (WebKit::UserMediaCaptureManager::createCaptureSource):
2002
2003 2019-01-10  Alex Christensen  <achristensen@webkit.org>
2004
2005         REGRESSION(r239815) http/tests/workers/service/serviceworker-private-browsing.https.html test times out
2006         https://bugs.webkit.org/show_bug.cgi?id=193325
2007
2008         Reviewed by Joseph Pecoraro.
2009
2010         InjectedBundle::setPrivateBrowsingEnabled effectively didn't do anything when enabled was false.
2011         I made it destroy the legacy private browsing session in the NetworkProcess, which caused a test to time out.
2012         This functionality is only used for testing, so it's no big deal to revert that part of the patch.
2013
2014         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2015         (WebKit::NetworkConnectionToWebProcess::destroyLegacyPrivateBrowsingSession): Deleted.
2016         * NetworkProcess/NetworkConnectionToWebProcess.h:
2017         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2018         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2019         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
2020         * WebProcess/WebProcess.cpp:
2021         (WebKit::WebProcess::destroyLegacyPrivateBrowsingSessionInNetworkProcess): Deleted.
2022         * WebProcess/WebProcess.h:
2023
2024 2019-01-10  Per Arne Vollan  <pvollan@apple.com>
2025
2026         [macOS] Add name of IORegistry key in sandbox.
2027         https://bugs.webkit.org/show_bug.cgi?id=193324
2028
2029         Reviewed by Brent Fulgham.
2030
2031         IOGVAVTCapabilities key has been changed to IOGVAHEVCDecodeCapabilities.
2032
2033         * WebProcess/com.apple.WebProcess.sb.in:
2034
2035 2019-01-10  John Wilander  <wilander@apple.com>
2036
2037         Override the session configuration for cookieAcceptPolicy
2038         https://bugs.webkit.org/show_bug.cgi?id=190925
2039         <rdar://problem/45497382>
2040
2041         Reviewed by Alexey Proskuryakov and Alex Christensen.
2042
2043         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2044         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2045             Now sets cookieStorage._overrideSessionCookieAcceptPolicy to YES.
2046
2047 2019-01-09  Matt Rajca  <mrajca@apple.com>
2048
2049         Put per-document autoplay behavior behind runtime website policies quirk instead of a compile time flag
2050         https://bugs.webkit.org/show_bug.cgi?id=193301
2051
2052         Reviewed by Jer Noble.
2053
2054         Register a new quirk that can be configured per-load for per-document media
2055         autoplay behaviors.
2056
2057         * Shared/WebsiteAutoplayQuirk.h:
2058         * Shared/WebsitePoliciesData.cpp:
2059         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2060         * UIProcess/API/C/WKWebsitePolicies.cpp:
2061         (WKWebsitePoliciesSetAllowedAutoplayQuirks):
2062         (WKWebsitePoliciesGetAllowedAutoplayQuirks):
2063         * UIProcess/API/C/WKWebsitePolicies.h:
2064         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2065         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
2066         (-[_WKWebsitePolicies setAllowedAutoplayQuirks:]):
2067         (-[_WKWebsitePolicies allowedAutoplayQuirks]):
2068
2069 2019-01-10  Tim Horton  <timothy_horton@apple.com>
2070
2071         Rename some entitlements files to be more clear about their target platform
2072         https://bugs.webkit.org/show_bug.cgi?id=193311
2073
2074         Reviewed by Alexey Proskuryakov.
2075
2076         * Configurations/Network-iOSMac.entitlements: Renamed from Source/WebKit/Configurations/Network-iOS-minimalsimulator.entitlements.
2077         * Configurations/NetworkService.xcconfig:
2078         * Configurations/WebContent-iOSMac.entitlements: Renamed from Source/WebKit/Configurations/WebContent-iOS-minimalsimulator.entitlements.
2079         * Configurations/WebContentService.xcconfig:
2080         * WebKit.xcodeproj/project.pbxproj:
2081
2082 2019-01-09  Brent Fulgham  <bfulgham@apple.com>
2083
2084         Unreviewed build fix after r239816.
2085
2086         Although EWS had no problem with the patch, I'm seeing build errors on the actual bots.
2087         This patch corrects the problem.
2088
2089         * NetworkProcess/NetworkProcess.cpp:
2090         (WebKit::NetworkProcess::logFrameNavigation):
2091         (WebKit::NetworkProcess::logUserInteraction):
2092
2093 2019-01-09  Brent Fulgham  <bfulgham@apple.com>
2094
2095         Create a WebResourceLoadStatisticsStore attached to the NetworkSession
2096         https://bugs.webkit.org/show_bug.cgi?id=193261
2097         <rdar://problem/47158616>
2098
2099         Reviewed by Alex Christensen.
2100
2101         This patch modifies NetworkSession so that it owns a WebResourceLoadStatisticsStore
2102         object. This object is only created if the ResourceLoadStatistics feature is turned on.
2103
2104         The patch also modifies WebResourceLoadStatisticsStore so that it can be constructed
2105         with an owning NetworkSession as an alternative to the current practice of using a
2106         WebsiteDataStore object.
2107
2108         Two initial messages from the WebContent process are added (logFrameNavigation and
2109         logUserNavigation) that notify the network process of these actions. Currently they
2110         are called in addition the calls to the WebsiteDataStore object. These redundant calls
2111         will be removed in a future patch.
2112
2113         This patch forces the ResourceLoadStatistics code in the NetworkSession to be off by
2114         default, so there should be no change in behavior with this patch.
2115
2116         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2117         (WebKit::ResourceLoadStatisticsMemoryStore::updateClientSideCookiesAgeCap):
2118         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2119         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2120         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccessForFrame):
2121         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
2122         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
2123         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
2124         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
2125         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
2126         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
2127         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCapForPrevalentResources):
2128         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
2129         (WebKit::WebResourceLoadStatisticsStore::updatePrevalentDomainsToBlockCookiesFor):
2130         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
2131         (WebKit::WebResourceLoadStatisticsStore::removePrevalentDomains):
2132         (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler):
2133         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2134         * NetworkProcess/NetworkProcess.cpp:
2135         (WebKit::NetworkProcess::initializeNetworkProcess):
2136         (WebKit::NetworkProcess::logFrameNavigation):
2137         (WebKit::NetworkProcess::logUserInteraction):
2138         * NetworkProcess/NetworkProcess.h:
2139         * NetworkProcess/NetworkProcess.messages.in:
2140         * NetworkProcess/NetworkSession.cpp:
2141         (WebKit::NetworkSession::enableResourceLoadStatistics):
2142         * NetworkProcess/NetworkSession.h:
2143         (WebKit::NetworkSession::resourceLoadStatistics const):
2144         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2145         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
2146         (WebKit::NetworkSessionCreationParameters::encode const):
2147         (WebKit::NetworkSessionCreationParameters::decode):
2148         * NetworkProcess/NetworkSessionCreationParameters.h:
2149         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2150         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2151         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2152         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2153         * UIProcess/Network/NetworkProcessProxy.cpp:
2154         (WebKit::NetworkProcessProxy::didLogUserInteraction):
2155         * UIProcess/Network/NetworkProcessProxy.h:
2156         * UIProcess/Network/NetworkProcessProxy.messages.in:
2157         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2158         (WebsiteDataStore::parameters):
2159         * UIProcess/WebPageProxy.cpp:
2160         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2161         (WebKit::WebPageProxy::logFrameNavigation):
2162         * UIProcess/WebPageProxy.h:
2163         * UIProcess/WebProcessPool.cpp:
2164         (WebKit::WebProcessPool::ensureNetworkProcess):
2165         (WebKit::WebProcessPool::initializeNewWebProcess):
2166
2167 2019-01-09  Alex Christensen  <achristensen@webkit.org>
2168
2169         Replace SessionTracker with HashMap member of NetworkProcess
2170         https://bugs.webkit.org/show_bug.cgi?id=193266
2171
2172         Reviewed by Joseph Pecoraro.
2173
2174         * NetworkProcess/Downloads/DownloadManager.cpp:
2175         (WebKit::DownloadManager::startDownload):
2176         * NetworkProcess/Downloads/DownloadManager.h:
2177         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
2178         (WebKit::Download::resume):
2179         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
2180         (WebKit::NetworkCORSPreflightChecker::startPreflight):
2181         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2182         (WebKit::NetworkConnectionToWebProcess::preconnectTo):
2183         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
2184         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
2185         (WebKit::NetworkConnectionToWebProcess::destroyLegacyPrivateBrowsingSession):
2186         * NetworkProcess/NetworkConnectionToWebProcess.h:
2187         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2188         * NetworkProcess/NetworkProcess.cpp:
2189         (WebKit::NetworkProcess::initializeNetworkProcess):
2190         (WebKit::NetworkProcess::clearCachedCredentials):
2191         (WebKit::NetworkProcess::networkSession):
2192         (WebKit::NetworkProcess::setSession):
2193         (WebKit::NetworkProcess::destroySession):
2194         (WebKit::NetworkProcess::preconnectTo):
2195         * NetworkProcess/NetworkProcess.h:
2196         * NetworkProcess/NetworkResourceLoader.cpp:
2197         (WebKit::NetworkResourceLoader::startNetworkLoad):
2198         (WebKit::NetworkResourceLoader::didFinishLoading):
2199         (WebKit::NetworkResourceLoader::sendResultForCacheEntry):
2200         (WebKit::NetworkResourceLoader::shouldLogCookieInformation):
2201         (WebKit::NetworkResourceLoader::logCookieInformation const):
2202         (WebKit::logBlockedCookieInformation):
2203         (WebKit::logCookieInformationInternal):
2204         (WebKit::NetworkResourceLoader::logCookieInformation):
2205         * NetworkProcess/NetworkResourceLoader.h:
2206         * NetworkProcess/PingLoad.cpp:
2207         (WebKit::PingLoad::loadRequest):
2208         * NetworkProcess/PingLoad.h:
2209         * NetworkProcess/PreconnectTask.cpp:
2210         (WebKit::PreconnectTask::PreconnectTask):
2211         * NetworkProcess/PreconnectTask.h:
2212         * NetworkProcess/RemoteNetworkingContext.h:
2213         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2214         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
2215         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2216         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2217         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2218         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2219         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2220         * Shared/SessionTracker.cpp: Removed.
2221         * Shared/SessionTracker.h: Removed.
2222         * Sources.txt:
2223         * WebKit.xcodeproj/project.pbxproj:
2224         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2225         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
2226         * WebProcess/Network/WebLoaderStrategy.cpp:
2227         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2228         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
2229         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
2230         * WebProcess/WebPage/WebPage.cpp:
2231         * WebProcess/WebProcess.cpp:
2232         (WebKit::WebProcess::destroyLegacyPrivateBrowsingSessionInNetworkProcess):
2233         * WebProcess/WebProcess.h:
2234         * WebProcess/cocoa/WebProcessCocoa.mm:
2235
2236 2019-01-09  Alex Christensen  <achristensen@webkit.org>
2237
2238         Expand use of sourceApplicationAuditData
2239         https://bugs.webkit.org/show_bug.cgi?id=192995
2240         <rdar://problem/46627875>
2241
2242         Reviewed by Brady Eidson.
2243
2244         sourceApplicationAuditData has been used for a long time on iOS, but it's needed on more platforms.
2245         I also made it return an Optional instead of a bool and returning by reference. Ahhh. So much nicer.
2246         The NetworkProcess needed an additional entitlement on Mac to continue to load anything, which is desirable.
2247
2248         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2249         (WebKit::NetworkProcess::sourceApplicationAuditData const):
2250         * Platform/IPC/Connection.h:
2251         * Platform/IPC/mac/ConnectionMac.mm:
2252         (IPC::Connection::getAuditToken):
2253         * WebProcess/WebProcess.cpp:
2254         (WebKit::WebProcess::initializeWebProcess):
2255         * WebProcess/cocoa/WebProcessCocoa.mm:
2256         (WebKit::WebProcess::sourceApplicationAuditData const):
2257
2258 2019-01-09  Brent Fulgham  <bfulgham@apple.com>
2259
2260         [iOS] Update sandbox profile to use iconservices instead of lsdiconservice
2261         https://bugs.webkit.org/show_bug.cgi?id=193115
2262         <rdar://problem/44867379>
2263
2264         Reviewed by Eric Carlson.
2265
2266         Add access to the 'com.apple.iconservices' endpoint. We will remove access to
2267         the older name ('com.apple.lsdiconservices') once existing clients have completed
2268         the switch.
2269
2270         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2271
2272 2019-01-09  Antti Koivisto  <antti@apple.com>
2273
2274         [PSON] Flash of blank content while transitioning from page A to page B.
2275         https://bugs.webkit.org/show_bug.cgi?id=193283
2276
2277         Reviewed by Chris Dumez.
2278
2279         Layer tree is not frozen during WebPage construction. If the flush timer (started for the initial
2280         empty document) manages to run before the actual page load starts, we'll get a flash.
2281
2282         * Shared/WebPageCreationParameters.cpp:
2283         (WebKit::WebPageCreationParameters::encode const):
2284         (WebKit::WebPageCreationParameters::decode):
2285         * Shared/WebPageCreationParameters.h:
2286
2287         Rename shouldDelayAttachingDrawingArea bit to isSwapFromSuspended and make it available on all platforms.
2288
2289         * UIProcess/RemoteLayerTree/mac/ScrollerMac.h: Removed.
2290         * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm: Removed.
2291         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.h: Removed.
2292         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm: Removed.
2293         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp: Removed.
2294         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h: Removed.
2295         * UIProcess/WebPageProxy.cpp:
2296         (WebKit::WebPageProxy::swapToWebProcess):
2297         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2298         (WebKit::WebPageProxy::initializeWebPage):
2299         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2300         * UIProcess/WebPageProxy.h:
2301         * WebProcess/WebPage/WebPage.cpp:
2302         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
2303
2304         Freeze the layer tree in WebPage constructor if this is a swap from a suspended process.
2305
2306         (WebKit::WebPage::reinitializeWebPage):
2307         (WebKit::WebPage::didCompletePageTransition):
2308
2309         Unfreeze on first non-initial empty document page transition.
2310
2311         * WebProcess/WebPage/WebPage.h:
2312         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2313         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
2314
2315 2019-01-09  Chris Dumez  <cdumez@apple.com>
2316
2317         WebKit Networking process crashes if the HTTPSUpgradeList is not found in the bundle
2318         https://bugs.webkit.org/show_bug.cgi?id=193285
2319         <rdar://problem/47147610>
2320
2321         Reviewed by Geoffrey Garen.
2322
2323         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
2324         (WebKit::networkHTTPSUpgradeCheckerDatabasePath):
2325         (WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker):
2326
2327 2019-01-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2328
2329         [GTK] Add missing autocleanups
2330         https://bugs.webkit.org/show_bug.cgi?id=193068
2331
2332         Reviewed by Carlos Garcia Campos.
2333
2334         * UIProcess/API/gtk/WebKitAutocleanups.h:
2335
2336 2019-01-08  Alex Christensen  <achristensen@webkit.org>
2337
2338         Fix CompletionHandler assertions introduced today.
2339         https://bugs.webkit.org/show_bug.cgi?id=193237
2340
2341         This reverts part of r239710 and all of r239725, r239738, and r239748 which unsuccessfully tried to fix all the assertions.
2342         This code is a mess that will have to be cleaned up later.
2343
2344         * NetworkProcess/NetworkResourceLoader.cpp:
2345         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
2346         * NetworkProcess/cache/CacheStorageEngine.cpp:
2347         (WebKit::CacheStorage::Engine::from):
2348         * NetworkProcess/cache/CacheStorageEngine.h:
2349         * NetworkProcess/cache/NetworkCache.cpp:
2350         (WebKit::NetworkCache::Cache::store):
2351         (WebKit::NetworkCache::Cache::remove):
2352         (WebKit::NetworkCache::Cache::traverse):
2353         (WebKit::NetworkCache::Cache::clear):
2354         (WebKit::NetworkCache::Cache::retrieveData):
2355         * NetworkProcess/cache/NetworkCache.h:
2356         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2357         (WebKit::NetworkCache::SpeculativeLoad::didFinishLoading):
2358         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2359         (WebKit::NetworkCache::Storage::store):
2360         (WebKit::NetworkCache::Storage::WriteOperation::~WriteOperation): Deleted.
2361         * NetworkProcess/cache/NetworkCacheStorage.h:
2362         (WebKit::NetworkCache::Storage::store):
2363
2364 2019-01-08  Jiewen Tan  <jiewen_tan@apple.com>
2365
2366         [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky
2367         https://bugs.webkit.org/show_bug.cgi?id=192061
2368
2369         Reviewed by Dewei Zhu.
2370
2371         Part 6.
2372
2373         Add some additional temporary logging info to determine if data is actually sent.
2374         Once the bug is determined and fixed, we should remove all logging added in this patch.
2375
2376         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
2377         (WebKit::MockHidConnection::send):
2378
2379 2019-01-08  Jiewen Tan  <jiewen_tan@apple.com>
2380
2381         [WebAuthN] Support U2F HID Authenticators on macOS
2382         https://bugs.webkit.org/show_bug.cgi?id=191535
2383         <rdar://problem/47102027>
2384
2385         Reviewed by Brent Fulgham.
2386
2387         This patch implements the support for U2F authenticators, and enables it for hid devices.
2388         It follows the CTAP spec to map WebAuthN requests to U2F commands and return the responses:
2389         https://fidoalliance.org/specs/fido-v2.0-id-20180227/fido-client-to-authenticator-protocol-v2.0-id-20180227.html#u2f-interoperability
2390         Most of the parts are done before this patch, this patch focues on: 7.2.2 and 7.3.2.
2391
2392         Besides implementing the U2fHidAuthenticator, this patch also adds support in the mocking
2393         environment for U2F authenticators. It is done by extending the stages in MockHidConnection
2394         from 4 to indefinite as multi-round communications are expected to map WebAuthN requests
2395         to U2F requests.
2396
2397         * Sources.txt:
2398         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2399         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
2400         * UIProcess/WebAuthentication/Cocoa/HidService.mm:
2401         (WebKit::HidService::continueAddDeviceAfterGetInfo):
2402         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
2403         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
2404         * UIProcess/WebAuthentication/fido/CtapHidDriver.h:
2405         (WebKit::CtapHidDriver::setProtocol):
2406         * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp: Added.
2407         (WebKit::U2fHidAuthenticator::U2fHidAuthenticator):
2408         (WebKit::U2fHidAuthenticator::makeCredential):
2409         (WebKit::U2fHidAuthenticator::checkExcludeList):
2410         (WebKit::U2fHidAuthenticator::issueRegisterCommand):
2411         (WebKit::U2fHidAuthenticator::getAssertion):
2412         (WebKit::U2fHidAuthenticator::issueSignCommand):
2413         (WebKit::U2fHidAuthenticator::issueNewCommand):
2414         (WebKit::U2fHidAuthenticator::issueCommand):
2415         (WebKit::U2fHidAuthenticator::responseReceived):
2416         (WebKit::U2fHidAuthenticator::continueRegisterCommandAfterResponseReceived):
2417         (WebKit::U2fHidAuthenticator::continueCheckOnlyCommandAfterResponseReceived):
2418         (WebKit::U2fHidAuthenticator::continueBogusCommandAfterResponseReceived):
2419         (WebKit::U2fHidAuthenticator::continueSignCommandAfterResponseReceived):
2420         * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.h: Added.
2421         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
2422         (WebKit::MockHidConnection::parseRequest):
2423         (WebKit::MockHidConnection::feedReports):
2424         * UIProcess/WebAuthentication/Mock/MockHidConnection.h:
2425         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
2426         * WebKit.xcodeproj/project.pbxproj:
2427
2428 2019-01-08  Youenn Fablet  <youenn@apple.com>
2429
2430         service worker fetch handler results in bad referrer
2431         https://bugs.webkit.org/show_bug.cgi?id=188248
2432         <rdar://problem/47050478>
2433
2434         Reviewed by Alex Christensen.
2435
2436         NetworkDataTaskCocoa is sometimes updating the referrer on its own.
2437         Instead of updating the referrer when sending the request to WebProcess for evaluation,
2438         Update the referrer once the web process decides to follow the redirection.
2439         This ensures that any referrer that the WebProcess will set will be updated by NetworkDataTaskCocoa.
2440
2441         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2442         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2443         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2444         (WebKit::NetworkDataTaskCocoa::restrictRequestReferrerToOriginIfNeeded):
2445         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
2446
2447 2019-01-08  Alex Christensen  <achristensen@webkit.org>
2448
2449         Fix more assertions after r239710
2450         https://bugs.webkit.org/show_bug.cgi?id=193237
2451
2452         * NetworkProcess/cache/NetworkCacheStorage.h:
2453         (WebKit::NetworkCache::Storage::store):
2454         Make default parameter an empty lambda instead of a null CompletionHandler.
2455         This way it can be called once instead of thinking it has already been called.
2456
2457 2019-01-08  Brent Fulgham  <bfulgham@apple.com>
2458
2459         Move ResourceLoadStatistics files from UIProcess to NetworkProcess
2460         https://bugs.webkit.org/show_bug.cgi?id=193252
2461         <rdar://problem/47125401>
2462
2463         Reviewed by Alex Christensen.
2464
2465         This patch is the first part of a refactoring to move the ResourceLoadStatistics logic from the UIProcess to the NetworkProcess.
2466
2467         This patch moves code into different folders and adjusts necessary build files, but does not change where the code executes. These
2468         changes have no impact on behavior or test results.
2469
2470         I also modified a few files to add missing include files uncovered by the unified build system.
2471
2472         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: Renamed from Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp.
2473         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: Renamed from Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h.
2474         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp: Renamed from Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp.
2475         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.h: Renamed from Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.h.
2476         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: Renamed from Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp.
2477         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: Renamed from Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h.
2478         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp: Renamed from Source/WebKit/UIProcess/WebResourceLoadStatisticsTelemetry.cpp.
2479         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.h: Renamed from Source/WebKit/UIProcess/WebResourceLoadStatisticsTelemetry.h.
2480         * NetworkProcess/Downloads/PendingDownload.cpp:
2481         * NetworkProcess/Downloads/PendingDownload.h:
2482         * CMakeLists.txt:
2483         * PlatformMac.cmake:
2484         * PlatformWin.cmake:
2485         * Shared/PersistencyUtils.cpp: Renamed from Source/WebKit/UIProcess/PersistencyUtils.cpp.
2486         * Shared/PersistencyUtils.h: Renamed from Source/WebKit/UIProcess/PersistencyUtils.h.
2487         * Sources.txt:
2488         * SourcesCocoa.txt:
2489         * SourcesGTK.txt:
2490         * SourcesWPE.txt:
2491         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2492         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): Add missing WebKit:: scope.
2493         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: Add missing include.
2494         * UIProcess/WebDataListSuggestionsDropdown.cpp: Ditto.
2495         * UIProcess/mac/DisplayLink.cpp:
2496         * UnifiedSources-input.xcfilelist:
2497         * WebKit.xcodeproj/project.pbxproj:
2498
2499 2019-01-08  Chris Dumez  <cdumez@apple.com>
2500
2501         Mark SuspendedPageProxy as fast allocated
2502         https://bugs.webkit.org/show_bug.cgi?id=193248
2503
2504         Reviewed by Alex Christensen.
2505
2506         * UIProcess/SuspendedPageProxy.h:
2507
2508 2019-01-08  Chris Dumez  <cdumez@apple.com>
2509
2510         Prevent cross-site top-level navigations from third-party iframes
2511         https://bugs.webkit.org/show_bug.cgi?id=193076
2512         <rdar://problem/36074736>
2513
2514         Reviewed by Alex Christensen.
2515
2516         Add experimental feature flag, on by default.
2517
2518         * Shared/WebPreferences.yaml:
2519
2520 2019-01-08  Alex Christensen  <achristensen@webkit.org>
2521
2522         Remove more use of NetworkProcess::singleton
2523         https://bugs.webkit.org/show_bug.cgi?id=193244
2524
2525         Reviewed by Brent Fulgham.
2526
2527         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
2528         (WebKit::NetworkCORSPreflightChecker::NetworkCORSPreflightChecker):
2529         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
2530         * NetworkProcess/NetworkCORSPreflightChecker.h:
2531         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2532         (WebKit::NetworkConnectionToWebProcess::loadPing):
2533         * NetworkProcess/NetworkContentRuleListManager.cpp:
2534         (WebKit::NetworkContentRuleListManager::NetworkContentRuleListManager):
2535         (WebKit::NetworkContentRuleListManager::contentExtensionsBackend):
2536         * NetworkProcess/NetworkContentRuleListManager.h:
2537         * NetworkProcess/NetworkLoadChecker.cpp:
2538         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
2539         (WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded const):
2540         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
2541         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
2542         * NetworkProcess/NetworkLoadChecker.h:
2543         * NetworkProcess/NetworkProcess.cpp:
2544         (WebKit::NetworkProcess::NetworkProcess):
2545         (WebKit::NetworkProcess::didReceiveMessage):
2546         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
2547         * NetworkProcess/NetworkProcess.h:
2548         (WebKit::NetworkProcess::networkContentRuleListManager):
2549         * NetworkProcess/NetworkResourceLoader.cpp:
2550         * NetworkProcess/PingLoad.cpp:
2551         (WebKit::PingLoad::PingLoad):
2552         * NetworkProcess/PingLoad.h:
2553         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2554         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
2555         (WebKit::WebSWServerToContextConnection::connectionMayNoLongerBeNeeded):
2556         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
2557
2558 2019-01-08  Alex Christensen  <achristensen@webkit.org>
2559
2560         Stop using NetworkProcess::singleton in NetworkCache code
2561         https://bugs.webkit.org/show_bug.cgi?id=193243
2562
2563         Reviewed by Brent Fulgham.
2564
2565         * NetworkProcess/cache/NetworkCache.cpp:
2566         (WebKit::NetworkCache::Cache::open):
2567         (WebKit::NetworkCache::Cache::Cache):
2568         * NetworkProcess/cache/NetworkCache.h:
2569         (WebKit::NetworkCache::Cache::networkProcess):
2570         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2571         (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
2572         (WebKit::NetworkCache::SpeculativeLoadManager::canRetrieve const):
2573         (WebKit::NetworkCache::SpeculativeLoadManager::addPreloadedEntry):
2574         (WebKit::NetworkCache::SpeculativeLoadManager::revalidateSubresource):
2575         (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
2576         (WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation):
2577         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
2578         (WebKit::NetworkCache::Statistics::recordRetrievalRequest):
2579         (WebKit::NetworkCache::Statistics::recordNotUsingCacheForRequest):
2580         (WebKit::NetworkCache::Statistics::recordRetrievalFailure):
2581         (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry):
2582         (WebKit::NetworkCache::Statistics::recordRevalidationSuccess):
2583         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2584         (WebKit::NetworkCache::retrieveFromMemory):
2585         * NetworkProcess/cache/NetworkCacheStorage.h:
2586         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2587         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2588
2589 2019-01-08  Alex Christensen  <achristensen@webkit.org>
2590
2591         Call CompletionHandler when destroying a NetworkCache::Storage::WriteOperation
2592         https://bugs.webkit.org/show_bug.cgi?id=193251
2593
2594         Reviewed by Chris Dumez.
2595
2596         This fixes another assertion introduced in r239710.
2597
2598         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2599         (WebKit::NetworkCache::Storage::WriteOperation::~WriteOperation):
2600
2601 2019-01-08  Alex Christensen  <achristensen@webkit.org>
2602
2603         Stop using NetworkStorageSession in WebProcess
2604         https://bugs.webkit.org/show_bug.cgi?id=193236
2605
2606         Reviewed by Don Olmstead.
2607
2608         * Shared/WebProcessCreationParameters.cpp:
2609         (WebKit::WebProcessCreationParameters::encode const):
2610         (WebKit::WebProcessCreationParameters::decode):
2611         * Shared/WebProcessCreationParameters.h:
2612         * Shared/WebsitePoliciesData.cpp:
2613         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2614         * UIProcess/WebProcessPool.cpp:
2615         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
2616         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
2617         (WebKit::WebProcessPool::initializeNewWebProcess):
2618         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
2619         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
2620         (WebKit::WebProcessPool::processForNavigationInternal):
2621         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2622         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
2623         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
2624         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
2625         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession): Deleted.
2626         (WebKit::WebFrameNetworkingContext::storageSession const): Deleted.
2627         * WebProcess/WebPage/WebPage.cpp:
2628         (WebKit::WebPage::setSessionID):
2629         * WebProcess/WebProcess.cpp:
2630         (WebKit::WebProcess::initializeWebProcess):
2631         (WebKit::WebProcess::fetchWebsiteData):
2632         (WebKit::WebProcess::addWebsiteDataStore): Deleted.
2633         (WebKit::WebProcess::destroySession): Deleted.
2634         * WebProcess/WebProcess.h:
2635         * WebProcess/WebProcess.messages.in:
2636
2637 2019-01-08  Michael Catanzaro  <mcatanzaro@igalia.com>
2638
2639         Unreviewed, silence -Wformat warnings
2640
2641         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
2642         (WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker):
2643         (WebKit::NetworkHTTPSUpgradeChecker::query):
2644
2645 2019-01-08  Alex Christensen  <achristensen@webkit.org>
2646
2647         Unreviewed, rolling out r239727.
2648
2649         Broke API tests
2650
2651         Reverted changeset:
2652
2653         "Stop using NetworkStorageSession in WebProcess"
2654         https://bugs.webkit.org/show_bug.cgi?id=193236
2655         https://trac.webkit.org/changeset/239727
2656
2657 2019-01-08  Brian Burg  <bburg@apple.com>
2658
2659         Remove WKPageRef-based SPI in _WKAutomationSessionDelegate
2660         https://bugs.webkit.org/show_bug.cgi?id=193202
2661         <rdar://problem/37408718>
2662
2663         Reviewed by Alex Christensen.
2664
2665         This code is no longer used, it should be deleted.
2666
2667         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
2668         * UIProcess/Cocoa/AutomationSessionClient.h:
2669         * UIProcess/Cocoa/AutomationSessionClient.mm:
2670         (WebKit::AutomationSessionClient::AutomationSessionClient):
2671         (WebKit::AutomationSessionClient::requestNewPageWithOptions):
2672         (WebKit::AutomationSessionClient::requestSwitchToPage):
2673         (WebKit::AutomationSessionClient::requestHideWindowOfPage):
2674         (WebKit::AutomationSessionClient::requestRestoreWindowOfPage):
2675         (WebKit::AutomationSessionClient::requestMaximizeWindowOfPage):
2676         (WebKit::AutomationSessionClient::isShowingJavaScriptDialogOnPage):
2677         (WebKit::AutomationSessionClient::dismissCurrentJavaScriptDialogOnPage):
2678         (WebKit::AutomationSessionClient::acceptCurrentJavaScriptDialogOnPage):
2679         (WebKit::AutomationSessionClient::messageOfCurrentJavaScriptDialogOnPage):
2680         (WebKit::AutomationSessionClient::setUserInputForCurrentJavaScriptPromptOnPage):
2681         (WebKit::AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage):
2682         Clean up the delegate bridging methods now that only one delegate implementation is possible.
2683
2684 2019-01-08  Patrick Griffis  <pgriffis@igalia.com>
2685
2686         [GTK][WPE] Remove DConf permissions from sandbox
2687         https://bugs.webkit.org/show_bug.cgi?id=193021
2688
2689         Reviewed by Michael Catanzaro.
2690
2691         The latest development releases of xdg-desktop-portal and gtk3 use a
2692         new portal for settings on Wayland org.freedesktop.portal.Settings.
2693
2694         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
2695         (WebKit::bubblewrapSpawn):
2696
2697 2019-01-08  Alex Christensen  <achristensen@webkit.org>
2698
2699         Stop using NetworkStorageSession in WebProcess
2700         https://bugs.webkit.org/show_bug.cgi?id=193236
2701
2702         Reviewed by Don Olmstead.
2703
2704         * Shared/WebProcessCreationParameters.cpp:
2705         (WebKit::WebProcessCreationParameters::encode const):
2706         (WebKit::WebProcessCreationParameters::decode):
2707         * Shared/WebProcessCreationParameters.h:
2708         * Shared/WebsitePoliciesData.cpp:
2709         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2710         * UIProcess/WebProcessPool.cpp:
2711         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
2712         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
2713         (WebKit::WebProcessPool::initializeNewWebProcess):
2714         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
2715         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
2716         (WebKit::WebProcessPool::processForNavigationInternal):
2717         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2718         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
2719         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
2720         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
2721         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession): Deleted.
2722         (WebKit::WebFrameNetworkingContext::storageSession const): Deleted.
2723         * WebProcess/WebPage/WebPage.cpp:
2724         (WebKit::WebPage::setSessionID):
2725         * WebProcess/WebProcess.cpp:
2726         (WebKit::WebProcess::initializeWebProcess):
2727         (WebKit::WebProcess::fetchWebsiteData):
2728         (WebKit::WebProcess::addWebsiteDataStore): Deleted.
2729         (WebKit::WebProcess::destroySession): Deleted.
2730         * WebProcess/WebProcess.h:
2731         * WebProcess/WebProcess.messages.in:
2732
2733 2019-01-08  Alex Christensen  <achristensen@webkit.org>
2734
2735         Always call CompletionHandler in Cache::store
2736         https://bugs.webkit.org/show_bug.cgi?id=193237
2737
2738         Reviewed by Chris Dumez.
2739
2740         No change in behavior. This just fixes an assertion introduced in r239710 when the speculative loader finishes.
2741
2742         * NetworkProcess/NetworkResourceLoader.cpp:
2743         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
2744         * NetworkProcess/cache/NetworkCache.cpp:
2745         (WebKit::NetworkCache::Cache::store):
2746         * NetworkProcess/cache/NetworkCache.h:
2747         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2748         (WebKit::NetworkCache::SpeculativeLoad::didFinishLoading):
2749
2750 2019-01-08  Carlos Garcia Campos  <cgarcia@igalia.com>
2751
2752         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.23.2 release
2753
2754         * gtk/NEWS: Add release notes for 2.23.2.
2755
2756 2019-01-07  Chris Dumez  <cdumez@apple.com>
2757
2758         Cannot scoll for 5 seconds after swiping back on quoteunquoteapps.com
2759         https://bugs.webkit.org/show_bug.cgi?id=193215
2760         <rdar://problem/45108222>
2761
2762         Reviewed by Tim Horton.
2763
2764         When doing the history navigation, if the source and destination history
2765         items are clones then we will not trigger a main frame load. We may
2766         however trigger loads in subframes if needed. This was an issue for the
2767         ViewGestureController because it was expecting a main frame load after
2768         calling WebPageProxy::goToBackForwardItem() in order to determine when
2769         taking down the view snapshot is appropriate.
2770
2771         To address the problem, the ViewGestureController now takes the snapshot
2772         down as soon as the swipe gesture ends when the source and destination
2773         items are clones.
2774
2775         * Shared/WebBackForwardListItem.cpp:
2776         (WebKit::childItemWithTarget):
2777         (WebKit::WebBackForwardListItem::itemIsInSameDocument const):
2778         (WebKit::hasSameFrames):
2779         (WebKit::WebBackForwardListItem::itemIsClone):
2780         * Shared/WebBackForwardListItem.h:
2781         * UIProcess/ios/ViewGestureControllerIOS.mm:
2782         (WebKit::ViewGestureController::endSwipeGesture):
2783         * UIProcess/mac/ViewGestureControllerMac.mm:
2784         (WebKit::ViewGestureController::endSwipeGesture):
2785
2786 2019-01-07  David Kilzer  <ddkilzer@apple.com>
2787
2788         Leak of ScrollCompletionCallbackData (16 bytes) in com.apple.WebKit.WebContent running WebKit layout tests
2789         <https://webkit.org/b/193222>
2790         <rdar://problem/46862309>
2791
2792         Reviewed by Joseph Pecoraro.
2793
2794         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2795         (WKBundlePageRegisterScrollOperationCompletionCallback): Change
2796         to return true if callback will be called, else false.
2797         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
2798         (WKBundlePageRegisterScrollOperationCompletionCallback): Change
2799         to return `bool` value to denote whether callback will be called
2800         (true) or not called (false).
2801
2802 2019-01-07  Alex Christensen  <achristensen@webkit.org>
2803
2804         Remove use of NetworkProcess::singleton from CacheStorage::Engine::from
2805         https://bugs.webkit.org/show_bug.cgi?id=193220
2806
2807         Reviewed by Andy Estes.
2808
2809         This required passing the NetworkProcess& in from all its callers.
2810         While I was at it, I made them use CompletionHandlers where appropriate.
2811
2812         * NetworkProcess/NetworkProcess.cpp:
2813         (WebKit::NetworkProcess::destroySession):
2814         (WebKit::NetworkProcess::fetchWebsiteData):
2815         (WebKit::NetworkProcess::deleteWebsiteData):
2816         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
2817         (WebKit::NetworkProcess::findCacheEngine):
2818         (WebKit::NetworkProcess::ensureCacheEngine):
2819         (WebKit::NetworkProcess::removeCacheEngine):
2820         * NetworkProcess/NetworkProcess.h:
2821         * NetworkProcess/cache/CacheStorageEngine.cpp:
2822         (WebKit::CacheStorage::Engine::from):
2823         (WebKit::CacheStorage::Engine::destroyEngine):
2824         (WebKit::CacheStorage::Engine::fetchEntries):
2825         (WebKit::CacheStorage::Engine::open):
2826         (WebKit::CacheStorage::Engine::remove):
2827         (WebKit::CacheStorage::Engine::retrieveCaches):
2828         (WebKit::CacheStorage::Engine::retrieveRecords):
2829         (WebKit::CacheStorage::Engine::putRecords):
2830         (WebKit::CacheStorage::Engine::deleteMatchingRecords):
2831         (WebKit::CacheStorage::Engine::lock):
2832         (WebKit::CacheStorage::Engine::unlock):
2833         (WebKit::CacheStorage::Engine::clearMemoryRepresentation):
2834         (WebKit::CacheStorage::Engine::representation):
2835         (WebKit::CacheStorage::Engine::clearAllCaches):
2836         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
2837         (WebKit::CacheStorage::globalEngineMap): Deleted.
2838         * NetworkProcess/cache/CacheStorageEngine.h:
2839         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
2840         (WebKit::CacheStorageEngineConnection::~CacheStorageEngineConnection):
2841         (WebKit::CacheStorageEngineConnection::open):
2842         (WebKit::CacheStorageEngineConnection::remove):
2843         (WebKit::CacheStorageEngineConnection::caches):
2844         (WebKit::CacheStorageEngineConnection::retrieveRecords):
2845         (WebKit::CacheStorageEngineConnection::deleteMatchingRecords):
2846         (WebKit::CacheStorageEngineConnection::putRecords):
2847         (WebKit::CacheStorageEngineConnection::reference):
2848         (WebKit::CacheStorageEngineConnection::dereference):
2849         (WebKit::CacheStorageEngineConnection::clearMemoryRepresentation):
2850         (WebKit::CacheStorageEngineConnection::engineRepresentation):
2851         * NetworkProcess/cache/NetworkCache.cpp:
2852         (WebKit::NetworkCache::Cache::store):
2853         (WebKit::NetworkCache::Cache::remove):
2854         (WebKit::NetworkCache::Cache::traverse):
2855         (WebKit::NetworkCache::Cache::clear):
2856         (WebKit::NetworkCache::Cache::retrieveData):
2857         * NetworkProcess/cache/NetworkCache.h:
2858
2859 2019-01-07  David Kilzer  <ddkilzer@apple.com>
2860
2861         Prefer RetainPtr<NSObject> to RetainPtr<NSObject *>
2862         <https://webkit.org/b/193056>
2863
2864         Reviewed by Alex Christensen.
2865
2866         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
2867         (WebKit::XPCServiceMain):
2868         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
2869         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
2870         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
2871         * UIProcess/Plugins/PluginProcessProxy.h:
2872         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
2873         (WebKit::RemoteLayerTreeHost::createEmbeddedView):
2874         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
2875         (WebKit::PlatformCALayerRemoteCustom::clone const):
2876         - Remove '*' from RetainPtr<> type.
2877
2878 2019-01-07  Dean Jackson  <dino@apple.com>
2879
2880         Turn on Pointer Events by default for iOS
2881         https://bugs.webkit.org/show_bug.cgi?id=193214
2882         <rdar://problem/46974878>
2883
2884         Reviewed by Wenson Hsieh.
2885
2886         Turn on Pointer Events.
2887
2888         * Shared/WebPreferences.yaml:
2889         * Shared/WebPreferencesDefaultValues.h: Make a new #define for iOS.
2890
2891 2019-01-07  Alex Christensen  <achristensen@webkit.org>
2892
2893         Remove use of NetworkProcess::singleton in ServiceWorker code
2894         https://bugs.webkit.org/show_bug.cgi?id=193209
2895
2896         Reviewed by Megan Gardner.
2897
2898         Use a member Ref<NetworkProcess> instead to avoid global singleton use.
2899
2900         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2901         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
2902         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
2903         (WebKit::WebSWServerConnection::WebSWServerConnection):
2904         (WebKit::WebSWServerConnection::~WebSWServerConnection):
2905         (WebKit::WebSWServerConnection::startFetch):
2906         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
2907         (WebKit::WebSWServerConnection::scheduleJobInServer):
2908         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
2909
2910 2019-01-07  Alex Christensen  <achristensen@webkit.org>
2911
2912         Remove use of NetworkProcess::singleton in NetworkLoad/NetworkDataTask code
2913         https://bugs.webkit.org/show_bug.cgi?id=193212
2914
2915         Reviewed by Andy Estes.
2916
2917         * NetworkProcess/NetworkDataTaskBlob.cpp:
2918         (WebKit::NetworkDataTaskBlob::NetworkDataTaskBlob):
2919         (WebKit::NetworkDataTaskBlob::download):
2920         (WebKit::NetworkDataTaskBlob::writeDownload):
2921         (WebKit::NetworkDataTaskBlob::didFailDownload):
2922         (WebKit::NetworkDataTaskBlob::didFinishDownload):
2923         * NetworkProcess/NetworkDataTaskBlob.h:
2924         * NetworkProcess/NetworkLoad.cpp:
2925         (WebKit::NetworkLoad::NetworkLoad):
2926         (WebKit::NetworkLoad::convertTaskToDownload):
2927         (WebKit::NetworkLoad::didReceiveChallenge):
2928         (WebKit::NetworkLoad::didReceiveResponse):
2929         * NetworkProcess/NetworkLoad.h:
2930
2931 2019-01-07  Alex Christensen  <achristensen@webkit.org>
2932
2933         Remove use of NetworkProcess::singleton for downloads
2934         https://bugs.webkit.org/show_bug.cgi?id=193207
2935
2936         Reviewed by Brady Eidson.
2937
2938         No change in behavior.  The DownloadManager is now a member of the NetworkProcess instead of a static singleton.
2939
2940         * NetworkProcess/Downloads/Download.cpp:
2941         (WebKit::Download::Download):
2942         (WebKit::Download::didReceiveChallenge):
2943         * NetworkProcess/Downloads/Download.h:
2944         * NetworkProcess/Downloads/DownloadManager.cpp:
2945         (WebKit::DownloadManager::startDownload):
2946         (WebKit::DownloadManager::convertNetworkLoadToDownload):
2947         * NetworkProcess/Downloads/DownloadManager.h:
2948         (WebKit::DownloadManager::client):
2949         * NetworkProcess/Downloads/PendingDownload.cpp:
2950         (WebKit::PendingDownload::PendingDownload):
2951         (WebKit::PendingDownload::messageSenderConnection):
2952         * NetworkProcess/Downloads/PendingDownload.h:
2953         * NetworkProcess/NetworkLoadChecker.cpp:
2954         * NetworkProcess/NetworkProcess.cpp:
2955         (WebKit::NetworkProcess::NetworkProcess):
2956         (WebKit::NetworkProcess::downloadManager):
2957         * NetworkProcess/NetworkProcess.h:
2958
2959 2019-01-07  Devin Rousso  <drousso@apple.com>
2960
2961         Web Inspector: Network: show secure connection details per-request
2962         https://bugs.webkit.org/show_bug.cgi?id=191539
2963         <rdar://problem/45979891>
2964
2965         Reviewed by Joseph Pecoraro.
2966
2967         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2968         (stringForSSLProtocol): Added.
2969         (stringForSSLCipher): Added.
2970         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
2971
2972 2019-01-07  Joseph Pecoraro  <pecoraro@apple.com>
2973
2974         Web Inspector: Remote inspector can crash if attempting to navigate inspector page
2975         https://bugs.webkit.org/show_bug.cgi?id=193204
2976         <rdar://problem/45550428>
2977
2978         Reviewed by Devin Rousso.
2979
2980         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
2981         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
2982         * UIProcess/mac/WKInspectorViewController.mm:
2983         (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]):
2984
2985 2019-01-07  Eric Carlson  <eric.carlson@apple.com>
2986
2987         Deactivate audio session whenever possible
2988         https://bugs.webkit.org/show_bug.cgi?id=193188
2989         <rdar://problem/42678977>
2990
2991         Reviewed by Jer Noble.
2992
2993         * WebProcess/WebPage/WebPage.cpp:
2994         (WebKit::WebPage::WebPage):
2995
2996 2019-01-07  Joseph Pecoraro  <pecoraro@apple.com>
2997
2998         [Cocoa] Add SPI to check if a WKWebView has an inspector frontend
2999         https://bugs.webkit.org/show_bug.cgi?id=193162
3000         <rdar://problem/24267143>
3001
3002         Reviewed by Alex Christensen.
3003
3004         * UIProcess/API/Cocoa/WKWebView.mm:
3005         (-[WKWebView _hasInspectorFrontend]):
3006         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3007         * UIProcess/WebPageProxy.h:
3008         (WebKit::WebPageProxy::hasInspectorFrontend const):
3009
3010 2019-01-07  Antti Koivisto  <antti@apple.com>
3011
3012         UI process side scrollbars for UI side compositing on Mac
3013         https://bugs.webkit.org/show_bug.cgi?id=193106
3014
3015         Reviewed by Tim Horton.
3016
3017         This patch implements Mac scrollbars on UI process side using the low level NSScrollerImp/NSScrollerPairImp
3018         SPIs. With this patch scrollbars mostly work for the main frame and also render (but can't be interacted with)
3019         for the subframes.
3020
3021         This is based on the similar code for web process side scrollbars in ScrollAnimatorMac. There is quite a bit of
3022         copy code as there is no way to share nicely. One of these will eventually go away anyway.
3023
3024         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
3025         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
3026         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
3027         * Shared/WebCoreArgumentCoders.cpp:
3028         (IPC::ArgumentCoder<ScrollableAreaParameters>::encode):
3029         (IPC::ArgumentCoder<ScrollableAreaParameters>::decode):
3030         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
3031         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
3032         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
3033         (WebKit::RemoteScrollingCoordinatorProxy::handleMouseEvent):
3034         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
3035         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
3036         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
3037         (WebKit::RemoteScrollingTree::handleMouseEvent):
3038         * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
3039         * UIProcess/RemoteLayerTree/mac: Added.
3040         * UIProcess/RemoteLayerTree/mac/ScrollerMac.h: Added.
3041
3042         Wraps NSScrollerImp for vertical or horizontal scrollbar.
3043
3044         (WebKit::ScrollerMac::pair):
3045         (WebKit::ScrollerMac::orientation const):
3046         (WebKit::ScrollerMac::hostLayer const):
3047         (WebKit::ScrollerMac::scrollerImp):
3048         * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm: Added.
3049         (-[WKScrollbarPartAnimation initWithScroller:featureToAnimate:animateFrom:animateTo:duration:]):
3050         (-[WKScrollbarPartAnimation startAnimation]):
3051         (-[WKScrollbarPartAnimation setStartValue:]):
3052         (-[WKScrollbarPartAnimation setEndValue:]):
3053         (-[WKScrollbarPartAnimation setCurrentProgress:]):
3054         (-[WKScrollbarPartAnimation invalidate]):
3055         (-[WKScrollerImpDelegate initWithScroller:]):
3056         (-[WKScrollerImpDelegate cancelAnimations]):
3057         (-[WKScrollerImpDelegate scrollerPair]):
3058         (-[WKScrollerImpDelegate convertRectToBacking:]):
3059         (-[WKScrollerImpDelegate convertRectFromBacking:]):
3060         (-[WKScrollerImpDelegate layer]):
3061         (-[WKScrollerImpDelegate mouseLocationInScrollerForScrollerImp:]):
3062         (-[WKScrollerImpDelegate convertRectToLayer:]):
3063         (-[WKScrollerImpDelegate shouldUseLayerPerPartForScrollerImp:]):
3064         (-[WKScrollerImpDelegate effectiveAppearanceForScrollerImp:]):
3065         (-[WKScrollerImpDelegate setUpAlphaAnimation:scrollerPainter:part:animateAlphaTo:duration:]):
3066         (-[WKScrollerImpDelegate scrollerImp:animateKnobAlphaTo:duration:]):
3067         (-[WKScrollerImpDelegate scrollerImp:animateTrackAlphaTo:duration:]):
3068         (-[WKScrollerImpDelegate scrollerImp:animateUIStateTransitionWithDuration:]):
3069         (-[WKScrollerImpDelegate scrollerImp:animateExpansionTransitionWithDuration:]):
3070         (-[WKScrollerImpDelegate scrollerImp:overlayScrollerStateChangedTo:]):
3071         (-[WKScrollerImpDelegate invalidate]):
3072         (WebKit::ScrollerMac::ScrollerMac):
3073         (WebKit::ScrollerMac::~ScrollerMac):
3074         (WebKit::ScrollerMac::attach):
3075         (WebKit::ScrollerMac::setHostLayer):
3076         (WebKit::ScrollerMac::updatePosition):
3077         (WebKit::ScrollerMac::convertFromContent const):
3078         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.h: Added.
3079         (WebKit::ScrollerPairMac::verticalScroller):
3080         (WebKit::ScrollerPairMac::horizontalScroller):
3081         (WebKit::ScrollerPairMac::scrollerImpPair):
3082         (WebKit::ScrollerPairMac::lastKnownMousePosition const):
3083         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm: Added.
3084
3085         Wraps NSScrollerPairImp and owns the vertical and horizontal scrollers.
3086
3087         (-[WKScrollerImpPairDelegate initWithScrollerPair:]):
3088         (-[WKScrollerImpPairDelegate invalidate]):
3089         (-[WKScrollerImpPairDelegate contentAreaRectForScrollerImpPair:]):
3090         (-[WKScrollerImpPairDelegate inLiveResizeForScrollerImpPair:]):
3091         (-[WKScrollerImpPairDelegate mouseLocationInContentAreaForScrollerImpPair:]):
3092         (-[WKScrollerImpPairDelegate scrollerImpPair:convertContentPoint:toScrollerImp:]):
3093         (-[WKScrollerImpPairDelegate scrollerImpPair:setContentAreaNeedsDisplayInRect:]):
3094         (-[WKScrollerImpPairDelegate scrollerImpPair:updateScrollerStyleForNewRecommendedScrollerStyle:]):
3095         (WebKit::ScrollerPairMac::ScrollerPairMac):
3096         (WebKit::ScrollerPairMac::~ScrollerPairMac):
3097         (WebKit::ScrollerPairMac::handleWheelEvent):
3098         (WebKit::ScrollerPairMac::handleMouseEvent):
3099         (WebKit::ScrollerPairMac::updatePositions):
3100         (WebKit::ScrollerPairMac::contentsSize const):
3101         (WebKit::ScrollerPairMac::visibleContentsRect const):
3102         (WebKit::ScrollerPairMac::useDarkAppearance const):
3103         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp: Added.
3104
3105         Special node for UI side Mac scrolling. Owns ScrollerPairMac instance.
3106
3107         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::ScrollingTreeFrameScrollingNodeRemoteMac):
3108         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::~ScrollingTreeFrameScrollingNodeRemoteMac):
3109         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::create):
3110         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::commitStateBeforeChildren):
3111         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::setScrollLayerPosition):
3112         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleWheelEvent):
3113         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleMouseEvent):
3114         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::scrollingTree const):
3115         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h: Added.
3116         * UIProcess/WebPageProxy.cpp:
3117         (WebKit::WebPageProxy::handleMouseEvent):
3118         * WebKit.xcodeproj/project.pbxproj:
3119
3120 2019-01-07  Brian Burg  <bburg@apple.com>
3121
3122         Unwanted page navigation after showing & dismissing contextual menu with control-click
3123         https://bugs.webkit.org/show_bug.cgi?id=192912
3124         <rdar://problem/46318508>
3125
3126         Reviewed by Timothy Hatcher.
3127
3128         After the conversion to use a mouse event queue, this behavior was observed rarely, especially
3129         when CPU is under load and lots of things are going on in the page. In other words, it's racy.
3130
3131         Based on NSEvent logging, it seems that when the system is under load, we simply take too long
3132         to enter the nested runloop that AppKit uses to handle events when the context menu is present.
3133         AppKit doesn't care whether or not the MouseDown triggered a nested runloop; on my machine it delivers
3134         the MouseUp event about 130ms after the MouseDown event. If we haven't show the context menu in
3135         that time, then the MouseUp is enqueued as a normal mouse event. If the Ctrl-click is on a link,
3136         then the MouseUp will be interpreted by EventHandler as a click event, which in the simplest case
3137         will initiate a main frame navigation. When the context menu is dismissed and the nested runloop
3138         is torn down, the navigation IPC message is handled in UIProcess and the page navigates away.
3139
3140         We can't do much to change AppKit's inherently racy behavior, but we can avoid processing
3141         mouse events that are delivered whilst we are processing the context menu-initiating event.
3142         From the WebProcess point of view, there is no race anymore because it does not receive the
3143         MouseUp event.
3144
3145         * UIProcess/WebPageProxy.cpp:
3146         (WebKit::WebPageProxy::showContextMenu):
3147         If new events come in, drop them on the floor. Based on testing, the nested runloop will discard
3148         the unpaired MouseUp event anyway, so this does not cause a change in behavior.
3149
3150 2019-01-07  Wenson Hsieh  <wenson_hsieh@apple.com>
3151
3152         Native caret shows up alongside the page's caret when requesting desktop site on jsfiddle.net
3153         https://bugs.webkit.org/show_bug.cgi?id=193180
3154         <rdar://problem/45971041>
3155
3156         Reviewed by Tim Horton.
3157
3158         JSFiddle uses CodeMirror; CodeMirror's editor works by capturing keystrokes and input in a hidden textarea
3159         element, and then drawing its own selection caret using web content. This textarea is hidden by being placed
3160         underneath an empty div with `overflow: hidden;`.
3161
3162         When requesting desktop site on iOS, both CodeMirror's caret and the native iOS caret are shown because iOS
3163         selection UI consists of native views overlaid on the page, whereas on macOS, the entire textarea (along with
3164         the caret) are occluded by the hidden overflow container. Additionally, various iOS behaviors related to
3165         selection and editing, such as zooming to reveal the focused element and showing the platform callout bar, are
3166         active when focusing this hidden editable area; these don't work as intended, and just interfere with the page's
3167         custom editing UI.
3168
3169         To fix this, we augment the text interaction suppression mechanism added in r238146 to detect when the focused
3170         element is in an empty `overflow: hidden` container, and bail out of native text editing behaviors.
3171
3172         * Shared/EditorState.cpp:
3173         (WebKit::EditorState::PostLayoutData::encode const):
3174         (WebKit::EditorState::PostLayoutData::decode):
3175         * Shared/EditorState.h:
3176
3177         Rename elementIsTransparent to elementIsTransparentOrFullyClipped.
3178
3179         * Shared/FocusedElementInformation.cpp:
3180         (WebKit::FocusedElementInformation::encode const):
3181         (WebKit::FocusedElementInformation::decode):
3182         * Shared/FocusedElementInformation.h:
3183         * UIProcess/ios/WKContentViewInteraction.h:
3184
3185         Rename FocusedElementIsTransparent to FocusedElementIsTransparentOrFullyClipped.
3186
3187         * UIProcess/ios/WKContentViewInteraction.mm:
3188         (-[WKContentView _zoomToRevealFocusedElement]):
3189         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3190         (-[WKContentView _elementDidBlur]):
3191
3192         Make an additional tweak here to only stop suppressing text interaction assistant in `-_elementDidBlur` if we're
3193         not also in the middle of changing the focused element. Without this, focusing a hidden editable element while
3194         another hidden editable element is currently focused causes us to zoom to reveal the newly focused hidden
3195         editable element, when we should be avoiding this behavior.
3196
3197         (-[WKContentView _updateChangedSelection:]):
3198         * WebProcess/WebPage/ios/WebPageIOS.mm:
3199         (WebKit::WebPage::platformEditorState const):
3200         (WebKit::WebPage::getFocusedElementInformation):
3201
3202 2019-01-07  Alex Christensen  <achristensen@webkit.org>
3203
3204         Move identifierBase from SessionTracker to NetworkProcess/WebProcess
3205         https://bugs.webkit.org/show_bug.cgi?id=193201
3206
3207         Reviewed by Tim Horton.
3208
3209         No change in behavior.  This just reduces process-global state.
3210
3211         * NetworkProcess/NetworkProcess.h:
3212         (WebKit::NetworkProcess::uiProcessBundleIdentifier const):
3213         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3214         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
3215         * NetworkProcess/mac/RemoteNetworkingContext.mm:
3216         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
3217         * Shared/SessionTracker.cpp:
3218         (WebKit::identifierBase): Deleted.
3219         (WebKit::SessionTracker::getIdentifierBase): Deleted.
3220         (WebKit::SessionTracker::setIdentifierBase): Deleted.
3221         * Shared/SessionTracker.h:
3222         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
3223         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
3224         (WebKit::WebFrameNetworkingContext::sourceApplicationIdentifier const):
3225         * WebProcess/WebProcess.h:
3226         (WebKit::WebProcess::uiProcessBundleIdentifier const):
3227         * WebProcess/cocoa/WebProcessCocoa.mm:
3228         (WebKit::WebProcess::platformInitializeWebProcess):
3229
3230 2019-01-07  Alex Christensen  <achristensen@webkit.org>
3231
3232         Reduce use of NetworkProcess::singleton
3233         https://bugs.webkit.org/show_bug.cgi?id=193197
3234
3235         Reviewed by Brady Eidson.
3236
3237         Pass it around as a Ref<NetworkProcess> as a step towards reducing global state.
3238         Soup's WebFrameNetworkingContext no longer makes a NetworkSession like all other ports
3239         because networking is no longer done in the WebProcess.
3240
3241         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
3242         (WebKit::WebIDBConnectionToClient::create):
3243         (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient):
3244         (WebKit::WebIDBConnectionToClient::disconnectedFromWebProcess):
3245         (WebKit::WebIDBConnectionToClient::deleteDatabase):
3246         (WebKit::WebIDBConnectionToClient::openDatabase):
3247         (WebKit::WebIDBConnectionToClient::abortTransaction):
3248         (WebKit::WebIDBConnectionToClient::commitTransaction):
3249         (WebKit::WebIDBConnectionToClient::didFinishHandlingVersionChangeTransaction):
3250         (WebKit::WebIDBConnectionToClient::createObjectStore):
3251         (WebKit::WebIDBConnectionToClient::deleteObjectStore):
3252         (WebKit::WebIDBConnectionToClient::renameObjectStore):
3253         (WebKit::WebIDBConnectionToClient::clearObjectStore):
3254         (WebKit::WebIDBConnectionToClient::createIndex):
3255         (WebKit::WebIDBConnectionToClient::deleteIndex):
3256         (WebKit::WebIDBConnectionToClient::renameIndex):
3257         (WebKit::WebIDBConnectionToClient::putOrAdd):
3258         (WebKit::WebIDBConnectionToClient::getRecord):
3259         (WebKit::WebIDBConnectionToClient::getAllRecords):
3260         (WebKit::WebIDBConnectionToClient::getCount):
3261         (WebKit::WebIDBConnectionToClient::deleteRecord):
3262         (WebKit::WebIDBConnectionToClient::openCursor):
3263         (WebKit::WebIDBConnectionToClient::iterateCursor):
3264         (WebKit::WebIDBConnectionToClient::establishTransaction):
3265         (WebKit::WebIDBConnectionToClient::databaseConnectionPendingClose):
3266         (WebKit::WebIDBConnectionToClient::databaseConnectionClosed):
3267         (WebKit::WebIDBConnectionToClient::abortOpenAndUpgradeNeeded):
3268         (WebKit::WebIDBConnectionToClient::didFireVersionChangeEvent):
3269         (WebKit::WebIDBConnectionToClient::openDBRequestCancelled):
3270         (WebKit::WebIDBConnectionToClient::confirmDidCloseFromServer):
3271         (WebKit::WebIDBConnectionToClient::getAllDatabaseNames):
3272         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
3273         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3274         (WebKit::NetworkConnectionToWebProcess::create):
3275         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
3276         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
3277         (WebKit::NetworkConnectionToWebProcess::didClose):
3278         (WebKit::NetworkConnectionToWebProcess::createSocketStream):
3279         (WebKit::NetworkConnectionToWebProcess::prefetchDNS):
3280         (WebKit::NetworkConnectionToWebProcess::startDownload):
3281         (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
3282         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
3283         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
3284         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
3285         * NetworkProcess/NetworkConnectionToWebProcess.h:
3286         (WebKit::NetworkConnectionToWebProcess::networkProcess):
3287         * NetworkProcess/NetworkProcess.cpp:
3288         (WebKit::NetworkProcess::singleton):
3289         (WebKit::NetworkProcess::initializeNetworkProcess):
3290         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
3291         (WebKit::NetworkProcess::addWebsiteDataStore):
3292         (WebKit::fetchDiskCacheEntries):
3293         (WebKit::NetworkProcess::fetchWebsiteData):
3294         (WebKit::clearDiskCacheEntries):
3295         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
3296         (WebKit::NetworkProcess::getNetworkProcessStatistics):
3297         (WebKit::NetworkProcess::idbServer):
3298         * NetworkProcess/NetworkProcess.h:
3299         * NetworkProcess/NetworkResourceLoader.cpp:
3300         (WebKit::NetworkResourceLoader::startNetworkLoad):
3301         (WebKit::NetworkResourceLoader::convertToDownload):
3302         (WebKit::NetworkResourceLoader::isAlwaysOnLoggingAllowed const):
3303         * NetworkProcess/NetworkSession.cpp:
3304         (WebKit::NetworkSession::create):
3305         (WebKit::NetworkSession::NetworkSession):
3306         * NetworkProcess/NetworkSession.h:
3307         (WebKit::NetworkSession::networkProcess):
3308         * NetworkProcess/RemoteNetworkingContext.h:
3309         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3310         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
3311         (WebKit::NetworkDataTaskCocoa::isAlwaysOnLoggingAllowed const):
3312         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3313         (WebKit::NetworkProcess::clearDiskCache):
3314         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
3315         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3316         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
3317         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
3318         (-[WKNetworkSessionDelegate URLSession:downloadTask:didFinishDownloadingToURL:]):
3319         (-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]):
3320         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]):
3321         (WebKit::NetworkSessionCocoa::create):
3322         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3323         * NetworkProcess/curl/NetworkSessionCurl.cpp:
3324         (WebKit::NetworkSessionCurl::NetworkSessionCurl):
3325         * NetworkProcess/curl/NetworkSessionCurl.h:
3326         * NetworkProcess/mac/RemoteNetworkingContext.mm:
3327         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
3328         * NetworkProcess/soup/NetworkSessionSoup.cpp:
3329         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
3330         * NetworkProcess/soup/NetworkSessionSoup.h:
3331
3332 2019-01-07  Alex Christensen  <achristensen@webkit.org>
3333
3334         Modernize CacheModel and disk cache fetching and clearing
3335         https://bugs.webkit.org/show_bug.cgi?id=193164
3336
3337         Reviewed by Joseph Pecoraro.
3338
3339         fetchDiskCacheEntries and clearDiskCacheEntries now use an early-return model.
3340         CacheModel is now an enum class.
3341
3342         * NetworkProcess/NetworkProcess.cpp:
3343         (WebKit::NetworkProcess::NetworkProcess):
3344         (WebKit::NetworkProcess::initializeNetworkProcess):
3345         (WebKit::fetchDiskCacheEntries):
3346         (WebKit::NetworkProcess::fetchWebsiteData):
3347         (WebKit::clearDiskCacheEntries):
3348         (WebKit::NetworkProcess::setCacheModel):
3349         * NetworkProcess/NetworkProcess.h:
3350         * NetworkProcess/NetworkProcess.messages.in:
3351         * NetworkProcess/NetworkProcessCreationParameters.h:
3352         * NetworkProcess/cache/NetworkCacheEntry.cpp:
3353         (WebKit::NetworkCache::Entry::initializeShareableResourceHandleFromStorageRecord const):
3354         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3355         (WebKit::NetworkProcess::clearDiskCache):
3356         * Shared/CacheModel.cpp:
3357         (WebKit::calculateMemoryCacheSizes):
3358         (WebKit::calculateURLCacheSizes):
3359         * Shared/CacheModel.h:
3360         (): Deleted.
3361         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3362         (API::ProcessPoolConfiguration::createWithLegacyOptions):
3363         * UIProcess/API/APIProcessPoolConfiguration.h:
3364         * UIProcess/API/C/WKAPICast.h:
3365         (WebKit::toCacheModel):
3366         (WebKit::toAPI):
3367         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3368         (-[_WKProcessPoolConfiguration pageCacheEnabled]):
3369         (-[_WKProcessPoolConfiguration setPageCacheEnabled:]):
3370         * WebProcess/WebProcess.cpp:
3371         (WebKit::WebProcess::initializeWebProcess):
3372         (WebKit::WebProcess::setCacheModel):
3373         (WebKit::WebProcess::clearResourceCaches):
3374         * WebProcess/WebProcess.h:
3375         * WebProcess/WebProcess.messages.in:
3376
3377 2019-01-06  Jiewen Tan  <jiewen_tan@apple.com>
3378
3379         [WebAuthN] Import U2F command/response converters from Chromium
3380         https://bugs.webkit.org/show_bug.cgi?id=193150
3381         <rdar://problem/47054028>
3382
3383         Reviewed by Brent Fulgham.
3384
3385         Moves helper functions to WebAuthenticationUtils.
3386
3387         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
3388         (WebKit::LocalAuthenticatorInternal::produceHashSet):
3389         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
3390         (): Deleted.
3391         (WebKit::LocalAuthenticatorInternal::buildAuthData): Deleted.
3392         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
3393         (WebKit::MockHidConnection::feedReports):
3394
3395 2019-01-04  Joseph Pecoraro  <pecoraro@apple.com>
3396
3397         Web Inspector: Use save sheet instead of dialog where possible
3398         https://bugs.webkit.org/show_bug.cgi?id=193160
3399         <rdar://problem/37399759>
3400
3401         Reviewed by Devin Rousso.
3402
3403         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
3404         (WebKit::RemoteWebInspectorProxy::platformSave