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