a09154b06488f803688cb8af6d20b69cd1e9f6cf
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-03-10  Tim Horton  <timothy_horton@apple.com>
2
3         iOS: Using ⌥ to scroll horizontally is no different than arrow key
4         https://bugs.webkit.org/show_bug.cgi?id=195268
5         <rdar://problem/48326682>
6
7         Reviewed by Brent Fulgham.
8
9         * UIProcess/ios/WKContentViewInteraction.mm:
10         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:inDirection:]):
11         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:]): Deleted.
12         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
13         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
14         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
15         (-[WKKeyboardScrollViewAnimator setDelegate:]):
16         (-[WKKeyboardScrollViewAnimator distanceForIncrement:inDirection:]):
17         (-[WKKeyboardScrollViewAnimator distanceForIncrement:]): Deleted.
18         Add a direction parameter to -distanceForIncrement:, so the client
19         can return a different page/document size based on the scrolling axis.
20         Adopt it both in the default implementation and in WKContentViewInteraction.
21         Make the option key scroll by page when scrolling horizontally, like it
22         does when scrolling vertically.
23
24 2019-03-10  David Quesada  <david_quesada@apple.com>
25
26         ASSERT(m_downloads.isEmpty()) fails in DownloadProxyMap::~DownloadProxyMap()
27         https://bugs.webkit.org/show_bug.cgi?id=152480
28
29         Reviewed by Chris Dumez.
30
31         * UIProcess/Downloads/DownloadProxyMap.cpp:
32         (WebKit::DownloadProxyMap::downloadFinished):
33             If the DownloadProxy is holding the last reference to the process pool, then
34             invalidating the proxy will cause the process pool, the network process proxy,
35             and this DownloadProxyMap to deallocate. Ensure that doesn't happen until this
36             method has done everything it wants to do to clean up.
37
38 2019-03-10  Wenson Hsieh  <wenson_hsieh@apple.com>
39
40         Fix some misleading function and variable names in WKContentViewInteraction.mm
41         https://bugs.webkit.org/show_bug.cgi?id=195536
42
43         Reviewed by Tim Horton.
44
45         * UIProcess/ios/WKContentViewInteraction.mm:
46         (shouldDeferZoomingToSelectionWhenRevealingFocusedElement):
47
48         Rename shouldZoomToRevealSelectionRect to shouldDeferZoomingToSelectionWhenRevealingFocusedElement; this
49         function is used to determine whether we should zoom to the selection rect when revealing the focused element,
50         and therefore affects whether we need to defer zooming until we get selection information.
51
52         (rectToRevealWhenZoomingToFocusedElement):
53         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
54
55         Rename shouldShowKeyboard to shouldShowInputView; this boolean indicates whether we should show not only the
56         keyboard, but other UI for user input such as date and select pickers.
57
58         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]):
59         (shouldZoomToRevealSelectionRect): Deleted.
60
61 2019-03-10  Simon Fraser  <simon.fraser@apple.com>
62
63         ScrollingTree should have the final say on where layers go
64         https://bugs.webkit.org/show_bug.cgi?id=195507
65
66         Reviewed by Antti Koivisto.
67
68         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
69         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
70         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
71         (WebKit::RemoteScrollingCoordinatorProxy::applyScrollingTreeLayerPositions):
72         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
73         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
74         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
75
76 2019-03-09  Darin Adler  <darin@apple.com>
77
78         [Cocoa] Code signing fails because services are copied into XPCServices after the framework is signed
79         https://bugs.webkit.org/show_bug.cgi?id=195523
80
81         Reviewed by Dan Bernstein.
82
83         * WebKit.xcodeproj/project.pbxproj: Make symbolic links while building the WebKit
84         framework instead of copying in the services after the framework is built.
85
86 2019-03-09  Wenson Hsieh  <wenson_hsieh@apple.com>
87
88         REGRESSION (r242551): Sporadic hangs when tapping to change selection on iOS
89         https://bugs.webkit.org/show_bug.cgi?id=195475
90         <rdar://problem/48721153>
91
92         Reviewed by Chris Dumez.
93
94         r242551 refactored synchronous autocorrection context requests to send an async IPC message and then use
95         waitForAndDispatchImmediately, instead of calling sendSync. However, this exposes a couple of existing issues in
96         the implementation of waitForAndDispatchImmediately that causes sporadic IPC deadlocks when changing selection.
97
98         First, passing in InterruptWaitingIfSyncMessageArrives when synchronously waiting for an IPC message currently
99         does not fulfill its intended behavior of interrupting waiting when a sync message arrives. This is because sync
100         IPC messages, by default, may be dispatched while the receiver is waiting for a sync reply. This means that the
101         logic in Connection::SyncMessageState::processIncomingMessage to dispatch an incoming sync message on the main
102         thread will attempt to handle the incoming message by enqueueing it on the main thread, and then waking up the
103         client runloop (i.e. signaling m_waitForSyncReplySemaphore). This works in the case of sendSync since the sync
104         reply semaphore is used to block the main thread, but in the case of waitForAndDispatchImmediately, a different
105         m_waitForMessageCondition is used instead, so SyncMessageState::processIncomingMessage will only enqueue the
106         incoming sync message on the main thread, and not actually invoke it.
107
108         To fix this first issue, observe that there is pre-existing logic to enqueue the incoming message and signal
109         m_waitForMessageCondition in Connection::processIncomingMessage. This codepath is currently not taken because we
110         end up bailing early in the call to SyncMessageState::processIncomingMessage. Instead, we can move this early
111         return further down in the function, such that if there is an incoming sync message and we're waiting with the
112         InterruptWaitingIfSyncMessageArrives option, we will correctly enqueue the incoming message, wake the runloop,
113         and proceed to handle the incoming message.
114
115         The second issue is more subtle; consider the scenario in which we send a sync message A from the web process to
116         the UI process, and simultaneously, in the UI process, we schedule some work to be done on the main thread.
117         Let's additionally suppose that this scheduled work will send an IPC message B to the web process and
118         synchronously wait for a reply (in the case of this particular bug, this is the sync autocorrection context
119         request). What happens upon receiving sync message A is that the IPC thread in the UI process will schedule A on
120         the main thread; however, before the scheduled response to A is invoked, we will first invoke previously
121         scheduled work that attempts to block synchronously until a message B is received. In summary:
122
123         1. (Web process)    sends sync IPC message A to UI process.
124         2. (UI process)     schedules some main runloop task that will block synchronously on IPC message B.
125         3. (UI process)     receives sync IPC message A and schedules A on the main runloop.
126         4. (UI process)     carry out the task scheduled in (2) and block on B.
127
128         ...and then, the UI process and web process are now deadlocked because the UI process is waiting for B to
129         arrive, but the web process can't send B because it's waiting for a reply for IPC message A! To fix this second
130         deadlock, we first make an important observation: when using sendSync, we don't run into this problem because
131         immediately before sending sync IPC, we will attempt to handle any incoming sync IPC messages that have been
132         queued up. However, when calling waitForAndDispatchImmediately, we don't have this extra step, so a deadlock may
133         occur in the manner described above. To fix this, we make waitForAndDispatchImmediately behave more like
134         sendSync, by handling all incoming sync messages prior to blocking on an IPC response.
135
136         Test: editing/selection/ios/change-selection-by-tapping.html
137
138         * Platform/IPC/Connection.cpp:
139         (IPC::Connection::waitForMessage):
140         (IPC::Connection::processIncomingMessage):
141
142 2019-03-09  Andy Estes  <aestes@apple.com>
143
144         [Apple Pay] CanMakePaymentsWithActiveCard and OpenPaymentSetup should be async messages
145         https://bugs.webkit.org/show_bug.cgi?id=195526
146         <rdar://problem/48745636>
147
148         Reviewed by Chris Dumez.
149
150         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
151         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard):
152         (WebKit::WebPaymentCoordinatorProxy::openPaymentSetup):
153         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
154         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
155         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
156         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard):
157         (WebKit::WebPaymentCoordinator::openPaymentSetup):
158         (WebKit::generateCanMakePaymentsWithActiveCardReplyID): Deleted.
159         (WebKit::generateOpenPaymentSetupReplyID): Deleted.
160         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCardReply): Deleted.
161         (WebKit::WebPaymentCoordinator::openPaymentSetupReply): Deleted.
162         * WebProcess/ApplePay/WebPaymentCoordinator.h:
163         * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
164
165 2019-03-09  Andy Estes  <aestes@apple.com>
166
167         [iOS] Remove unneeded entitlements and sandbox allowances from the Networking service
168         https://bugs.webkit.org/show_bug.cgi?id=195527
169
170         Reviewed by Eric Carlson.
171
172         * Configurations/Network-iOS.entitlements:
173         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
174
175 2019-03-09  Chris Dumez  <cdumez@apple.com>
176
177         Use modern async IPC with reply for device orientation permission
178         https://bugs.webkit.org/show_bug.cgi?id=195529
179
180         Reviewed by Ryosuke Niwa.
181
182         * UIProcess/WebPageProxy.cpp:
183         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
184         * UIProcess/WebPageProxy.h:
185         * UIProcess/WebPageProxy.messages.in:
186         * WebProcess/WebPage/WebPage.cpp:
187         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
188         (WebKit::nextDeviceOrientationAndMotionPermissionCallbackID): Deleted.
189         (WebKit::WebPage::didReceiveDeviceOrientationAndMotionAccessDecision): Deleted.
190         * WebProcess/WebPage/WebPage.h:
191         * WebProcess/WebPage/WebPage.messages.in:
192
193 2019-03-09  Zalan Bujtas  <zalan@apple.com>
194
195         [ContentChangeObserver] Start observing for content change between touchEnd and mouseMoved start
196         https://bugs.webkit.org/show_bug.cgi?id=195510
197         <rdar://problem/48735695>
198
199         Reviewed by Simon Fraser.
200
201         * WebProcess/WebPage/ios/WebPageIOS.mm:
202         (WebKit::WebPage::cancelPotentialTapInFrame):
203
204 2019-03-08  Chris Dumez  <cdumez@apple.com>
205
206         Enable ProcessAssertions on iOS Simulator
207         https://bugs.webkit.org/show_bug.cgi?id=195479
208
209         Reviewed by Alexey Proskuryakov.
210
211         Enable ProcessAssertions on iOS Simulator. We have some layout tests timing out in the
212         iOS Simulator due to the WebContent process suspending. Turning on ProcessAssertions in
213         the iOS Simulator seems to make those tests pass.
214
215         * UIProcess/ProcessAssertion.cpp:
216         * UIProcess/ProcessAssertion.h:
217         * UIProcess/ios/ProcessAssertionIOS.mm:
218
219 2019-03-08  Chris Dumez  <cdumez@apple.com>
220
221         Add support for Device Orientation / Motion permission API
222         https://bugs.webkit.org/show_bug.cgi?id=195329
223         <rdar://problem/47645367>
224
225         Reviewed by Geoffrey Garen.
226
227         Add support for Device Orientation / Motion permission API:
228         - https://github.com/w3c/deviceorientation/issues/57
229
230         This adds new SPI to WKUIDelegatePrivate, until we can make this API.
231
232         * Shared/WebPreferences.yaml:
233         * UIProcess/API/APIUIClient.h:
234         (API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
235         * UIProcess/API/C/WKPage.cpp:
236         (WKPageSetPageUIClient):
237         * UIProcess/API/C/WKPageUIClient.h:
238         * UIProcess/API/Cocoa/WKUIDelegate.h:
239         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
240         * UIProcess/Cocoa/UIDelegate.h:
241         * UIProcess/Cocoa/UIDelegate.mm:
242         (WebKit::UIDelegate::setDelegate):
243         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
244         * UIProcess/WebPageProxy.cpp:
245         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
246         * UIProcess/WebPageProxy.h:
247         * UIProcess/WebPageProxy.messages.in:
248         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
249         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
250         * WebProcess/WebCoreSupport/WebChromeClient.h:
251         * WebProcess/WebPage/WebPage.cpp:
252         (WebKit::nextDeviceOrientationAndMotionPermissionCallbackID):
253         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
254         (WebKit::WebPage::didReceiveDeviceOrientationAndMotionAccessDecision):
255         * WebProcess/WebPage/WebPage.h:
256         * WebProcess/WebPage/WebPage.messages.in:
257
258 2019-03-08  Brady Eidson  <beidson@apple.com>
259
260         Have the UIProcess take the UnboundedNetworking assertion when downloads are in progress.
261         https://bugs.webkit.org/show_bug.cgi?id=195468
262
263         Reviewed by Andy Estes.
264
265         * UIProcess/Downloads/DownloadProxyMap.cpp:
266         (WebKit::DownloadProxyMap::DownloadProxyMap):
267         (WebKit::DownloadProxyMap::createDownloadProxy): If this is the first download, and the process has the entitlement,
268           take the assertion.
269         (WebKit::DownloadProxyMap::downloadFinished):
270         (WebKit::DownloadProxyMap::processDidClose):
271         * UIProcess/Downloads/DownloadProxyMap.h:
272
273 2019-03-08  Chris Dumez  <cdumez@apple.com>
274
275         Add assertions to help debug a WebProcessCache crash
276         https://bugs.webkit.org/show_bug.cgi?id=195469
277
278         Reviewed by Brady Eidson.
279
280         I suspect the process's registrableDomain in null when evictProcess() gets
281         called, thus crashing when lookup it up in the HashMap. Confirm this and
282         how this could happen via assertions.
283
284         * UIProcess/WebProcessCache.cpp:
285         (WebKit::WebProcessCache::evictProcess):
286         * UIProcess/WebProcessProxy.cpp:
287         (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
288
289 2019-03-08  Brady Eidson  <beidson@apple.com>
290
291         Rename AssertionState::Download.
292         https://bugs.webkit.org/show_bug.cgi?id=195465
293
294         Reviewed by Andy Estes.
295
296         It's (currently) about uploads and downloads.
297         Let's call it "UnboundedNetworking"
298
299         * NetworkProcess/Downloads/DownloadMap.cpp:
300         (WebKit::DownloadMap::add):
301
302         * UIProcess/ProcessAssertion.h:
303
304         * UIProcess/WebProcessProxy.cpp:
305         (WebKit::WebProcessProxy::didSetAssertionState):
306
307         * UIProcess/ios/ProcessAssertionIOS.mm:
308         (WebKit::flagsForState):
309         (WebKit::reasonForState):
310
311 2019-03-08  Simon Fraser  <simon.fraser@apple.com>
312
313         [macOS UI-side compositing] Mouse handling can trigger a crash before we have a scrolling tree root
314         https://bugs.webkit.org/show_bug.cgi?id=195467
315
316         Reviewed by Antti Koivisto.
317         
318         When launching MiniBrowser with UI-side compositing enabled in a state where the window
319         appears under the mouse, we can hit RemoteScrollingTree::handleMouseEvent() for a mouseEnter
320         event before we have a scrolling tree root node, so add a null check.
321
322         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
323         (WebKit::RemoteScrollingTree::handleMouseEvent):
324
325 2019-03-08  Carlos Garcia Campos  <cgarcia@igalia.com>
326
327         REGRESSION(r242624): [GTK] New rAF code path assumes AC mode
328         https://bugs.webkit.org/show_bug.cgi?id=195459
329
330         Reviewed by Žan Doberšek.
331
332         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
333         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
334         The refresh monitor now calls scheduleLayerFlush() but when AC
335         mode is disabled this method does nothing, so setNeedsDisplay()
336         needs to be called instead.
337
338 2019-03-07  Tim Horton  <timothy_horton@apple.com>
339
340         Crash under RemoteLayerTreePropertyApplier::applyProperties
341         https://bugs.webkit.org/show_bug.cgi?id=195448
342         <rdar://problem/48588226>
343
344         Reviewed by Simon Fraser.
345
346         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
347         (WebKit::RemoteLayerTreeHost::updateLayerTree):
348         Under some currently-unknown circumstances, the UI process is receiving
349         commits referring to layers that it does not know about.
350         One understood case of this was fixed in r241899, but there seem to be
351         cases remaining that are not understood.
352         Also, add a release log so that we can identify any downstream effects.
353
354 2019-03-07  Zalan Bujtas  <zalan@apple.com>
355
356         [ContentChangeObserver] Introduce fixed duration content observation
357         https://bugs.webkit.org/show_bug.cgi?id=195295
358         <rdar://problem/48579913>
359
360         Reviewed by Simon Fraser.
361
362         * WebProcess/WebPage/ios/WebPageIOS.mm:
363         (WebKit::WebPage::handleSyntheticClick):
364         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
365
366 2019-03-07  Fujii Hironori  <Hironori.Fujii@sony.com>
367
368         [WinCairo][WebKit] Nothing is drawn after Web process crashed
369         https://bugs.webkit.org/show_bug.cgi?id=195399
370
371         Reviewed by Alex Christensen.
372
373         PageClientImpl::viewSize returned 0x0 size after Web process
374         crashed. Restored the original implementation using GetClientRect
375         (Bug 52175).
376
377         * UIProcess/win/PageClientImpl.cpp:
378         (WebKit::PageClientImpl::viewSize):
379
380 2019-03-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
381
382         requestAnimationFrame should execute before the next frame
383         https://bugs.webkit.org/show_bug.cgi?id=177484
384
385         Reviewed by Simon Fraser.
386
387         Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by
388         a single call to Page::renderingUpdate(). This new function implements 
389         "Update the rendering" step of the HTML Event Loop specification
390         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
391
392         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
393         (WebKit::AcceleratedDrawingArea::updateBackingStoreState):
394         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
395         (WebKit::LayerTreeHost::layerFlushTimerFired):
396         * WebProcess/WebPage/DrawingAreaImpl.cpp:
397         (WebKit::DrawingAreaImpl::display):
398         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
399         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
400         * WebProcess/WebPage/WebPage.cpp:
401         (WebKit::WebPage::layoutIfNeeded):
402         (WebKit::WebPage::renderingUpdate):
403         (WebKit::WebPage::willDisplayPage): Deleted.
404         * WebProcess/WebPage/WebPage.h:
405         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
406         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
407
408 2019-03-07  Zalan Bujtas  <zalan@apple.com>
409
410         [ContentChangeObserver] Add a setting to be able to turn content change observation on/off
411         https://bugs.webkit.org/show_bug.cgi?id=195353
412         <rdar://problem/48626394>
413
414         Reviewed by Simon Fraser.
415
416         * Shared/WebPreferences.yaml:
417         * UIProcess/API/C/WKPreferences.cpp:
418         (WKPreferencesSetContentChangeObserverEnabled):
419         (WKPreferencesGetContentChangeObserverEnabled):
420         * UIProcess/API/C/WKPreferencesRefPrivate.h:
421         * UIProcess/API/Cocoa/WKPreferences.mm:
422         (-[WKPreferences _contentChangeObserverEnabled]):
423         (-[WKPreferences _setContentChangeObserverEnabled:]):
424         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
425         * WebProcess/WebPage/ios/WebPageIOS.mm:
426         (WebKit::WebPage::handleSyntheticClick):
427
428 2019-03-07  Andy Estes  <aestes@apple.com>
429
430         [Apple Pay] Untangle PKPaymentAuthorizationViewController from WebPaymentCoordinatorProxy
431         https://bugs.webkit.org/show_bug.cgi?id=195349
432         <rdar://problem/48625510>
433
434         Reviewed by Alex Christensen.
435
436         Introduced PaymentAuthorizationPresenter and WKPaymentAuthorizationDelegate to encapsulate
437         PKPaymentAuthorizationViewController and its delegate. Taught WebPaymentCoordinatorProxy to
438         interact with PaymentAuthorizationPresenter rather than PKPAVC directly.
439
440         These changes will allow us to swap out PKPaymentAuthorizationViewController with PKPaymentAuthorizationController in a follow-on patch.
441
442         * Platform/cocoa/PaymentAuthorizationPresenter.h: Added. Defined the abstract interface for
443         payment authorization presenters that use PKPA(V)C.
444         * Platform/cocoa/PaymentAuthorizationPresenter.mm: Added.
445         (WebKit::toPKPaymentAuthorizationStatus): Moved from WebPaymentCoordinatorProxyCocoa.mm.
446         (WebKit::toPKPaymentErrorCode): Ditto.
447         (WebKit::toNSError): Ditto.
448         (WebKit::toNSErrors): Ditto.
449         (WebKit::toPKShippingMethods): Ditto.
450         (WebKit::PaymentAuthorizationPresenter::completeMerchantValidation): Added. Implements the
451         logic previously in WebPaymentCoordinatorProxy::platformCompleteMerchantValidation.
452         (WebKit::PaymentAuthorizationPresenter::completePaymentMethodSelection): Ditto for
453         WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection.
454         (WebKit::PaymentAuthorizationPresenter::completePaymentSession): Ditto for 
455         (WebKit::PaymentAuthorizationPresenter::completeShippingContactSelection): Ditto for
456         WebPaymentCoordinatorProxy::platformCompletePaymentSession.
457         (WebKit::PaymentAuthorizationPresenter::completeShippingMethodSelection): Ditto for
458         WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection.
459         * Platform/cocoa/PaymentAuthorizationViewController.h: Added. Defined a subclass of PaymentAuthorizationPresenter for PKPaymentAuthorizationViewController.
460         * Platform/cocoa/PaymentAuthorizationViewController.mm: Added.
461         (-[WKPaymentAuthorizationViewControllerDelegate initWithPresenter:]): Added a PKPAVC
462         delegate that's a subclass of WKPaymentAuthorizationDelegate.
463         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]):
464         Called -[WKPaymentAuthorizationDelegate _didFinish].
465         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]): Called
466         -[WKPaymentAuthorizationDelegate _didAuthorizePayment:completion:].
467         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]): Called
468         -[WKPaymentAuthorizationDelegate _didSelectShippingMethod:completion:].
469         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]): Called
470         -[WKPaymentAuthorizationDelegate _didSelectShippingContact:completion:].
471         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]): Called
472         -[WKPaymentAuthorizationDelegate _didSelectPaymentMethod:completion:].
473         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:willFinishWithError:]):
474         Called -[WKPaymentAuthorizationDelegate _willFinishWithError:].
475         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didRequestMerchantSession:]): Called
476         -[WKPaymentAuthorizationDelegate _didRequestMerchantSession:].
477         * Platform/cocoa/WKPaymentAuthorizationDelegate.h: Added.
478         * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: Added.
479         (-[WKPaymentAuthorizationDelegate summaryItems]): Added a summaryItems getter.
480         (-[WKPaymentAuthorizationDelegate shippingMethods]): Ditto for shippingMethods.
481         (-[WKPaymentAuthorizationDelegate completeMerchantValidation:error:]): Called
482         _didRequestMerchantSessionCompletion then set it to nil.
483         (-[WKPaymentAuthorizationDelegate completePaymentMethodSelection:]): Ditto for
484         _didSelectPaymentMethodCompletion.
485         (-[WKPaymentAuthorizationDelegate completePaymentSession:errors:didReachFinalState:]): Ditto
486         for _didAuthorizePaymentCompletion.
487         (-[WKPaymentAuthorizationDelegate completeShippingContactSelection:summaryItems:shippingMethods:errors:]):
488         Ditto for _didSelectShippingContactCompletion.
489         (-[WKPaymentAuthorizationDelegate completeShippingMethodSelection:]): Ditto for
490         _didSelectShippingMethodCompletion.
491         (-[WKPaymentAuthorizationDelegate invalidate]): If there's an outstanding authorization
492         callback, called -completePaymentSession:errors:didReachFinalState: with a state of
493         PKPaymentAuthorizationStatusFailure.
494         (-[WKPaymentAuthorizationDelegate _initWithPresenter:]):
495         (-[WKPaymentAuthorizationDelegate _didAuthorizePayment:completion:]): Added. Implements the
496         logic previously in WKPaymentAuthorizationViewControllerDelegate.
497         (-[WKPaymentAuthorizationDelegate _didFinish]): Ditto.
498         (-[WKPaymentAuthorizationDelegate _didRequestMerchantSession:]): Ditto.
499         (-[WKPaymentAuthorizationDelegate _didSelectPaymentMethod:completion:]): Ditto.
500         (-[WKPaymentAuthorizationDelegate _didSelectShippingContact:completion:]): Ditto.
501         (toShippingMethod): Moved from WebPaymentCoordinatorProxyCocoa.mm.
502         (-[WKPaymentAuthorizationDelegate _didSelectShippingMethod:completion:]): Added. Implements
503         the logic previously in WKPaymentAuthorizationViewControllerDelegate.
504         (-[WKPaymentAuthorizationDelegate _willFinishWithError:]): Ditto.
505         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
506         (WebKit::WebPaymentCoordinatorProxy::presenterWillValidateMerchant): To conform to
507         PaymentAuthorizationPresenter::Client, renamed from validateMerchant.
508         (WebKit::WebPaymentCoordinatorProxy::presenterDidAuthorizePayment): Renamed from
509         didAuthorizePayment.
510         (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Moved logic here that previously
511         existed in WKPaymentAuthorizationViewControllerDelegate.
512         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectShippingMethod): Renamed from
513         didSelectShippingMethod.
514         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectShippingContact): Renamed from
515         didSelectShippingContact.
516         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectPaymentMethod): Renamed from
517         didSelectPaymentMethod.
518         (WebKit::WebPaymentCoordinatorProxy::validateMerchant): Renamed to
519         presenterWillValidateMerchant.
520         (WebKit::WebPaymentCoordinatorProxy::didAuthorizePayment): Renamed to
521         presenterDidAuthorizePayment.
522         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingMethod): Renamed to
523         presenterDidSelectShippingMethod.
524         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingContact): Renamed to
525         presenterDidSelectShippingContact.
526         (WebKit::WebPaymentCoordinatorProxy::didSelectPaymentMethod): Renamed to
527         didSelectPaymentMethod.
528         * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Changed WebPaymentCoordinatorProxy to
529         subclass PaymentAuthorizationPresenter::Client.
530         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: Removed WKPaymentAuthorizationViewControllerDelegate interface and declared some helper functions
531         needed by PaymentAuthorizationPresenter.
532         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
533         (WebKit::toPKPaymentSummaryItemType): Removed static keyword.
534         (WebKit::toDecimalNumber): Ditto.
535         (WebKit::toPKPaymentSummaryItem): Ditto.
536         (WebKit::toPKPaymentSummaryItems): Ditto.
537         (WebKit::toPKShippingMethod): Ditto.
538         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Changed to call
539         m_authorizationPresenter.
540         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession): Ditto.
541         (WebKit::WebPaymentCoordinatorProxy::platformCompleteMerchantValidation): Ditto.
542         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection): Ditto.
543         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection): Ditto.
544         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection): Ditto.
545         (-[WKPaymentAuthorizationViewControllerDelegate initWithPaymentCoordinatorProxy:]): Deleted.
546         (-[WKPaymentAuthorizationViewControllerDelegate invalidate]): Deleted.
547         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:willFinishWithError:]): Deleted.
548         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didRequestMerchantSession:]): Deleted.
549         (toShippingMethod): Deleted.
550         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]): Deleted.
551         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]): Deleted.
552         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]): Deleted.
553         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]): Deleted.
554         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:completion:]): Deleted.
555         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:completion:]): Deleted.
556         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:completion:]): Deleted.
557         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:completion:]): Deleted.
558         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]): Deleted.
559         (WebKit::toPKPaymentAuthorizationStatus): Moved to PaymentAuthorizationPresenter.mm.
560         (WebKit::toPKPaymentErrorCode): Ditto.
561         (WebKit::toNSError): Ditto.
562         (WebKit::toNSErrors): Ditto.
563         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
564         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Changed to present a
565         PaymentAuthorizationPresenter rather than a PKPAVC.
566         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Changed to dismiss a
567         PaymentAuthorizationPresenter rather than a PKPAVC.
568         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
569         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Ditto.
570         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Ditto.
571         * SourcesCocoa.txt:
572         * UIProcess/WebPageProxy.h:
573         * UIProcess/ios/WebPageProxyIOS.mm:
574         (WebKit::WebPageProxy::paymentCoordinatorAuthorizationPresenter): Added. Returns a new
575         PaymentAuthorizationViewController.
576         * WebKit.xcodeproj/project.pbxproj:
577
578 2019-03-07  Chris Dumez  <cdumez@apple.com>
579
580         Regression(r242580) WebKit.NetworkProcessCrashWithPendingConnection API is crashing on iOS debug
581         https://bugs.webkit.org/show_bug.cgi?id=195416
582
583         Reviewed by Antti Koivisto.
584
585         Drop ASSERT_NOT_REACHED() in WebPage::didCompletePageTransition() when the tree is still frozen due to
586         LayerTreeFreezeReason::ProcessSuspended. As demonstrated by this API test, nothing prevents a load from
587         completing and WebPage::didCompletePageTransition() to get called *after* WebProcess::prepareToSuspend()
588         has been called. From the logging during the test, I can tell that WebProcess::processDidResume() gets
589         called later on and the LayerTreeFreezeReason::ProcessSuspended freezing reason gets dropped, as expected.
590
591         * WebProcess/WebPage/WebPage.cpp:
592         (WebKit::WebPage::didCompletePageTransition):
593
594 2019-03-07  Chris Dumez  <cdumez@apple.com>
595
596         Clean up / simplify ProcessAssertion code
597         https://bugs.webkit.org/show_bug.cgi?id=195394
598
599         Reviewed by Geoffrey Garen.
600
601         Clean up / simplify ProcessAssertion code to facilitate its maintenance and make it
602         less error-prone.
603
604         * Platform/IPC/mac/ConnectionMac.mm:
605         (IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
606         * UIProcess/ProcessAssertion.cpp:
607         (WebKit::ProcessAssertion::ProcessAssertion):
608         (WebKit::ProcessAssertion::setState):
609         * UIProcess/ProcessAssertion.h:
610         (WebKit::ProcessAssertion::Client::~Client):
611         (WebKit::ProcessAssertion::setClient):
612         (WebKit::ProcessAssertion::client):
613         * UIProcess/ProcessThrottler.cpp:
614         (WebKit::ProcessThrottler::didConnectToProcess):
615         * UIProcess/ProcessThrottler.h:
616         * UIProcess/ios/ProcessAssertionIOS.mm:
617         (-[WKProcessAssertionBackgroundTaskManager dealloc]):
618         (-[WKProcessAssertionBackgroundTaskManager addAssertionNeedingBackgroundTask:]):
619         (-[WKProcessAssertionBackgroundTaskManager removeAssertionNeedingBackgroundTask:]):
620         (-[WKProcessAssertionBackgroundTaskManager _notifyAssertionsOfImminentSuspension]):
621         (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]):
622         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
623         (WebKit::ProcessAssertion::ProcessAssertion):
624         (WebKit::ProcessAssertion::processAssertionWasInvalidated):
625         (WebKit::ProcessAssertion::setState):
626         (WebKit::ProcessAndUIAssertion::updateRunInBackgroundCount):
627         (WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):
628         (WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
629         (WebKit::ProcessAndUIAssertion::processAssertionWasInvalidated):
630         (WebKit::ProcessAndUIAssertion::setState):
631         (WebKit::ProcessAndUIAssertion::uiAssertionWillExpireImminently):
632
633 2019-03-07  Commit Queue  <commit-queue@webkit.org>
634
635         Unreviewed, rolling out r242297.
636         https://bugs.webkit.org/show_bug.cgi?id=195430
637
638         Broke Microsoft Visio. (Requested by dydz on #webkit).
639
640         Reverted changeset:
641
642         "[iOS] Turn mouse event simulation on by default"
643         https://bugs.webkit.org/show_bug.cgi?id=195218
644         https://trac.webkit.org/changeset/242297
645
646 2019-03-07  John Wilander  <wilander@apple.com>
647
648         Resource Load Statistics: Log first-party navigations with link decoration
649         https://bugs.webkit.org/show_bug.cgi?id=195301
650         <rdar://problem/48569971>
651
652         Reviewed by Brent Fulgham.
653
654         This patch adds a call to the network process' resource load statistics to
655         log cross-site navigations with link decoration. The logging checks if the
656         source of the navigation is a prevalent resource and if so, sets the
657         appropriate flag for the destination.
658
659         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
660         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
661         (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
662         (WebKit::ResourceLoadStatisticsDatabaseStore::logSubresourceRedirect):
663         (WebKit::ResourceLoadStatisticsDatabaseStore::logCrossSiteLoadWithLinkDecoration):
664         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
665         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
666         (WebKit::ResourceLoadStatisticsMemoryStore::logCrossSiteLoadWithLinkDecoration):
667         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
668         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
669         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
670         (WebKit::WebResourceLoadStatisticsStore::logCrossSiteLoadWithLinkDecoration):
671         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
672         * NetworkProcess/NetworkProcess.cpp:
673         (WebKit::NetworkProcess::committedCrossSiteLoadWithLinkDecoration):
674             This now receives a completion handler. This is in preparation for
675             test cases where we need to log such an event and wait for it to
676             finish before continuing.
677         * NetworkProcess/NetworkProcess.h:
678         * NetworkProcess/NetworkProcess.messages.in:
679         * UIProcess/Network/NetworkProcessProxy.cpp:
680         (WebKit::NetworkProcessProxy::committedCrossSiteLoadWithLinkDecoration):
681         * UIProcess/Network/NetworkProcessProxy.h:
682         * UIProcess/WebPageProxy.cpp:
683         (WebKit::WebPageProxy::didCommitLoadForFrame):
684         * UIProcess/WebProcessPool.cpp:
685         (WebKit::WebProcessPool::committedCrossSiteLoadWithLinkDecoration):
686         * UIProcess/WebProcessPool.h:
687
688 2019-03-07  Per Arne Vollan  <pvollan@apple.com>
689
690         [iOS] Disable permissive call logging in sandbox
691         https://bugs.webkit.org/show_bug.cgi?id=195288
692         <rdar://problem/47683804>
693
694         Reviewed by Brent Fulgham.
695
696         As on macOS, we should enable strict call filtering in sandbox on iOS.
697
698         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
699
700 2019-03-07  Youenn Fablet  <youenn@apple.com>
701
702         Introduce a quota manager for Cache API/Service Worker/IDB storage
703         https://bugs.webkit.org/show_bug.cgi?id=195283
704
705         Reviewed by Chris Dumez.
706
707         Remove quota handling from Cache API storage and use StorageQuotaManager/StorageQuotaUser.
708         CacheStorage::Caches becomes a quota user and has a StorageQuotaManager to check for space for any cache API write task.
709         NetworkProcess is responsible to manage the quota managers.
710         Quota managers will go through network process to ask UIProcess for quota extension.
711
712         Remove pending callback handling from CacheStorage since they are queued in QuotaManager now.
713
714         * NetworkProcess/NetworkProcess.cpp:
715         (WebKit::NetworkProcess::~NetworkProcess):
716         (WebKit::NetworkProcess::destroySession):
717         (WebKit::NetworkProcess::cacheStorageRootPath):
718         (WebKit::NetworkProcess::setCacheStorageParameters):
719         (WebKit::NetworkProcess::storageQuotaManager):
720         * NetworkProcess/NetworkProcess.h:
721         * NetworkProcess/cache/CacheStorageEngine.cpp:
722         (WebKit::CacheStorage::Engine::from):
723         (WebKit::CacheStorage::Engine::Engine):
724         (WebKit::CacheStorage::Engine::readCachesFromDisk):
725         * NetworkProcess/cache/CacheStorageEngine.h:
726         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
727         (WebKit::CacheStorage::Cache::put):
728         * NetworkProcess/cache/CacheStorageEngineCache.h:
729         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
730         (WebKit::CacheStorage::Caches::Caches):
731         (WebKit::CacheStorage::Caches::~Caches):
732         (WebKit::CacheStorage::Caches::requestSpace):
733         (WebKit::CacheStorage::Caches::writeRecord):
734         * NetworkProcess/cache/CacheStorageEngineCaches.h:
735
736 2019-03-07  John Wilander  <wilander@apple.com>
737
738         Resource Load Statistics: Make it possible to purge only script-accessible cookies
739         https://bugs.webkit.org/show_bug.cgi?id=195383
740         <rdar://problem/48570136>
741
742         Reviewed by Brent Fulgham.
743
744         This patch provides the ability to purge all script-accessible cookies while leaving
745         HttpOnly cookies in place.
746
747         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
748         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
749         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
750         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
751             Support for a new boolean flag on whether or not to include HttpOnly Cookies.
752         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
753         * NetworkProcess/NetworkProcess.cpp:
754         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
755             Support for a new boolean flag on whether or not to include HttpOnly Cookies.
756         (WebKit::NetworkProcess::deleteCookiesForTesting):
757             Test infrastructure.
758         * NetworkProcess/NetworkProcess.h:
759         * NetworkProcess/NetworkProcess.messages.in:
760         * NetworkProcess/NetworkSession.cpp:
761         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
762             Support for a new boolean flag on whether or not to include HttpOnly Cookies.
763         * NetworkProcess/NetworkSession.h:
764         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
765         (WKWebsiteDataStoreStatisticsDeleteCookiesForTesting):
766             Test infrastructure.
767         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
768         * UIProcess/Network/NetworkProcessProxy.cpp:
769         (WebKit::NetworkProcessProxy::deleteCookiesForTesting):
770             Test infrastructure.
771         * UIProcess/Network/NetworkProcessProxy.h:
772         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
773         (WebKit::WebsiteDataStore::deleteCookiesForTesting):
774             Test infrastructure.
775         * UIProcess/WebsiteData/WebsiteDataStore.h:
776
777 2019-03-07  Carlos Garcia Campos  <cgarcia@igalia.com>
778
779         REGRESSION(r242364): [WPE] Do not stop the compositing run loop update timer on suspend
780         https://bugs.webkit.org/show_bug.cgi?id=195410
781
782         Reviewed by Žan Doberšek.
783
784         Calling CompositingRunLoop::stopUpdates() on suspend is leaving the threaded compositor in an inconsistent
785         state, failing to resume and stopping the updates forever. This is causing timeouts in WPE layout tests. Instead
786         of calling stopUpdates(), a new suspend() is called, that stops the update timer, without changing the current
787         updae tha compositing state. A new method resume() is also added to schedule an update if needed.
788
789         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
790         (WebKit::CompositingRunLoop::suspend): Set state as suspended and stop the update timer.
791         (WebKit::CompositingRunLoop::resume): Set state as not suspended and start the update timer if it was scheduled
792         while suspended.
793         (WebKit::CompositingRunLoop::scheduleUpdate): Do not start the update timer when suspended.
794         (WebKit::CompositingRunLoop::compositionCompleted): Ditto.
795         (WebKit::CompositingRunLoop::updateCompleted): Ditto.
796         (WebKit::CompositingRunLoop::updateTimerFired): Add an assert to ensure the update timer is not fired while suspended.
797         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
798         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
799         (WebKit::ThreadedCompositor::suspend): Call CompositingRunLoop::suspend() instead of stopUpdates().
800         (WebKit::ThreadedCompositor::resume): Call CompositingRunLoop::resume().
801
802 2019-03-06  Mark Lam  <mark.lam@apple.com>
803
804         Exception is a JSCell, not a JSObject.
805         https://bugs.webkit.org/show_bug.cgi?id=195392
806
807         Reviewed by Saam Barati.
808
809         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
810         (WebKit::JSNPObject::throwInvalidAccessError):
811         * WebProcess/Plugins/Netscape/JSNPObject.h:
812
813 2019-03-07  Commit Queue  <commit-queue@webkit.org>
814
815         Unreviewed, rolling out r242354.
816         https://bugs.webkit.org/show_bug.cgi?id=195402
817
818         breaks layout tests in all configurations (Requested by
819         zdobersek on #webkit).
820
821         Reverted changeset:
822
823         "[WPE] Enable web process sandbox"
824         https://bugs.webkit.org/show_bug.cgi?id=195169
825         https://trac.webkit.org/changeset/242354
826
827 2019-03-06  Ross Kirsling  <ross.kirsling@sony.com>
828
829         [Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
830         https://bugs.webkit.org/show_bug.cgi?id=195346
831
832         Reviewed by Fujii Hironori.
833
834         * Platform/IPC/win/ConnectionWin.cpp:
835         (IPC::Connection::createServerAndClientIdentifiers):
836         * Platform/win/ModuleWin.cpp:
837         (WebKit::Module::load):
838         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
839         (WebKit::ProcessLauncher::launchProcess):
840         * UIProcess/win/WebContextMenuProxyWin.cpp:
841         (WebKit::createMenuItem):
842         * UIProcess/win/WebView.cpp:
843         (WebKit::WebView::setToolTip):
844         * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp:
845         (WebKit::InjectedBundle::initialize):
846         Use wchar helpers as needed.
847
848 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
849
850         Crash when attempting to change input type while dismissing datalist suggestions
851         https://bugs.webkit.org/show_bug.cgi?id=195384
852         <rdar://problem/48563718>
853
854         Reviewed by Brent Fulgham.
855
856         See WebCore ChangeLog for more details.
857
858         * WebProcess/WebPage/WebPage.cpp:
859         (WebKit::WebPage::setActiveDataListSuggestionPicker):
860         (WebKit::WebPage::didSelectDataListOption):
861         (WebKit::WebPage::didCloseSuggestions):
862         * WebProcess/WebPage/WebPage.h:
863
864         Turn m_activeDataListSuggestionPicker from a raw pointer into a WeakPtr.
865
866 2019-03-06  Chris Dumez  <cdumez@apple.com>
867
868         [iOS] ProcessDidResume() IPC should be sent upon resuming when ProcessWillSuspendImminently() IPC was sent
869         https://bugs.webkit.org/show_bug.cgi?id=195382
870         <rdar://problem/48642739>
871
872         Reviewed by Geoffrey Garen.
873
874         ProcessDidResume() IPC should be sent upon resuming when ProcessWillSuspendImminently() IPC was sent. Previously,
875         we only send ProcessDidResume() to the WebProcess if PrepareToSuspend() was sent, not when the more urgent
876         ProcessWillSuspendImminently() IPC was sent.
877
878         This mismatch has lead to bugs because the WebProcess does not know it got resumed and failed to unfreeze the
879         layers it froze upon suspension.
880
881         * UIProcess/ProcessAssertion.h:
882         (WebKit::ProcessAssertionClient::~ProcessAssertionClient):
883
884         * UIProcess/ProcessThrottler.cpp:
885         (WebKit::ProcessThrottler::updateAssertion):
886         (WebKit::ProcessThrottler::uiAssertionWillExpireImminently):
887         (WebKit::ProcessThrottler::assertionWillExpireImminently): Deleted.
888
889         * UIProcess/ProcessThrottler.h:
890         * UIProcess/ios/ProcessAssertionIOS.mm:
891         (-[WKProcessAssertionBackgroundTaskManager _notifyClientsOfImminentSuspension]):
892         (WebKit::ProcessAssertion::~ProcessAssertion):
893         (WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
894         (WebKit::ProcessAndUIAssertion::setClient):
895
896         * WebProcess/WebPage/WebPage.cpp:
897         (WebKit::WebPage::didCompletePageTransition):
898         Revert change that was landed in r242098 to work around this ProcessThrottler bug.
899
900         * WebProcess/WebPage/ios/WebPageIOS.mm:
901         (WebKit::WebPage::applicationWillEnterForeground):
902         Revert change that was landed in r242554 to work around this ProcessThrottler bug.
903
904 2019-03-06  Alex Christensen  <achristensen@webkit.org>
905
906         Add gettid to allowed syscalls on Mac
907         https://bugs.webkit.org/show_bug.cgi?id=195386
908         <rdar://problem/48651255>
909
910         Reviewed by Brent Fulgham.
911
912         * WebProcess/com.apple.WebProcess.sb.in:
913
914 2019-03-06  Per Arne Vollan  <pvollan@apple.com>
915
916         [macOS] Sandbox call violation causes WebContent process to crash
917         https://bugs.webkit.org/show_bug.cgi?id=195379
918         <rdar://problem/48647263>
919
920         Reviewed by Brent Fulgham.
921
922         A new call needs to be added to the allow list in the WebContent process' sandbox.
923
924         * WebProcess/com.apple.WebProcess.sb.in:
925
926 2019-03-06  Antti Koivisto  <antti@apple.com>
927
928         [iOS] Basic hit testing for content overlapping fast-scrollable overflow
929         https://bugs.webkit.org/show_bug.cgi?id=195360
930
931         Reviewed by Simon Fraser.
932
933         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
934         (WebKit::RemoteLayerTreeHost::makeNode):
935
936         Use new UIView subclass for tiled layer hosting (so we know they have content even when contents property is nil).
937
938         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
939         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
940         (collectDescendantViewsAtPoint):
941
942         Factor collection step into a function.
943         Do basic skipping of event-transparent layers.
944
945         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
946
947         To handle overlap cases, find the scroll view that has the deepest non-transparent view hit as its descendant.
948
949         (-[UIView _web_recursiveFindDescendantInteractibleViewAtPoint:withEvent:]): Deleted.
950
951 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
952
953         Move RenderObject::isTransparentOrFullyClippedRespectingParentFrames() to RenderLayer
954         https://bugs.webkit.org/show_bug.cgi?id=195300
955
956         Reviewed by Simon Fraser.
957
958         Refactor some logic to use isTransparentOrFullyClippedRespectingParentFrames on RenderLayer rather than
959         RenderObject; introduce a helper method to ask whether the enclosing layer of a renderer is transparent or
960         clipped.
961
962         * WebProcess/WebPage/ios/WebPageIOS.mm:
963         (WebKit::enclosingLayerIsTransparentOrFullyClipped):
964         (WebKit::WebPage::platformEditorState const):
965         (WebKit::WebPage::requestEvasionRectsAboveSelection):
966         (WebKit::WebPage::getFocusedElementInformation):
967
968 2019-03-06  Chris Dumez  <cdumez@apple.com>
969
970         REGRESSION (r238490): YouTube.com: Returning PiP to Safari after sleeping device loses page
971         https://bugs.webkit.org/show_bug.cgi?id=195364
972         <rdar://problem/48538837>
973
974         Reviewed by Geoffrey Garen.
975
976         Make sure we unset the LayerTreeFreezeReason::ProcessSuspended layer tree freeze reason
977         when WebPage::applicationWillEnterForeground() is called. This restores pre-r238490
978         behavior and addresses the issue with PiP on youtube.com.
979
980         * WebProcess/WebPage/ios/WebPageIOS.mm:
981         (WebKit::WebPage::applicationWillEnterForeground):
982
983 2019-03-05  Dean Jackson  <dino@apple.com>
984
985         Fix WKPasswordView compilation on iOS
986         https://bugs.webkit.org/show_bug.cgi?id=195344
987         <rdar://problem/48620066>
988
989         Reviewed by Dan Bates.
990
991         Use WebKitAdditions.
992
993         * UIProcess/ios/WKPasswordView.mm:
994         (-[WKPasswordView showInScrollView:]):
995
996 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
997
998         [iOS] Frequent 1 second IPC deadlocks when showing a paste callout
999         https://bugs.webkit.org/show_bug.cgi?id=195354
1000         <rdar://problem/48624675>
1001
1002         Reviewed by Tim Horton.
1003
1004         When triggering programmatic paste, we frequently hit deadlocks due to sync IPC going from the UI process to the
1005         web process and vice versa. What happens in this scenario is that prior to triggering programmatic paste, the
1006         page may try to move focus to a different element (e.g. a hidden editable area) before calling `execCommand`.
1007         This causes us to send an ElementDidFocus message to the UI process, followed by RequestDOMPasteAccess.
1008
1009         However, upon receiving ElementDidFocus, we reload input views and (in the process) UIKit requests the
1010         autocorrection context, which we implement in WebKit using a sync message to the web process due to
1011         <rdar://problem/16207002> and its blocking bug <rdar://problem/48383001>. This means we'll end up in a state
1012         where both the UI process and web process are blocked on each other waiting for a sync IPC response, and the UI
1013         process is hung for a second until the IPC message times out.
1014
1015         Ideally, we should fix this by addressing <rdar://problem/16207002>. However, this requires potentially large
1016         changes in UIKit (<rdar://problem/48383001>); for the time being, work around this deadlock by refactoring
1017         synchronous autocorrection context requests such that they can be resolved by an out-of-band IPC response
1018         (HandleAutocorrectionContext). Then prior to requesting DOM paste access, preemptively send a
1019         HandleAutocorrectionContext message to the UI process to unblock any pending synchronous autocorrection context
1020         requests.
1021
1022         * UIProcess/PageClient.h:
1023         * UIProcess/WebPageProxy.h:
1024         * UIProcess/WebPageProxy.messages.in:
1025         * UIProcess/ios/PageClientImplIOS.h:
1026         * UIProcess/ios/PageClientImplIOS.mm:
1027         (WebKit::PageClientImpl::handleAutocorrectionContext):
1028         * UIProcess/ios/WKContentViewInteraction.h:
1029
1030         Make it possible for WKContentView to remember its current pending autocorrection context completion handler.
1031         This is invoked and cleared out in `-_invokePendingAutocorrectionContextHandler:`.
1032
1033         * UIProcess/ios/WKContentViewInteraction.mm:
1034         (-[WKContentView _invokePendingAutocorrectionContextHandler:]):
1035         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
1036         (-[WKContentView _handleAutocorrectionContext:]):
1037
1038         Handle an autocorrection context response. This is invoked when the web process either handles an autocorrection
1039         context message, or when it preemptively sends an autocorrection context before requesting DOM paste access.
1040
1041         (+[WKAutocorrectionContext emptyAutocorrectionContext]):
1042
1043         Add a helper to create an empty autocorrection context.
1044
1045         * UIProcess/ios/WebPageProxyIOS.mm:
1046         (WebKit::WebPageProxy::requestAutocorrectionContext):
1047         (WebKit::WebPageProxy::handleAutocorrectionContext):
1048         (WebKit::WebPageProxy::autocorrectionContextSync): Deleted.
1049
1050         Removed this sync version, since we now only have requestAutocorrectionContext.
1051
1052         * WebProcess/WebPage/WebPage.cpp:
1053         (WebKit::WebPage::requestDOMPasteAccess):
1054
1055         Send WebPageProxy::HandleAutocorrectionContext, and add a FIXME referencing <rdar://problem/16207002>.
1056
1057         * WebProcess/WebPage/WebPage.h:
1058         * WebProcess/WebPage/WebPage.messages.in:
1059
1060         Split AutocorrectionContextSync into RequestAutocorrectionContext and HandleAutocorrectionContext; additionally,
1061         remove the existing RequestAutocorrectionContext message.
1062
1063         * WebProcess/WebPage/ios/WebPageIOS.mm:
1064         (WebKit::WebPage::requestAutocorrectionContext):
1065         (WebKit::WebPage::autocorrectionContextSync): Deleted.
1066
1067 2019-03-06  Rob Buis  <rbuis@igalia.com>
1068
1069         Consider supporting the `referrerpolicy` attribute.
1070         https://bugs.webkit.org/show_bug.cgi?id=179053
1071
1072         Reviewed by Darin Adler.
1073
1074         Add a runtime flag for referrerpolicy attribute.
1075
1076         * Shared/WebPreferences.yaml:
1077         * UIProcess/API/C/WKPreferences.cpp:
1078         (WKPreferencesSetReferrerPolicyAttributeEnabled):
1079         (WKPreferencesGetReferrerPolicyAttributeEnabled):
1080         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1081         * WebProcess/Network/WebLoaderStrategy.cpp:
1082         (WebKit::WebLoaderStrategy::loadResource): do not hardcode choosing
1083         the document referrer policy.
1084
1085 2019-03-06  Philippe Normand  <pnormand@igalia.com>
1086
1087         Unreviewed, WPE build fix after r242503
1088
1089         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
1090         ServiceWorker messages moved from network process to another
1091         header, so it needs to be included.
1092
1093 2019-03-05  David Quesada  <david_quesada@apple.com>
1094
1095         [WK2] It should be possible to follow links with 'download' attributes
1096         https://bugs.webkit.org/show_bug.cgi?id=195145
1097         rdar://problem/48462642
1098
1099         Reviewed by Alex Christensen.
1100
1101         When a link with a 'download' attribute is clicked and the navigation client
1102         says to allow the navigation (i.e. provides PolicyAction::Use),
1103         WebPageProxy::receivedNavigationPolicyDecision() should stop overriding this
1104         decision and downloading the link instead. Instead, web view should honor the
1105         policy chosen by the navigation delegate. This supports clients that want to
1106         offer the user the ability to view, rather than download, the contents of
1107         such links, which is permitted per the HTML spec.
1108
1109         This change is only made on Cocoa platforms for now since no other ports
1110         expose an API on their navigation action to express whether the page intends
1111         to download the linked resource.
1112
1113         * UIProcess/API/APINavigation.h:
1114         (API::Navigation::shouldPerformDownload const):
1115             Rename this to be in line with APINavigationAction's shouldPerformDownload()
1116             for consistency. 'Force' seems like too strong of a word for this property
1117             considering that 'forcing' the download isn't really an attribute inherent
1118             to the navigation, but a behavior implemented by the web page proxy.
1119         (API::Navigation::shouldForceDownload const): Deleted.
1120         * UIProcess/Cocoa/VersionChecks.h:
1121         * UIProcess/WebPageProxy.cpp:
1122         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1123
1124 2019-03-05  Takashi Komori  <Takashi.Komori@sony.com>
1125
1126         [Curl] Implement Cookie Accept Policy.
1127         https://bugs.webkit.org/show_bug.cgi?id=191645
1128
1129         Reviewed by Fujii Hironori.
1130
1131         * NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp:
1132         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
1133         (WebKit::WebCookieManager::platformGetHTTPCookieAcceptPolicy):
1134         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1135         (WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
1136         (WebKit::NetworkDataTaskCurl::handleCookieHeaders):
1137         * NetworkProcess/curl/NetworkDataTaskCurl.h:
1138
1139 2019-03-05  Youenn Fablet  <youenn@apple.com>
1140
1141         Introduce ServiceWorkerFetchTask
1142         https://bugs.webkit.org/show_bug.cgi?id=195130
1143
1144         Reviewed by Chris Dumez.
1145
1146         ServiceWorkerFetchTask is added to represent NetworkProcess side of an ongoing fetch intercepted by service worker.
1147         This patch should not change existing behavior.
1148
1149         * CMakeLists.txt:
1150         * DerivedSources-input.xcfilelist:
1151         * DerivedSources-output.xcfilelist:
1152         * DerivedSources.make:
1153         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1154         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1155         * NetworkProcess/NetworkProcess.cpp:
1156         (WebKit::NetworkProcess::didFailFetch): Deleted.
1157         (WebKit::NetworkProcess::didNotHandleFetch): Deleted.
1158         (WebKit::NetworkProcess::didReceiveFetchRedirectResponse): Deleted.
1159         (WebKit::NetworkProcess::didReceiveFetchResponse): Deleted.
1160         (WebKit::NetworkProcess::didReceiveFetchData): Deleted.
1161         (WebKit::NetworkProcess::didReceiveFetchFormData): Deleted.
1162         (WebKit::NetworkProcess::didFinishFetch): Deleted.
1163         * NetworkProcess/NetworkProcess.h:
1164         * NetworkProcess/NetworkProcess.messages.in:
1165         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
1166         (WebKit::WebSWServerConnection::cancelFetch):
1167         (WebKit::WebSWServerConnection::continueDidReceiveFetchResponse):
1168         (WebKit::WebSWServerConnection::startFetch):
1169         (WebKit::WebSWServerConnection::didReceiveFetchRedirectResponse): Deleted.
1170         (WebKit::WebSWServerConnection::didReceiveFetchResponse): Deleted.
1171         (WebKit::WebSWServerConnection::didReceiveFetchData): Deleted.
1172         (WebKit::WebSWServerConnection::didReceiveFetchFormData): Deleted.
1173         (WebKit::WebSWServerConnection::didFinishFetch): Deleted.
1174         (WebKit::WebSWServerConnection::didFailFetch): Deleted.
1175         (WebKit::WebSWServerConnection::didNotHandleFetch): Deleted.
1176         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
1177         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1178         (WebKit::WebSWServerToContextConnection::connectionClosed):
1179         (WebKit::WebSWServerToContextConnection::startFetch):
1180         (WebKit::WebSWServerToContextConnection::cancelFetch):
1181         (WebKit::WebSWServerToContextConnection::continueDidReceiveFetchResponse):
1182         (WebKit::WebSWServerToContextConnection::didReceiveFetchTaskMessage):
1183         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
1184         * SourcesCocoa.txt:
1185         * WebKit.xcodeproj/project.pbxproj:
1186         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1187         (WebKit::WebSWContextManagerConnection::startFetch):
1188         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
1189         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveRedirection):
1190         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse):
1191         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
1192         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish):
1193         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveBlobChunk):
1194         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
1195         (WebKit::WebServiceWorkerFetchTaskClient::didFinish):
1196         (WebKit::WebServiceWorkerFetchTaskClient::didNotHandle):
1197         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: Added.
1198         (WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse):
1199         (WebKit::ServiceWorkerFetchTask::didReceiveResponse):
1200         (WebKit::ServiceWorkerFetchTask::didReceiveData):
1201         (WebKit::ServiceWorkerFetchTask::didReceiveFormData):
1202         (WebKit::ServiceWorkerFetchTask::didFinish):
1203         (WebKit::ServiceWorkerFetchTask::didFail):
1204         (WebKit::ServiceWorkerFetchTask::didNotHandle):
1205         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h: Added.
1206         (WebKit::ServiceWorkerFetchTask::create):
1207         (WebKit::ServiceWorkerFetchTask::Identifier::hash const):
1208         (WebKit::ServiceWorkerFetchTask::identifier const):
1209         (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask):
1210         (WebKit::operator==):
1211         (WTF::ServiceWorkerFetchTaskIdentifierHash::hash):
1212         (WTF::ServiceWorkerFetchTaskIdentifierHash::equal):
1213         (WTF::HashTraits<WebKit::ServiceWorkerFetchTask::Identifier>::emptyValue):
1214         (WTF::HashTraits<WebKit::ServiceWorkerFetchTask::Identifier>::constructDeletedValue):
1215         (WTF::HashTraits<WebKit::ServiceWorkerFetchTask::Identifier>::isDeletedValue):
1216         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.messages.in: Added.
1217
1218 2019-03-05  Youenn Fablet  <youenn@apple.com>
1219
1220         Rename requestCacheStorageSpace to requestStorageSpace
1221         https://bugs.webkit.org/show_bug.cgi?id=195282
1222
1223         Reviewed by Chris Dumez.
1224
1225         Make the name more abstract as it might be used in the future for other storage
1226         like IDB or service worker registrations.
1227
1228         * NetworkProcess/NetworkProcess.cpp:
1229         (WebKit::NetworkProcess::requestStorageSpace):
1230         (WebKit::NetworkProcess::requestCacheStorageSpace): Deleted.
1231         * NetworkProcess/NetworkProcess.h:
1232         * NetworkProcess/cache/CacheStorageEngine.cpp:
1233         (WebKit::CacheStorage::Engine::requestSpace):
1234         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1235         (WebsiteDataStoreClient::WebsiteDataStoreClient):
1236         * UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h:
1237         * UIProcess/Network/NetworkProcessProxy.cpp:
1238         (WebKit::NetworkProcessProxy::requestStorageSpace):
1239         (WebKit::NetworkProcessProxy::requestCacheStorageSpace): Deleted.
1240         * UIProcess/Network/NetworkProcessProxy.h:
1241         * UIProcess/Network/NetworkProcessProxy.messages.in:
1242         * UIProcess/WebsiteData/WebsiteDataStoreClient.h:
1243         (WebKit::WebsiteDataStoreClient::requestStorageSpace):
1244         (WebKit::WebsiteDataStoreClient::requestCacheStorageSpace): Deleted.
1245
1246 2019-03-05  Chris Dumez  <cdumez@apple.com>
1247
1248         Drop cached WebProcesses for a given session when this session is destroyed
1249         https://bugs.webkit.org/show_bug.cgi?id=195212
1250         <rdar://problem/48301483>
1251
1252         Reviewed by Geoffrey Garen.
1253
1254         Drop cached WebProcesses for a give session when this session is destroyed. This way, when you close
1255         your private browsing window, all the processes it used get cleared and it cannot leave any state
1256         behind.
1257
1258         * UIProcess/WebProcessCache.cpp:
1259         (WebKit::WebProcessCache::canCacheProcess const):
1260         (WebKit::WebProcessCache::addProcessIfPossible):
1261         (WebKit::WebProcessCache::addProcess):
1262         (WebKit::WebProcessCache::clearAllProcessesForSession):
1263         * UIProcess/WebProcessCache.h:
1264         (WebKit::WebProcessCache::capacity const):
1265         * UIProcess/WebProcessPool.cpp:
1266         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
1267         (WebKit::WebProcessPool::hasPagesUsingWebsiteDataStore const):
1268         * UIProcess/WebProcessPool.h:
1269
1270 2019-03-05  Brady Eidson  <beidson@apple.com>
1271
1272         Correctly handle sandbox extensions when the same WKWebView loads multiple file:// URLs.
1273         <rdar://problem/47820581> and https://bugs.webkit.org/show_bug.cgi?id=195291
1274
1275         Reviewed by Tim Horton.
1276
1277         * WebProcess/WebPage/WebPage.cpp:
1278         (WebKit::WebPage::SandboxExtensionTracker::shouldReuseCommittedSandboxExtension): If there is a pendingProvisionalSandboxExtension
1279           then its existence should override our willingness to reuse the existing committed extension.
1280         (WebKit::shouldReuseCommittedSandboxExtension): Deleted.
1281         * WebProcess/WebPage/WebPage.h:
1282
1283 2019-03-05  Ryan Haddad  <ryanhaddad@apple.com>
1284
1285         Unreviewed, rolling out r242403.
1286
1287         Caused layout test crashes on iOS simulator.
1288
1289         Reverted changeset:
1290
1291         "[ContentChangeObserver] Introduce fixed duration content
1292         observation"
1293         https://bugs.webkit.org/show_bug.cgi?id=195295
1294         https://trac.webkit.org/changeset/242403
1295
1296 2019-03-05  Loïc Yhuel  <loic.yhuel@softathome.com>
1297
1298         [WPE] Do not create a PlatformDisplay in the Service Worker process
1299         https://bugs.webkit.org/show_bug.cgi?id=194830
1300
1301         Reviewed by Žan Doberšek.
1302
1303         It avoids opening the Wayland socket in this WPEWebProcess, which might cause issues
1304         depending on the platform, and allocates unneeded resources.
1305
1306         * Shared/WebProcessCreationParameters.cpp:
1307         (WebKit::WebProcessCreationParameters::encode const):
1308         (WebKit::WebProcessCreationParameters::decode):
1309         * Shared/WebProcessCreationParameters.h: Add new isServiceWorkerProcess parameter.
1310         * UIProcess/WebProcessPool.cpp:
1311         (WebKit::WebProcessPool::initializeNewWebProcess): Set isServiceWorkerProcess parameter.
1312         * UIProcess/glib/WebProcessPoolGLib.cpp:
1313         (WebKit::WebProcessPool::platformInitializeWebProcess): No implementationLibraryName and hostClientFileDescriptor for Service Worker.
1314         * WebProcess/glib/WebProcessGLib.cpp:
1315         (WebKit::WebProcess::platformInitializeWebProcess): No wpe_loader_init nor PlatformDisplayLibWPE for Service Worker.
1316
1317 2019-03-04  Brady Eidson  <beidson@apple.com>
1318
1319         Unreviewed, rolling out r242376.
1320
1321         Broke some tests
1322
1323         Reverted changeset:
1324
1325         "Correctly handle sandbox extensions when the same WKWebView
1326         loads multiple file:// URLs."
1327         https://bugs.webkit.org/show_bug.cgi?id=195291
1328         https://trac.webkit.org/changeset/242376
1329
1330 2019-03-04  Fujii Hironori  <Hironori.Fujii@sony.com>
1331
1332         Use a SQLite database to hold the ResourceLoadStatistics data
1333         https://bugs.webkit.org/show_bug.cgi?id=194867
1334         <rdar://problem/24240854>
1335
1336         Unreviewed build fix for WinCairo.
1337
1338         ResourceLoadStatisticsDebug and RELEASE_LOG_INFO_IF are not
1339         defined because WinCairo port defines RELEASE_LOG_DISABLED.
1340
1341         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1342         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess): Enclosed RELEASE_LOG_INFO_IF with #if !RELEASE_LOG_DISABLED.
1343         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener): Ditto.
1344         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking): Ditto.
1345
1346 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
1347
1348         Use a SQLite database to hold the ResourceLoadStatistics data
1349         https://bugs.webkit.org/show_bug.cgi?id=194867
1350         <rdar://problem/24240854>
1351
1352         Reviewed by Chris Dumez.
1353
1354         The ResourceLoadStatistics database plist is inefficient. It requires more memory use
1355         than it needs, and forces lots of looping and string comparisons to find information.
1356
1357         This problem has already been solved in the form of relational databases. We use them
1358         elsewhere in WebKit, and should do so for this storage as well.
1359
1360         This patch creates an optional SQLite database to handle ITP operations.
1361
1362         1. It adds a new internal experimental feature flag to activate it. It requires the user
1363            exit and restart the process to take effect.
1364         2. It populates itself from the existing plist file (if it exists).
1365         3. It stops using the plist in favor of the database.
1366         4. It does queries and other operations using the database instead of the old hash table
1367            implementation.
1368
1369         This patch refactors the exisiting ResourceLoadStatisticsMemoryStore class into a base
1370         ResourceLoadStatisticsStore class, which ResourceLoadStatisticsMemoryStore is based on.
1371         It adds a new ResourceLoadStatisticsDatabaseStore that is implemented in terms of SQL
1372         operations.
1373
1374         These code changes should not have any impact on existing operations, and when enabled
1375         should produce the same test results.
1376
1377         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: Added.
1378         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
1379         (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
1380         (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements):
1381         (WebKit::ResourceLoadStatisticsDatabaseStore::insertObservedDomain):
1382         (WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const):
1383         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationship):
1384         (WebKit::ResourceLoadStatisticsDatabaseStore::confirmDomainDoesNotExist const):
1385         (WebKit::ResourceLoadStatisticsDatabaseStore::domainIDFromString const):
1386         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
1387         (WebKit::ResourceLoadStatisticsDatabaseStore::databaseIsEmpty const):
1388         (WebKit::ResourceLoadStatisticsDatabaseStore::populateFromMemoryStore):
1389         (WebKit::ResourceLoadStatisticsDatabaseStore::calculateAndSubmitTelemetry const):
1390         (WebKit::ResourceLoadStatisticsDatabaseStore::incrementRecordsDeletedCountForDomains):
1391         (WebKit::ResourceLoadStatisticsDatabaseStore::recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain):
1392         (WebKit::buildList):
1393         (WebKit::ResourceLoadStatisticsDatabaseStore::markAsPrevalentIfHasRedirectedToPrevalent):
1394         (WebKit::listToString):
1395         (WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources):
1396         (WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
1397         (WebKit::ResourceLoadStatisticsDatabaseStore::classifyPrevalentResources):
1398         (WebKit::ResourceLoadStatisticsDatabaseStore::syncStorageIfNeeded):
1399         (WebKit::ResourceLoadStatisticsDatabaseStore::syncStorageImmediately):
1400         (WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess):
1401         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
1402         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
1403         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
1404         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
1405         (WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
1406         (WebKit::ResourceLoadStatisticsDatabaseStore::ensurePrevalentResourcesForDebugMode):
1407         (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation):
1408         (WebKit::ResourceLoadStatisticsDatabaseStore::logSubresourceLoading):
1409         (WebKit::ResourceLoadStatisticsDatabaseStore::logSubresourceRedirect):
1410         (WebKit::ResourceLoadStatisticsDatabaseStore::setUserInteraction):
1411         (WebKit::ResourceLoadStatisticsDatabaseStore::logUserInteraction):
1412         (WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction):
1413         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
1414         (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
1415         (WebKit::ResourceLoadStatisticsDatabaseStore::setDomainsAsPrevalent):
1416         (WebKit::ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics const):
1417         (WebKit::ResourceLoadStatisticsDatabaseStore::predicateValueForDomain const):
1418         (WebKit::ResourceLoadStatisticsDatabaseStore::isPrevalentResource const):
1419         (WebKit::ResourceLoadStatisticsDatabaseStore::isVeryPrevalentResource const):
1420         (WebKit::ResourceLoadStatisticsDatabaseStore::isRegisteredAsSubresourceUnder const):
1421         (WebKit::ResourceLoadStatisticsDatabaseStore::isRegisteredAsSubFrameUnder const):
1422         (WebKit::ResourceLoadStatisticsDatabaseStore::isRegisteredAsRedirectingTo const):
1423         (WebKit::ResourceLoadStatisticsDatabaseStore::clearPrevalentResource):
1424         (WebKit::ResourceLoadStatisticsDatabaseStore::setGrandfathered):
1425         (WebKit::ResourceLoadStatisticsDatabaseStore::isGrandfathered const):
1426         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubframeUnderTopFrameOrigin):
1427         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUnderTopFrameOrigin):
1428         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectTo):
1429         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectFrom):
1430         (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectTo):
1431         (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectFrom):
1432         (WebKit::ResourceLoadStatisticsDatabaseStore::ensureResourceStatisticsForPrimaryDomain):
1433         (WebKit::ResourceLoadStatisticsDatabaseStore::clear):
1434         (WebKit::ResourceLoadStatisticsDatabaseStore::cookieTreatmentForOrigin const):
1435         (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt):
1436         (WebKit::ResourceLoadStatisticsDatabaseStore::domainsToBlock const):
1437         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking):
1438         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlockingForDomains):
1439         (WebKit::ResourceLoadStatisticsDatabaseStore::clearBlockingStateForDomains):
1440         (WebKit::ResourceLoadStatisticsDatabaseStore::processStatistics const):
1441         (WebKit::ResourceLoadStatisticsDatabaseStore::prevalentDomains const):
1442         (WebKit::ResourceLoadStatisticsDatabaseStore::findExpiredUserInteractions const):
1443         (WebKit::ResourceLoadStatisticsDatabaseStore::clearExpiredUserInteractions):
1444         (WebKit::ResourceLoadStatisticsDatabaseStore::clearGrandfathering):
1445         (WebKit::ResourceLoadStatisticsDatabaseStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
1446         (WebKit::ResourceLoadStatisticsDatabaseStore::pruneStatisticsIfNeeded):
1447         (WebKit::ResourceLoadStatisticsDatabaseStore::updateLastSeen):
1448         (WebKit::ResourceLoadStatisticsDatabaseStore::setLastSeen):
1449         (WebKit::ResourceLoadStatisticsDatabaseStore::setVeryPrevalentResource):
1450         (WebKit::ResourceLoadStatisticsDatabaseStore::removeAllStorageAccess):
1451         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: Added.
1452         (WebKit::ResourceLoadStatisticsDatabaseStore::isEmpty const):
1453         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1454         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
1455         (WebKit::ResourceLoadStatisticsMemoryStore::incrementRecordsDeletedCountForDomains):
1456         (WebKit::ResourceLoadStatisticsMemoryStore::classifyPrevalentResources):
1457         (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageIfNeeded):
1458         (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageImmediately):
1459         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherDataForDomains):
1460         (WebKit::domainsToString): Deleted.
1461         (WebKit::OperatingDate::fromWallTime): Deleted.
1462         (WebKit::OperatingDate::today): Deleted.
1463         (WebKit::OperatingDate::secondsSinceEpoch const): Deleted.
1464         (WebKit::OperatingDate::operator== const): Deleted.
1465         (WebKit::OperatingDate::operator< const): Deleted.
1466         (WebKit::OperatingDate::operator<= const): Deleted.
1467         (WebKit::OperatingDate::OperatingDate): Deleted.
1468         (WebKit::mergeOperatingDates): Deleted.
1469         (WebKit::computeImportance): Deleted.
1470         (WebKit::ResourceLoadStatisticsMemoryStore::~ResourceLoadStatisticsMemoryStore): Deleted.
1471         (WebKit::ResourceLoadStatisticsMemoryStore::setNotifyPagesWhenDataRecordsWereScanned): Deleted.
1472         (WebKit::ResourceLoadStatisticsMemoryStore::setShouldClassifyResourcesBeforeDataRecordsRemoval): Deleted.
1473         (WebKit::ResourceLoadStatisticsMemoryStore::setShouldSubmitTelemetry): Deleted.
1474         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords): Deleted.
1475         (WebKit::ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords): Deleted.
1476         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData): Deleted.
1477         (WebKit::ResourceLoadStatisticsMemoryStore::setResourceLoadStatisticsDebugMode): Deleted.
1478         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode): Deleted.
1479         (WebKit::ResourceLoadStatisticsMemoryStore::scheduleStatisticsProcessingRequestIfNecessary): Deleted.
1480         (WebKit::ResourceLoadStatisticsMemoryStore::cancelPendingStatisticsProcessingRequest): Deleted.
1481         (WebKit::ResourceLoadStatisticsMemoryStore::setTimeToLiveUserInteraction): Deleted.
1482         (WebKit::ResourceLoadStatisticsMemoryStore::setMinimumTimeBetweenDataRecordsRemoval): Deleted.
1483         (WebKit::ResourceLoadStatisticsMemoryStore::setGrandfatheringTime): Deleted.
1484         (WebKit::ResourceLoadStatisticsMemoryStore::setCacheMaxAgeCap): Deleted.
1485         (WebKit::ResourceLoadStatisticsMemoryStore::updateCacheMaxAgeCap): Deleted.
1486         (WebKit::ResourceLoadStatisticsMemoryStore::setAgeCapForClientSideCookies): Deleted.
1487         (WebKit::ResourceLoadStatisticsMemoryStore::updateClientSideCookiesAgeCap): Deleted.
1488         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveDataRecords const): Deleted.
1489         (WebKit::ResourceLoadStatisticsMemoryStore::setDataRecordsBeingRemoved): Deleted.
1490         (WebKit::debugLogDomainsInBatches): Deleted.
1491         (WebKit::ResourceLoadStatisticsMemoryStore::includeTodayAsOperatingDateIfNecessary): Deleted.
1492         (WebKit::ResourceLoadStatisticsMemoryStore::hasStatisticsExpired const): Deleted.
1493         (WebKit::ResourceLoadStatisticsMemoryStore::setMaxStatisticsEntries): Deleted.
1494         (WebKit::ResourceLoadStatisticsMemoryStore::setPruneEntriesDownTo): Deleted.
1495         (WebKit::ResourceLoadStatisticsMemoryStore::resetParametersToDefaultValues): Deleted.
1496         (WebKit::ResourceLoadStatisticsMemoryStore::logTestingEvent): Deleted.
1497         (WebKit::ResourceLoadStatisticsMemoryStore::didCreateNetworkProcess): Deleted.
1498         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
1499         (WebKit::ResourceLoadStatisticsMemoryStore::data const):
1500         (WebKit::ResourceLoadStatisticsMemoryStore::isDebugModeEnabled const): Deleted.
1501         (WebKit::ResourceLoadStatisticsMemoryStore::store const): Deleted.
1502         (WebKit::ResourceLoadStatisticsMemoryStore::setStorageAccessPromptsEnabled): Deleted.
1503         (WebKit::ResourceLoadStatisticsMemoryStore::setDebugLogggingEnabled): Deleted.
1504         (): Deleted.
1505         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: Added.
1506         (WebKit::domainsToString):
1507         (WebKit::OperatingDate::fromWallTime):
1508         (WebKit::OperatingDate::today):
1509         (WebKit::OperatingDate::secondsSinceEpoch const):
1510         (WebKit::OperatingDate::operator== const):
1511         (WebKit::OperatingDate::operator< const):
1512         (WebKit::OperatingDate::operator<= const):
1513         (WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
1514         (WebKit::ResourceLoadStatisticsStore::~ResourceLoadStatisticsStore):
1515         (WebKit::ResourceLoadStatisticsStore::calculateAndSubmitTelemetry const):
1516         (WebKit::ResourceLoadStatisticsStore::computeImportance):
1517         (WebKit::ResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
1518         (WebKit::ResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
1519         (WebKit::ResourceLoadStatisticsStore::setShouldSubmitTelemetry):
1520         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
1521         (WebKit::ResourceLoadStatisticsStore::processStatisticsAndDataRecords):
1522         (WebKit::ResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
1523         (WebKit::ResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
1524         (WebKit::ResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
1525         (WebKit::ResourceLoadStatisticsStore::scheduleStatisticsProcessingRequestIfNecessary):
1526         (WebKit::ResourceLoadStatisticsStore::cancelPendingStatisticsProcessingRequest):
1527         (WebKit::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
1528         (WebKit::ResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
1529         (WebKit::ResourceLoadStatisticsStore::setGrandfatheringTime):
1530         (WebKit::ResourceLoadStatisticsStore::setCacheMaxAgeCap):
1531         (WebKit::ResourceLoadStatisticsStore::updateCacheMaxAgeCap):
1532         (WebKit::ResourceLoadStatisticsStore::setAgeCapForClientSideCookies):
1533         (WebKit::ResourceLoadStatisticsStore::updateClientSideCookiesAgeCap):
1534         (WebKit::ResourceLoadStatisticsStore::shouldRemoveDataRecords const):
1535         (WebKit::ResourceLoadStatisticsStore::setDataRecordsBeingRemoved):
1536         (WebKit::ResourceLoadStatisticsStore::updateCookieBlockingForDomains):
1537         (WebKit::ResourceLoadStatisticsStore::clearBlockingStateForDomains):
1538         (WebKit::ResourceLoadStatisticsStore::processStatistics const):
1539         (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const):
1540         (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates):
1541         (WebKit::ResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
1542         (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const):
1543         (WebKit::ResourceLoadStatisticsStore::setMaxStatisticsEntries):
1544         (WebKit::ResourceLoadStatisticsStore::setPruneEntriesDownTo):
1545         (WebKit::ResourceLoadStatisticsStore::resetParametersToDefaultValues):
1546         (WebKit::ResourceLoadStatisticsStore::logTestingEvent):
1547         (WebKit::ResourceLoadStatisticsStore::removeAllStorageAccess):
1548         (WebKit::ResourceLoadStatisticsStore::didCreateNetworkProcess):
1549         (WebKit::ResourceLoadStatisticsStore::debugLogDomainsInBatches):
1550         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: Copied from Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h.
1551         (WebKit::OperatingDate::OperatingDate):
1552         (WebKit::ResourceLoadStatisticsStore::isEmpty const):
1553         (WebKit::ResourceLoadStatisticsStore::data const):
1554         (WebKit::ResourceLoadStatisticsStore::isDebugModeEnabled const):
1555         (WebKit::ResourceLoadStatisticsStore::store const):
1556         (WebKit::ResourceLoadStatisticsStore::setStorageAccessPromptsEnabled):
1557         (WebKit::ResourceLoadStatisticsStore::setDebugLogggingEnabled):
1558         * NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm: Renamed from Source/WebKit/UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm.
1559         (WebKit::ResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
1560         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1561         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
1562         (WebKit::WebResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
1563         (WebKit::WebResourceLoadStatisticsStore::setShouldSubmitTelemetry):
1564         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1565         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
1566         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
1567         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
1568         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
1569         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
1570         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
1571         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
1572         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
1573         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
1574         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
1575         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading):
1576         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading):
1577         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect):
1578         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
1579         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
1580         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
1581         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
1582         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
1583         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
1584         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
1585         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
1586         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder):
1587         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
1588         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
1589         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
1590         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
1591         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
1592         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
1593         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
1594         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
1595         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
1596         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
1597         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
1598         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdate):
1599         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains):
1600         (WebKit::WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains):
1601         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
1602         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
1603         (WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
1604         (WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
1605         (WebKit::WebResourceLoadStatisticsStore::setMaxStatisticsEntries):
1606         (WebKit::WebResourceLoadStatisticsStore::setPruneEntriesDownTo):
1607         (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
1608         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1609         * NetworkProcess/NetworkProcess.cpp:
1610         (WebKit::NetworkProcess::initializeNetworkProcess):
1611         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1612         (WebKit::NetworkProcessCreationParameters::encode const):
1613         (WebKit::NetworkProcessCreationParameters::decode):
1614         * NetworkProcess/NetworkProcessCreationParameters.h:
1615         * Platform/classifier/ResourceLoadStatisticsClassifier.cpp:
1616         (WebKit::ResourceLoadStatisticsClassifier::calculateResourcePrevalence):
1617         * Platform/classifier/ResourceLoadStatisticsClassifier.h:
1618         * Shared/WebPreferences.yaml:
1619         * Sources.txt:
1620         * SourcesCocoa.txt:
1621         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1622         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1623         * UIProcess/WebProcessPool.cpp:
1624         * WebKit.xcodeproj/project.pbxproj:
1625
1626 2019-03-04  Zalan Bujtas  <zalan@apple.com>
1627
1628         [ContentChangeObserver] Introduce fixed duration content observation
1629         https://bugs.webkit.org/show_bug.cgi?id=195295
1630         <rdar://problem/48579913>
1631
1632         Reviewed by Simon Fraser.
1633
1634         * WebProcess/WebPage/ios/WebPageIOS.mm:
1635         (WebKit::WebPage::handleSyntheticClick):
1636
1637 2019-03-04  Truitt Savell  <tsavell@apple.com>
1638
1639         Unreviewed, rolling out r242396.
1640
1641         Found issue to be unrelated. reverting my rollout.
1642
1643         Reverted changeset:
1644
1645         "Unreviewed, rolling out r242222."
1646         https://bugs.webkit.org/show_bug.cgi?id=193683
1647         https://trac.webkit.org/changeset/242396
1648
1649 2019-03-04  Jiewen Tan  <jiewen_tan@apple.com>
1650
1651         Unreviewed, a followup after r242336
1652
1653         * UIProcess/WebPageProxy.cpp:
1654         (WebKit::WebPageProxy::webViewDidMoveToWindow):
1655         Copy the list of observers before iterating it to avoid observers modifying the list.
1656
1657 2019-03-04  Truitt Savell  <tsavell@apple.com>
1658
1659         Unreviewed, rolling out r242222.
1660
1661         Broke internal debug testing
1662
1663         Reverted changeset:
1664
1665         "[iOS] Move calls to [UIKeyboard isInHardwareKeyboardMode] to
1666         the UI process."
1667         https://bugs.webkit.org/show_bug.cgi?id=193683
1668         https://trac.webkit.org/changeset/242222
1669
1670 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
1671
1672         Unreviewed build fix after r242378
1673
1674         * UIProcess/ios/EditableImageController.mm:
1675         (WebKit::EditableImageController::associateWithAttachment):
1676
1677 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
1678
1679         Check contextIDs when handling WebContent messages
1680         https://bugs.webkit.org/show_bug.cgi?id=195289
1681         <rdar://problem/48475870>
1682
1683         Reviewed by Alex Christensen.
1684
1685         The WebContent process is untrusted because it handles arbitrary markup and javascript from untrusted sources.
1686         We should handle its messages with suspicion, and make sure the arguments are valid and usable before honoring them.
1687
1688         This patch hardens the message passing layer by performing MESSAGE_CHECK in places that had been overlooked.
1689
1690         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
1691         (WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID):
1692         (WebKit::PlaybackSessionManagerProxy::currentTimeChanged):
1693         (WebKit::PlaybackSessionManagerProxy::bufferedTimeChanged):
1694         (WebKit::PlaybackSessionManagerProxy::seekableRangesVectorChanged):
1695         (WebKit::PlaybackSessionManagerProxy::canPlayFastReverseChanged):
1696         (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionOptionsChanged):
1697         (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionOptionsChanged):
1698         (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionIndexChanged):
1699         (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionIndexChanged):
1700         (WebKit::PlaybackSessionManagerProxy::externalPlaybackPropertiesChanged):
1701         (WebKit::PlaybackSessionManagerProxy::wirelessVideoPlaybackDisabledChanged):
1702         (WebKit::PlaybackSessionManagerProxy::mutedChanged):
1703         (WebKit::PlaybackSessionManagerProxy::volumeChanged):
1704         (WebKit::PlaybackSessionManagerProxy::durationChanged):
1705         (WebKit::PlaybackSessionManagerProxy::playbackStartedTimeChanged):
1706         (WebKit::PlaybackSessionManagerProxy::rateChanged):
1707         (WebKit::PlaybackSessionManagerProxy::pictureInPictureSupportedChanged):
1708         (WebKit::PlaybackSessionManagerProxy::pictureInPictureActiveChanged):
1709         (WebKit::PlaybackSessionManagerProxy::handleControlledElementIDResponse const):
1710         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1711         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
1712         (WebKit::UserMediaCaptureManagerProxy::startProducingData):
1713         (WebKit::UserMediaCaptureManagerProxy::stopProducingData):
1714         (WebKit::UserMediaCaptureManagerProxy::end):
1715         (WebKit::UserMediaCaptureManagerProxy::capabilities):
1716         (WebKit::UserMediaCaptureManagerProxy::setMuted):
1717         (WebKit::UserMediaCaptureManagerProxy::applyConstraints):
1718         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1719         (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
1720         (WebKit::VideoFullscreenManagerProxy::setHasVideo):
1721         (WebKit::VideoFullscreenManagerProxy::setVideoDimensions):
1722         (WebKit::VideoFullscreenManagerProxy::enterFullscreen):
1723         (WebKit::VideoFullscreenManagerProxy::exitFullscreen):
1724         (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode):
1725         (WebKit::VideoFullscreenManagerProxy::setInlineRect):
1726         (WebKit::VideoFullscreenManagerProxy::setHasVideoContentLayer):
1727         (WebKit::VideoFullscreenManagerProxy::cleanupFullscreen):
1728         (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline):
1729         (WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen):
1730         * UIProcess/ios/EditableImageController.mm:
1731         (WebKit::EditableImageController::didCreateEditableImage):
1732         (WebKit::EditableImageController::didDestroyEditableImage):
1733         (WebKit::EditableImageController::associateWithAttachment):
1734
1735 2019-03-04  Alex Christensen  <achristensen@webkit.org>
1736
1737         Fix crashes when NetworkResourceLoader/NetworkLoadChecker are destroyed during HTTPS upgrade check
1738         https://bugs.webkit.org/show_bug.cgi?id=195238
1739         <rdar://problem/47598656>
1740
1741         Reviewed by Chris Dumez.
1742
1743         * NetworkProcess/NetworkLoadChecker.cpp:
1744         (WebKit::NetworkLoadChecker::checkRequest):
1745
1746 2019-03-04  Brady Eidson  <beidson@apple.com>
1747
1748         Correctly handle sandbox extensions when the same WKWebView loads multiple file:// URLs.
1749         <rdar://problem/47820581> and https://bugs.webkit.org/show_bug.cgi?id=195291
1750
1751         Reviewed by Andy Estes.
1752
1753         * WebProcess/WebPage/WebPage.cpp:
1754         (WebKit::shouldReuseCommittedSandboxExtension): Only retain the previous sandbox extension if the file URL
1755           we're currently loading is functionally equivalent to the previous one.
1756
1757 2019-03-04  Chris Dumez  <cdumez@apple.com>
1758
1759         Drop legacy userAgentForURL injected bundle SPI
1760         https://bugs.webkit.org/show_bug.cgi?id=195222
1761         <rdar://problem/46734147>
1762
1763         Reviewed by Darin Adler.
1764
1765         Drop legacy userAgentForURL injected bundle SPI. There are no longer any clients, and using
1766         WebsitePolicies.customUserAgent is the way to go nowadays.
1767
1768         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
1769         (API::InjectedBundle::PageLoaderClient::willDestroyFrame):
1770         (API::InjectedBundle::PageLoaderClient::userAgentForURL const): Deleted.
1771         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
1772         * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:
1773         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1774         (setUpPageLoaderClient):
1775         (userAgentForURL): Deleted.
1776         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
1777         (WebKit::InjectedBundlePageLoaderClient::userAgentForURL const): Deleted.
1778         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
1779         * WebProcess/WebPage/WebPage.cpp:
1780         (WebKit::WebPage::userAgent const):
1781
1782 2019-03-04  Chris Dumez  <cdumez@apple.com>
1783
1784         Do not share WebProcesses between private and regular sessions
1785         https://bugs.webkit.org/show_bug.cgi?id=195189
1786         <rdar://problem/48421064>
1787
1788         Reviewed by Alex Christensen.
1789
1790         Do not share WebProcesses between private and regular sessions. There are some privacy concerns.
1791         Also, some of the WebsiteDataStore informations are passed via WebProcessCreationParameters (e.g.
1792         ApplicationCache path) and cannot be updated later.
1793
1794         There were 2 cases where this could happen and that are fixed in the patch:
1795         - A process may be prewarmed with a given website data store and then later on used for a page
1796           associated with a different data store. We now prevent this. While this is not necessary for
1797           privacy reasons, it is still useful because our code currently does not support well uses
1798           different sessions inside a single WebProcess, as mentioned above.
1799         - The client can force a WebsiteDataStore swap when responding to the decidePolicyForNavigationAction,
1800           via the WebsitePolicies. To address the issue, we now force a process swap whenever the client
1801           makes such a change.
1802
1803         As a result, WebProcessProxy::websiteDataStore() now makes sense and is always correct. It can
1804         also only contains pages whose WebPageProxy::websiteDataStore() returns the same store.
1805
1806         * UIProcess/API/C/WKContext.cpp:
1807         (WKContextWarmInitialProcess):
1808         * UIProcess/API/Cocoa/WKProcessPool.mm:
1809         (-[WKProcessPool _warmInitialProcess]):
1810         * UIProcess/ProvisionalPageProxy.cpp:
1811         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
1812         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
1813         * UIProcess/WebPageProxy.cpp:
1814         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
1815         (WebKit::WebPageProxy::reattachToWebProcess):
1816         (WebKit::WebPageProxy::swapToWebProcess):
1817         (WebKit::WebPageProxy::close):
1818         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1819         (WebKit::WebPageProxy::commitProvisionalPage):
1820         (WebKit::WebPageProxy::creationParameters):
1821         * UIProcess/WebPageProxy.h:
1822         (WebKit::WebPageProxy::websiteDataStore):
1823         * UIProcess/WebProcessPool.cpp:
1824         (WebKit::WebProcessPool::ensureNetworkProcess):
1825         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
1826         (WebKit::WebProcessPool::prewarmProcess):
1827         (WebKit::WebProcessPool::createWebPage):
1828         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
1829         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
1830         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
1831         (WebKit::WebProcessPool::processForNavigation):
1832         (WebKit::WebProcessPool::processForNavigationInternal):
1833         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
1834         * UIProcess/WebProcessPool.h:
1835         (WebKit::WebProcessPool::sendToOneProcess):
1836         * UIProcess/WebProcessProxy.cpp:
1837         (WebKit::WebProcessProxy::createWebPage):
1838         (WebKit::WebProcessProxy::addExistingWebPage):
1839         (WebKit::WebProcessProxy::removeWebPage):
1840         * UIProcess/WebProcessProxy.h:
1841
1842 2019-03-04  Chris Dumez  <cdumez@apple.com>
1843
1844         [iOS] Improve our file picker
1845         https://bugs.webkit.org/show_bug.cgi?id=195284
1846         <rdar://problem/45655856>
1847
1848         Reviewed by Tim Horton and Wenson Hsieh.
1849
1850         Improve our file picker on iOS so that:
1851         - Accepted file extensions specified in the HTML (e.g. <input type="file"> accept=".pdf">) are now
1852           properly reflected in the file picker. Previously, we only we only supported MIME types in the
1853           accept attribute that only Image / Video ones.
1854         - If accepted types are specified in the HTML and not of them are Video or Image types, then bypass
1855           the UIDocumentMenuViewController and show the file picker directly (as if the user had tapped on
1856           "Browse..." on that menu). Other menu items such as "Take Photo or Video" and "Photo Library" do
1857           not make sense if the page only accepts PDF files for example.
1858
1859         Things that we should do but are not fixed in this patch:
1860         - Stop using UIDocumentMenuViewController entirely since it was deprecated in favor of using
1861           UIDocumentPickerViewController directly.
1862         - Add multiple selection support, which is supported both on the HTML side and in the
1863           UIDocumentPickerViewController API.
1864
1865         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1866         (arrayContainsUTIThatConformsTo):
1867         (-[WKFileUploadPanel dealloc]):
1868         (-[WKFileUploadPanel presentWithParameters:resultListener:]):
1869         (UTIsForMIMETypes):
1870         (-[WKFileUploadPanel _mediaTypesForPickerSourceType:]):
1871         (-[WKFileUploadPanel _cameraButtonLabelAllowingPhoto:allowingVideo:]):
1872         (-[WKFileUploadPanel _showDocumentPickerMenu]):
1873
1874 2019-03-04  Alex Christensen  <achristensen@webkit.org>
1875
1876         REGRESSION: ( r240978-r240985 ) [ iOS Release ] Layout Test imported/w3c/web-platform-tests/xhr/send-redirect-post-upload.htm is crashing
1877         https://bugs.webkit.org/show_bug.cgi?id=194523
1878
1879         Reviewed by Ryosuke Niwa.
1880
1881         Attempt to work around a CFNetwork bug in the timing of tearing down tasks with upload streams.
1882         See rdar://problem/28233746.
1883
1884         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1885         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1886         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
1887         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1888         (-[WKNetworkSessionDelegate URLSession:task:needNewBodyStream:]):
1889
1890 2019-03-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1891
1892         [CoordinatedGraphics] The compositing loop is still running even after exiting AC mode
1893         https://bugs.webkit.org/show_bug.cgi?id=195270
1894
1895         Reviewed by Don Olmstead.
1896
1897         Suspend the threaded compositor when the painting is paused or layer flush disabled, and resume it again when
1898         painting is resumed and layer flush enabled.
1899
1900         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1901         (WebKit::ThreadedCompositor::suspend): Increment the suspend counter and mark the scene as inactive if it was suspended.
1902         (WebKit::ThreadedCompositor::resume): Decrement the suspend counter and mark the scene as active if it's now resumed.
1903         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1904         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
1905         (WebKit::DrawingAreaCoordinatedGraphics::forceRepaint): Return early if layer tree state is frozen.
1906         (WebKit::DrawingAreaCoordinatedGraphics::forceRepaintAsync): Ditto.
1907         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
1908         (WebKit::LayerTreeHost::setLayerFlushSchedulingEnabled): Call ThreadedCompositor::suspend()/resume().
1909         (WebKit::LayerTreeHost::pauseRendering): Call ThreadedCompositor::suspend.
1910         (WebKit::LayerTreeHost::resumeRendering): Call ThreadedCompositor::resume().
1911
1912 2019-03-04  Simon Fraser  <simon.fraser@apple.com>
1913
1914         Share more code between overflow and frame scrolling nodes, fixing overflow scrollbar display
1915         https://bugs.webkit.org/show_bug.cgi?id=195258
1916
1917         Reviewed by Antti Koivisto.
1918
1919         This patch moves management of scrollbar layers and scrollbar painters ("NSScrollerImp") down to
1920         ScrollingStateScrollingNode to be shared between frame and overflow nodes, allowing for
1921         scrolling thread updates of overflow scrollbars. It also moves some scrolling tree-side code
1922         to ScrollingTreeScrollingNodeDelegateMac to be shared between the "tree" nodes for overflow and frames.
1923
1924         Layers for scrollbars are given to scrolling state nodes via setNodeLayers() now, and
1925         RenderLayerCompositor::updateScrollingNodeLayers() is added to provide a bottleneck to call that.
1926         At some point AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() should be relieved
1927         of the responsibility of pushing scrollbar layers (but the scrolling state tree needs to hold
1928         references to GraphicsLayers before that becomes safe).
1929         
1930         The actual fix that allows overflow scrollbars to show is the change in
1931         AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() that calls scrollableArea.*ScrollbarLayerDidChange()
1932         for all ScrollableAreas. This ensures that the CALayer is pushed onto the NSScrollerImp.
1933
1934         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1935         (ArgumentCoder<ScrollingStateScrollingNode>::encode):
1936         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
1937         (ArgumentCoder<ScrollingStateScrollingNode>::decode):
1938         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
1939         * SourcesCocoa.txt:
1940         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1941         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1942         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
1943         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
1944         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp:
1945         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::commitStateBeforeChildren):
1946         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::repositionRelatedLayers):
1947         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleMouseEvent):
1948         * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp: Copied from Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp.
1949         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::create):
1950         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::ScrollingTreeOverflowScrollingNodeRemoteMac):
1951         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::~ScrollingTreeOverflowScrollingNodeRemoteMac):
1952         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::commitStateBeforeChildren):
1953         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::repositionRelatedLayers):
1954         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::handleWheelEvent):
1955         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::handleMouseEvent):
1956         * WebKit.xcodeproj/project.pbxproj:
1957
1958 2019-03-04  Andy Estes  <aestes@apple.com>
1959
1960         [Apple Pay] Move WebPaymentCoordinatorProxy from Source/WebKit/UIProcess to Source/WebKit/Shared
1961         https://bugs.webkit.org/show_bug.cgi?id=195080
1962         <rdar://problem/48421558>
1963
1964         Reviewed by Antti Koivisto.
1965
1966         * CMakeLists.txt:
1967         * DerivedSources-input.xcfilelist:
1968         * DerivedSources.make:
1969         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp: Renamed from Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp.
1970         * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Renamed from Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h.
1971         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: Renamed from Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in.
1972         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: Renamed from Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h.
1973         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: Renamed from Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm.
1974         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: Renamed from Source/WebKit/UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm.
1975         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: Renamed from Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm.
1976         * Shared/mac/WebHitTestResultData.mm:
1977         * SourcesCocoa.txt:
1978         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h:
1979         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
1980         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
1981         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1982         * WebKit.xcodeproj/project.pbxproj:
1983
1984 2019-03-04  Jer Noble  <jer.noble@apple.com>
1985
1986         [iOS] Fullscreen "stay in page" option breaks video playback
1987         https://bugs.webkit.org/show_bug.cgi?id=195277
1988         <rdar://problem/48537317>
1989
1990         Reviewed by Eric Carlson.
1991
1992         Make sure we resume media playback when the user chooses "stay in page" from the deceptive
1993         website warning dialog.
1994
1995         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1996         (-[WKFullScreenViewController _showPhishingAlert]):
1997
1998 2019-03-04  Michael Catanzaro  <mcatanzaro@igalia.com>
1999
2000         [WPE] Enable web process sandbox
2001         https://bugs.webkit.org/show_bug.cgi?id=195169
2002
2003         Reviewed by Daniel Bates.
2004
2005         * PlatformWPE.cmake:
2006         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
2007         (WebKit::bubblewrapSpawn):
2008         * UIProcess/glib/WebProcessPoolGLib.cpp:
2009         (WebKit::WebProcessPool::platformInitialize):
2010
2011 2019-03-04  Adrian Perez de Castro  <aperez@igalia.com>
2012
2013         [GTK][WPE] Wrong license header in WebKit{,WebExtension}Autocleanups.h
2014         https://bugs.webkit.org/show_bug.cgi?id=195245
2015
2016         Reviewed by Carlos Garcia Campos.
2017
2018         Changed license headers to contain the LGPL, which is the correct one for the GTK
2019         and WPE ports. The change was agreed by the contributors to the files involved.
2020
2021         * UIProcess/API/gtk/WebKitAutocleanups.h:
2022         * UIProcess/API/wpe/WebKitAutocleanups.h:
2023         * WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionAutocleanups.h:
2024         * WebProcess/InjectedBundle/API/wpe/WebKitWebExtensionAutocleanups.h:
2025
2026 2019-03-04  Commit Queue  <commit-queue@webkit.org>
2027
2028         Unreviewed, rolling out r242045.
2029         https://bugs.webkit.org/show_bug.cgi?id=195273
2030
2031         WE not ready to enable PSON yet (Requested by KaL on #webkit).
2032
2033         Reverted changeset:
2034
2035         "[GTK] Enable PSON"
2036         https://bugs.webkit.org/show_bug.cgi?id=194979
2037         https://trac.webkit.org/changeset/242045
2038
2039 2019-03-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2040
2041         [CoordinatedGraphics] Unify DrawingArea classes
2042         https://bugs.webkit.org/show_bug.cgi?id=195167
2043
2044         Reviewed by Žan Doberšek.
2045
2046         Add DrawingAreaProxyCoordinatedGraphics and DrawingAreaCoordinatedGraphics.
2047
2048         * PlatformGTK.cmake:
2049         * PlatformWPE.cmake:
2050         * PlatformWin.cmake:
2051         * Shared/DrawingAreaInfo.h:
2052         * SourcesGTK.txt:
2053         * SourcesWPE.txt:
2054         * UIProcess/API/gtk/PageClientImpl.cpp:
2055         (WebKit::PageClientImpl::createDrawingAreaProxy):
2056         (WebKit::PageClientImpl::viewSize):
2057         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2058         (webkitWebViewBaseRealize):
2059         (webkitWebViewBaseUnrealize):
2060         (webkitWebViewBaseDraw):
2061         (webkitWebViewBaseSizeAllocate):
2062         (webkitWebViewBaseDidRelaunchWebProcess):
2063         (webkitWebViewBasePageClosed):
2064         * UIProcess/API/wpe/PageClientImpl.cpp:
2065         (WebKit::PageClientImpl::createDrawingAreaProxy):
2066         * UIProcess/AcceleratedDrawingAreaProxy.cpp: Removed.
2067         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp: Added.
2068         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingAreaProxyCoordinatedGraphics):
2069         (WebKit::DrawingAreaProxyCoordinatedGraphics::~DrawingAreaProxyCoordinatedGraphics):
2070         (WebKit::DrawingAreaProxyCoordinatedGraphics::paint):
2071         (WebKit::DrawingAreaProxyCoordinatedGraphics::sizeDidChange):
2072         (WebKit::DrawingAreaProxyCoordinatedGraphics::deviceScaleFactorDidChange):
2073         (WebKit::DrawingAreaProxyCoordinatedGraphics::waitForBackingStoreUpdateOnNextPaint):
2074         (WebKit::DrawingAreaProxyCoordinatedGraphics::setBackingStoreIsDiscardable):
2075         (WebKit::DrawingAreaProxyCoordinatedGraphics::update):
2076         (WebKit::DrawingAreaProxyCoordinatedGraphics::didUpdateBackingStoreState):
2077         (WebKit::DrawingAreaProxyCoordinatedGraphics::enterAcceleratedCompositingMode):
2078         (WebKit::DrawingAreaProxyCoordinatedGraphics::exitAcceleratedCompositingMode):
2079         (WebKit::DrawingAreaProxyCoordinatedGraphics::updateAcceleratedCompositingMode):
2080         (WebKit::DrawingAreaProxyCoordinatedGraphics::incorporateUpdate):
2081         (WebKit::DrawingAreaProxyCoordinatedGraphics::alwaysUseCompositing const):
2082         (WebKit::DrawingAreaProxyCoordinatedGraphics::backingStoreStateDidChange):
2083         (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState):
2084         (WebKit::DrawingAreaProxyCoordinatedGraphics::waitForAndDispatchDidUpdateBackingStoreState):
2085         (WebKit::DrawingAreaProxyCoordinatedGraphics::discardBackingStoreSoon):
2086         (WebKit::DrawingAreaProxyCoordinatedGraphics::discardBackingStore):
2087         (WebKit::DrawingAreaProxyCoordinatedGraphics::setNativeSurfaceHandleForCompositing):
2088         (WebKit::DrawingAreaProxyCoordinatedGraphics::destroyNativeSurfaceHandleForCompositing):
2089         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::DrawingMonitor):
2090         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::~DrawingMonitor):
2091         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::webViewDrawCallback):
2092         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::start):
2093         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::stop):
2094         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::didDraw):
2095         (WebKit::DrawingAreaProxyCoordinatedGraphics::dispatchAfterEnsuringDrawing):
2096         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h: Renamed from Source/WebKit/UIProcess/AcceleratedDrawingAreaProxy.h.
2097         * UIProcess/DrawingAreaProxyImpl.cpp: Removed.
2098         * UIProcess/DrawingAreaProxyImpl.h: Removed.
2099         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
2100         (WebKit::AcceleratedBackingStoreX11::update):
2101         * UIProcess/win/PageClientImpl.cpp:
2102         (WebKit::PageClientImpl::createDrawingAreaProxy):
2103         * UIProcess/win/WebView.cpp:
2104         (WebKit::WebView::paint):
2105         * WebProcess/WebPage/AcceleratedDrawingArea.cpp: Removed.
2106         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: Added.
2107         (WebKit::DrawingAreaCoordinatedGraphics::DrawingAreaCoordinatedGraphics):
2108         (WebKit::DrawingAreaCoordinatedGraphics::~DrawingAreaCoordinatedGraphics):
2109         (WebKit::DrawingAreaCoordinatedGraphics::setNeedsDisplay):
2110         (WebKit::DrawingAreaCoordinatedGraphics::setNeedsDisplayInRect):
2111         (WebKit::DrawingAreaCoordinatedGraphics::scroll):
2112         (WebKit::DrawingAreaCoordinatedGraphics::forceRepaint):
2113         (WebKit::DrawingAreaCoordinatedGraphics::forceRepaintAsync):
2114         (WebKit::DrawingAreaCoordinatedGraphics::setLayerTreeStateIsFrozen):
2115         (WebKit::DrawingAreaCoordinatedGraphics::updatePreferences):
2116         (WebKit::DrawingAreaCoordinatedGraphics::mainFrameContentSizeChanged):
2117         (WebKit::DrawingAreaCoordinatedGraphics::deviceOrPageScaleFactorChanged):
2118         (WebKit::DrawingAreaCoordinatedGraphics::didChangeViewportAttributes):
2119         (WebKit::DrawingAreaCoordinatedGraphics::graphicsLayerFactory):
2120         (WebKit::DrawingAreaCoordinatedGraphics::setRootCompositingLayer):
2121         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
2122         (WebKit::DrawingAreaCoordinatedGraphics::layerHostDidFlushLayers):
2123         (WebKit::DrawingAreaCoordinatedGraphics::createDisplayRefreshMonitor):
2124         (WebKit::DrawingAreaCoordinatedGraphics::setNativeSurfaceHandleForCompositing):
2125         (WebKit::DrawingAreaCoordinatedGraphics::destroyNativeSurfaceHandleForCompositing):
2126         (WebKit::DrawingAreaCoordinatedGraphics::activityStateDidChange):
2127         (WebKit::DrawingAreaCoordinatedGraphics::attachViewOverlayGraphicsLayer):
2128         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
2129         (WebKit::DrawingAreaCoordinatedGraphics::didUpdate):
2130         (WebKit::DrawingAreaCoordinatedGraphics::sendDidUpdateBackingStoreState):
2131         (WebKit::DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingModeSoon):
2132         (WebKit::DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingModeNow):
2133         (WebKit::DrawingAreaCoordinatedGraphics::discardPreviousLayerTreeHost):
2134         (WebKit::DrawingAreaCoordinatedGraphics::suspendPainting):
2135         (WebKit::DrawingAreaCoordinatedGraphics::resumePainting):
2136         (WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode):
2137         (WebKit::DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingMode):
2138         (WebKit::DrawingAreaCoordinatedGraphics::scheduleDisplay):
2139         (WebKit::DrawingAreaCoordinatedGraphics::displayTimerFired):
2140         (WebKit::DrawingAreaCoordinatedGraphics::display):
2141         (WebKit::shouldPaintBoundsRect):
2142         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h: Renamed from Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h.
2143         * WebProcess/WebPage/DrawingArea.cpp:
2144         (WebKit::DrawingArea::create):
2145         * WebProcess/WebPage/DrawingArea.h:
2146         (WebKit::DrawingArea::layerFlushThrottlingIsActive const):
2147         * WebProcess/WebPage/DrawingAreaImpl.cpp: Removed.
2148         * WebProcess/WebPage/DrawingAreaImpl.h: Removed.
2149
2150 2019-03-03  Zalan Bujtas  <zalan@apple.com>
2151
2152         [ContentChangeObserver] Content observation should be limited to the current document.
2153         https://bugs.webkit.org/show_bug.cgi?id=195256
2154         <rdar://problem/48544402>
2155
2156         Reviewed by Simon Fraser.
2157
2158         * WebProcess/WebPage/WebPage.h:
2159         * WebProcess/WebPage/ios/WebPageIOS.mm:
2160         (WebKit::WebPage::handleSyntheticClick):
2161         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
2162         (WebKit::WebPage::completeSyntheticClick):
2163         (WebKit::WebPage::handleTap):
2164         (WebKit::WebPage::handleTwoFingerTapAtPoint):
2165         (WebKit::WebPage::commitPotentialTap):
2166
2167 2019-03-03  Tim Horton  <timothy_horton@apple.com>
2168
2169         Rid the world of WK_API_ENABLED
2170         https://bugs.webkit.org/show_bug.cgi?id=195263
2171
2172         Reviewed by Dan Bernstein.
2173
2174         List of changed files elided because it's useless.
2175
2176 2019-03-03  Jiewen Tan  <jiewen_tan@apple.com>
2177
2178         Add a WebViewDidMoveToWindowObserver for WKWebView
2179         https://bugs.webkit.org/show_bug.cgi?id=195223
2180         <rdar://problem/48520161>
2181
2182         Reviewed by Darin Adler.
2183
2184         The load optimizer would only allow itself to optimize loads whenever the web view
2185         who owns the page is (visible && focused), otherwises it will wait until the web view
2186         becomes (visible && focused). Therefore, we need a way to notify the load optimizer
2187         changes of statuses.
2188
2189         * UIProcess/API/Cocoa/WKWebView.mm:
2190         (-[WKWebView didMoveToWindow]):
2191         * UIProcess/Cocoa/WebViewImpl.mm:
2192         (WebKit::WebViewImpl::viewDidMoveToWindow):
2193         * UIProcess/WebPageProxy.cpp:
2194         (WebKit::WebPageProxy::addWebViewDidMoveToWindowObserver):
2195         (WebKit::WebPageProxy::removeWebViewDidMoveToWindowObserver):
2196         (WebKit::WebPageProxy::webViewDidMoveToWindow):
2197         * UIProcess/WebPageProxy.h:
2198         * UIProcess/WebViewDidMoveToWindowObserver.h: Added.
2199         * WebKit.xcodeproj/project.pbxproj:
2200
2201 2019-03-03  Andy Estes  <aestes@apple.com>
2202
2203         [Apple Pay] Untangle WebPageProxy and WebPaymentCoordinatorProxy
2204         https://bugs.webkit.org/show_bug.cgi?id=195219
2205         <rdar://problem/48518082>
2206
2207         Reviewed by Darin Adler.
2208
2209         Rather than having WebPaymentCoordinatorProxy know about WebPageProxy, give
2210         WebPaymentCoordinatorProxy a client interface that WebPageProxy conforms to.
2211
2212         In a follow-on patch, WebPaymentCoordinatorProxy will have a non-WebPageProxy client.
2213
2214         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
2215         (WebKit::WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy): Replaced use of
2216         m_webPageProxy with m_client.
2217         (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy): Ditto.
2218         (WebKit::WebPaymentCoordinatorProxy::messageSenderConnection const): Implemented
2219         IPC::MessageSender via m_client.
2220         (WebKit::WebPaymentCoordinatorProxy::messageSenderDestinationID const): Ditto.
2221         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard): Replaced use of
2222         m_webPageProxy with m_client.
2223         (WebKit::WebPaymentCoordinatorProxy::openPaymentSetup): Ditto.
2224         (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession): Called our own
2225         MessageSender::send rather than going through m_webPageProxy.
2226         (WebKit::WebPaymentCoordinatorProxy::validateMerchant): Ditto.
2227         (WebKit::WebPaymentCoordinatorProxy::didAuthorizePayment): Ditto.
2228         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingMethod): Ditto.
2229         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingContact): Ditto.
2230         (WebKit::WebPaymentCoordinatorProxy::didSelectPaymentMethod): Ditto.
2231         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h: Defined the Client abstract class and
2232         changed m_webPageProxy to m_client.
2233         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
2234         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2235         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard): Replaced use of
2236         m_webPageProxy with m_client.
2237         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Renamed from toPKPaymentRequest.
2238         (WebKit::toPKPaymentRequest): Renamed to WebPaymentCoordinatorProxy::platformPaymentRequest.
2239         * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
2240         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Replaced use of m_webPageProxy
2241         with m_client.
2242         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
2243         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Ditto.
2244         * UIProcess/AuxiliaryProcessProxy.h:
2245         (WebKit::AuxiliaryProcessProxy::messageReceiverMap): Added.
2246         * UIProcess/WebPageProxy.cpp:
2247         (WebKit::WebPageProxy::paymentCoordinatorConnection): Implemented WebPaymentCoordinatorProxy::Client.
2248         (WebKit::WebPageProxy::paymentCoordinatorMessageReceiver): Ditto.
2249         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
2250         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
2251         (WebKit::WebPageProxy::paymentCoordinatorDestinationID): Ditto.
2252         * UIProcess/WebPageProxy.h: Made WebPageProxy derive from WebPaymentCoordinatorProxy::Client.
2253         * UIProcess/ios/WebPageProxyIOS.mm:
2254         (WebKit::WebPageProxy::paymentCoordinatorPresentingViewController): Implemented WebPaymentCoordinatorProxy::Client.
2255         (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType): Ditto.
2256         * UIProcess/mac/WebPageProxyMac.mm:
2257         (WebKit::WebPageProxy::paymentCoordinatorPresentingWindow): Ditto.
2258         * WebKit.xcodeproj/project.pbxproj:
2259
2260 2019-03-03  Tim Horton  <timothy_horton@apple.com>
2261
2262         Remove some more unused 32-bit code
2263         https://bugs.webkit.org/show_bug.cgi?id=195255
2264
2265         Reviewed by Darin Adler.
2266
2267         * Platform/Module.cpp:
2268         (WebKit::Module::Module):
2269         * Platform/Module.h:
2270         * Platform/cf/ModuleCF.cpp:
2271         (WebKit::Module::unload):
2272         (WebKit::Module::bundleResourceMap): Deleted.
2273         * PluginProcess/mac/PluginProcessMac.mm:
2274         (WebKit::initializeShim):
2275         (WebKit::PluginProcess::platformInitializeProcess):
2276         (WebKit::shouldCallRealDebugger): Deleted.
2277         (WebKit::isWindowActive): Deleted.
2278         (WebKit::getCurrentEventButtonState): Deleted.
2279         (WebKit::carbonWindowShown): Deleted.
2280         (WebKit::carbonWindowHidden): Deleted.
2281         (WebKit::openCFURLRef): Deleted.
2282         (WebKit::isMallocTinyMemoryTag): Deleted.
2283         (WebKit::shouldMapMemoryExecutable): Deleted.
2284         * PluginProcess/mac/PluginProcessShim.h:
2285         * PluginProcess/mac/PluginProcessShim.mm:
2286         (WebKit::shimDebugger): Deleted.
2287         (WebKit::shimGetCurrentEventButtonState): Deleted.
2288         (WebKit::shimIsWindowActive): Deleted.
2289         (WebKit::shimModalDialog): Deleted.
2290         (WebKit::shimAlert): Deleted.
2291         (WebKit::shimShowWindow): Deleted.
2292         (WebKit::shimHideWindow): Deleted.
2293         (WebKit::shimLSOpenCFURLRef): Deleted.
2294         (WebKit::shimMachVMMap): Deleted.
2295         * Shared/API/Cocoa/WKFoundation.h:
2296         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
2297         (WebKit::XPCServiceMain):
2298         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
2299         (WebKit::NetscapePluginModule::tryLoad):
2300         * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
2301         (WebKit::getPluginArchitecture):
2302         (WebKit::NetscapePluginModule::determineQuirks):
2303         * Shared/Plugins/PluginQuirks.h:
2304         * Shared/cf/ArgumentCodersCF.cpp:
2305         (IPC::sizeForNumberType):
2306         * Shared/mac/WebEventFactory.mm:
2307         (WebKit::mouseButtonForEvent):
2308         (WebKit::globalPointForEvent):
2309         (WebKit::pointForEvent):
2310         (WebKit::WebEventFactory::createWebMouseEvent):
2311         * UIProcess/API/C/mac/WKPagePrivateMac.h:
2312         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
2313         (WKPageLoadFileReturningNavigation):
2314         * UIProcess/Cocoa/WebViewImpl.mm:
2315         (WebKit::WebViewImpl::pressureChangeWithEvent):
2316         * UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm:
2317         (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider):
2318         * UIProcess/mac/ServicesController.mm:
2319         (WebKit::ServicesController::ServicesController):
2320         * UIProcess/mac/WebContextMenuProxyMac.mm:
2321         (WebKit::WebContextMenuProxyMac::setupServicesMenu):
2322         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
2323         (WebKit::NPN_GetValue):
2324         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
2325         (WebKit::NetscapePlugin::NetscapePlugin):
2326         * WebProcess/Plugins/Netscape/NetscapePlugin.h:
2327         (WebKit::NetscapePlugin::isWindowActive const): Deleted.
2328         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
2329         (WebKit::NetscapePlugin::setDrawingModel):
2330         (WebKit::NetscapePlugin::setEventModel):
2331         (WebKit::NetscapePlugin::platformPostInitialize):
2332         (WebKit::NetscapePlugin::platformDestroy):
2333         (WebKit::NetscapePlugin::platformGeometryDidChange):
2334         (WebKit::NetscapePlugin::platformPaint):
2335         (WebKit::NetscapePlugin::platformHandleMouseEvent):
2336         (WebKit::NetscapePlugin::platformHandleWheelEvent):
2337         (WebKit::NetscapePlugin::platformHandleMouseEnterEvent):
2338         (WebKit::NetscapePlugin::platformHandleMouseLeaveEvent):
2339         (WebKit::NetscapePlugin::platformHandleKeyboardEvent):
2340         (WebKit::NetscapePlugin::platformSetFocus):
2341         (WebKit::NetscapePlugin::windowFocusChanged):
2342         (WebKit::NetscapePlugin::windowAndViewFramesChanged):
2343         (WebKit::NetscapePlugin::sendComplexTextInput):
2344         (): Deleted.
2345         (WebKit::windowMap): Deleted.
2346         (WebKit::NetscapePlugin::netscapePluginFromWindow): Deleted.
2347         (WebKit::NetscapePlugin::windowRef const): Deleted.
2348         (WebKit::NetscapePlugin::updateFakeWindowBounds): Deleted.
2349         (WebKit::NetscapePlugin::buttonState): Deleted.
2350         (WebKit::initializeEventRecord): Deleted.
2351         (WebKit::anyMouseButtonIsDown): Deleted.
2352         (WebKit::rightMouseButtonIsDown): Deleted.
2353         (WebKit::modifiersForEvent): Deleted.
2354         (WebKit::convertStringToKeyCodes): Deleted.
2355         (WebKit::scriptCodeFromCurrentKeyboardInputSource): Deleted.
2356         (WebKit::NetscapePlugin::nullEventTimerFired): Deleted.
2357
2358 2019-03-02  Zalan Bujtas  <zalan@apple.com>
2359
2360         [ContentChangeObserver] Introduce ContentChangeObserver::MouseMovedScope
2361         https://bugs.webkit.org/show_bug.cgi?id=195252
2362         <rdar://problem/48539446>
2363
2364         Reviewed by Simon Fraser.
2365
2366         * WebProcess/WebPage/ios/WebPageIOS.mm:
2367         (WebKit::WebPage::handleSyntheticClick):
2368
2369 2019-03-02  Tim Horton  <timothy_horton@apple.com>
2370
2371         Move EditingRange <-> Range methods to EditingRange instead of WebPage
2372         https://bugs.webkit.org/show_bug.cgi?id=195201
2373
2374         Reviewed by Sam Weinig.
2375
2376         * Shared/EditingRange.h:
2377         * Shared/EditingRange.cpp:
2378         Also, modernize the coders.
2379
2380         * Sources.txt:
2381         * WebKit.xcodeproj/project.pbxproj:
2382         * WebProcess/WebPage/WebPage.cpp:
2383         (WebKit::WebPage::insertTextAsync):
2384         (WebKit::WebPage::getMarkedRangeAsync):
2385         (WebKit::WebPage::getSelectedRangeAsync):
2386         (WebKit::WebPage::characterIndexForPointAsync):
2387         (WebKit::WebPage::firstRectForCharacterRangeAsync):
2388         (WebKit::WebPage::setCompositionAsync):
2389         (WebKit::WebPage::rangeFromEditingRange): Deleted.
2390         * WebProcess/WebPage/mac/WebPageMac.mm:
2391         (WebKit::WebPage::insertDictatedTextAsync):
2392         (WebKit::WebPage::attributedSubstringForCharacterRangeAsync):
2393
2394 2019-03-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2395
2396         [iOS] Programmatic paste access should be granted when copying and pasting within the same origin
2397         https://bugs.webkit.org/show_bug.cgi?id=195053
2398         <rdar://problem/48134710>
2399
2400         Reviewed by Ryosuke Niwa.
2401
2402         Add support for automatically granting programmatic pasteboard access when the pasteboard identifier of the
2403         document requesting programmatic paste matches the identifier in the custom pasteboard data blob in the
2404         UIPasteboard. To do this, we send the pasteboard identifier of the document requesting the DOM paste to the UI
2405         process, and check this against the pasteboard identifiers for each item on the platform pasteboard. If all
2406         items in the platform pasteboard match the given pasteboard identifier (since we don't support writing multiple
2407         pasteboard items via bindings, this should only be a single item), we skip showing the paste callout and
2408         immediately invoke the programmatic paste handler.
2409
2410         * Scripts/webkit/messages.py:
2411         * UIProcess/API/gtk/PageClientImpl.cpp:
2412         (WebKit::PageClientImpl::requestDOMPasteAccess):
2413         * UIProcess/API/gtk/PageClientImpl.h:
2414         * UIProcess/API/wpe/PageClientImpl.cpp:
2415         (WebKit::PageClientImpl::requestDOMPasteAccess):
2416         * UIProcess/API/wpe/PageClientImpl.h:
2417         * UIProcess/PageClient.h:
2418         * UIProcess/WebPageProxy.cpp:
2419         (WebKit::WebPageProxy::requestDOMPasteAccess):
2420         * UIProcess/WebPageProxy.h:
2421         * UIProcess/WebPageProxy.messages.in:
2422
2423         Add plumbing to deliver the pasteboard identifier to the client when requesting DOM paste.
2424
2425         * UIProcess/ios/PageClientImplIOS.h:
2426         * UIProcess/ios/PageClientImplIOS.mm:
2427         (WebKit::PageClientImpl::requestDOMPasteAccess):
2428         * UIProcess/ios/WKContentViewInteraction.h:
2429         * UIProcess/ios/WKContentViewInteraction.mm:
2430         (-[WKContentView cleanupInteraction]):
2431         (-[WKContentView resignFirstResponderForWebView]):
2432         (-[WKContentView _webTouchEventsRecognized:]):
2433         (-[WKContentView _willHideMenu:]):
2434         (-[WKContentView pasteForWebView:]):
2435         (-[WKContentView _handleDOMPasteRequestWithResult:]):
2436         (-[WKContentView _willPerformAction:sender:]):
2437         (-[WKContentView _didPerformAction:sender:]):
2438         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
2439         (allPasteboardItemOriginsMatchOrigin):
2440         (-[WKContentView _requestDOMPasteAccessWithElementRect:originIdentifier:completionHandler:]):
2441         (-[WKContentView _requestDOMPasteAccessWithElementRect:completionHandler:]): Deleted.
2442
2443         Bail early in the case where all items' pasteboard identifiers (read via custom pasteboard data) match. When
2444         this happens, we only grant access for the current paste command, rather than granting access for the user
2445         gesture token.
2446
2447         * UIProcess/mac/PageClientImplMac.h:
2448         * UIProcess/win/PageClientImpl.cpp:
2449         (WebKit::PageClientImpl::requestDOMPasteAccess):
2450         * UIProcess/win/PageClientImpl.h:
2451         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
2452         (WebKit::WebEditorClient::requestDOMPasteAccess):
2453         * WebProcess/WebCoreSupport/WebEditorClient.h:
2454         * WebProcess/WebPage/WebPage.cpp:
2455         (WebKit::WebPage::requestDOMPasteAccess):
2456         * WebProcess/WebPage/WebPage.h:
2457
2458 2019-02-27  Darin Adler  <darin@apple.com>
2459
2460         Fixed makeString(float) to do shortest-form serialization without first converting to double
2461         https://bugs.webkit.org/show_bug.cgi?id=195142
2462
2463         Reviewed by Daniel Bates.
2464
2465         * UIProcess/PerActivityStateCPUUsageSampler.cpp: Removed unneeded include of DecimalNumber.h.
2466
2467 2019-03-02  Adrian Perez de Castro  <aperez@igalia.com>
2468
2469         [WPE] Public API headers are missing autocleanup definitions
2470         https://bugs.webkit.org/show_bug.cgi?id=195211
2471
2472         Reviewed by Philippe Normand.
2473
2474         * PlatformWPE.cmake: List new API headers as installable.
2475         * UIProcess/API/wpe/WebKitAutocleanups.h: Added. This is a copy of the header from the GTK
2476         port, adapted to fit the WPE port.
2477         * UIProcess/API/wpe/webkit.h: Add inclusion of WebKitAutocleanups.h
2478         * WebProcess/InjectedBundle/API/wpe/WebKitWebExtensionAutocleanups.h: Added. Also adapted
2479         from the equivalent header of the GTK port.
2480         * WebProcess/InjectedBundle/API/wpe/webkit-web-extension.h: Add inclusion of
2481         WebKitWebExtensionAutocleanups.h
2482
2483 2019-03-02  Michael Catanzaro  <mcatanzaro@igalia.com>
2484
2485         Remove unused WebPageProxy::m_navigationID
2486         https://bugs.webkit.org/show_bug.cgi?id=195209
2487
2488         Reviewed by Darin Adler.
2489
2490         WebPageProxy::m_navigationID is never assigned to and is only used once by mistake in a
2491         debug LOG(). It must be a refactoring mistake.
2492
2493         * UIProcess/WebPageProxy.cpp:
2494         (WebKit::WebPageProxy::didCommitLoadForFrame):
2495         * UIProcess/WebPageProxy.h:
2496
2497 2019-03-01  Darin Adler  <darin@apple.com>
2498
2499         Finish removing String::format
2500         https://bugs.webkit.org/show_bug.cgi?id=194893
2501
2502         Reviewed by Daniel Bates.
2503
2504         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
2505         (WebKit::LocalAuthenticator::getAssertion): Use makeString, attempting to fix
2506         a problem where we passed an NSData * to format with a "%s"."
2507
2508 2019-03-01  Chris Dumez  <cdumez@apple.com>
2509
2510         Unreviewed Windows build fix after r242302.
2511
2512         * UIProcess/WebProcessPool.cpp:
2513         (WebKit::WebProcessPool::ensureNetworkProcess):
2514
2515 2019-03-01  Alex Christensen  <achristensen@webkit.org>
2516
2517         NetworkDataTask redirection should not keep alive its NetworkSession
2518         https://bugs.webkit.org/show_bug.cgi?id=194927
2519
2520         Reviewed by Darin Adler.
2521
2522         This should fix rdar://problem/47580502
2523
2524         * NetworkProcess/NetworkDataTask.h:
2525         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2526         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
2527
2528 2019-03-01  Alex Christensen  <achristensen@webkit.org>
2529
2530         Revert r241223, r241235, and r241287
2531         https://bugs.webkit.org/show_bug.cgi?id=194427
2532         <rdar://48045861>
2533
2534         This caused crashes, and feature design has evolved away from needing the daemon in this form.
2535
2536         * NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm:
2537         (WebKit::DaemonMain):
2538         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
2539         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
2540         (WebKit::XPCServiceEventHandler):
2541         (WebKit::XPCServiceMain):
2542         (WebKit::XPCEventHandler): Deleted.
2543         (WebKit::XPCInitializationHandler): Deleted.
2544         * UIProcess/API/APIProcessPoolConfiguration.h:
2545         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2546         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2547         (-[_WKProcessPoolConfiguration usesNetworkingDaemon]): Deleted.
2548         (-[_WKProcessPoolConfiguration setUsesNetworkingDaemon:]): Deleted.
2549         * UIProcess/AuxiliaryProcessProxy.cpp:
2550         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
2551         * UIProcess/Launcher/ProcessLauncher.h:
2552         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2553         (WebKit::serviceName):
2554         (WebKit::ProcessLauncher::launchProcess):
2555         * UIProcess/Network/NetworkProcessProxy.cpp:
2556         (WebKit::NetworkProcessProxy::getLaunchOptions):
2557         * UIProcess/WebProcessPool.cpp:
2558         (WebKit::WebProcessPool::usesNetworkingDaemon const): Deleted.
2559         * UIProcess/WebProcessPool.h:
2560
2561 2019-03-01  Alex Christensen  <achristensen@webkit.org>
2562
2563         Add setters on WKWebsiteDataStore for sourceApplicationBundleIdentifier and sourceApplicationSecondaryIdentifier
2564         https://bugs.webkit.org/show_bug.cgi?id=195229
2565         <rdar://problem/48520362>
2566
2567         Reviewed by Chris Dumez.
2568
2569         Just like _setBoundInterfaceIdentifier, we need a way to set these properties after instantiation of a WKWebsiteDataStore,
2570         but we need to make sure we don't set it after the parameters have been copied to the NetworkProcess.
2571
2572         Functionality verified by manual testing.  See radar.
2573         Added an API test that verifies the setter restrictions work as expected.
2574
2575         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2576         (-[WKWebsiteDataStore _sourceApplicationBundleIdentifier]):
2577         (-[WKWebsiteDataStore _setSourceApplicationBundleIdentifier:]):
2578         (-[WKWebsiteDataStore _sourceApplicationSecondaryIdentifier]):
2579         (-[WKWebsiteDataStore _setSourceApplicationSecondaryIdentifier:]):
2580         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2581         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2582         (WebKit::toPKPaymentRequest):
2583         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2584         (WebKit::WebsiteDataStore::parameters):
2585         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2586         (WebKit::WebsiteDataStore::WebsiteDataStore):
2587         (WebKit::WebsiteDataStore::setSourceApplicationSecondaryIdentifier):
2588         (WebKit::WebsiteDataStore::setSourceApplicationBundleIdentifier):
2589         * UIProcess/WebsiteData/WebsiteDataStore.h:
2590         (WebKit::WebsiteDataStore::sourceApplicationBundleIdentifier):
2591         (WebKit::WebsiteDataStore::sourceApplicationSecondaryIdentifier):
2592
2593 2019-03-01  Antoine Quint  <graouts@apple.com>
2594
2595         [iOS] Turn mouse event simulation on by default
2596         https://bugs.webkit.org/show_bug.cgi?id=195218
2597         <rdar://problem/48516794>
2598
2599         Reviewed by Dean Jackson.
2600
2601         * Shared/WebPreferences.yaml:
2602
2603 2019-03-01  Ross Kirsling  <ross.kirsling@sony.com>
2604
2605         EnvironmentUtilities::stripValuesEndingWithString isn't thread-safe
2606         https://bugs.webkit.org/show_bug.cgi?id=194612
2607
2608         Reviewed by Alex Christensen.
2609
2610         This API test really shouldn't be verifying that the actual environment was successfully modified.
2611
2612         At its core, stripValuesEndingWithString is really just split-filter-join. By replacing it with a pair of
2613         simple functions -- one for string processing, one for environment processing -- the API test only needs to
2614         worry about the former.
2615
2616         * Platform/unix/EnvironmentUtilities.cpp:
2617         (WebKit::EnvironmentUtilities::stripEntriesEndingWith):
2618         (WebKit::EnvironmentUtilities::removeValuesEndingWith):
2619         (WebKit::EnvironmentUtilities::stripValuesEndingWithString): Deleted.
2620         * Platform/unix/EnvironmentUtilities.h:
2621         Replace old function with a pair of simpler ones.
2622
2623         * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkServiceEntryPoint.mm:
2624         (NetworkServiceInitializer):
2625         * PluginProcess/EntryPoint/Cocoa/XPCService/PluginServiceEntryPoint.mm:
2626         (PluginServiceInitializer):
2627         * WebProcess/EntryPoint/Cocoa/XPCService/WebContentServiceEntryPoint.mm:
2628         (WebContentServiceInitializer):
2629         Update function name.
2630
2631 2019-03-01  Don Olmstead  <don.olmstead@sony.com>
2632
2633         Unify WebsiteDataStore::defaultDataStoreConfiguration across ports
2634         https://bugs.webkit.org/show_bug.cgi?id=194844
2635
2636         Reviewed by Youenn Fablet.
2637
2638         Move the Cocoa implementation into APIWebsiteDataStore.cpp as the source of truth and
2639         append configuration for Glib's DeviceIdHashSalts storage directory. This also fixes
2640         a crash in Windows when running a Service Worker.
2641
2642         * UIProcess/API/APIWebsiteDataStore.cpp:
2643         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
2644         (API::WebsiteDataStore::defaultDataStoreConfiguration):
2645         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
2646         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory): Deleted.
2647         (API::WebsiteDataStore::defaultDataStoreConfiguration): Deleted.
2648         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
2649         (API::WebsiteDataStore::defaultDataStoreConfiguration): Deleted.
2650         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp:
2651         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory): Deleted.
2652         (API::WebsiteDataStore::defaultDataStoreConfiguration): Deleted.
2653
2654 2019-03-01  John Wilander  <wilander@apple.com>
2655
2656         Resource Load Statistics: Further restrict client-side cookie persistence after cross-site navigations with link decoration
2657         https://bugs.webkit.org/show_bug.cgi?id=195196
2658         <rdar://problem/48006419>
2659
2660         Reviewed by Brent Fulgham.
2661
2662         Trackers abuse link query parameters to transport user identifiers cross-site.
2663         This patch detects such navigations and applies further restrictions to
2664         client-site cookies on the destination page.
2665
2666         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2667         (WebKit::NetworkConnectionToWebProcess::clearPageSpecificDataForResourceLoadStatistics):
2668         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage): Deleted.
2669             Renamed NetworkConnectionToWebProcess::clearPageSpecificDataForResourceLoadStatistics().
2670         * NetworkProcess/NetworkConnectionToWebProcess.h:
2671         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2672         * NetworkProcess/NetworkProcess.cpp:
2673         (WebKit::NetworkProcess::committedCrossSiteLoadWithLinkDecoration):
2674             Reporting IPC message when a link decorated cross-site navigation happens.
2675         (WebKit::NetworkProcess::resetCrossSiteLoadsWithLinkDecorationForTesting):
2676         * NetworkProcess/NetworkProcess.h:
2677         * NetworkProcess/NetworkProcess.messages.in:
2678         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2679         (WKWebsiteDataStoreStatisticsResetToConsistentState):
2680             Added clearing of the new state between test runs.
2681         * UIProcess/Network/NetworkProcessProxy.cpp:
2682         (WebKit::NetworkProcessProxy::resetCrossSiteLoadsWithLinkDecorationForTesting):
2683             Test infrastructure.
2684         * UIProcess/Network/NetworkProcessProxy.h:
2685         * UIProcess/WebPageProxy.cpp:
2686         (WebKit::isNonUniqueNavigationWithLinkDecoration):
2687             Convenience function.
2688         (WebKit::WebPageProxy::didCommitLoadForFrame):
2689             This function now reports to the network process when a link decorated
2690             cross-site navigation happens.
2691         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2692         (WebKit::WebsiteDataStore::resetCrossSiteLoadsWithLinkDecorationForTesting):
2693             Test infrastructure.
2694         * UIProcess/WebsiteData/WebsiteDataStore.h:
2695         * WebProcess/WebPage/WebPage.cpp:
2696         (WebKit::WebPage::close):
2697             Name change of function called.
2698
2699 2019-03-01  Tim Horton  <timothy_horton@apple.com>
2700
2701         Remove unused code in WebKitLegacy
2702         https://bugs.webkit.org/show_bug.cgi?id=189614
2703
2704         Reviewed by Simon Fraser.
2705
2706         * mac/MigrateHeadersFromWebKitLegacy.make:
2707
2708 2019-03-01  Tim Horton  <timothy_horton@apple.com>
2709
2710         Modernize WebKit::AttributedString a little bit
2711         https://bugs.webkit.org/show_bug.cgi?id=195200
2712
2713         Reviewed by Wenson Hsieh.
2714
2715         * Shared/mac/AttributedString.h:
2716         (WebKit::AttributedString::AttributedString):
2717         (WebKit::AttributedString::operator NSAttributedString * const):
2718         * Shared/mac/AttributedString.mm:
2719         (IPC::ArgumentCoder<WebKit::AttributedString>::encode):
2720         (IPC::ArgumentCoder<WebKit::AttributedString>::decode):
2721         (WebKit::AttributedString::encode const): Deleted.
2722         (WebKit::AttributedString::decode): Deleted.
2723         * UIProcess/Cocoa/WebViewImpl.mm:
2724         (WebKit::WebViewImpl::attributedSubstringForProposedRange):
2725         * WebProcess/WebPage/mac/WebPageMac.mm:
2726         (WebKit::WebPage::attributedSubstringForCharacterRangeAsync):
2727         Modern coders, and a constructor and cast operator to/from NSAttributedString.
2728         Also adopt those in a few places just for fun.
2729
2730 2019-03-01  Youenn Fablet  <youenn@apple.com>
2731
2732         Serialize IndexedDB::ObjectStoreOverwriteMode as an enum
2733         https://bugs.webkit.org/show_bug.cgi?id=195213
2734
2735         Reviewed by Alex Christensen.
2736
2737         Make use of enum trait to automatically check for correct enum value when receiving a putOrAdd message.
2738
2739         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
2740         (WebKit::WebIDBConnectionToClient::putOrAdd):
2741         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
2742         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.messages.in:
2743         * Scripts/webkit/messages.py:
2744         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
2745         (WebKit::WebIDBConnectionToServer::putOrAdd):
2746
2747 2019-03-01  Don Olmstead  <don.olmstead@sony.com>
2748
2749         [WinCairo] Enable service worker
2750         https://bugs.webkit.org/show_bug.cgi?id=188318
2751
2752         Reviewed by Youenn Fablet.
2753
2754         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2755         (WebKit::WebSWContextManagerConnection::terminateProcess):
2756         * WebProcess/Storage/WebSWContextManagerConnection.h:
2757         * config.h:
2758
2759 2019-03-01  Chris Dumez  <cdumez@apple.com>
2760
2761         Flaky API Test TestWebKitAPI.ProcessSwap.LoadUnload
2762         https://bugs.webkit.org/show_bug.cgi?id=195110
2763
2764         Reviewed by Ryosuke Niwa.
2765
2766         The test was attempting to disable PageCache via view preferences instead of using the
2767         process pool configuration flag. This would fail to disable PageCache because the
2768         usesPageCache preference would not prevent the creation of SuspendedPageProxy objects.
2769         As a result, the firing on the unload event would get delayed until the SuspendedPageProxy
2770         objects would get destroyed, which would lead to flakiness.
2771
2772         This patch updates WebPageProxy::suspendCurrentPageIfPossible() to not create suspended
2773         pages proxies when the usesPageCache preference is set to false.
2774
2775         * UIProcess/WebPageProxy.cpp:
2776         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
2777
2778 2019-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
2779
2780         [ThreadedCompositor] Simply the compositing run loop worker thread
2781         https://bugs.webkit.org/show_bug.cgi?id=195208
2782
2783         Reviewed by Don Olmstead.
2784
2785         We can remove the WorkQueuePool, since we never really supported more than one thread, and now that single
2786         process model non longer exists it doesn't even make sense. We can simply use a RunLoop instead of a WorkQueue
2787         so that the implementation is not specific to the generic WorkQueue implementation.
2788
2789         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2790         (WebKit::createRunLoop): Helper function to create the RunLoop in a worker thread before m_updateTimer is initialized.
2791         (WebKit::CompositingRunLoop::CompositingRunLoop): Use createRunLoop().
2792         (WebKit::CompositingRunLoop::~CompositingRunLoop): Stop the worker thread run loop in the next main run loop iteration.
2793         (WebKit::CompositingRunLoop::performTask): Use m_runLoop.
2794         (WebKit::CompositingRunLoop::performTaskSync): Ditto.
2795         (WebKit::WorkQueuePool::singleton): Deleted.
2796         (WebKit::WorkQueuePool::dispatch): Deleted.
2797         (WebKit::WorkQueuePool::runLoop): Deleted.
2798         (WebKit::WorkQueuePool::invalidate): Deleted.
2799         (WebKit::WorkQueuePool::WorkQueuePool): Deleted.
2800         (WebKit::WorkQueuePool::getOrCreateWorkQueueForContext): Deleted.
2801         (): Deleted.
2802         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
2803
2804 2019-03-01  Justin Fan  <justin_fan@apple.com>
2805
2806         [Web GPU] 32-bit builds broken by attempt to disable WebGPU on 32-bit
2807         https://bugs.webkit.org/show_bug.cgi?id=195191
2808
2809         Rubber-stamped by Dean Jackson.
2810
2811         Dropping support for 32-bit entirely, so I'm intentionally leaving 32-bit broken.
2812
2813         * Configurations/FeatureDefines.xcconfig:
2814
2815 2019-02-28  Chris Dumez  <cdumez@apple.com>
2816
2817         HTTPSUpgradeList.db database should be opened in readonly mode
2818         https://bugs.webkit.org/show_bug.cgi?id=195194
2819         <rdar://problem/47103889>
2820
2821         Reviewed by Youenn Fablet.
2822
2823         HTTPSUpgradeList.db database should be opened in readonly mode since it is not meant to be
2824         modified by WebKit. Opening it in ReadWrite mode causes sandbox violations.
2825
2826         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
2827         (WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker):
2828
2829 2019-02-28  David Quesada  <david_quesada@apple.com>
2830
2831         Expose APINavigationAction.shouldPerformDownload() on WKNavigationAction
2832         https://bugs.webkit.org/show_bug.cgi?id=195121
2833         rdar://problem/48450302
2834
2835         Reviewed by Alex Christensen.
2836
2837         * UIProcess/API/Cocoa/WKNavigationAction.mm:
2838         (-[WKNavigationAction _shouldPerformDownload]):
2839         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
2840
2841 2019-02-28  Antoine Quint  <graouts@apple.com>
2842
2843         Disable Web Animations in Safari Technology Preview
2844         https://bugs.webkit.org/show_bug.cgi?id=194748
2845         <rdar://problem/48139481>
2846
2847         Reviewed by Dean Jackson.
2848
2849         The test runners already opt into that feature explicitly, so all that is needed is to turn
2850         the default setting value to false.
2851
2852         * Shared/WebPreferences.yaml:
2853
2854 2019-02-28  Antoine Quint  <graouts@apple.com>
2855
2856         Enable the Pointer Events runtime flag by default
2857         https://bugs.webkit.org/show_bug.cgi?id=195156
2858
2859         Reviewed by Dean Jackson.
2860
2861         * Shared/WebPreferences.yaml:
2862
2863 2019-02-28  Sihui Liu  <sihui_liu@apple.com>
2864
2865         Revert r232263: it caused processes to crash because process was suspended with locked file
2866         https://bugs.webkit.org/show_bug.cgi?id=195122
2867         <rdar://problem/48444599>
2868
2869         Reviewed by Geoffrey Garen.
2870
2871         * NetworkProcess/NetworkProcess.cpp:
2872         (WebKit::NetworkProcess::NetworkProcess):
2873         * NetworkProcess/NetworkProcess.h:
2874         * Shared/WebSQLiteDatabaseTracker.cpp:
2875         (WebKit::WebSQLiteDatabaseTracker::WebSQLiteDatabaseTracker):
2876         (WebKit::WebSQLiteDatabaseTracker::hysteresisUpdated):
2877         * Shared/WebSQLiteDatabaseTracker.h:
2878         * WebProcess/WebProcess.cpp:
2879         (WebKit::m_webSQLiteDatabaseTracker):
2880         (WebKit::m_nonVisibleProcessCleanupTimer): Deleted.
2881         * WebProcess/WebProcess.h:
2882
2883 2019-02-28  Per Arne Vollan  <pvollan@apple.com>
2884
2885         [iOS] Move calls to [UIKeyboard isInHardwareKeyboardMode] to the UI process.
2886         https://bugs.webkit.org/show_bug.cgi?id=193683
2887         <rdar://problem/47634345>
2888
2889         Reviewed by Brent Fulgham.
2890
2891         When a keyboard is attached/deattached or the application becomes foreground, send a message from
2892         the UI process to the WebContent process, notifying whether a keyboard is attached or not. Also,
2893         cache the value of [UIKeyboard isInHardwareKeyboardMode] in the UI process, since this call seems
2894         to be expensive.
2895
2896         * UIProcess/API/Cocoa/WKWebView.mm:
2897         (hardwareKeyboardAvailabilityChangedCallback):
2898         * UIProcess/WebPageProxy.h:
2899         * UIProcess/WebProcessProxy.h:
2900         (WebKit::WebProcessProxy::setKeyboardIsAttached):
2901         (WebKit::WebProcessProxy::keyboardIsAttached const):
2902         * UIProcess/ios/WKContentViewInteraction.mm:
2903         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2904         * UIProcess/ios/WebPageProxyIOS.mm:
2905         (WebKit::WebPageProxy::applicationWillEnterForeground):
2906         (WebKit::WebPageProxy::hardwareKeyboardAvailabilityChanged):
2907         * WebProcess/WebPage/WebPage.h:
2908         * WebProcess/WebPage/WebPage.messages.in:
2909         * WebProcess/WebPage/ios/WebPageIOS.mm:
2910         (WebKit::WebPage::platformEditorState const):
2911         (WebKit::WebPage::hardwareKeyboardAvailabilityChanged):
2912
2913 2019-02-28  Carlos Garcia Campos  <cgarcia@igalia.com>
2914
2915         [CoordinatedGraphics] Remove COORDINATED_GRAPHICS_THREADED option
2916         https://bugs.webkit.org/show_bug.cgi?id=195159
2917
2918         Reviewed by Don Olmstead.
2919
2920         Use COORDINATED_GRAPHICS instead.
2921
2922         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2923         (WebKit::CoordinatedGraphicsScene::onNewBufferAvailable):
2924         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
2925         * Shared/CoordinatedGraphics/SimpleViewportController.cpp:
2926         * Shared/CoordinatedGraphics/SimpleViewportController.h:
2927         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2928         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
2929         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2930         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2931         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
2932         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h:
2933         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2934         (WebKit::AcceleratedDrawingArea::mainFrameContentSizeChanged):
2935         (WebKit::AcceleratedDrawingArea::enterAcceleratedCompositingMode):
2936         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
2937         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
2938         * WebProcess/WebPage/DrawingAreaImpl.cpp:
2939         (WebKit::DrawingAreaImpl::updatePreferences):
2940         * WebProcess/WebPage/WebPage.cpp:
2941         (WebKit::WebPage::sendViewportAttributesChanged):
2942         (WebKit::WebPage::viewportPropertiesDidChange):
2943         * WebProcess/gtk/WebProcessMainGtk.cpp:
2944
2945 2019-02-28  Sihui Liu  <sihui_liu@apple.com>
2946
2947         Stop using legacy IDB path by default when creating WebProcessPool from websiteDataStore
2948         https://bugs.webkit.org/show_bug.cgi?id=194958
2949
2950         Reviewed by Geoffrey Garen.
2951
2952         ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration should not use fixed IDB path.
2953
2954         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2955         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
2956         * UIProcess/API/APIWebsiteDataStore.cpp:
2957         (API::WebsiteDataStore::createLegacy):
2958         (API::indexedDBDatabaseDirectory):
2959         * UIProcess/API/APIWebsiteDataStore.h:
2960         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2961         (-[WKWebsiteDataStore _indexedDBDatabaseDirectory]):
2962         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2963         * UIProcess/WebProcessPool.cpp:
2964         (WebKit::legacyWebsiteDataStoreConfiguration):
2965
2966 2019-02-28  Carlos Garcia Campos  <cgarcia@igalia.com>
2967
2968         [CoordinatedGraphics] Unify all LayerTreeHost classes
2969         https://bugs.webkit.org/show_bug.cgi?id=195094
2970
2971         Reviewed by Žan Doberšek.
2972
2973         There's no reason to have 3 classes, since currently LayerTreeHost is only used by coordinated graphics based
2974         ports.
2975
2976         * PlatformWin.cmake:
2977         * SourcesGTK.txt:
2978         * SourcesWPE.txt:
2979         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2980         (WebKit::AcceleratedDrawingArea::enterAcceleratedCompositingMode):
2981         (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeNow):
2982         * WebProcess/WebPage/AcceleratedDrawingArea.h:
2983         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp: Removed.
2984         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h: Removed.
2985         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp.
2986         (WebKit::LayerTreeHost::LayerTreeHost):
2987         (WebKit::LayerTreeHost::~LayerTreeHost):
2988         (WebKit::LayerTreeHost::setLayerFlushSchedulingEnabled):
2989         (WebKit::LayerTreeHost::scheduleLayerFlush):
2990         (WebKit::LayerTreeHost::cancelPendingLayerFlush):
2991         (WebKit::LayerTreeHost::layerFlushTimerFired):
2992         (WebKit::LayerTreeHost::setRootCompositingLayer):
2993         (WebKit::LayerTreeHost::setViewOverlayRootLayer):
2994         (WebKit::LayerTreeHost::invalidate):
2995         (WebKit::LayerTreeHost::scrollNonCompositedContents):
2996         (WebKit::LayerTreeHost::forceRepaint):
2997         (WebKit::LayerTreeHost::forceRepaintAsync):
2998         (WebKit::LayerTreeHost::sizeDidChange):
2999         (WebKit::LayerTreeHost::pauseRendering):
3000         (WebKit::LayerTreeHost::resumeRendering):
3001         (WebKit::LayerTreeHost::graphicsLayerFactory):
3002         (WebKit::LayerTreeHost::contentsSizeChanged):
3003         (WebKit::LayerTreeHost::didChangeViewportAttributes):
3004         (WebKit::LayerTreeHost::didChangeViewport):
3005         (WebKit::LayerTreeHost::setIsDiscardable):
3006         (WebKit::LayerTreeHost::setNativeSurfaceHandleForCompositing):
3007         (WebKit::LayerTreeHost::deviceOrPageScaleFactorChanged):
3008         (WebKit::LayerTreeHost::createDisplayRefreshMonitor):
3009         (WebKit::LayerTreeHost::didFlushRootLayer):
3010         (WebKit::LayerTreeHost::commitSceneState):
3011         (WebKit::LayerTreeHost::frameComplete):
3012         (WebKit::LayerTreeHost::nativeSurfaceHandleForCompositing):
3013         (WebKit::LayerTreeHost::didDestroyGLContext):
3014         (WebKit::LayerTreeHost::willRenderFrame):
3015         (WebKit::LayerTreeHost::didRenderFrame):
3016         (WebKit::LayerTreeHost::requestDisplayRefreshMonitorUpdate):
3017         (WebKit::LayerTreeHost::handleDisplayRefreshMonitorUpdate):
3018         (WebKit::LayerTreeHost::renderNextFrame):
3019         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h.
3020         * WebProcess/WebPage/DrawingAreaImpl.cpp:
3021         (WebKit::DrawingAreaImpl::setNeedsDisplay):
3022         (WebKit::DrawingAreaImpl::setNeedsDisplayInRect):
3023         * WebProcess/WebPage/LayerTreeHost.cpp: Removed.
3024         * WebProcess/WebPage/LayerTreeHost.h: Removed.
3025         * WebPage/win/LayerTreeHost.h: Added.
3026
3027 2019-02-28  Justin Fan  <justin_fan@apple.com>
3028
3029         [Web GPU] Enable Web GPU only on 64-bit
3030         https://bugs.webkit.org/show_bug.cgi?id=195139
3031
3032         Because Metal is only supported on 64 bit apps.
3033
3034         Unreviewed build fix.
3035
3036         * Configurations/FeatureDefines.xcconfig:
3037
3038 2019-02-27  Simon Fraser  <simon.fraser@apple.com>
3039
3040         Roll out r242014; it caused crashes in compositing logging (webkit.org/b/195141)
3041
3042         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
3043         (WebKit::LocalAuthenticator::getAssertion):
3044
3045 2019-02-27  Michael Catanzaro  <mcatanzaro@igalia.com>
3046
3047         Unreviewed, fix -Wformat warning
3048
3049         * WebProcess/WebPage/WebPage.cpp:
3050         (WebKit::WebPage::didCompletePageTransition):
3051
3052 2019-02-27  Brent Fulgham  <bfulgham@apple.com>
3053
3054         REGRESSION: Crash beneath ResourceLoadObserver::logSubresourceLoading
3055         https://bugs.webkit.org/show_bug.cgi?id=195072
3056
3057         Reviewed by Ryosuke Niwa.
3058
3059         ResourceLoadObserver and WebProcess should exist as long as the web page (process) is running. However,
3060         the NetworkProcess connection can close for a variety of reasons. If the ResourceLoadObserver observes
3061         a load or user gesture in the WebProcess, we should attempt to reconnect to the NetworkProcess (if it
3062         was disconnected), just like we do for other message send cases.
3063
3064         This patch switches from using the m_networkProcessConnection member (which might be null) to use the
3065         'ensureNetworkProcessConnection' accessor which ensures we have a valid connection for message sends.
3066
3067         * WebProcess/WebProcess.cpp:
3068         (WebKit::WebProcess::initializeWebProcess):
3069
3070 2019-02-27  Chris Dumez  <cdumez@apple.com>
3071
3072         Flaky API Test: TestWebKitAPI.ProcessSwap.SessionStorage
3073         https://bugs.webkit.org/show_bug.cgi?id=194480
3074
3075         Reviewed by Brady Eidson.
3076
3077         The StorageManager would only start listening for IPC on a given connection when
3078         StorageManager::processWillOpenConnection() is called. This gets called from
3079         WebsiteDataStore::webProcessWillOpenConnection() which gets called from
3080         WebProcessLifetimeTracker::webPageEnteringWebProcess().
3081
3082         webPageEnteringWebProcess() was called in WebPageProxy::finishAttachingToWebProcess()
3083         after process-swapping. This means that IPC comming from the *provisional* process
3084         would not get processed and we would only start processing IPC on the provisional
3085         process's connection when it would get committed.
3086
3087         To address the issue, this patch teaches WebProcessLifetimeTracker that a page can
3088         now have several processes. We also make sure that webPageEnteringWebProcess() gets
3089         called for the provisional process as soon as we create the provisional page, instead
3090         of waiting for it to get committed.
3091
3092         * UIProcess/ProvisionalPageProxy.cpp:
3093         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
3094         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
3095         (WebKit::ProvisionalPageProxy::connectionWillOpen):
3096         * UIProcess/ProvisionalPageProxy.h:
3097         * UIProcess/WebPageProxy.cpp:
3098         (WebKit::WebPageProxy::finishAttachingToWebProcess):
3099         (WebKit::WebPageProxy::connectionWillOpen):
3100         (WebKit::WebPageProxy::webProcessWillShutDown):
3101         (WebKit::WebPageProxy::processDidTerminate):
3102         * UIProcess/WebPageProxy.h:
3103         (WebKit::WebPageProxy::webProcessLifetimeTracker):
3104         * UIProcess/WebProcessLifetimeObserver.cpp:
3105         (WebKit::WebProcessLifetimeObserver::addWebPage):
3106         (WebKit::WebProcessLifetimeObserver::removeWebPage):
3107         * UIProcess/WebProcessLifetimeObserver.h:
3108         * UIProcess/WebProcessLifetimeTracker.cpp:
3109         (WebKit::WebProcessLifetimeTracker::addObserver):
3110         (WebKit::WebProcessLifetimeTracker::webPageEnteringWebProcess):
3111         (WebKit::WebProcessLifetimeTracker::webPageLeavingWebProcess):
3112         (WebKit::WebProcessLifetimeTracker::pageWasInvalidated):
3113         (WebKit::WebProcessLifetimeTracker::processIsRunning):
3114         * UIProcess/WebProcessLifetimeTracker.h:
3115         * UIProcess/WebProcessProxy.cpp:
3116         (WebKit::WebProcessProxy::connectionWillOpen):
3117         * UIProcess/WebStorage/StorageManager.cpp:
3118         (WebKit::StorageManager::SessionStorageNamespace::allowedConnections const):
3119         (WebKit::StorageManager::SessionStorageNamespace::addAllowedConnection):
3120         (WebKit::StorageManager::SessionStorageNamespace::removeAllowedConnection):
3121         (WebKit::StorageManager::addAllowedSessionStorageNamespaceConnection):
3122         (WebKit::StorageManager::removeAllowedSessionStorageNamespaceConnection):
3123         (WebKit::StorageManager::processWillOpenConnection):
3124         (WebKit::StorageManager::processDidCloseConnection):
3125         (WebKit::StorageManager::createSessionStorageMap):
3126         (WebKit::StorageManager::SessionStorageNamespace::allowedConnection const): Deleted.
3127         (WebKit::StorageManager::SessionStorageNamespace::setAllowedConnection): Deleted.
3128         (WebKit::StorageManager::setAllowedSessionStorageNamespaceConnection): Deleted.
3129         * UIProcess/WebStorage/StorageManager.h:
3130         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3131         (WebKit::WebsiteDataStore::webPageWillOpenConnection):
3132         (WebKit::WebsiteDataStore::webPageDidCloseConnection):
3133
3134 2019-02-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3135
3136         [iOS] Web pages shouldn't be able to present a keyboard after the web view resigns first responder
3137         https://bugs.webkit.org/show_bug.cgi?id=195118
3138         <rdar://problem/43411940>
3139
3140         Reviewed by Tim Horton.
3141
3142         It's currently possible for websites to redirect focus into an editable element on the page by programmatically
3143         requesting focus within the "blur" event handler. This is because our current heuristics:
3144
3145         (1) Allow programmatic focus to show the keyboard when an element is already focused; this is meant to handle
3146             the case where the page moves focus between different elements on the page.
3147         (2) And also allow programmatic focus to show the keyboard when changing activity state; this is meant to handle
3148             the case where a focused element should show the keyboard when first responder is restored on a web view
3149             (e.g. in the case where a modal view controller is dismissed, and the web view regains first responder once
3150             again).
3151
3152         In both of these scenarios, we actually only want the keyboard to appear if the web view itself is either
3153         becoming the first responder, or is already the first responder. Importantly, when blurring the focused element
3154         by calling -[WKWebViewe resignFirstResponder] (as is the case when dismissing the keyboard by tapping 'Done' or
3155         focusing other platform UI), we don't want to allow the page to show the keyboard due to element focus.
3156
3157         To fix this issue, we enforce that we're either becoming the first responder or already are the first responder
3158         before showing the keyboard due to activity state change or focused element change.
3159
3160         Test: fast/events/ios/do-not-show-keyboard-when-focusing-after-blur.html
3161
3162         * UIProcess/ios/WKContentViewInteraction.h:
3163         * UIProcess/ios/WKContentViewInteraction.mm:
3164         (-[WKContentView setupInteraction]):
3165         (-[WKContentView textInputTraits]):
3166
3167         Quick drive-by tweak: rename _isBlurringFocusedNode to _isBlurringFocusedElement, to match the rest of the
3168         terminology used in WebKit.
3169
3170         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3171
3172         Make our heuristics for determining whether to show the keyboard a tiny bit easier to follow, by moving the
3173         logic into a lambda function and using early returns. See above for more details.
3174
3175         (-[WKContentView _elementDidBlur]):
3176         (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
3177
3178 2019-02-27  John Wilander  <wilander@apple.com>
3179
3180         Adopt WebCore::RegistrableDomain in WebCore::ResourceLoadStatistics and WebKit::NetworkProcessProxy
3181         https://bugs.webkit.org/show_bug.cgi?id=195071
3182         <rdar://problem/48417690>
3183
3184         Reviewed by Alex Christensen and Brent Fulgham.
3185
3186         This patch adopts WebCore::RegistrableDomain in WebKit::NetworkProcessProxy
3187         and makes the necessary infrastructure changes to support that.
3188
3189         The previous HashCountedSets in WebCore::ResourceLoadStatistics are now just
3190         HashSets since we never used the counts for anything. This change simplified
3191         the IPC::ArgumentCoder<ResourceLoadStatistics> encode and decode functions.
3192
3193         The patch also makes WebCore::RegistrableDomain's String constructor private.
3194         A new create function WebCore::RegistrableDomain::uncheckedCreateFromString()
3195         is introduced to better signal to users that creating a registrable domain
3196         object with a string may create an object that doesn't match a registrable
3197         domain in a valid HTTP-family URL.
3198
3199         Finally, this patch harmonizes parameter and variable naming, going from
3200         "origin" to "domain" and "mainFrame" to "topFrame."
3201
3202         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3203         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
3204         (WebKit::ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain const):
3205         (WebKit::ResourceLoadStatisticsMemoryStore::markAsPrevalentIfHasRedirectedToPrevalent):
3206         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess):
3207         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
3208         (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
3209         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceLoading):
3210         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceRedirect):
3211         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsSubresourceUnder const):
3212         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsSubFrameUnder const):
3213         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsRedirectingTo const):
3214         (WebKit::ResourceLoadStatisticsMemoryStore::setSubframeUnderTopFrameDomain):
3215         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUnderTopFrameDomain):
3216         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectTo):
3217         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectFrom):
3218         (WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectTo):
3219         (WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectFrom):
3220         (WebKit::ResourceLoadStatisticsMemoryStore::createEncoderFromData const):
3221         (WebKit::ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt):
3222         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUnexpiredRecentUserInteraction const):
3223         (WebKit::ResourceLoadStatisticsMemoryStore::setSubframeUnderTopFrameOrigin): Deleted.
3224         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUnderTopFrameOrigin): Deleted.
3225         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
3226         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3227         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted):
3228         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameDomain):
3229         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameDomain):
3230         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
3231         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin): Deleted.
3232         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin): Deleted.
3233         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3234         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp:
3235         (WebKit::sortedPrevalentResourceTelemetry):
3236         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3237         * NetworkProcess/NetworkProcess.cpp:
3238         (WebKit::NetworkProcess::setSubframeUnderTopFrameDomain):
3239         (WebKit::NetworkProcess::setSubresourceUnderTopFrameDomain):
3240         (WebKit::filterForRegistrableDomains):
3241         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
3242         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
3243         (WebKit::NetworkProcess::setSubframeUnderTopFrameOrigin): Deleted.
3244         (WebKit::NetworkProcess::setSubresourceUnderTopFrameOrigin): Deleted.
3245         * NetworkProcess/NetworkProcess.h:
3246         * NetworkProcess/NetworkProcess.messages.in:
3247         * NetworkProcess/NetworkSession.cpp:
3248         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
3249         * NetworkProcess/NetworkSession.h:
3250         * Platform/classifier/ResourceLoadStatisticsClassifier.cpp:
3251         (WebKit::ResourceLoadStatisticsClassifier::calculateResourcePrevalence):
3252         * Shared/WebCoreArgumentCoders.cpp:
3253         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
3254         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
3255         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3256         (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin):
3257         (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin):
3258         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
3259         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
3260         * UIProcess/Network/NetworkProcessProxy.cpp:
3261         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
3262         (WebKit::NetworkProcessProxy::isPrevalentResource):
3263         (WebKit::NetworkProcessProxy::isVeryPrevalentResource):
3264         (WebKit::NetworkProcessProxy::setPrevalentResource):
3265         (WebKit::NetworkProcessProxy::setPrevalentResourceForDebugMode):
3266         (WebKit::NetworkProcessProxy::setVeryPrevalentResource):
3267         (WebKit::NetworkProcessProxy::setLastSeen):
3268         (WebKit::NetworkProcessProxy::clearPrevalentResource):
3269         (WebKit::NetworkProcessProxy::logUserInteraction):
3270         (WebKit::NetworkProcessProxy::hasHadUserInteraction):
3271         (WebKit::NetworkProcessProxy::clearUserInteraction):
3272         (WebKit::NetworkProcessProxy::setSubframeUnderTopFrameDomain):
3273         (WebKit::NetworkProcessProxy::isRegisteredAsRedirectingTo):
3274         (WebKit::NetworkProcessProxy::isRegisteredAsSubFrameUnder):
3275         (WebKit::NetworkProcessProxy::setSubresourceUnderTopFrameDomain):
3276         (WebKit::NetworkProcessProxy::isRegisteredAsSubresourceUnder):
3277         (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectTo):
3278         (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectFrom):
3279         (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectTo):
3280         (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectFrom):
3281         (WebKit::NetworkProcessProxy::isGrandfathered):
3282         (WebKit::NetworkProcessProxy::setGrandfathered):
3283         (WebKit::NetworkProcessProxy::hasStorageAccessForFrame):
3284         (WebKit::NetworkProcessProxy::hasStorageAccess):
3285         (WebKit::NetworkProcessProxy::requestStorageAccess):
3286         (WebKit::NetworkProcessProxy::requestStorageAccessConfirm):
3287         (WebKit::NetworkProcessProxy::grantStorageAccess):
3288         (WebKit::NetworkProcessProxy::setSubframeUnderTopFrameOrigin): Deleted.
3289         (WebKit::NetworkProcessProxy::setSubresourceUnderTopFrameOrigin): Deleted.
3290         * UIProcess/Network/NetworkProcessProxy.h:
3291         * UIProcess/Network/NetworkProcessProxy.messages.in:
3292         * UIProcess/WebPageProxy.cpp:
3293         (WebKit::WebPageProxy::requestStorageAccessConfirm):
3294         * UIProcess/WebPageProxy.h:
3295         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3296         (WebKit::WebsiteDataStore::isPrevalentResource):
3297         (WebKit::WebsiteDataStore::setPrevalentResource):
3298         (WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode):
3299         (WebKit::WebsiteDataStore::isVeryPrevalentResource):
3300         (WebKit::WebsiteDataStore::setVeryPrevalentResource):
3301         (WebKit::WebsiteDataStore::setSubframeUnderTopFrameDomain):
3302         (WebKit::WebsiteDataStore::isRegisteredAsSubFrameUnder):
3303         (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameDomain):
3304         (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder):
3305         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo):
3306         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom):
3307         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo):
3308         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom):
3309         (WebKit::WebsiteDataStore::isRegisteredAsRedirectingTo):
3310         (WebKit::WebsiteDataStore::clearPrevalentResource):
3311         (WebKit::WebsiteDataStore::setLastSeen):
3312         (WebKit::WebsiteDataStore::hasStorageAccess):
3313         (WebKit::WebsiteDataStore::requestStorageAccess):
3314         (WebKit::WebsiteDataStore::grantStorageAccess):
3315         (WebKit::WebsiteDataStore::logUserInteraction):
3316         (WebKit::WebsiteDataStore::hasHadUserInteraction):
3317         (WebKit::WebsiteDataStore::clearUserInteraction):
3318         (WebKit::WebsiteDataStore::setGrandfathered):
3319         (WebKit::WebsiteDataStore::setSubframeUnderTopFrameOrigin): Deleted.
3320         (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameOrigin): Deleted.
3321         * UIProcess/WebsiteData/WebsiteDataStore.h:
3322         * WebProcess/WebPage/WebPage.cpp:
3323         (WebKit::WebPage::hasStorageAccess):
3324         (WebKit::WebPage::requestStorageAccess):
3325
3326 2019-02-27  Keith Rollin  <krollin@apple.com>
3327
3328         Fix Xcode project UUIDs for TextCheckerCompletion.cpp and TextCheckerCompletion.h
3329         https://bugs.webkit.org/show_bug.cgi?id=195109
3330         <rdar://problem/48442272>
3331
3332         Reviewed by Alexey Proskuryakov.
3333
3334         In r144436, TextCheckerCompletion.cpp and TextCheckerCompletion.h were
3335         added to WebKit2.xcodeproj with invalid UUIDs (they included Q's and
3336         Z's in hexadecimal strings). While these UUIDs haven't caused any
3337         problems in practice over the last six years, they are indeed invalid,
3338         and were discovered via an Xcode-project processing tool that did not
3339         anticipate their format. Fix this by removing the files from the
3340         project and re-adding them.
3341
3342         * WebKit.xcodeproj/project.pbxproj:
3343
3344 2019-02-27  Youenn Fablet  <youenn@apple.com>
3345
3346         Remove UserMediaProcessManager processState map
3347         https://bugs.webkit.org/show_bug.cgi?id=195056
3348
3349         Reviewed by Eric Carlson.
3350
3351         Before the patch, the WebProcessProxy->ProcessState map was storing the list of manager proxies and process state.
3352         To improve on this model, this patch does the following:
3353         - Move the process state to WebProcessProxy.
3354         - Remove the map and replace it by a set of all manager proxies.
3355
3356         This simplifies the handling.
3357         On WebProcess side, instead of storing the sandbox extensions in each WebPage, we handle them in WebProcess directly.
3358         This mirrors what is being done in UIProcess and reduces the risk of inconsistencies between the two, the risk being that capture would fail.
3359
3360         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3361         (WebKit::UserMediaPermissionRequestManagerProxy::forEach):
3362         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy):
3363         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
3364         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged):
3365         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
3366         * UIProcess/UserMediaProcessManager.cpp:
3367         (WebKit::UserMediaProcessManager::muteCaptureMediaStreamsExceptIn):
3368         (WebKit::UserMediaProcessManager::willCreateMediaStream):
3369         (WebKit::UserMediaProcessManager::endedCaptureSession):
3370         (WebKit::UserMediaProcessManager::setCaptureEnabled):
3371         (WebKit::UserMediaProcessManager::captureDevicesChanged):
3372         (WebKit::ProcessState::ProcessState): Deleted.
3373         (WebKit::ProcessState::hasVideoExtension const): Deleted.
3374         (WebKit::ProcessState::grantVideoExtension): Deleted.
3375         (WebKit::ProcessState::revokeVideoExtension): Deleted.
3376         (WebKit::ProcessState::hasAudioExtension const): Deleted.
3377         (WebKit::ProcessState::grantAudioExtension): Deleted.
3378         (WebKit::ProcessState::revokeAudioExtension): Deleted.
3379         (WebKit::stateMap): Deleted.
3380         (WebKit::processState): Deleted.
3381         (WebKit::ProcessState::addRequestManager): Deleted.
3382         (WebKit::ProcessState::removeRequestManager): Deleted.
3383         (WebKit::UserMediaProcessManager::addUserMediaPermissionRequestManagerProxy): Deleted.
3384         (WebKit::UserMediaProcessManager::removeUserMediaPermissionRequestManagerProxy): Deleted.
3385         (WebKit::UserMediaProcessManager::startedCaptureSession): Deleted.
3386         * UIProcess/UserMediaProcessManager.h:
3387         * UIProcess/WebProcessProxy.h:
3388         (WebKit::WebProcessProxy::mediaCaptureSandboxExtensions const):
3389         (WebKit::WebProcessProxy::hasVideoCaptureExtension const):
3390         (WebKit::WebProcessProxy::grantVideoCaptureExtension):
3391         (WebKit::WebProcessProxy::revokeVideoCaptureExtension):
3392         (WebKit::WebProcessProxy::hasAudioCaptureExtension const):
3393         (WebKit::WebProcessProxy::grantAudioCaptureExtension):
3394         (WebKit::WebProcessProxy::revokeAudioCaptureExtension):
3395         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
3396         (WebKit::UserMediaPermissionRequestManager::~UserMediaPermissionRequestManager): Deleted.
3397         (WebKit::UserMediaPermissionRequestManager::clear): Deleted.
3398         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Deleted.
3399         (WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): Deleted.
3400         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
3401         * WebProcess/WebPage/WebPage.cpp:
3402         (WebKit::WebPage::close):
3403         (WebKit::WebPage::grantUserMediaDeviceSandboxExtensions): Deleted.
3404         (WebKit::WebPage::revokeUserMediaDeviceSandboxExtensions): Deleted.
3405         * WebProcess/WebPage/WebPage.h:
3406         * WebProcess/WebPage/WebPage.messages.in:
3407         * WebProcess/WebProcess.cpp:
3408         (WebKit::WebProcess::grantUserMediaDeviceSandboxExtensions):
3409         (WebKit::WebProcess::revokeUserMediaDeviceSandboxExtensions):
3410         * WebProcess/WebProcess.h:
3411         * WebProcess/WebProcess.messages.in:
3412
3413 2019-02-27  Per Arne Vollan  <pvollan@apple.com>
3414
3415         [macOS] Disable permissive call logging in sandbox
3416         https://bugs.webkit.org/show_bug.cgi?id=194061
3417         <rdar://problem/47686253>
3418
3419         Reviewed by Brent Fulgham.
3420
3421         Strict call filtering should be reenabled.
3422
3423         * WebProcess/com.apple.WebProcess.sb.in:
3424
3425 2019-02-27  Chris Dumez  <cdumez@apple.com>
3426
3427         [HTTPSUpgrade] Use open source database until the feature is ready
3428         https://bugs.webkit.org/show_bug.cgi?id=195069
3429         <rdar://problem/47838224>
3430
3431         Reviewed by Geoffrey Garen.
3432
3433         * DerivedSources-input.xcfilelist:
3434         * DerivedSources.make:
3435
3436 2019-02-27  Antoine Quint  <graouts@apple.com>
3437
3438         Support Pointer Events on macOS
3439         https://bugs.webkit.org/show_bug.cgi?id=195008
3440         <rdar://problem/47454419>
3441
3442         Reviewed by Dean Jackson.
3443
3444         * Configurations/FeatureDefines.xcconfig:
3445
3446 2019-02-27  Sihui Liu  <sihui_liu@apple.com>
3447
3448         Network Process is put to suspended when holding locked IndexedDB files
3449         https://bugs.webkit.org/show_bug.cgi?id=195024
3450         <rdar://problem/45194169>
3451
3452         Reviewed by Geoffrey Garen.
3453
3454         * NetworkProcess/NetworkProcess.cpp:
3455         (WebKit::NetworkProcess::idbServer):
3456         (WebKit::NetworkProcess::notifyHoldingLockedFiles):
3457         * NetworkProcess/NetworkProcess.h:
3458         * UIProcess/Network/NetworkProcessProxy.cpp:
3459         (WebKit::NetworkProcessProxy::didClose):
3460         (WebKit::NetworkProcessProxy::setIsIDBDatabaseHoldingLockedFiles):
3461         * UIProcess/Network/NetworkProcessProxy.h:
3462         * UIProcess/Network/NetworkProcessProxy.messages.in:
3463
3464 2019-02-26  Simon Fraser  <simon.fraser@apple.com>
3465
3466         Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
3467         https://bugs.webkit.org/show_bug.cgi?id=194973
3468
3469         Reviewed by Antti Koivisto.
3470
3471         This patch cleans up how the scrolling tree responds to scrolls.
3472
3473         First, ScrollingTreeScrollingNode::m_currentScrollPosition is "truth" for scrolling thread/
3474         UI process scroll position.
3475
3476         On macOS where handleWheelEvent on the scrolling thread changes scroll position, the
3477         bottleneck is ScrollingTreeScrollingNode::scrollTo() which sets the new scroll position,
3478         update the visual viewport (for frame scrolls) updates the scrolledContentsLayer position,
3479         updates related layers on this node (counter-scrolling layers etc), and then tells the
3480         scrolling tree, which recurses through descendant nodes so they can adjust their layer
3481         positions.
3482
3483         On iOS, the bottleneck is ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling(),
3484         which does the above other than setting scrolledContentsLayer (since we're reacting to
3485         layer state changes, not producing them).
3486
3487         updateLayersAfterAncestorChange() is renamed to relatedNodeScrollPositionDidChange(), and
3488         ScrollingTree does the tree walk so classes don't have to implement
3489         updateLayersAfterAncestorChange() just to talk children. The ScrollingTree tree walk knows
3490         how to get the correct layoutViewport and to stop at frame boundaries (layer updates never
3491         need to cross frame boundaries).
3492
3493         We preserve 'cumulativeDelta'; it's necessary for things like fixed inside overflow:scroll,
3494         since the fixed state was computed with the "layout" scroll position, so we have to account
3495         for the scroll delta since the last committed position. It's possible we could improve this
3496         in future.
3497
3498         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
3499         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
3500         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
3501         (WebKit::RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling):
3502         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
3503         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
3504         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
3505         (WebKit::RemoteScrollingTree::scrollingTreeNodeDidScroll):
3506         * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
3507         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
3508         (WebKit::RemoteScrollingCoordinatorProxy::currentLayoutViewport const):
3509         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h:
3510         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
3511         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
3512         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::repositionScrollingLayers):
3513         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::repositionRelatedLayers):
3514         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::scrollPosition const): Deleted.
3515         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::setScrollPosition): Deleted.
3516         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::setScrollLayerPosition): Deleted.
3517         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateChildNodesAfterScroll): Deleted.
3518         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterDelegatedScroll): Deleted.
3519         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterViewportChange): Deleted.
3520         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterAncestorChange): Deleted.
3521         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
3522         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
3523         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::repositionScrollingLayers):
3524         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterAncestorChange): Deleted.
3525         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollPosition const): Deleted.
3526         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::setScrollLayerPosition): Deleted.
3527         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterDelegatedScroll): Deleted.
3528         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
3529         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
3530         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::ScrollingTreeScrollingNodeDelegateIOS):
3531         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers):
3532         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll):
3533         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateLayersAfterAncestorChange): Deleted.
3534         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollPosition const): Deleted.
3535         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::setScrollLayerPosition): Deleted.
3536         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll): Deleted.
3537         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll const): Deleted.
3538         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm:
3539         (WebKit::ScrollerPairMac::updateValues):
3540         (WebKit::ScrollerPairMac::valuesForOrientation):
3541         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp:
3542         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::repositionRelatedLayers):
3543         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::setScrollLayerPosition): Deleted.
3544         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h:
3545         * UIProcess/ios/WKContentView.mm:
3546         (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
3547
3548 2019-02-27  Alex Christensen  <achristensen@webkit.org>
3549
3550         Silence log after r242122
3551         https://bugs.webkit.org/show_bug.cgi?id=195074
3552
3553         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
3554         (WebKit::LocalStorageDatabaseTracker::databasePath const):
3555         m_localStorageDirectory can now be null for ephemeral sessions.
3556         This is not a failure to create a directory and needs no log.
3557         This fixes the WKWebView.InitializingWebViewWithEphemeralStorageDoesNotLog API test.
3558
3559 2019-02-27  Timothy Hatcher  <timothy@apple.com>
3560
3561         REGRESSION: WebKit content crash in Base System (because NSAppearance is NULL).
3562         https://bugs.webkit.org/show_bug.cgi?id=195086
3563         rdar://problem/48419124
3564
3565         Reviewed by Tim Horton.
3566
3567         * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm:
3568         (-[WKScrollerImpDelegate effectiveAppearanceForScrollerImp:]): Always return a valid NSAppearance.
3569
3570 2019-02-26  Chris Dumez  <cdumez@apple.com>
3571
3572         [PSON] Add mechanism to clear suspended pages while bypassing the WebProcess cache
3573         https://bugs.webkit.org/show_bug.cgi?id=195089
3574
3575         Reviewed by Geoffrey Garen.
3576
3577         Add a convenient mechanism to clear suspended pages while bypassing the WebProcess
3578         cache since we need to do this on memory pressure and when clearing website data.
3579
3580         * UIProcess/WebPageProxy.cpp:
3581         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3582         * UIProcess/WebProcessCache.cpp:
3583         (WebKit::WebProcessCache::addProcessIfPossible):
3584         (WebKit::WebProcessCache::addProcess):
3585         (WebKit::WebProcessCache::takeProcess):
3586         (WebKit::WebProcessCache::CachedProcess::~CachedProcess):
3587         * UIProcess/WebProcessCache.h:
3588         (WebKit::WebProcessCache::setIsDisabled): Deleted.
3589         * UIProcess/WebProcessPool.cpp:
3590         (WebKit::WebProcessPool::handleMemoryPressureWarning):
3591         (WebKit::WebProcessPool::hasSuspendedPageFor const):
3592         (WebKit::WebProcessPool::clearSuspendedPages):
3593         * UIProcess/WebProcessPool.h:
3594         * UIProcess/WebProcessProxy.cpp:
3595         (WebKit::WebProcessProxy::maybeShutDown):
3596         (WebKit::WebProcessProxy::canTerminateAuxiliaryProcess):
3597         * UIProcess/WebProcessProxy.h:
3598         (WebKit::WebProcessProxy::suspendedPageCount const):
3599         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3600         (WebKit::WebsiteDataStore::removeData):
3601
3602 2019-02-26  Alex Christensen  <achristensen@webkit.org>
3603
3604         Move ephemeral local storage from WebProcess to UIProcess
3605         https://bugs.webkit.org/show_bug.cgi?id=195074
3606         <rdar://problem/47937975>
3607
3608         Reviewed by Geoff Garen.
3609
3610         Before PSON, a page could navigate to another domain that navigates back and still have its local storage.
3611         Since PSON makes it unreliable to retain the state in the WebProcess, move it to the process with the rest of the local storage.
3612         If it's ephemeral, we obviously can't use the SQLite on-disk storage implementation, so use the same WebCore::StorageMap we used to in the WebProcess.
3613
3614         * UIProcess/WebStorage/StorageManager.cpp:
3615         (WebKit::StorageManager::LocalStorageNamespace::LocalStorageNamespace):
3616         (WebKit::StorageManager::StorageManager):
3617         (WebKit::StorageManager::createLocalStorageMap):
3618         (WebKit::StorageManager::createTransientLocalStorageMap):
3619         (WebKit::StorageManager::createSessionStorageMap):
3620         (WebKit::StorageManager::destroyStorageMap):
3621         (WebKit::StorageManager::getValues):
3622         (WebKit::StorageManager::setItem):
3623         (WebKit::StorageManager::removeItem):
3624         (WebKit::StorageManager::clear):
3625         * UIProcess/WebStorage/StorageManager.h:
3626         * UIProcess/WebStorage/StorageManager.messages.in:
3627         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3628         (WebKit::WebsiteDataStore::WebsiteDataStore):
3629         * WebProcess/WebStorage/StorageAreaMap.cpp:
3630         (WebKit::StorageAreaMap::StorageAreaMap):
3631         (WebKit::StorageAreaMap::setItem):
3632         (WebKit::StorageAreaMap::removeItem):
3633         (WebKit::StorageAreaMap::clear):
3634         (WebKit::StorageAreaMap::loadValuesIfNeeded):
3635         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
3636         (WebKit::StorageNamespaceImpl::createEphemeralLocalStorageNamespace):
3637         (WebKit::StorageNamespaceImpl::storageArea):
3638         (WebKit::StorageNamespaceImpl::copy):
3639         (): Deleted.
3640         (WebKit::StorageNamespaceImpl::ephemeralLocalStorageArea): Deleted.
3641         * WebProcess/WebStorage/StorageNamespaceImpl.h:
3642
3643 2019-02-20  Jer Noble  <jer.noble@apple.com>
3644
3645         [Cocoa] Media elements will restart network buffering just before suspending
3646         https://bugs.webkit.org/show_bug.cgi?id=193691
3647
3648         Reviewed by Eric Carlson.
3649
3650         When the WebProcess receives a notification that the process is about to become
3651         suspended, it tells the MemoryPressureHandler to release all critical memory. This
3652         has the side effect of causing AVFoundation-backed media elements to dump their
3653         in-memory caches and start downloading media data again. Instead, media elements
3654         should all stop buffering media data during suspension. Add new testing SPI to
3655         simulate suspension and resume messages.
3656
3657         * UIProcess/API/Cocoa/WKWebView.mm:
3658         (-[WKWebView _processWillSuspendImminentlyForTesting]):
3659         (-[WKWebView _processDidResumeForTesting]):
3660         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3661         * UIProcess/WebProcessProxy.h:
3662         * UIProcess/ios/WKInkPickerView.mm:
3663         * WebProcess/WebPage/WebPage.cpp:
3664         (WebKit::WebPage::suspendAllMediaBuffering):
3665         (WebKit::WebPage::resumeAllMediaBuffering):
3666         * WebProcess/WebPage/WebPage.h:
3667         * WebProcess/WebProcess.cpp:
3668         (WebKit::WebProcess::actualPrepareToSuspend):
3669         (WebKit::WebProcess::cancelPrepareToSuspend):
3670         (WebKit::WebProcess::processDidResume):
3671         (WebKit::WebProcess::suspendAllMediaBuffering):
3672         (WebKit::WebProcess::resumeAllMediaBuffering):
3673         * WebProcess/WebProcess.h:
3674
3675 2019-02-26  Youenn Fablet  <youenn@apple.com>
3676
3677         Move service worker response validation from the service worker client to the service worker itself
3678         https://bugs.webkit.org/show_bug.cgi?id=194716
3679
3680         Reviewed by Geoffrey Garen.
3681
3682         Removed response validation as it is now done in service worker side.
3683
3684         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
3685         (WebKit::ServiceWorkerClientFetch::didReceiveRedirectResponse):
3686         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
3687
3688 2019-02-26  Zalan Bujtas  <zalan@apple.com>
3689
3690         [ContentChangeObserver] clearContentChangeObservers should be internal to ContentChangeObserver class
3691         https://bugs.webkit.org/show_bug.cgi?id=195066
3692         <rdar://problem/48411682>
3693
3694         Reviewed by Tim Horton.
3695
3696         * WebProcess/WebCoreSupport/WebChromeClient.h:
3697         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
3698         (WebKit::WebChromeClient::clearContentChangeObservers): Deleted.
3699
3700 2019-02-26  Per Arne Vollan  <pvollan@apple.com>
3701
3702         [iOS] Sandbox should allow mach lookups related to media capturing
3703         https://bugs.webkit.org/show_bug.cgi?id=194951
3704
3705         Reviewed by Eric Carlson.
3706
3707         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3708
3709 2019-02-26  Brent Fulgham  <bfulgham@apple.com>
3710
3711         Update NetworkSession to use Session Cleanup when available
3712         https://bugs.webkit.org/show_bug.cgi?id=195019
3713         <rdar://problem/45149868>
3714
3715         Reviewed by Alex Christensen.
3716
3717         If the build environment supports Session Cleanup, initialize it.
3718
3719         No test changes since this doesn't do anything on the test systems at present.
3720
3721         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3722         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3723
3724 2019-02-26  Chris Dumez  <cdumez@apple.com>
3725
3726         [iOS] Regression(PSON) Scroll position is no longer restored when navigating back to reddit.com
3727         https://bugs.webkit.org/show_bug.cgi?id=195054
3728         <rdar://problem/48330549>
3729
3730         Reviewed by Geoff Garen.
3731
3732         We attempt to restore the scroll position twice, on first layout and then on load completion.
3733         Before PSON, the scroll position would fail to get restored on first layout but would succeed
3734         on load completion because the view is tall enough by then. With PSON however, we would
3735         fail to restore the scroll position on load completion because the view would not be tall
3736         enough yet by this point. The reason is that the dynamic resources would not be in the memory cache
3737         and would then get reloaded abd finish loading *after* the load event.
3738
3739         To address the issue, we now make sure to not purge the memory cache on process suspension on
3740         iOS if there is currently a SuspendedPageProxy in the UIProcess for this process.
3741
3742         * UIProcess/SuspendedPageProxy.cpp:
3743         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
3744         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
3745         * UIProcess/WebProcessProxy.cpp:
3746         (WebKit::WebProcessProxy::incrementSuspendedPageCount):
3747         (WebKit::WebProcessProxy::decrementSuspendedPageCount):
3748         * UIProcess/WebProcessProxy.h:
3749         * WebProcess/WebProcess.cpp:
3750         (WebKit::WebProcess::initializeWebProcess):
3751         (WebKit::WebProcess::setHasSuspendedPageProxy):
3752         * WebProcess/WebProcess.h:
3753         * WebProcess/WebProcess.messages.in:
3754
3755 2019-02-26  Ryosuke Niwa  <rniwa@webkit.org>
3756
3757         [iOS] REGRESSION(r238490?): Safari sometimes shows blank page until a cross site navigation or re-opening the tab
3758         https://bugs.webkit.org/show_bug.cgi?id=195037
3759         <rdar://problem/48154508>
3760
3761         Reviewed by Antti Koivisto.
3762
3763         Restore the pre-r238490 behavior of WebPage::didCompletePageTransition clearing LayerTreeFreezeReason::ProcessSuspended
3764         as this has been an issue when I was able to reproduce the issue locally.
3765
3766         Also added release logging to help diagnose the issue in the future.
3767
3768         * WebProcess/WebPage/WebPage.cpp:
3769         (WebKit::WebPage::freezeLayerTree):
3770         (WebKit::WebPage::unfreezeLayerTree):
3771         (WebKit::WebPage::didCompletePageTransition):
3772         * WebProcess/WebProcess.cpp:
3773         (WebKit::WebProcess::freezeAllLayerTrees):
3774         (WebKit::WebProcess::unfreezeAllLayerTrees):
3775
3776 2019-02-26  Youenn Fablet  <youenn@apple.com>
3777
3778         Create WebPageProxy::m_userMediaPermissionRequestManager only when needed
3779         https://bugs.webkit.org/show_bug.cgi?id=195051
3780
3781         Reviewed by Eric Carlson.
3782
3783         Before the patch, WebPageProxy::m_userMediaPermissionRequestManager was created
3784         in some methods to reset its state when main document is changing, view is becoming visible...
3785         This code is unnecessary if the page did not create it already using JS APIs such as getUserMedia/enumerateDevices/ondevicechange.
3786         This patch skips processing in the other cases if WebPageProxy::m_userMediaPermissionRequestManager is null.
3787
3788         * UIProcess/WebPageProxy.cpp:
3789         (WebKit::WebPageProxy::close): No need to nullify it since it will be done in resetState shortly after.
3790         (WebKit::WebPageProxy::didChangeMainDocument):
3791         (WebKit::WebPageProxy::viewIsBecomingVisible):
3792         (WebKit::WebPageProxy::clearUserMediaState):
3793         (WebKit::WebPageProxy::updatePlayingMediaDidChange): m_userMediaPermissionRequestManager should not be null here
3794         since there is or was some capturing done for the page.
3795
3796 2019-02-26  Zalan Bujtas  <zalan@apple.com>
3797
3798         [ContentChangeObserver] Simplify content observation API by removing explicit DOMTimer observation.
3799         https://bugs.webkit.org/show_bug.cgi?id=195023
3800         <rdar://problem/48381885>
3801
3802         Reviewed by Tim Horton.
3803
3804         * WebProcess/WebPage/ios/WebPageIOS.mm:
3805         (WebKit::WebPage::handleSyntheticClick):
3806
3807 2019-02-26  Takashi Komori  <Takashi.Komori@sony.com>
3808
3809         [Curl] Load HTTP body of 401 response when AuthenticationChange is cancelled.
3810         https://bugs.webkit.org/show_bug.cgi?id=191652
3811
3812         Reviewed by Alex Christensen.
3813
3814         Test: http/tests/security/401-logout/401-logout.php
3815
3816         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3817         (WebKit::NetworkDataTaskCurl::tryHttpAuthentication):
3818         (WebKit::NetworkDataTaskCurl::tryProxyAuthentication):
3819         * NetworkProcess/curl/NetworkDataTaskCurl.h:
3820
3821 2019-02-26  Youenn Fablet  <youenn@apple.com>
3822
3823         WebPageProxy should nullify m_userMediaPermissionRequestManager after resetting the media state
3824         https://bugs.webkit.org/show_bug.cgi?id=195028
3825         <rdar://problem/48243733>
3826
3827         Reviewed by Eric Carlson.
3828
3829         Covered by API test.
3830
3831         * UIProcess/WebPageProxy.cpp:
3832         (WebKit::WebPageProxy::resetState):
3833
3834 2019-02-26  Philippe Normand <pnormand@igalia.com> and Carlos Garcia Campos  <cgarcia@igalia.com>
3835
3836         [WPE] Add API for webview background color configuration
3837         https://bugs.webkit.org/show_bug.cgi?id=192305
3838
3839         Reviewed by Michael Catanzaro.
3840
3841         In the case of WPE we need to send the background color to the web process to be used as the background color of
3842         the page. This patch adapts the GTK+ implementation to do the same, since it's a lot simpler. The patch also
3843         removes the SetDrawsBackground message in favor of the new SetBackgroundColor message that receives an optional
3844         color.
3845
3846         * PlatformWPE.cmake: Add new WPE API for WebKitColor boxed type.
3847         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3848         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext): Remove background rendering and opacity handling.
3849         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
3850         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3851         (WebKit::ThreadedCompositor::renderLayerTree): Remove drawsBakground and always clear the context with
3852         transparent color.
3853         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
3854         * Shared/WebPageCreationParameters.cpp:
3855         (WebKit::WebPageCreationParameters::encode const): Replace drawsBackground with backgroundColor.
3856         (WebKit::WebPageCreationParameters::decode): Ditto.
3857         * Shared/WebPageCreationParameters.h:
3858         * SourcesWPE.txt:
3859         * UIProcess/API/glib/WebKitWebView.cpp:
3860         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
3861         (webkit_web_view_set_background_color):
3862         (webkit_web_view_get_background_color):
3863         * UIProcess/API/wpe/WebKitColor.cpp: Added.
3864         (webkit_color_copy):
3865         (webkit_color_free):
3866         (webkitColorToWebCoreColor):
3867         (webkitColorFillFromWebCoreColor):
3868         (webkit_color_parse):
3869         * UIProcess/API/wpe/WebKitColor.h: Added.
3870         * UIProcess/API/wpe/WebKitColorPrivate.h: Added.
3871         * UIProcess/API/wpe/WebKitWebView.h: Implement webkit_web_view_set_background_color API.
3872         * UIProcess/API/wpe/WebKitWebViewWPE.cpp: Ditto.
3873         (webkit_web_view_set_background_color):
3874         (webkit_web_view_get_background_color):
3875         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt: Add new symbols.
3876         * UIProcess/WebPageProxy.cpp:
3877         (WebKit::WebPageProxy::setDrawsBackground): Set a transparent background color when false is passed.
3878         (WebKit::WebPageProxy::setBackgroundColor): Send background color to the WebProcess.
3879         (WebKit::WebPageProxy::creationParameters): Replace drawsBackground with backgroundColor.
3880         * UIProcess/WebPageProxy.h:
3881         (WebKit::WebPageProxy::drawsBackground const):
3882         (WebKit::WebPageProxy::backgroundColor const):
3883         * UIProcess/cairo/BackingStoreCairo.cpp:
3884         (WebKit::BackingStore::incorporateUpdate): Remove GTK+ code to handle background color.
3885         * UIProcess/gtk/AcceleratedBackingStore.cpp:
3886         * UIProcess/gtk/AcceleratedBackingStore.h: Make paint() pure virtual and remove the implementation.
3887         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
3888         (WebKit::AcceleratedBackingStoreWayland::paint): Dot not call AcceleratedBackingStore::paint() now that is pure virtual.
3889         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
3890         (WebKit::AcceleratedBackingStoreX11::paint): Ditto.
3891         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3892         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Use background color as provided by the
3893         UIProcess when creating the FrameView.
3894         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
3895         * WebProcess/WebPage/AcceleratedDrawingArea.h:
3896         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
3897         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
3898         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
3899         (WebKit::ThreadedCoordinatedLayerTreeHost::setIsDiscardable):
3900         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
3901         * WebProcess/WebPage/DrawingArea.h:
3902         * WebProcess/WebPage/DrawingAreaImpl.cpp:
3903         (WebKit::DrawingAreaImpl::display): Remove special case for transparent background.
3904         * WebProcess/WebPage/LayerTreeHost.h:
3905         * WebProcess/WebPage/WebPage.cpp:
3906         (WebKit::WebPage::setBackgroundColor): New API for background color configuration. Proxies to FrameView and DrawingArea.
3907         * WebProcess/WebPage/WebPage.h:
3908         (WebKit::WebPage::backgroundColor const): Read-only access to the current background color.
3909         * WebProcess/WebPage/WebPage.messages.in: Replace SetDrawsBackground message with SetBackgroundColor.
3910
3911 2019-02-25  Yongjun Zhang  <yongjun_zhang@apple.com>
3912
3913         scalableNativeWebpageParameters() is not preserved on new page navigation.
3914         https://bugs.webkit.org/show_bug.cgi?id=194892
3915         <rdar://problem/47538280>
3916
3917         If a page's current default viewport configuration is scalableNativeWebpageParameters due to
3918         the fact that m_canIgnoreScalingConstraints is true, loading a new page should preserve this