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