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