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