Optimize Region for single rectangle case
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-03-15  Antti Koivisto  <antti@apple.com>
2
3         Optimize Region for single rectangle case
4         https://bugs.webkit.org/show_bug.cgi?id=195743
5
6         Reviewed by Simon Fraser.
7
8         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
9         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
10         * Shared/WebCoreArgumentCoders.cpp:
11         (IPC::ArgumentCoder<EventTrackingRegions>::decode):
12         (IPC::ArgumentCoder<Region::Span>::encode): Deleted.
13         (IPC::ArgumentCoder<Region::Span>::decode): Deleted.
14         (IPC::ArgumentCoder<Region>::encode): Deleted.
15         (IPC::ArgumentCoder<Region>::decode): Deleted.
16         * Shared/WebCoreArgumentCoders.h:
17
18 2019-03-14  Per Arne Vollan  <pvollan@apple.com>
19
20         [iOS] WebKit crashes when opening pages documents
21         https://bugs.webkit.org/show_bug.cgi?id=195784
22         <rdar://problem/48904334>
23
24         Reviewed by Brent Fulgham.
25
26         The sandbox needs to allow additional syscalls.
27
28         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
29
30 2019-03-14  Simon Fraser  <simon.fraser@apple.com>
31
32         Make it possible to test scrolling tree layer manipulation more easily
33         https://bugs.webkit.org/show_bug.cgi?id=195780
34
35         Reviewed by Tim Horton.
36
37         Add a boolean attribute 'scrollUpdatesDisabled' on UIScriptController that
38         cuts off communication of scrolling tree scrolls back to the web process
39         (in RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll()). This
40         allows tests to trigger scrolls which run the scrolling tree layer positioning
41         logic, but never get another commit from the web process that might mask
42         scrolling tree bugs.
43         
44         WKWebView's testing protocol get @property _scrollingUpdatesDisabledForTesting,
45         whose getters and setters are overridden by TestRunnerWKWebView. Plumbing
46         via PageClient and WebPageProxy makes this flag reachable by RemoteScrollingCoordinatorProxy.
47
48         * UIProcess/API/Cocoa/WKWebView.mm:
49         (-[WKWebView _scrollingUpdatesDisabledForTesting]):
50         (-[WKWebView _setScrollingUpdatesDisabledForTesting:]):
51         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
52         * UIProcess/Cocoa/PageClientImplCocoa.h:
53         * UIProcess/Cocoa/PageClientImplCocoa.mm:
54         (WebKit::PageClientImplCocoa::scrollingUpdatesDisabledForTesting):
55         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
56         (WebKit::WebPageProxy::scrollingUpdatesDisabledForTesting):
57         * UIProcess/PageClient.h:
58         (WebKit::PageClient::scrollingUpdatesDisabledForTesting):
59         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
60         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
61         * UIProcess/WebPageProxy.h:
62
63 2019-03-14  Youenn Fablet  <youenn@apple.com>
64
65         Move IDB storage in private browsing mode to NetworkProcess
66         https://bugs.webkit.org/show_bug.cgi?id=195602
67
68         Reviewed by Brady Eidson.
69
70         Covered by existing IDB tests and added API test.
71
72         * NetworkProcess/NetworkProcess.cpp:
73         (WebKit::NetworkProcess::createIDBServer):
74         Make sure that path is empty for private sessions.
75         This will make IDB use a memory backing store.
76         * WebProcess/Databases/WebDatabaseProvider.cpp:
77         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
78         Use NetworkProcess IDB server instead of InProcessIDBServer.
79
80 2019-03-14  Wenson Hsieh  <wenson_hsieh@apple.com>
81
82         REGRESSION (r242801): [iOS] preventDefault() on touchstart in a subframe does not prevent focusing the subframe
83         https://bugs.webkit.org/show_bug.cgi?id=195749
84         <rdar://problem/48892367>
85
86         Reviewed by Tim Horton.
87
88         r242801 added logic to fetch interaction information at the touch location upon touch start. However this,
89         combined with an existing behavior where the process of computing InteractionInformationAtPosition in WebPage
90         moves focus into the frame of the hit-tested node below the touch location, means that we'll always trigger a
91         blur event on the window and move focus into the subframe when performing a touch inside a subframe, even if the
92         page prevents default on touchstart.
93
94         To fix this, add a "readonly" flag to InteractionInformationRequest, and only change focus when requesting
95         position information in the case where the request is not readonly. For now, this readonly flag is false by
96         default; in a future patch, we should identify the (hopefully few) places that rely on position information
97         requests to move focus, explicitly turn this bit off in those places, and otherwise send readonly position
98         information requests by default.
99
100         * Shared/ios/InteractionInformationRequest.cpp:
101         (WebKit::InteractionInformationRequest::encode const):
102         (WebKit::InteractionInformationRequest::decode):
103         (WebKit::InteractionInformationRequest::isValidForRequest):
104         (WebKit::InteractionInformationRequest::isApproximatelyValidForRequest):
105
106         Ensure that a readonly request is not valid for a non-readonly request.
107
108         * Shared/ios/InteractionInformationRequest.h:
109         * UIProcess/API/Cocoa/WKWebView.mm:
110         (-[WKWebView _requestActivatedElementAtPosition:completionBlock:]):
111
112         Send a readonly position information request in the case where a WebKit SPI client is querying for element
113         information at the given location.
114
115         * UIProcess/ios/WKContentViewInteraction.mm:
116         (-[WKContentView _webTouchEventsRecognized:]):
117
118         Send a readonly position information request on touchstart.
119
120         * WebProcess/WebPage/ios/WebPageIOS.mm:
121         (WebKit::WebPage::positionInformation):
122
123 2019-03-14  Chris Dumez  <cdumez@apple.com>
124
125         Add WebsitePolicy for the client to specify the device orientation & motion access policy
126         https://bugs.webkit.org/show_bug.cgi?id=195750
127
128         Reviewed by Geoffrey Garen.
129
130         Add WebsitePolicy for the client to specify the device orientation & motion access policy. If
131         the client already knows access to the device motion & orientation API will be granted / denied,
132         it can let WebKit know via WebsitePolicies so that WebKit will not ask the client when the
133         permission is requested by JS.
134
135         * Shared/WebsitePoliciesData.cpp:
136         (WebKit::WebsitePoliciesData::encode const):
137         (WebKit::WebsitePoliciesData::decode):
138         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
139         * Shared/WebsitePoliciesData.h:
140         * UIProcess/API/APIWebsitePolicies.cpp:
141         (API::WebsitePolicies::data):
142         * UIProcess/API/APIWebsitePolicies.h:
143         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
144         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
145         (-[_WKWebsitePolicies setDeviceOrientationAndMotionAccessPolicy:]):
146         (-[_WKWebsitePolicies deviceOrientationAndMotionAccessPolicy]):
147
148 2019-03-14  Timothy Hatcher  <timothy@apple.com>
149
150         REGRESSION (r242908): TestWebKitAPI.WebKit.AddAndRemoveDataDetectors Crashed
151         https://bugs.webkit.org/show_bug.cgi?id=195751
152
153         Reviewed by Wenson Hsieh.
154
155         * Shared/Cocoa/ArgumentCodersCocoa.mm:
156         (IPC::decodeArrayInternal): Added allowedClasses, pass to internal decodeObject for values.
157         (IPC::decodeDictionaryInternal): Ditto for keys and values.
158         (IPC::decodeObject): Pass allowedClasses to array and dictionary decoders.
159
160 2019-03-14  Chris Dumez  <cdumez@apple.com>
161
162         [PSON] Make sure the WebProcessCache is leverage when relaunching a process after termination
163         https://bugs.webkit.org/show_bug.cgi?id=195747
164
165         Reviewed by Geoff Garen.
166
167         Make sure the WebProcessCache and the prewarmed process are used when relaunching a process
168         after termination (e.g. crash).
169
170         * UIProcess/WebPageProxy.cpp:
171         (WebKit::WebPageProxy::reattachToWebProcess):
172         (WebKit::WebPageProxy::reattachToWebProcessForReload):
173         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
174         (WebKit::WebPageProxy::loadRequest):
175         (WebKit::WebPageProxy::loadFile):
176         (WebKit::WebPageProxy::loadData):
177         (WebKit::WebPageProxy::loadAlternateHTML):
178         (WebKit::WebPageProxy::loadWebArchiveData):
179         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
180         * UIProcess/WebPageProxy.h:
181         * UIProcess/WebProcessPool.cpp:
182         (WebKit::WebProcessPool::processForRegistrableDomain):
183         (WebKit::WebProcessPool::createWebPage):
184         (WebKit::WebProcessPool::processForNavigationInternal):
185         (WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
186         * UIProcess/WebProcessPool.h:
187
188 2019-03-14  Timothy Hatcher  <timothy@apple.com>
189
190         Unreviewed speculative build fix for watchOS after r242908.
191
192         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
193
194 2019-03-14  Youenn Fablet  <youenn@apple.com>
195
196         Reset storage quota when clearing IDB/Cache API entries
197         https://bugs.webkit.org/show_bug.cgi?id=195716
198
199         Reviewed by Chris Dumez.
200
201         On clearing DOMCache or IDB data, reset quota value to the default value.
202         This ensures consistent layout test runs.
203
204         * NetworkProcess/NetworkProcess.cpp:
205         (WebKit::NetworkProcess::deleteWebsiteData):
206         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
207         (WebKit::NetworkProcess::clearStorageQuota):
208         * NetworkProcess/NetworkProcess.h:
209
210 2019-03-13  Zalan Bujtas  <zalan@apple.com>
211
212         [ContentChangeObserver] Stop content observation when content calls preventDefault() on touch events
213         https://bugs.webkit.org/show_bug.cgi?id=195724
214         <rdar://problem/48873456>
215
216         Reviewed by Simon Fraser.
217
218         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
219         (WebKit::WebChromeClient::didPreventDefaultForEvent):
220
221 2019-03-13  Wenson Hsieh  <wenson_hsieh@apple.com>
222
223         Make -[_WKAttachment setFileWrapper:contentType:completion:] robust when given a nil completion handler
224         https://bugs.webkit.org/show_bug.cgi?id=195725
225         <rdar://problem/48545062>
226
227         Reviewed by Tim Horton.
228
229         Add a missing nil check before invoking the given completionHandler in the case where the attachment is invalid.
230         Tested by augmenting WKAttachmentTests.SetFileWrapperForPDFImageAttachment to exercise this scenario.
231
232         * UIProcess/API/APIAttachment.cpp:
233         (API::Attachment::invalidate):
234
235         Additionally make sure that an invalidated _WKAttachment is also considered to be disconnected.
236
237         * UIProcess/API/Cocoa/_WKAttachment.mm:
238         (-[_WKAttachment setFileWrapper:contentType:completion:]):
239
240 2019-03-13  Timothy Hatcher  <timothy@apple.com>
241
242         REGRESSION (r242908):  'NSInvalidArgumentException', reason: '+[PKPaymentMerchantSession count]: unrecognized selector sent to class 0x1c0fae060'
243         https://bugs.webkit.org/show_bug.cgi?id=195720
244
245         Reviewed by Andy Estes.
246
247         Add back decode(Decoder& decoder, Class allowedClass) for Apple Pay code.
248
249         * Shared/Cocoa/ArgumentCodersCocoa.h:
250         (IPC::decode): Added.
251
252 2019-03-13  Tim Horton  <timothy_horton@apple.com>
253
254         Stop using some deprecated SPI in WKDrawingView
255         https://bugs.webkit.org/show_bug.cgi?id=195706
256         <rdar://problem/48062599>
257
258         Reviewed by Wenson Hsieh.
259
260         * UIProcess/ios/WKDrawingView.mm:
261         (-[WKDrawingView renderedDrawing]):
262         (-[WKDrawingView PNGRepresentation]):
263         (-[WKDrawingView loadDrawingFromPNGRepresentation:]):
264
265 2019-03-13  Timothy Hatcher  <timothy@apple.com>
266
267         Unreviewed speculative build fix for watchOS after r242908.
268
269         * Shared/Cocoa/ArgumentCodersCocoa.mm:
270         (IPC::decodeObject):
271
272 2019-03-13  Dean Jackson  <dino@apple.com>
273
274         Block all plugins smaller than 5x5px
275         https://bugs.webkit.org/show_bug.cgi?id=195702
276         <rdar://problem/28435204>
277
278         Reviewed by Sam Weinig.
279
280         Block all plugins that are smaller than a threshold, in this case
281         5x5px. Other browsers have implemented this for a while, and now
282         that we have Intersection Observers, small plugins are no longer
283         necessary.
284
285         * Shared/WebPreferences.yaml: New setting for this feature.
286
287         * UIProcess/WebPageProxy.cpp: Handle new unavailability type.
288         (WebKit::WebPageProxy::unavailablePluginButtonClicked):
289         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
290         (WebKit::WebChromeClient::shouldUnavailablePluginMessageBeButton const):
291
292         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: Removed this function
293         as it was never being called.
294         (WebKit::WebFrameLoaderClient::recreatePlugin): Deleted.
295         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
296
297         * WebProcess/WebPage/WebPage.cpp:
298         (WebKit::pluginIsSmall): Checks the size of the plugin.
299         (WebKit::WebPage::createPlugin): If the plugin is too small, stop it from
300         launching.
301
302 2019-03-13  Keith Rollin  <krollin@apple.com>
303
304         Add support for new StagedFrameworks layout
305         https://bugs.webkit.org/show_bug.cgi?id=195543
306
307         Reviewed by Alexey Proskuryakov.
308
309         When creating the WebKit layout for out-of-band Safari/WebKit updates,
310         use an optional path prefix when called for.
311
312         Update the dyld_env path in OTHER_LDFLAGS_VERSIONED_FRAMEWORK_PATH to
313         also understand about this layout.
314
315         * Configurations/BaseTarget.xcconfig:
316
317 2019-03-13  Simon Fraser  <simon.fraser@apple.com>
318
319         Scrolling tree should reposition non-stacking order descendents of overflow:scroll.
320         https://bugs.webkit.org/show_bug.cgi?id=195608
321
322         Reviewed by Zalan Bujtas.
323
324         Step 1: add scrolling tree positioning nodes classes (but don't create them yet).
325
326         Add Scrolling{State,Tree}PositionedNode to track composited layers that have to be repositioned when
327         an async overflow:scroll scrolls. There are two instances in which this is necessary, reflected by
328         the values of ScrollPositioningBehavior:
329
330         ScrollPositioningBehavior::Moves - a composited layer whose containing block chain includes an
331             async overflow scroller, but whose composited (i.e. z-order) parent is outside of the overflow.
332             When the overflow scrolls, this layer has to move along with the overflow.
333
334         ScrollPositioningBehavior::Stationary - a composited layer whose containing block chain skips the
335             overflow scroller, but whose compositing (z-order) parent is the scroller, or inside the scroller.
336             This only applies to position:absolute, on, for example, an overflow:scroll ith opacity.
337
338         PositionedNodes are modeled after Fixed/Sticky nodes, with a new type of layout constraint just called LayoutConstraints.
339         
340         This patch adds support for PositionedNodes in the scrolling trees, but RenderLayerCompositor::computeCoordinatedPositioningForLayer()
341         is just a stub so the new node types aren't created yet.
342         
343         RenderLayerBacking stores a ScrollingNodeID for the positioning role (just like the other roles). Since the Positioning
344         role is about position relative to ancestors, a node with both Positioning and FrameHosting or Scrolling roles treats
345         the Positioning node as the parent of the other types. A node should never have both Positioning and ViewportConstrained roles.
346
347         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
348         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
349         (ArgumentCoder<ScrollingStatePositionedNode>::encode):
350         (ArgumentCoder<ScrollingStatePositionedNode>::decode):
351         (WebKit::encodeNodeAndDescendants):
352         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
353         (WebKit::dump):
354         * Shared/WebCoreArgumentCoders.cpp:
355         (IPC::ArgumentCoder<LayoutConstraints>::encode):
356         (IPC::ArgumentCoder<LayoutConstraints>::decode):
357         (IPC::ArgumentCoder<StickyPositionViewportConstraints>::decode):
358         * Shared/WebCoreArgumentCoders.h:
359         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
360         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
361         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
362         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
363         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
364         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
365
366 2019-03-13  Youenn Fablet  <youenn@apple.com>
367
368         Check IDB quota usage through QuotaManager
369         https://bugs.webkit.org/show_bug.cgi?id=195302
370
371         Reviewed by Chris Dumez.
372
373         Set the quota manager getter for IDBServer at creation time.
374
375         * NetworkProcess/NetworkProcess.cpp:
376         (WebKit::NetworkProcess::createIDBServer):
377         (WebKit::NetworkProcess::idbServer):
378         * NetworkProcess/NetworkProcess.h:
379         * WebProcess/Databases/WebDatabaseProvider.cpp:
380         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
381
382 2019-03-13  Timothy Hatcher  <timothy@apple.com>
383
384         Consolidate ArgumentCodersMac and ArgumentCodersCocoa.
385         https://bugs.webkit.org/show_bug.cgi?id=195636
386         rdar://problem/45055697
387
388         Reviewed by Ryosuke Niwa.
389
390         Merge the two similar encoders and decoders. This avoids issues where
391         one encoder could be used and the other decoder, which caused a crash.
392         It also stops handling NSAttributedString specifically and just uses
393         the NSSecureCoding path to handle more complex attributes.
394
395         Some WebCore encoders code needed to move to platform files, since
396         ArgumentCodersCocoa.h requires an ObjectiveC++ implementation to work.
397
398         * Shared/Cocoa/ArgumentCodersCocoa.h:
399         (IPC::encode):
400         (IPC::decode):
401         (IPC::ArgumentCoder<RetainPtr<T>>::encode):
402         (IPC::ArgumentCoder<RetainPtr<T>>::decode):
403         * Shared/Cocoa/ArgumentCodersCocoa.mm:
404         (IPC::typeFromObject):
405         (IPC::isSerializableFont):
406         (IPC::isSerializableValue):
407         (IPC::encodeObject):
408         (IPC::decodeObject):
409         * Shared/Cocoa/LoadParametersCocoa.mm:
410         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
411         (IPC::ArgumentCoder<WebCore::DictionaryPopupInfo>::encodePlatformData):
412         (IPC::ArgumentCoder<WebCore::DictionaryPopupInfo>::decodePlatformData):
413         (IPC::ArgumentCoder<WebCore::FontAttributes>::encodePlatformData):
414         (IPC::ArgumentCoder<WebCore::FontAttributes>::decodePlatformData):
415         * Shared/WebCoreArgumentCoders.cpp:
416         (IPC::ArgumentCoder<DictionaryPopupInfo>::encode):
417         (IPC::ArgumentCoder<DictionaryPopupInfo>::decode):
418         (IPC::ArgumentCoder<FontAttributes>::encode):
419         (IPC::ArgumentCoder<FontAttributes>::decode):
420         * Shared/WebCoreArgumentCoders.h:
421         * Shared/mac/ArgumentCodersMac.h: Removed.
422         * Shared/mac/ArgumentCodersMac.mm: Removed.
423         * Shared/mac/AttributedString.mm:
424         (WebKit::AttributedString::encode const):
425         * Shared/mac/ObjCObjectGraph.mm:
426         * SourcesCocoa.txt:
427         * WebKit.xcodeproj/project.pbxproj:
428
429 2019-03-13  Chris Dumez  <cdumez@apple.com>
430
431         Use a ServiceWorker process per registrable domain
432         https://bugs.webkit.org/show_bug.cgi?id=195649
433
434         Reviewed by Youenn Fablet.
435
436         Use a ServiceWorker process per registrable domain instead of one per security origin. This is
437         more in line with PSON and avoids launching too many processes.
438
439         * NetworkProcess/NetworkProcess.cpp:
440         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
441         (WebKit::NetworkProcess::connectionToContextProcessWasClosed):
442         (WebKit::NetworkProcess::needsServerToContextConnectionForRegistrableDomain const):
443         (WebKit::NetworkProcess::serverToContextConnectionForRegistrableDomain):
444         (WebKit::NetworkProcess::createServerToContextConnection):
445         (WebKit::NetworkProcess::swContextConnectionMayNoLongerBeNeeded):
446         * NetworkProcess/NetworkProcess.h:
447         * NetworkProcess/NetworkProcess.messages.in:
448         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
449         (WebKit::WebSWServerConnection::scheduleJobInServer):
450         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
451         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
452         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
453         * UIProcess/Network/NetworkProcessProxy.cpp:
454         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
455         (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess):
456         (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcessForExplicitSession):
457         * UIProcess/Network/NetworkProcessProxy.h:
458         * UIProcess/Network/NetworkProcessProxy.messages.in:
459         * UIProcess/ServiceWorkerProcessProxy.cpp:
460         (WebKit::ServiceWorkerProcessProxy::create):
461         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
462         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
463         * UIProcess/ServiceWorkerProcessProxy.h:
464         * UIProcess/WebProcessPool.cpp:
465         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
466         (WebKit::WebProcessPool::disconnectProcess):
467         (WebKit::WebProcessPool::updateProcessAssertions):
468         * UIProcess/WebProcessPool.h:
469
470 2019-03-13  Chris Dumez  <cdumez@apple.com>
471
472         REGRESSION(PSON, r240660): Navigation over process boundary is flashy when using Cmd-left/right arrow to navigate
473         https://bugs.webkit.org/show_bug.cgi?id=195684
474         <rdar://problem/48294714>
475
476         Reviewed by Antti Koivisto.
477
478         * Shared/NavigationActionData.cpp:
479         (WebKit::NavigationActionData::encode const):
480         (WebKit::NavigationActionData::decode):
481         * Shared/NavigationActionData.h:
482         * UIProcess/WebPageProxy.cpp:
483         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
484         (WebKit::WebPageProxy::backForwardAddItem):
485         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
486         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
487
488 2019-03-13  Chris Dumez  <cdumez@apple.com>
489
490         Drop legacy WebCore::toRegistrableDomain() utility function
491         https://bugs.webkit.org/show_bug.cgi?id=195637
492
493         Reviewed by Geoffrey Garen.
494
495         Drop legacy toRegistrableDomain() / registrableDomainAreEqual() utility functions.
496         Update call sites to use modern RegistrableDomain type instead.
497
498         * UIProcess/WebProcessPool.cpp:
499         (WebKit::WebProcessPool::processForNavigationInternal):
500
501 2019-03-12  Brady Eidson  <beidson@apple.com>
502
503         Take UnboundedNetworking assertion when a file upload is in progress.
504         https://bugs.webkit.org/show_bug.cgi?id=195497
505
506         Reviewed by Geoff Garen.
507
508         This patch implements whole bunch of bookkeeping in both the Networking and UI processes.
509
510         The TLDR of that bookkeeping is:
511         - Whenever any uploads are in progress, take an assertion for both Networking and UI processes.
512         - Whenever a particular WebProcess has an upload in progress, take an assertion for it.
513
514         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
515         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
516         (WebKit::NetworkConnectionToWebProcess::setProcessIdentifier):
517         (WebKit::NetworkConnectionToWebProcess::setConnectionHasUploads):
518         (WebKit::NetworkConnectionToWebProcess::clearConnectionHasUploads):
519         * NetworkProcess/NetworkConnectionToWebProcess.h:
520         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
521
522         * NetworkProcess/NetworkResourceLoadMap.cpp: Added.
523         (WebKit::NetworkResourceLoadMap::add):
524         (WebKit::NetworkResourceLoadMap::remove):
525         (WebKit::NetworkResourceLoadMap::get const):
526         * NetworkProcess/NetworkResourceLoadMap.h: Added.
527         (WebKit::NetworkResourceLoadMap::NetworkResourceLoadMap):
528         (WebKit::NetworkResourceLoadMap::isEmpty const):
529         (WebKit::NetworkResourceLoadMap::contains const):
530         (WebKit::NetworkResourceLoadMap::begin):
531         (WebKit::NetworkResourceLoadMap::values):
532
533         * NetworkProcess/NetworkSession.cpp:
534  
535        * Scripts/webkit/messages.py:
536
537         * Sources.txt:
538
539         * UIProcess/Network/NetworkProcessProxy.cpp:
540         (WebKit::NetworkProcessProxy::takeUploadAssertion):
541         (WebKit::NetworkProcessProxy::clearUploadAssertion):
542         * UIProcess/Network/NetworkProcessProxy.h:
543
544         * UIProcess/WebProcessPool.cpp:
545         (WebKit::WebProcessPool::setWebProcessHasUploads):
546         (WebKit::WebProcessPool::clearWebProcessHasUploads):
547         * UIProcess/WebProcessPool.h:
548         * UIProcess/WebProcessPool.messages.in:
549  
550        * WebKit.xcodeproj/project.pbxproj:
551
552         * WebProcess/WebProcess.cpp:
553         (WebKit::WebProcess::ensureNetworkProcessConnection):
554
555 2019-03-13  Chris Dumez  <cdumez@apple.com>
556
557         Use new RegistrableDomain type in PSON code
558         https://bugs.webkit.org/show_bug.cgi?id=195634
559
560         Reviewed by Youenn Fablet.
561
562         Use new RegistrableDomain type in PSON code instead of more error-prone String type.
563
564         * UIProcess/SuspendedPageProxy.cpp:
565         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
566         * UIProcess/SuspendedPageProxy.h:
567         * UIProcess/WebProcessCache.cpp:
568         (WebKit::WebProcessCache::canCacheProcess const):
569         (WebKit::WebProcessCache::addProcessIfPossible):
570         (WebKit::WebProcessCache::takeProcess):
571         (WebKit::WebProcessCache::clearAllProcessesForSession):
572         * UIProcess/WebProcessCache.h:
573         * UIProcess/WebProcessPool.cpp:
574         (WebKit::WebProcessPool::addProcessToOriginCacheSet):
575         (WebKit::WebProcessPool::removeProcessFromOriginCacheSet):
576         (WebKit::WebProcessPool::processForNavigationInternal):
577         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
578         (WebKit::WebProcessPool::didCollectPrewarmInformation):
579         (WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
580         * UIProcess/WebProcessPool.h:
581         * UIProcess/WebProcessProxy.cpp:
582         (WebKit::WebProcessProxy::canBeAddedToWebProcessCache const):
583         (WebKit::WebProcessProxy::maybeShutDown):
584         (WebKit::WebProcessProxy::didCollectPrewarmInformation):
585         (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
586         * UIProcess/WebProcessProxy.h:
587         (WebKit::WebProcessProxy::registrableDomain const):
588         * UIProcess/WebProcessProxy.messages.in:
589         * WebProcess/WebProcess.cpp:
590         (WebKit::WebProcess::sendPrewarmInformation):
591
592 2019-03-13  Fujii Hironori  <Hironori.Fujii@sony.com>
593
594         [Win][PlayStation] Remove WebCore::standardUserAgentForURL
595         https://bugs.webkit.org/show_bug.cgi?id=195662
596
597         Reviewed by Ryosuke Niwa.
598
599         * WebProcess/WebPage/win/WebPageWin.cpp:
600         (WebKit::WebPage::platformUserAgent const): Return an empty string as well as mac/ios ports.
601
602 2019-03-12  Ross Kirsling  <ross.kirsling@sony.com>
603
604         [Win] Fix a slew of simple clang-cl warnings.
605         https://bugs.webkit.org/show_bug.cgi?id=195652
606
607         Reviewed by Don Olmstead.
608
609         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
610         (WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse): -Wswitch
611         * Platform/IPC/win/ConnectionWin.cpp:
612         (IPC::Connection::readEventHandler): -Wunused-variable
613         * Platform/win/LoggingWin.cpp:
614         (WebKit::logLevelString): -Wwritable-strings
615         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
616         (WebKit::ProcessLauncher::launchProcess): -Wunused-variable
617
618 2019-03-12  Ryosuke Niwa  <rniwa@webkit.org>
619
620         Move the code for determining the need for touch bar quirks to Quirks class
621         https://bugs.webkit.org/show_bug.cgi?id=195654
622
623         Reviewed by Brent Fulgham.
624
625         Moved the code to determine whether touch bar quirks are needed or not to WebCore.
626
627         Also renamed HiddenContentEditableQuirk to IsTouchBarUpdateSupressedForHiddenContentEditable
628         and PlainTextQuirk to NeverRichlyEditableForTouchBar.
629
630         * UIProcess/Cocoa/WebViewImpl.h:
631         (WebKit::WebViewImpl::isRichlyEditableForTouchBar): Renamed.
632         * UIProcess/Cocoa/WebViewImpl.mm:
633         (WebKit::WebViewImpl::updateTouchBar):
634         (WebKit::WebViewImpl::candidateListTouchBarItem const):
635         (WebKit::WebViewImpl::isRichlyEditableForTouchBar const): Renamed from isRichlyEditable.
636         (WebKit::WebViewImpl::textTouchBar const):
637         (WebKit::WebViewImpl::updateTextTouchBar):
638         * UIProcess/WebPageProxy.cpp:
639         (WebKit::WebPageProxy::setIsTouchBarUpdateSupressedForHiddenContentEditable): Renamed from
640         setNeedsHiddenContentEditableQuirk.
641         (WebKit::WebPageProxy::setIsNeverRichlyEditableForTouchBar): Renamed from setNeedsPlainTextQuirk.
642         * UIProcess/WebPageProxy.h:
643         (WebKit::WebPageProxy::isTouchBarUpdateSupressedForHiddenContentEditable const): Renamed from
644         needsHiddenContentEditableQuirk.
645         (WebKit::WebPageProxy::isNeverRichlyEditableForTouchBar const): Renamed from needsPlainTextQuirk.
646         * UIProcess/WebPageProxy.messages.in: Renamed the IPC messages.
647         * WebProcess/WebPage/WebPage.cpp:
648         (WebKit::needsHiddenContentEditableQuirk): Deleted. Moved to WebCore.
649         (WebKit::needsPlainTextQuirk): Deleted. Moved to WebCore.
650         (WebKit::WebPage::didStartPageTransition):
651         (WebKit::WebPage::didChangeSelection):
652         * WebProcess/WebPage/WebPage.h:
653         (WebKit::WebPage):
654
655 2019-03-12  Jiewen Tan  <jiewen_tan@apple.com>
656
657         Add WebFrameProxy::loadData
658         https://bugs.webkit.org/show_bug.cgi?id=195647
659         <rdar://problem/48826856>
660
661         Reviewed by Youenn Fablet.
662
663         This patch adds WebFrameProxy::loadData which is a simplified version of WebPageProxy::loadData that
664         loads substitute data to an iframe. This is needed by the Load Optimizer.
665
666         * UIProcess/WebFrameProxy.cpp:
667         (WebKit::WebFrameProxy::loadData):
668         * UIProcess/WebFrameProxy.h:
669         * WebProcess/WebPage/WebPage.cpp:
670         (WebKit::WebPage::loadDataInFrame):
671         * WebProcess/WebPage/WebPage.h:
672         * WebProcess/WebPage/WebPage.messages.in:
673
674 2019-03-12  Wenson Hsieh  <wenson_hsieh@apple.com>
675
676         [iOS] Input view sometimes flickers when blurring and refocusing an element
677         https://bugs.webkit.org/show_bug.cgi?id=195639
678         <rdar://problem/48735337>
679
680         Reviewed by Tim Horton.
681
682         On iOS, if a focused element is blurred and immediately refocused in the scope of user interaction, we will end
683         up reloading interaction state (input views, autocorrection contexts, etc.) in the UI process. On certain well-
684         trafficked websites, this results in the input view and input accessory view flickering (or more egregiously,
685         scrolling to re-reveal the focused element) when changing selection.
686
687         To fix the issue, this patch refactors some focus management logic to suppress sending focused element updates
688         to the UI process in the case where the same element is being blurred and immediately refocused. To do this, we
689         track the most recently blurred element and bail when the recently blurred element is identical to the newly
690         focused element. See below for more detail.
691
692         Test: fast/forms/ios/keyboard-stability-when-refocusing-element.html
693
694         * UIProcess/WebPageProxy.h:
695         * UIProcess/ios/WKContentViewInteraction.mm:
696         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
697         (-[WKContentView _elementDidBlur]):
698
699         Update the web process' notion of whether an input view is showing. Importantly, this accounts for decisions
700         made by _WKUIDelegate. See below for more details.
701
702         (isAssistableInputType): Deleted.
703
704         Removed this helper function; this was only used in one place as a sanity check that the focused element's type
705         is not none, right before attempting to show an input view. Instead, we can just check the focused element's
706         type directly against InputType::None in the if statement of the early return.
707
708         * UIProcess/ios/WebPageProxyIOS.mm:
709         (WebKit::WebPageProxy::setIsShowingInputViewForFocusedElement):
710
711         Add a hook to notify the web process when an input view is showing or not (see below for more detail).
712
713         * WebProcess/WebPage/WebPage.cpp:
714         (WebKit::WebPage::didStartPageTransition):
715         (WebKit::WebPage::elementDidRefocus):
716         (WebKit::WebPage::shouldDispatchUpdateAfterFocusingElement const):
717
718         Add a helper to determine whether we notify the UI process about a newly focused element. On macOS, this is true
719         only when the new focused element is neither the currently focused element, nor the focused element that was
720         just blurred. On iOS, we have an additional constraint that when the input view is not showing, we still need to
721         notify the UI process, since the UI process might want to begin showing the keyboard for an element that has
722         only been programmatically focused, for which we aren't currently showing the input view.
723
724         (WebKit::WebPage::elementDidFocus):
725         (WebKit::WebPage::elementDidBlur):
726
727         Replace a couple of existing member variables in WebPage used for focus management:
728         -   Replace m_hasPendingBlurNotification with m_recentlyBlurredElement, a RefPtr to the Element that is being
729             blurred. Behavior here is the same as before (i.e. having a pending blur notification is equivalent to
730             having recently blurred a focused element). However, this allows us to check newly focused elements against
731             the recently blurred element in WebPage::elementDidFocus().
732         -   Replace m_isFocusingElementDueToUserInteraction with m_isShowingInputViewForFocusedElement. The flag
733             m_isFocusingElementDueToUserInteraction was originally added to fix <webkit.org/b/146735>, by ensuring that
734             we don't send redundant ElementDidFocus (formerly, StartAssistingNode) messages to the UI process even when
735             the keyboard is already up. In these simpler times, user interaction when focusing an element was equivalent
736             to showing an input view for the focused element. However, in today's world, there are a variety of reasons
737             why we might or might not show an input view for a given element (including, but not limited to activity
738             state changes and decisions made by _WKInputDelegate). As such, it doesn't make sense to continue relying on
739             m_isFocusingElementDueToUserInteraction in this early return. Instead, have the UI process propagate a
740             message back to the web process, to let it know whether there is a keyboard showing, and use this flag
741             instead.
742
743         * WebProcess/WebPage/WebPage.h:
744         * WebProcess/WebPage/WebPage.messages.in:
745         * WebProcess/WebPage/ios/WebPageIOS.mm:
746         (WebKit::WebPage::setIsShowingInputViewForFocusedElement):
747
748 2019-03-12  Tim Horton  <timothy_horton@apple.com>
749
750         More attempts at build fixing.
751
752         * UIProcess/ios/WKActionSheetAssistant.mm:
753         Yet more.
754
755 2019-03-12  Chris Dumez  <cdumez@apple.com>
756
757         Device Orientation access permission should be denied unless explicitly granted by the client
758         https://bugs.webkit.org/show_bug.cgi?id=195625
759
760         Reviewed by Youenn Fablet.
761
762         Device Orientation access permission should be denied unless explicitly granted by the client.
763         Previously, it was granted by default.
764
765         * UIProcess/API/APIUIClient.h:
766         (API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
767         * UIProcess/API/C/WKPage.cpp:
768         (WKPageSetPageUIClient):
769         * UIProcess/Cocoa/UIDelegate.mm:
770         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
771
772 2019-03-12  Antti Koivisto  <antti@apple.com>
773
774         [iOS] Enable asynchronous frame scrolling by default
775         https://bugs.webkit.org/show_bug.cgi?id=195622
776         <rdar://problem/48658028>
777
778         Reviewed by Simon Fraser
779
780         * Shared/WebPreferences.yaml:
781         * Shared/WebPreferencesDefaultValues.h:
782
783 2019-03-12  Per Arne Vollan  <pvollan@apple.com>
784
785         [iOS] Block access to backboardd service
786         https://bugs.webkit.org/show_bug.cgi?id=195484
787
788         Reviewed by Brent Fulgham.
789
790         This patch is addressing blocking the backboardd service "com.apple.backboard.hid.services". Getting the
791         backlight level in the WebContent process will initiate a connection with this service. To be able to
792         block the service, the backlight level is queried in the UI process and sent to the WebContent process
793         when the WebContent process is started, and when the backlight level is changed. On the WebContent side,
794         the method getting the backlight level is swizzled to return the value sent from the UI process.
795
796         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
797         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
798         (WebKit::WebProcessPool::displayBrightness):
799         (WebKit::WebProcessPool::backlightLevelDidChangeCallback):
800         (WebKit::WebProcessPool::registerNotificationObservers):
801         (WebKit::WebProcessPool::unregisterNotificationObservers):
802         * UIProcess/WebProcessPool.cpp:
803         (WebKit::WebProcessPool::initializeNewWebProcess):
804         * UIProcess/WebProcessPool.h:
805         * WebProcess/WebProcess.h:
806         * WebProcess/WebProcess.messages.in:
807         * WebProcess/cocoa/WebProcessCocoa.mm:
808         (WebKit::currentBacklightLevel):
809         (WebKit::WebProcess::backlightLevelDidChange):
810
811 2019-03-12  Tim Horton  <timothy_horton@apple.com>
812
813         Fix the build after 242801
814
815         * UIProcess/ios/WKActionSheetAssistant.mm:
816         (-[WKActionSheetAssistant _elementActionForDDAction:]):
817         More.
818
819 2019-03-12  Tim Horton  <timothy_horton@apple.com>
820
821         Fix the build after 242801
822
823         * UIProcess/ios/WKActionSheetAssistant.mm:
824         (-[WKActionSheetAssistant _elementActionForDDAction:]):
825
826 2019-03-12  Eric Carlson  <eric.carlson@apple.com>
827
828         [iOS] Sandbox must allow mach lookup required to compress video
829         https://bugs.webkit.org/show_bug.cgi?id=195627
830         <rdar://problem/48811072>
831
832         Reviewed by Youenn Fablet.
833
834         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
835
836 2019-03-12  Jennifer Moore  <jennifer.moore@apple.com>
837
838         Check whether to launch a default action instead of action sheet
839         https://bugs.webkit.org/show_bug.cgi?id=195225
840         <rdar://problem/47715544>
841
842         Reviewed by Daniel Bates and Tim Horton.
843
844         Notify DataDetectors at the start of a touch on a link, and check whether to immediately
845         launch the default action instead of an action sheet.
846
847         * UIProcess/ios/WKActionSheetAssistant.h:
848         * UIProcess/ios/WKActionSheetAssistant.mm:
849         (-[WKActionSheetAssistant interactionDidStart]):
850         (-[WKActionSheetAssistant _createSheetWithElementActions:defaultTitle:showLinkTitle:]):
851         (-[WKActionSheetAssistant showImageSheet]):
852         (-[WKActionSheetAssistant showLinkSheet]):
853         (-[WKActionSheetAssistant showDataDetectorsSheet]):
854         (-[WKActionSheetAssistant _createSheetWithElementActions:showLinkTitle:]): Deleted.
855         * UIProcess/ios/WKContentViewInteraction.mm:
856         (-[WKContentView _webTouchEventsRecognized:]):
857 :
858 2019-03-12  Zalan Bujtas  <zalan@apple.com>
859
860         [Synthetic Click] Dispatch mouseout soon after mouseup
861         https://bugs.webkit.org/show_bug.cgi?id=195575
862         <rdar://problem/47093049>
863
864         Reviewed by Simon Fraser.
865
866         * WebProcess/WebPage/ios/WebPageIOS.mm:
867         (WebKit::WebPage::completeSyntheticClick):
868
869 2019-03-12  Zalan Bujtas  <zalan@apple.com>
870
871         [ContentChangeObserver] Stop content change observation when the touch event turns into long press
872         https://bugs.webkit.org/show_bug.cgi?id=195601
873         <rdar://problem/48796324>
874
875         Reviewed by Wenson Hsieh.
876
877         Add didRecognizeLongPress() message to be able to cancel content observation (started at touchStart).
878
879         * UIProcess/WebPageProxy.h:
880         * UIProcess/ios/WKContentViewInteraction.mm:
881         (-[WKContentView _longPressRecognized:]):
882         * UIProcess/ios/WebPageProxyIOS.mm:
883         (WebKit::WebPageProxy::didRecognizeLongPress):
884         * WebProcess/WebPage/WebPage.h:
885         * WebProcess/WebPage/WebPage.messages.in:
886         * WebProcess/WebPage/ios/WebPageIOS.mm:
887         (WebKit::WebPage::didRecognizeLongPress):
888
889 2019-03-11  Andy Estes  <aestes@apple.com>
890
891         [Mac] Ensure Apple Pay is unavailable when PassKit.framework is missing
892         https://bugs.webkit.org/show_bug.cgi?id=195583
893         <rdar://problem/48420224>
894
895         Reviewed by Daniel Bates.
896
897         PassKit.framework is optionally soft-linked on Mac because it is missing from the Recovery
898         Partition. We need to check if the framework is available before calling into it.
899
900         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
901         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
902         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
903         (WebKit::WebPaymentCoordinatorProxy::platformOpenPaymentSetup):
904         (WebKit::WebPaymentCoordinatorProxy::platformAvailablePaymentNetworks):
905         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
906         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
907
908 2019-03-12  Antti Koivisto  <antti@apple.com>
909
910         Compositing layer that renders two positioned elements should not hit test
911         https://bugs.webkit.org/show_bug.cgi?id=195371
912         <rdar://problem/48649586>
913
914         Reviewed by Simon Fraser.
915
916         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
917         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
918         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
919         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
920         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
921         (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const):
922         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
923
924         Pass event region to UI process.
925
926         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
927         (WebKit::RemoteLayerTreeNode::layerID const):
928         (WebKit::RemoteLayerTreeNode::eventRegion const):
929         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
930         (WebKit::RemoteLayerTreeNode::RemoteLayerTreeNode):
931         (WebKit::RemoteLayerTreeNode::~RemoteLayerTreeNode):
932         (WebKit::RemoteLayerTreeNode::setEventRegion):
933
934         Maintain event region in RemoteLayerTreeNodes.
935
936         (WebKit::RemoteLayerTreeNode::initializeLayer):
937         (WebKit::RemoteLayerTreeNode::layerID):
938         (WebKit::RemoteLayerTreeNode::forCALayer):
939
940         Move layerID to RemoteLayerTreeNode and store RemoteLayerTreeNode pointer to CALayers instead.
941         This makes it easy to find the matching RemoteLayerTreeNode from a layer, globally.
942
943         (WebKit::RemoteLayerTreeNode::setLayerID): Deleted.
944         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
945         (WebKit::collectDescendantViewsAtPoint):
946
947         If we have event region, use it for hit testing.
948
949         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
950         (collectDescendantViewsAtPoint): Deleted.
951         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
952         (WebKit::PlatformCALayerRemote::eventRegion const):
953         (WebKit::PlatformCALayerRemote::setEventRegion):
954         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
955
956 2019-03-12  Carlos Garcia Campos  <cgarcia@igalia.com>
957
958         [WPE][GTK] Load events may occur in unexpected order when JS redirects page before subresource load finishes
959         https://bugs.webkit.org/show_bug.cgi?id=194131
960
961         Reviewed by Michael Catanzaro.
962
963         Ensure we emit the load-failed and load-changed with finished event when there's still an ongoing load when a
964         new provisional load strarts. Previous load fails with cancelled error.
965
966         * UIProcess/API/glib/WebKitWebView.cpp:
967         (webkitWebViewWillStartLoad): Call webkitWebViewLoadFailed() if current page load state is not finished.
968         * UIProcess/API/glib/WebKitWebViewPrivate.h:
969         * UIProcess/API/gtk/PageClientImpl.cpp:
970         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame): Call webkitWebViewWillStartLoad().
971         * UIProcess/API/wpe/APIViewClient.h:
972         (API::ViewClient::willStartLoad): Add willStartLoad() to API::ViewClient
973         * UIProcess/API/wpe/PageClientImpl.cpp:
974         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame): Call WPEView::willStartLoad().
975         * UIProcess/API/wpe/PageClientImpl.h:
976         * UIProcess/API/wpe/WPEView.cpp:
977         (WKWPE::View::willStartLoad): Call API::ViewClient::willStartLoad().
978         * UIProcess/API/wpe/WPEView.h:
979         * UIProcess/PageLoadState.h:
980         (WebKit::PageLoadState::isProvisional const):
981         (WebKit::PageLoadState::isCommitted const):
982         (WebKit::PageLoadState::isFinished const):
983
984 2019-03-11  Ryan Haddad  <ryanhaddad@apple.com>
985
986         Unreviewed, rolling out r242763.
987
988         Causes layout test crashes on iOS simulator
989
990         Reverted changeset:
991
992         "[Synthetic Click] Dispatch mouseout soon after mouseup"
993         https://bugs.webkit.org/show_bug.cgi?id=195575
994         https://trac.webkit.org/changeset/242763
995
996 2019-03-11  Ross Kirsling  <ross.kirsling@sony.com>
997
998         Add Optional to Forward.h.
999         https://bugs.webkit.org/show_bug.cgi?id=195586
1000
1001         Reviewed by Darin Adler.
1002
1003         * Shared/RTCNetwork.cpp:
1004         * Shared/RTCNetwork.h:
1005         * Shared/RTCPacketOptions.cpp:
1006         * Shared/RTCPacketOptions.h:
1007         * UIProcess/API/APIWebsitePolicies.h:
1008         * UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
1009         Remove unnecessary includes from headers.
1010
1011 2019-03-11  Commit Queue  <commit-queue@webkit.org>
1012
1013         Unreviewed, rolling out r242745 and r242756.
1014         https://bugs.webkit.org/show_bug.cgi?id=195606
1015
1016         Breaks internal builds (Requested by ryanhaddad on #webkit).
1017
1018         Reverted changesets:
1019
1020         "[iOS] Block access to backboardd service"
1021         https://bugs.webkit.org/show_bug.cgi?id=195484
1022         https://trac.webkit.org/changeset/242745
1023
1024         "Unreviewed build fix after r242745."
1025         https://trac.webkit.org/changeset/242756
1026
1027 2019-03-11  Fujii Hironori  <Hironori.Fujii@sony.com>
1028
1029         [CoordinatedGraphics] ASSERTION FAILED: !m_state.isSuspended
1030         https://bugs.webkit.org/show_bug.cgi?id=195550
1031
1032         Reviewed by Carlos Garcia Campos.
1033
1034         CompositingRunLoop::suspend() locks a mutex and stops the update
1035         timer. But, the timer can be fired after the lock was acquired and
1036         before the timer is stopped.
1037
1038         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
1039         (WebKit::CompositingRunLoop::updateTimerFired): Removed the
1040         assertion. Return early if m_state.isSuspended.
1041
1042 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
1043
1044         [macOS] Remove the Kerberos rules from the WebContent sandbox
1045         https://bugs.webkit.org/show_bug.cgi?id=195464
1046         <rdar://problem/35369230>
1047
1048         Reviewed by Brent Fulgham.
1049
1050         Kerberos auth is done in the UIProcess or NetworkProcess now.
1051
1052         * WebProcess/com.apple.WebProcess.sb.in:
1053
1054 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
1055
1056         [iOS] Add entitlement to enable use of graphics endpoint with limited capabilities
1057         https://bugs.webkit.org/show_bug.cgi?id=195582
1058         <rdar://problem/36082379>
1059
1060         Reviewed by Brent Fulgham.
1061
1062         This is a QuartzCore endpoint with a minimal set of capabilities.
1063
1064         * Configurations/WebContent-iOS.entitlements:
1065
1066 2019-03-11  John Wilander  <wilander@apple.com>
1067
1068         Move NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm functionality into UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
1069         https://bugs.webkit.org/show_bug.cgi?id=195117
1070         <rdar://problem/48448715>
1071
1072         Reviewed by Brent Fulgham.
1073
1074         Reading of user defaults on Cocoa platforms should be done in the UI process and
1075         forwarded to Resource Load Statistics in the network process through the
1076         WebKit::NetworkSessionCreationParameters struct.
1077
1078         This patch does away with some old user defaults we don't use anymore. It also
1079         changes the developer-facing default name to ITPManualPrevalentResource.
1080
1081         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1082         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
1083             Removed the call to the old registerUserDefaultsIfNeeded().
1084         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1085         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
1086             Removed the call to the old registerUserDefaultsIfNeeded().
1087         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
1088             Removed the declaration of the old registerUserDefaultsIfNeeded().
1089         * NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm: Removed.
1090         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1091             Added an enum class EnableResourceLoadStatisticsDebugMode.
1092         * NetworkProcess/NetworkSession.cpp:
1093         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
1094         * NetworkProcess/NetworkSession.h:
1095         * NetworkProcess/NetworkSessionCreationParameters.cpp:
1096         (WebKit::NetworkSessionCreationParameters::encode const):
1097         (WebKit::NetworkSessionCreationParameters::decode):
1098         * NetworkProcess/NetworkSessionCreationParameters.h:
1099            The struct now has two new fields:
1100            - enableResourceLoadStatisticsDebugMode
1101            - resourceLoadStatisticsManualPrevalentResource
1102         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1103         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1104             Forwarding of the parameters.
1105         * SourcesCocoa.txt:
1106         * UIProcess/WebProcessPool.cpp:
1107         (WebKit::WebProcessPool::ensureNetworkProcess):
1108             Forwarding of the parameters.
1109         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1110         (WebKit::WebsiteDataStore::parameters):
1111             This is where user defaults for Resource Load Statistics are now read.
1112         * WebKit.xcodeproj/project.pbxproj:
1113
1114 2019-03-11  Zalan Bujtas  <zalan@apple.com>
1115
1116         [Synthetic Click] Dispatch mouseout soon after mouseup
1117         https://bugs.webkit.org/show_bug.cgi?id=195575
1118         <rdar://problem/47093049>
1119
1120         Reviewed by Simon Fraser.
1121
1122         * WebProcess/WebPage/ios/WebPageIOS.mm:
1123         (WebKit::WebPage::completeSyntheticClick):
1124
1125 2019-03-11  Tim Horton  <timothy_horton@apple.com>
1126
1127         API test WebKit.RequestTextInputContext fails on iOS
1128         https://bugs.webkit.org/show_bug.cgi?id=195585
1129
1130         Reviewed by Wenson Hsieh and Simon Fraser.
1131
1132         * UIProcess/API/Cocoa/WKWebView.mm:
1133         (-[WKWebView _convertRectFromRootViewCoordinates:]):
1134         (-[WKWebView _convertRectToRootViewCoordinates:]):
1135         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
1136         (-[WKWebView _focusTextInputContext:completionHandler:]):
1137         * WebProcess/WebPage/WebPage.cpp:
1138         (WebKit::elementRectInRootViewCoordinates):
1139         (WebKit::WebPage::textInputContextsInRect):
1140         (WebKit::elementRectInWindowCoordinates): Deleted.
1141         Text input context SPI should be in terms of WKWebView coordinates,
1142         for consistency's sake. This is a bit irritating; WebPage(Proxy) continue
1143         to operate in "root view" coordinates, which means different things
1144         depending on if delegatesScrolling is true or not. So, WKWebView does
1145         the conversion, re-creating objects as needed.
1146
1147 2019-03-09  Jiewen Tan  <jiewen_tan@apple.com>
1148
1149         Optimizing loads when creating new pages
1150         https://bugs.webkit.org/show_bug.cgi?id=195516
1151         <rdar://problem/48738086>
1152
1153         Reviewed by Darin Adler.
1154
1155         This patch adds hooks in WebPageProxy::createNewPage to optimize loads, and moves the creationParameters
1156         of API::NavigationAction from UI clients to WebPageProxy::createNewPage. Also, we now pass the whole
1157         API::NavigationAction to the load optimizer instead of the request within.
1158
1159         * UIProcess/API/APINavigationAction.h:
1160         * UIProcess/API/APIUIClient.h:
1161         (API::UIClient::createNewPage):
1162         * UIProcess/API/C/WKPage.cpp:
1163         (WKPageSetPageUIClient):
1164         * UIProcess/API/glib/WebKitUIClient.cpp:
1165         * UIProcess/Cocoa/NavigationState.mm:
1166         (WebKit::tryOptimizingLoad):
1167         (WebKit::tryInterceptNavigation):
1168         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1169         * UIProcess/Cocoa/UIDelegate.h:
1170         * UIProcess/Cocoa/UIDelegate.mm:
1171         (WebKit::UIDelegate::UIClient::createNewPage):
1172         * UIProcess/WebPageProxy.cpp:
1173         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1174         (WebKit::tryOptimizingLoad):
1175         (WebKit::WebPageProxy::createNewPage):
1176         * UIProcess/WebPageProxy.h:
1177
1178 2019-03-11  Dean Jackson  <dino@apple.com>
1179
1180         [iOS] Implement a faster click detection that intercepts double-tap-to-zoom if possible
1181         https://bugs.webkit.org/show_bug.cgi?id=195473
1182         <rdar://problem/48718396>
1183
1184         Reviewed by Wenson Hsieh (with some help from Dan Bates).
1185
1186         Adds a new algorithm, behind a flag FasterClicksEnabled, that can trigger a click
1187         event without waiting to see if a double tap will occur. It does this by examining
1188         the amount of zoom that would be triggered if it was a double tap, and if that value
1189         doesn't exceed a set threshold, commits to the click event instead.
1190
1191         This is implemented by having the Web Process respond to the potential click with
1192         some geometry information. If the UI Process receives the information before the
1193         second tap in a double tap, it can decide to trigger a click.
1194
1195         * Shared/WebPreferences.yaml: New internal feature so this can be toggled in
1196             a UI for testing.
1197
1198         * SourcesCocoa.txt: Renamed WKSyntheticTapGestureRecognizer.
1199         * WebKit.xcodeproj/project.pbxproj: Ditto.
1200
1201         * UIProcess/ios/WKSyntheticTapGestureRecognizer.h:
1202         * UIProcess/ios/WKSyntheticTapGestureRecognizer.m:
1203         (-[WKSyntheticTapGestureRecognizer setGestureIdentifiedTarget:action:]):
1204         (-[WKSyntheticTapGestureRecognizer setGestureFailedTarget:action:]):
1205         (-[WKSyntheticTapGestureRecognizer setResetTarget:action:]):
1206         (-[WKSyntheticTapGestureRecognizer setState:]):
1207         (-[WKSyntheticTapGestureRecognizer reset]):  Renamed WKSyntheticClickTapGestureRecognizer to
1208             WKSyntheticTapGestureRecognizer, changed the signature of the main function to be a bit
1209             more clear about what it does, and added a gesture failed target.
1210
1211         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1212         * UIProcess/API/Cocoa/WKWebView.mm:
1213         (-[WKWebView _initialScaleFactor]):
1214         (-[WKWebView _contentZoomScale]):
1215         (-[WKWebView _targetContentZoomScaleForRect:currentScale:fitEntireRect:minimumScale:maximumScale:]):
1216             Exposed the initial content scale, the current scale and added a declaration that
1217             was missing from the .h.
1218
1219         * UIProcess/WebPageProxy.messages.in: Add a new message,
1220             HandleSmartMagnificationInformationForPotentialTap, to
1221             communicate the geometry of the clicked node to the UI Process.
1222
1223         * UIProcess/PageClient.h: Pure virtual function for the geometry message response.
1224         * UIProcess/WebPageProxy.h: Ditto.
1225
1226         * UIProcess/ios/PageClientImplIOS.h: Calls into the WKContentView.
1227         * UIProcess/ios/PageClientImplIOS.mm:
1228         (WebKit::PageClientImpl::handleSmartMagnificationInformationForPotentialTap):
1229
1230         * UIProcess/ios/SmartMagnificationController.h:
1231         * UIProcess/ios/SmartMagnificationController.mm:
1232         (WebKit::SmartMagnificationController::calculatePotentialZoomParameters): A new method that
1233             asks the WKContentView to work out what the zoom factor will be for a potential double
1234             tap at a location.
1235         (WebKit::SmartMagnificationController::smartMagnificationTargetRectAndZoomScales): New implementation
1236             of this function to avoid multiple out-arguments.
1237
1238         * UIProcess/ios/WKContentView.h:
1239         * UIProcess/ios/WKContentView.mm:
1240         (-[WKContentView _initialScaleFactor]):
1241         (-[WKContentView _contentZoomScale]):
1242         (-[WKContentView _targetContentZoomScaleForRect:currentScale:fitEntireRect:minimumScale:maximumScale:]):
1243             Exposed the initial content scale, the current scale and the target zoom scale. These
1244             all just call into the WKWebView implementation.
1245
1246         * UIProcess/ios/WKContentViewInteraction.h:
1247         * UIProcess/ios/WKContentViewInteraction.mm:
1248         (-[WKContentView _createAndConfigureDoubleTapGestureRecognizer]): Use a WKSyntheticTapGestureRecognizer instead
1249             of a generic one, so we can capture the failure.
1250         (-[WKContentView setupInteraction]):
1251         (-[WKContentView cleanupInteraction]):
1252         (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:origin:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:]):
1253             New method that responds to the incoming Web Process message, and decides if any
1254             potential zoom would be "significant".
1255         (-[WKContentView _singleTapIdentified:]):
1256         (-[WKContentView _doubleTapDidFail:]):
1257         (-[WKContentView _didCompleteSyntheticClick]):
1258         (-[WKContentView _singleTapRecognized:]):
1259         (-[WKContentView _doubleTapRecognized:]):
1260             Add some release logging.
1261         (-[WKContentView _singleTapCommited:]): Deleted.
1262
1263         * UIProcess/ios/WebPageProxyIOS.mm:
1264         (WebKit::WebPageProxy::potentialTapAtPosition):
1265         (WebKit::WebPageProxy::handleSmartMagnificationInformationForPotentialTap):
1266         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
1267         * WebProcess/WebPage/WebPage.h:
1268         * WebProcess/WebPage/WebPage.messages.in:
1269             Removed an unused parameter from the existing message.
1270
1271         * WebProcess/WebPage/ios/WebPageIOS.mm:
1272         (WebKit::WebPage::potentialTapAtPosition): Calculates the geometry of the element
1273         if requested, and sends it to the UIProcess.
1274
1275 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
1276
1277         Unreviewed build fix after r242745.
1278
1279         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1280         (WebKit::WebProcessPool::registerNotificationObservers):
1281         (WebKit::WebProcessPool::unregisterNotificationObservers):
1282
1283 2019-03-11  Chris Dumez  <cdumez@apple.com>
1284
1285         Assert in WebPageProxy::suspendCurrentPageIfPossible()
1286         https://bugs.webkit.org/show_bug.cgi?id=195506
1287         <rdar://problem/48733477>
1288
1289         Reviewed by Alex Christensen.
1290
1291         The crash was caused by the top-hit preloading logic in MobileSafari which creates a new Web view that is *related*
1292         to the previous one, restores the session state onto it and then triggers a load in this new Web view.
1293
1294         Initially, the 2 Web views use the same process as they are related. However, if the new load's URL is cross-site
1295         with regards to the first view's URL, then we decide to process swap in the new view. This process swap makes
1296         sense from a security standpoint. However, when we commit the load in the new process and call
1297         suspendCurrentPageIfPossible() we end up in an unexpected state because we have a fromItem (due to the session
1298         state having been restored on the new view) but we haven't committed any load yet in this new view.
1299
1300         To address the issue, suspendCurrentPageIfPossible() now returns early and does not attempt to suspend anything
1301         if we have not committed any load yet.
1302
1303         * UIProcess/WebPageProxy.cpp:
1304         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
1305         Do not attempt to suspend to current page if we have not committed any provisional load yet.
1306
1307 2019-03-11  Chris Dumez  <cdumez@apple.com>
1308
1309         Update device orientation & motion permission native SPI as per latest proposal
1310         https://bugs.webkit.org/show_bug.cgi?id=195567
1311
1312         Reviewed by Youenn Fablet.
1313
1314         The native SPI is now:
1315         +- (void)_webView:(WKWebView *)webView shouldAllowDeviceOrientationAndMotionAccessRequestedByFrame:(WKFrameInfo *)frameInfo decisionHandler:(void (^)(BOOL))decisionHandler;
1316
1317         * UIProcess/API/APIUIClient.h:
1318         (API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
1319         * UIProcess/API/C/WKPage.cpp:
1320         (WKPageSetPageUIClient):
1321         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1322         * UIProcess/Cocoa/UIDelegate.h:
1323         * UIProcess/Cocoa/UIDelegate.mm:
1324         (WebKit::UIDelegate::setDelegate):
1325         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
1326         * UIProcess/WebPageProxy.cpp:
1327         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
1328         * UIProcess/WebPageProxy.h:
1329         * UIProcess/WebPageProxy.messages.in:
1330         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1331         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
1332         * WebProcess/WebCoreSupport/WebChromeClient.h:
1333         * WebProcess/WebPage/WebPage.cpp:
1334         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
1335         * WebProcess/WebPage/WebPage.h:
1336
1337 2019-03-11  Andy Estes  <aestes@apple.com>
1338
1339         [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
1340         https://bugs.webkit.org/show_bug.cgi?id=195530
1341         <rdar://problem/48747164>
1342
1343         Reviewed by Alex Christensen.
1344
1345         * Configurations/Network-iOS.entitlements: Added the 'com.apple.payment.all-access'
1346         entitlement and reordered the others.
1347
1348         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1349         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): Forwarded
1350         WebPaymentCoordinatorProxy messages to the payment coordinator.
1351         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage): Ditto.
1352         (WebKit::NetworkConnectionToWebProcess::didClose): Set m_paymentCoordinator to nullptr.
1353         * NetworkProcess/NetworkConnectionToWebProcess.h: Inherited from
1354         WebPaymentCoordinatorProxy::Client and added a unique_ptr<WebPaymentCoordinatorProxy> member.
1355
1356         * NetworkProcess/cocoa/NetworkSessionCocoa.h: Declared getters for source application bundle
1357         and secondary identifiers, and CTDataConnectionServiceType on iOS.
1358         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1359         (WebKit::NetworkSessionCocoa::sourceApplicationBundleIdentifier const): Defined getter.
1360         (WebKit::NetworkSessionCocoa::sourceApplicationSecondaryIdentifier const): Ditto.
1361         (WebKit::NetworkSessionCocoa::ctDataConnectionServiceType const): Ditto.
1362         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Initialized
1363         m_sourceApplicationBundleIdentifier and m_sourceApplicationSecondaryIdentifier with
1364         corresponding NetworkSessionCreationParameters.
1365
1366         * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm: Added.
1367         (WebKit::NetworkConnectionToWebProcess::paymentCoordinator): Added. Returns
1368         m_paymentCoordinator after lazily initializing it.
1369         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorConnection): Added. Returns the
1370         connection to the web process.
1371         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorPresentingViewController): Added.
1372         Returns nil.
1373         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType):
1374         Added. Returns the value from the network session identified by sessionID.
1375         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationBundleIdentifier):
1376         Ditto.
1377         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationSecondaryIdentifier):
1378         Ditto.
1379         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAuthorizationPresenter): Added.
1380         Returns a new PaymentAuthorizationController.
1381         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAddMessageReceiver): Added empty
1382         definition. NetworkConnectionToWebProcess explicitly forwards WebPaymentCoordinatorProxy
1383         messages to its payment coordinator, so there's no need to register with a MessageReceiverMap.
1384         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorRemoveMessageReceiver): Ditto.
1385
1386         * Platform/ios/PaymentAuthorizationController.h: Added. Declares a
1387         PaymentAuthorizationPresenter subclass based on PKPaymentAuthorizationController.
1388         * Platform/ios/PaymentAuthorizationController.mm: Added.
1389         (-[WKPaymentAuthorizationControllerDelegate initWithRequest:presenter:]):
1390         Initialized WKPaymentAuthorizationDelegate with request and presenter.
1391         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationControllerDidFinish:]):
1392         Forwarded call to WKPaymentAuthorizationDelegate.
1393         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didAuthorizePayment:handler:]):
1394         Ditto.
1395         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingMethod:handler:]):
1396         Ditto.
1397         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingContact:handler:]):
1398         Ditto.
1399         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectPaymentMethod:handler:]):
1400         Ditto.
1401         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:willFinishWithError:]):
1402         Ditto.
1403         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didRequestMerchantSession:]):
1404         Ditto.
1405         (WebKit::PaymentAuthorizationController::PaymentAuthorizationController):
1406         Initialized m_controller with a new PKPaymentAuthorizationController and m_delegate with a
1407         new WKPaymentAuthorizationControllerDelegate.
1408         (WebKit::PaymentAuthorizationController::platformDelegate): Returned m_delegate.
1409         (WebKit::PaymentAuthorizationController::dismiss): Dismissed the controller, set its
1410         delegates to nil, set m_controller to nil, invalidated the delegate, and set m_delegate to
1411         nil.
1412         (WebKit::PaymentAuthorizationController::present): Called -presentWithCompletion: on the
1413         controller, forwarding the passed-in completion handler.
1414         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Allowed PassKit to look up
1415         the "com.apple.passd.in-app-payment" and "com.apple.passd.library" service endpoints.
1416
1417         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
1418         (WebKit::WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy): Changed to call
1419         paymentCoordinatorAddMessageReceiver.
1420         (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy): Changed to call
1421         paymentCoordinatorRemoveMessageReceiver.
1422         (WebKit::WebPaymentCoordinatorProxy::messageSenderDestinationID const): Deleted.
1423         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard): Passed sessionID to
1424         platformCanMakePaymentsWithActiveCard.
1425         (WebKit::WebPaymentCoordinatorProxy::showPaymentUI): Stored destinationID and passed
1426         sessionID to platformShowPaymentUI.
1427         (WebKit::WebPaymentCoordinatorProxy::cancelPaymentSession): Changed to account for new
1428         behavior of didCancelPaymentSession.
1429         (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession): Changed to call hidePaymentUI.
1430         (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Changed to only call hidePaymentUI
1431         when didReachFinalState is true, since didCancelPaymentSession is called otherwise.
1432         (WebKit::WebPaymentCoordinatorProxy::didReachFinalState): Cleared m_destinationID.
1433         * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Added m_destionationID member.
1434         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: Changed
1435         CanMakePaymentsWithActiveCard and ShowPaymentUI messages to take destinationID and sessionID
1436         arguments.
1437
1438         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1439         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard): Passed
1440         sessionID to paymentCoordinatorSourceApplicationSecondaryIdentifier.
1441         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Passed sessionID to various
1442         m_client call sites.
1443
1444         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
1445         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
1446         platformPaymentRequest.
1447         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
1448         before calling dismiss.
1449
1450         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
1451         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
1452         platformPaymentRequest.
1453         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
1454         before calling dismiss.
1455
1456         * Shared/WebPreferences.yaml: Added ApplePayRemoteUIEnabled as an internal preference.
1457
1458         * SourcesCocoa.txt: Added NetworkConnectionToWebProcessIOS.mm and
1459         PaymentAuthorizationController.mm.
1460
1461         * UIProcess/AuxiliaryProcessProxy.h:
1462         (WebKit::AuxiliaryProcessProxy::messageReceiverMap): Deleted.
1463
1464         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1465         (WebKit::WebPageProxy::paymentCoordinatorConnection): Moved from WebPageProxy.cpp.
1466         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
1467         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
1468         (WebKit::WebPageProxy::paymentCoordinatorAddMessageReceiver): Ditto.
1469         (WebKit::WebPageProxy::paymentCoordinatorRemoveMessageReceiver): Ditto.
1470
1471         * UIProcess/WebPageProxy.cpp:
1472         (WebKit::WebPageProxy::paymentCoordinatorConnection): Moved to WebPageProxyCocoa.mm.
1473         (WebKit::WebPageProxy::paymentCoordinatorMessageReceiver): Ditto.
1474         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
1475         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
1476         (WebKit::WebPageProxy::paymentCoordinatorDestinationID): Ditto.
1477         * UIProcess/WebPageProxy.h:
1478
1479         * UIProcess/ios/WebPageProxyIOS.mm:
1480         (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType): Asserted that
1481         sessionID equals the website data store's sessionID.
1482
1483         * WebKit.xcodeproj/project.pbxproj:
1484
1485         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
1486         (WebKit::WebPaymentCoordinator::networkProcessConnectionClosed): Added. Cancels the current
1487         session if Apple Pay Remote UI is enabled and the network process connection closes.
1488         (WebKit::WebPaymentCoordinator::availablePaymentNetworks): Changed to account for
1489         WebPaymentCoordinator being an IPC::MessageSender.
1490         (WebKit::WebPaymentCoordinator::canMakePayments): Ditto.
1491         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard): Ditto.
1492         (WebKit::WebPaymentCoordinator::openPaymentSetup): Ditto.
1493         (WebKit::WebPaymentCoordinator::showPaymentUI): Ditto.
1494         (WebKit::WebPaymentCoordinator::completeMerchantValidation): Ditto.
1495         (WebKit::WebPaymentCoordinator::completeShippingMethodSelection): Ditto.
1496         (WebKit::WebPaymentCoordinator::completeShippingContactSelection): Ditto.
1497         (WebKit::WebPaymentCoordinator::completePaymentMethodSelection): Ditto.
1498         (WebKit::WebPaymentCoordinator::completePaymentSession): Ditto.
1499         (WebKit::WebPaymentCoordinator::abortPaymentSession): Ditto.
1500         (WebKit::WebPaymentCoordinator::cancelPaymentSession): Ditto.
1501         (WebKit::WebPaymentCoordinator::messageSenderConnection const): Added. Returns a connection
1502         to the network process if Apple Pay Remote UI is enabled. Otherwise, returned the web
1503         process's parent connection.
1504         (WebKit::WebPaymentCoordinator::messageSenderDestinationID const): Added. Returns the web
1505         page's ID.
1506         (WebKit::WebPaymentCoordinator::remoteUIEnabled const): Added. Calls Settings::applePayRemoteUIEnabled.
1507         * WebProcess/ApplePay/WebPaymentCoordinator.h: Inherited from IPC::MessageSender.
1508
1509         * WebProcess/Network/NetworkProcessConnection.cpp:
1510         (WebKit::NetworkProcessConnection::didReceiveMessage): Forwarded WebPaymentCoordinator
1511         messages to the payment coordinator of the web page matching the decoder's destination ID.
1512         (WebKit::NetworkProcessConnection::didReceiveSyncMessage): Ditto for sync messages.
1513
1514         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1515         (WebKit::WebPage::paymentCoordinator): Added a payment coordinator getter.
1516         * WebProcess/WebPage/WebPage.h: Ditto.
1517
1518         * WebProcess/WebProcess.cpp:
1519         (WebKit::WebProcess::networkProcessConnectionClosed): Called
1520         WebPaymentCoordinator::networkProcessConnectionClosed when the network process connection
1521         closes.
1522
1523 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
1524
1525         [iOS] Block access to backboardd service
1526         https://bugs.webkit.org/show_bug.cgi?id=195484
1527
1528         Reviewed by Brent Fulgham.
1529
1530         This patch is addressing blocking the backboardd service "com.apple.backboard.hid.services". Getting the
1531         backlight level in the WebContent process will initiate a connection with this service. To be able to
1532         block the service, the backlight level is queried in the UI process and sent to the WebContent process
1533         when the WebContent process is started, and when the backlight level is changed. On the WebContent side,
1534         the method getting the backlight level is swizzled to return the value sent from the UI process.
1535
1536         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1537         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1538         (WebKit::WebProcessPool::displayBrightness):
1539         (WebKit::WebProcessPool::backlightLevelDidChangeCallback):
1540         (WebKit::WebProcessPool::registerNotificationObservers):
1541         (WebKit::WebProcessPool::unregisterNotificationObservers):
1542         * UIProcess/WebProcessPool.cpp:
1543         (WebKit::WebProcessPool::initializeNewWebProcess):
1544         * UIProcess/WebProcessPool.h:
1545         * WebProcess/WebProcess.h:
1546         * WebProcess/WebProcess.messages.in:
1547         * WebProcess/cocoa/WebProcessCocoa.mm:
1548         (WebKit::currentBacklightLevel):
1549         (WebKit::WebProcess::backlightLevelDidChange):
1550
1551 2019-03-11  Brent Fulgham  <bfulgham@apple.com>
1552
1553         Remove obsolete runtime flag for StorageAccess API Prompt
1554         https://bugs.webkit.org/show_bug.cgi?id=195564
1555         <rdar://problem/37279014>
1556
1557         Reviewed by Chris Dumez.
1558
1559         This bug tracks the work of removing the obsolete flag that had been used to optionally
1560         prevent display of the StorageAccess API prompt. We have since shipped the final version
1561         of this feature with an always-on prompt, and should have removed this runtime flag.
1562
1563         No test changes because this has no change in behavior. Tests already assume the prompt
1564         behavior, and did not test turning the flag off.
1565
1566         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1567         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
1568         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
1569         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1570         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1571         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
1572         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
1573         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
1574         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
1575         (WebKit::ResourceLoadStatisticsStore::debugModeEnabled const):
1576         (WebKit::ResourceLoadStatisticsStore::storageAccessPromptsEnabled const): Deleted.
1577         (WebKit::ResourceLoadStatisticsStore::setStorageAccessPromptsEnabled): Deleted.
1578         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1579         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted):
1580         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
1581         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1582         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1583         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
1584         * NetworkProcess/NetworkConnectionToWebProcess.h:
1585         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1586         * NetworkProcess/NetworkProcess.cpp:
1587         (WebKit::NetworkProcess::requestStorageAccess):
1588         (WebKit::NetworkProcess::requestStorageAccessGranted):
1589         * NetworkProcess/NetworkProcess.h:
1590         * NetworkProcess/NetworkProcess.messages.in:
1591         * Shared/WebPreferences.yaml:
1592         * UIProcess/API/C/WKPreferences.cpp:
1593         (WKPreferencesSetStorageAccessPromptsEnabled): Deleted.
1594         (WKPreferencesGetStorageAccessPromptsEnabled): Deleted.
1595         * UIProcess/API/C/WKPreferencesRef.h:
1596         * UIProcess/API/Cocoa/WKPreferences.mm:
1597         (-[WKPreferences _storageAccessPromptsEnabled]): Deleted.
1598         (-[WKPreferences _setStorageAccessPromptsEnabled:]): Deleted.
1599         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1600         * UIProcess/Network/NetworkProcessProxy.cpp:
1601         (WebKit::NetworkProcessProxy::requestStorageAccess):
1602         * UIProcess/Network/NetworkProcessProxy.h:
1603         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1604         (WebKit::WebsiteDataStore::requestStorageAccess):
1605         * UIProcess/WebsiteData/WebsiteDataStore.h:
1606         * WebProcess/WebPage/WebPage.cpp:
1607         (WebKit::WebPage::requestStorageAccess):
1608
1609 2019-03-11  Alex Christensen  <achristensen@webkit.org>
1610
1611         Add a WKContentRuleList variant that uses copied memory instead of mmap'd shared memory for class A containerized apps
1612         https://bugs.webkit.org/show_bug.cgi?id=195511
1613         <rdar://problem/44873269>
1614
1615         Reviewed by Darin Adler.
1616
1617         * NetworkProcess/NetworkContentRuleListManager.cpp:
1618         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
1619         * NetworkProcess/NetworkContentRuleListManager.h:
1620         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
1621         (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting):
1622         (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting):
1623         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
1624         * NetworkProcess/cache/NetworkCacheFileSystem.h:
1625         * Shared/WebCompiledContentRuleList.cpp:
1626         (WebKit::WebCompiledContentRuleList::usesCopiedMemory const):
1627         (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
1628         (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
1629         (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
1630         (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
1631         (WebKit::WebCompiledContentRuleList::actions const):
1632         * Shared/WebCompiledContentRuleList.h:
1633         * Shared/WebCompiledContentRuleListData.cpp:
1634         (WebKit::WebCompiledContentRuleListData::size const):
1635         (WebKit::WebCompiledContentRuleListData::dataPointer const):
1636         (WebKit::WebCompiledContentRuleListData::encode const):
1637         (WebKit::WebCompiledContentRuleListData::decode):
1638         * Shared/WebCompiledContentRuleListData.h:
1639         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
1640         * UIProcess/API/APIContentRuleList.cpp:
1641         (API::ContentRuleList::usesCopiedMemory const):
1642         * UIProcess/API/APIContentRuleList.h:
1643         * UIProcess/API/APIContentRuleListStore.cpp:
1644         (API::getData):
1645         (API::decodeContentRuleListMetaData):
1646         (API::ContentRuleListStore::readContentsOfFile):
1647         (API::MappedOrCopiedData::dataPointer const):
1648         (API::openAndMapOrCopyContentRuleList):
1649         (API::compiledToFile):
1650         (API::createExtension):
1651         (API::ContentRuleListStore::lookupContentRuleList):
1652         (API::ContentRuleListStore::compileContentRuleList):
1653         (API::ContentRuleListStore::getContentRuleListSource):
1654         (API::openAndMapContentRuleList): Deleted.
1655         * UIProcess/API/APIContentRuleListStore.h:
1656         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
1657         (API::ContentRuleListStore::readContentsOfFile):
1658         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
1659         (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]):
1660         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
1661         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
1662         (-[_WKUserContentFilter usesCopiedMemory]):
1663         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
1664         * WebProcess/UserContent/WebUserContentController.cpp:
1665         (WebKit::WebUserContentController::addContentRuleLists):
1666         * WebProcess/UserContent/WebUserContentController.h:
1667         * WebProcess/WebPage/WebPage.cpp:
1668         (WebKit::m_hostFileDescriptor):
1669
1670 2019-03-11  Chris Dumez  <cdumez@apple.com>
1671
1672         Unreviewed, fix assertions in layout tests on iOS Simulator after r242666.
1673
1674         Log an error but do not crash if we fail to acquire a ProcessAssertion.
1675
1676         * UIProcess/ios/ProcessAssertionIOS.mm:
1677         (WebKit::ProcessAssertion::ProcessAssertion):
1678
1679 2019-03-11  Chris Dumez  <cdumez@apple.com>
1680
1681         WebProcessCache should keep track of processes being added
1682         https://bugs.webkit.org/show_bug.cgi?id=195538
1683
1684         Reviewed by Geoffrey Garen.
1685
1686         WebProcessCache should keep track of processes being added, while they are being
1687         checked for responsiveness. This is useful so that:
1688         - Requests to clear the cache also clear processes being added
1689         - Requests to remove a given process from the cache (either because it crashed
1690           or because it is being used for a history navigation) actually remove the
1691           process if it is still being checked for responsiveness.
1692         - The cached process eviction timer applies to such processes in case something
1693           goes wrong with the code and the pending request does not get processed.
1694
1695         * UIProcess/WebProcessCache.cpp:
1696         (WebKit::generateAddRequestIdentifier):
1697         (WebKit::WebProcessCache::addProcessIfPossible):
1698         (WebKit::WebProcessCache::addProcess):
1699         (WebKit::WebProcessCache::clear):
1700         (WebKit::WebProcessCache::clearAllProcessesForSession):
1701         (WebKit::WebProcessCache::removeProcess):
1702         (WebKit::WebProcessCache::CachedProcess::evictionTimerFired):
1703         (WebKit::WebProcessCache::evictProcess): Deleted.
1704         * UIProcess/WebProcessCache.h:
1705         (WebKit::WebProcessCache::size const):
1706         * UIProcess/WebProcessPool.cpp:
1707         (WebKit::WebProcessPool::processForNavigationInternal):
1708         * UIProcess/WebProcessProxy.cpp:
1709         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
1710
1711 2019-03-11  Alex Christensen  <achristensen@webkit.org>
1712
1713         REGRESSION: ( r240978-r240985 ) [ iOS Release ] Layout Test imported/w3c/web-platform-tests/xhr/send-redirect-post-upload.htm is crashing
1714         https://bugs.webkit.org/show_bug.cgi?id=194523
1715
1716         Reviewed by Alexey Proskuryakov.
1717
1718         Attempt another workaround to prevent crashes.
1719
1720         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1721         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1722         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
1723         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1724         (-[WKNetworkSessionDelegate URLSession:task:needNewBodyStream:]):
1725
1726 2019-03-11  Ryan Haddad  <ryanhaddad@apple.com>
1727
1728         Unreviewed, rolling out r242688, r242643, r242624.
1729
1730         Caused multiple layout test failures and crashes on iOS and macOS.
1731
1732         Reverted changeset:
1733
1734         "requestAnimationFrame should execute before the next frame"
1735         https://bugs.webkit.org/show_bug.cgi?id=177484
1736         https://trac.webkit.org/changeset/242624/webkit
1737
1738         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
1739         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
1740         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
1741         (WebKit::DrawingAreaCoordinatedGraphics::display):
1742         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
1743         (WebKit::LayerTreeHost::layerFlushTimerFired):
1744         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1745         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1746         * WebProcess/WebPage/WebPage.cpp:
1747         (WebKit::WebPage::layoutIfNeeded):
1748         (WebKit::WebPage::willDisplayPage):
1749         (WebKit::WebPage::renderingUpdate): Deleted.
1750         * WebProcess/WebPage/WebPage.h:
1751         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1752         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1753
1754 2019-03-11  Darin Adler  <darin@apple.com>
1755
1756         Specify fixed precision explicitly to prepare to change String::number and StringBuilder::appendNumber floating point behavior
1757         https://bugs.webkit.org/show_bug.cgi?id=195533
1758
1759         Reviewed by Brent Fulgham.
1760
1761         * NetworkProcess/cache/NetworkCache.cpp:
1762         (WebKit::NetworkCache::Cache::dumpContentsToFile): Use appendFixedPrecisionNumber.
1763         * NetworkProcess/cache/NetworkCacheEntry.cpp:
1764         (WebKit::NetworkCache::Entry::asJSON const): Ditto.
1765         * Shared/Gamepad/GamepadData.cpp:
1766         (WebKit::GamepadData::loggingString const): Ditto.
1767         * UIProcess/WebPageProxy.cpp:
1768         (WebKit::WebPageProxy::logDiagnosticMessageWithValue): Use numberToStringFixedPrecision.
1769
1770 2019-03-11  John Wilander  <wilander@apple.com>
1771
1772         Resource Load Statistics: Make it possible exclude localhost from classification
1773         https://bugs.webkit.org/show_bug.cgi?id=195474
1774         <rdar://problem/47520577>
1775
1776         Reviewed by Brent Fulgham.
1777
1778         This patch allows for localhost to be excluded from classification and
1779         treatment as a prevalent resource.
1780
1781         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1782         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
1783         (WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
1784             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
1785         (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
1786             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
1787         (WebKit::ResourceLoadStatisticsDatabaseStore::isPrevalentResource const):
1788             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
1789         (WebKit::ResourceLoadStatisticsDatabaseStore::isVeryPrevalentResource const):
1790             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
1791         (WebKit::ResourceLoadStatisticsDatabaseStore::setVeryPrevalentResource):
1792             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
1793         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1794         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1795         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
1796         (WebKit::ResourceLoadStatisticsMemoryStore::classifyPrevalentResources):
1797             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
1798         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResource):
1799             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
1800         (WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentResource const):
1801             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
1802         (WebKit::ResourceLoadStatisticsMemoryStore::isVeryPrevalentResource const):
1803             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
1804         (WebKit::ResourceLoadStatisticsMemoryStore::setVeryPrevalentResource):
1805             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
1806         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
1807         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
1808         (WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
1809             Now takes a ShouldIncludeLocalhost parameter.
1810         (WebKit::ResourceLoadStatisticsStore::shouldSkip const):
1811             Convenience function, currently supporting the localhost exclusion.
1812         (WebKit::ResourceLoadStatisticsStore::setIsRunningTest):
1813             Test infrastructure.
1814         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
1815         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1816         (WebKit::WebResourceLoadStatisticsStore::setIsRunningTest):
1817             Test infrastructure.
1818         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1819             Now takes a ShouldIncludeLocalhost parameter.
1820         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1821             Defines the new ShouldIncludeLocalhost boolean enum.
1822         * NetworkProcess/NetworkProcess.cpp:
1823         (WebKit::NetworkProcess::setIsRunningResourceLoadStatisticsTest):
1824             Test infrastructure.
1825         * NetworkProcess/NetworkProcess.h:
1826         * NetworkProcess/NetworkProcess.messages.in:
1827         * NetworkProcess/NetworkSession.cpp:
1828         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
1829             Forwards the localhost setting to the create function.
1830         * NetworkProcess/NetworkSession.h:
1831         * NetworkProcess/NetworkSessionCreationParameters.cpp:
1832         (WebKit::NetworkSessionCreationParameters::encode const):
1833         (WebKit::NetworkSessionCreationParameters::decode):
1834         * NetworkProcess/NetworkSessionCreationParameters.h:
1835             New parameter called shouldIncludeLocalhostInResourceLoadStatistics.
1836         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1837         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1838             Picks up the localhost setting from the parameters.
1839         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1840         (WKWebsiteDataStoreSetStatisticsIsRunningTest):
1841             Test infrastructure.
1842         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1843         * UIProcess/Network/NetworkProcessProxy.cpp:
1844         (WebKit::NetworkProcessProxy::setIsRunningResourceLoadStatisticsTest):
1845             Test infrastructure.
1846         * UIProcess/Network/NetworkProcessProxy.h:
1847         * UIProcess/WebProcessPool.cpp:
1848         (WebKit::WebProcessPool::ensureNetworkProcess):
1849             Picks up the localhost setting from the WebsiteDataStore parameters.
1850         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1851         (WebKit::WebsiteDataStore::parameters):
1852             Makes sure Safari does not exclude localhost.
1853         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1854         (WebKit::WebsiteDataStore::setIsRunningResourceLoadStatisticsTest):
1855             Test infrastructure.
1856         * UIProcess/WebsiteData/WebsiteDataStore.h:
1857
1858 2019-03-11  Alex Christensen  <achristensen@webkit.org>
1859
1860         Unreviewed, rolling out r242698.
1861
1862         API test crashes on bots.
1863
1864         Reverted changeset:
1865
1866         "Add a WKContentRuleList variant that uses copied memory
1867         instead of mmap'd shared memory for class A containerized
1868         apps"
1869         https://bugs.webkit.org/show_bug.cgi?id=195511
1870         https://trac.webkit.org/changeset/242698
1871
1872 2019-03-11  Michael Catanzaro  <mcatanzaro@igalia.com>
1873
1874         [WPE] Enable web process sandbox
1875         https://bugs.webkit.org/show_bug.cgi?id=195169
1876
1877         Reviewed by Daniel Bates.
1878
1879         * PlatformWPE.cmake:
1880         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
1881         (WebKit::bubblewrapSpawn):
1882
1883 2019-03-11  Truitt Savell  <tsavell@apple.com>
1884
1885         Unreviewed, rolling out r242697.
1886
1887         Broke internal builders.
1888
1889         Reverted changeset:
1890
1891         "Optimizing loads when creating new pages"
1892         https://bugs.webkit.org/show_bug.cgi?id=195516
1893         https://trac.webkit.org/changeset/242697
1894
1895 2019-03-10  Alex Christensen  <achristensen@webkit.org>
1896
1897         Add a WKContentRuleList variant that uses copied memory instead of mmap'd shared memory for class A containerized apps
1898         https://bugs.webkit.org/show_bug.cgi?id=195511
1899         <rdar://problem/44873269>
1900
1901         Reviewed by Darin Adler.
1902
1903         * NetworkProcess/NetworkContentRuleListManager.cpp:
1904         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
1905         * NetworkProcess/NetworkContentRuleListManager.h:
1906         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
1907         (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting):
1908         (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting):
1909         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
1910         * NetworkProcess/cache/NetworkCacheFileSystem.h:
1911         * Shared/WebCompiledContentRuleList.cpp:
1912         (WebKit::WebCompiledContentRuleList::usesCopiedMemory const):
1913         (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
1914         (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
1915         (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
1916         (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
1917         (WebKit::WebCompiledContentRuleList::actions const):
1918         * Shared/WebCompiledContentRuleList.h:
1919         * Shared/WebCompiledContentRuleListData.cpp:
1920         (WebKit::WebCompiledContentRuleListData::size const):
1921         (WebKit::WebCompiledContentRuleListData::dataPointer const):
1922         (WebKit::WebCompiledContentRuleListData::encode const):
1923         (WebKit::WebCompiledContentRuleListData::decode):
1924         * Shared/WebCompiledContentRuleListData.h:
1925         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
1926         * UIProcess/API/APIContentRuleList.cpp:
1927         (API::ContentRuleList::usesCopiedMemory const):
1928         * UIProcess/API/APIContentRuleList.h:
1929         * UIProcess/API/APIContentRuleListStore.cpp:
1930         (API::getData):
1931         (API::decodeContentRuleListMetaData):
1932         (API::ContentRuleListStore::readContentsOfFile):
1933         (API::MappedOrCopiedData::dataPointer const):
1934         (API::openAndMapOrCopyContentRuleList):
1935         (API::compiledToFile):
1936         (API::createExtension):
1937         (API::ContentRuleListStore::lookupContentRuleList):
1938         (API::ContentRuleListStore::compileContentRuleList):
1939         (API::ContentRuleListStore::getContentRuleListSource):
1940         (API::openAndMapContentRuleList): Deleted.
1941         * UIProcess/API/APIContentRuleListStore.h:
1942         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
1943         (API::ContentRuleListStore::readContentsOfFile):
1944         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
1945         (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]):
1946         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
1947         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
1948         (-[_WKUserContentFilter usesCopiedMemory]):
1949         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
1950         * WebProcess/UserContent/WebUserContentController.cpp:
1951         (WebKit::WebUserContentController::addContentRuleLists):
1952         * WebProcess/UserContent/WebUserContentController.h:
1953         * WebProcess/WebPage/WebPage.cpp:
1954         (WebKit::m_hostFileDescriptor):
1955
1956 2019-03-10  Jiewen Tan  <jiewen_tan@apple.com>
1957
1958         Optimizing loads when creating new pages
1959         https://bugs.webkit.org/show_bug.cgi?id=195516
1960         <rdar://problem/48738086>
1961
1962         Reviewed by Darin Adler.
1963
1964         This patch adds hooks in WebPageProxy::createNewPage to optimize loads, and moves the creationParameters
1965         of API::NavigationAction from UI clients to WebPageProxy::createNewPage. Also, we now pass the whole
1966         API::NavigationAction to the load optimizer instead of the request within.
1967
1968         * UIProcess/API/APINavigationAction.h:
1969         * UIProcess/API/APIUIClient.h:
1970         (API::UIClient::createNewPage):
1971         * UIProcess/API/C/WKPage.cpp:
1972         (WKPageSetPageUIClient):
1973         * UIProcess/API/glib/WebKitUIClient.cpp:
1974         * UIProcess/Cocoa/NavigationState.mm:
1975         (WebKit::tryOptimizingLoad):
1976         (WebKit::tryInterceptNavigation):
1977         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1978         * UIProcess/Cocoa/UIDelegate.h:
1979         * UIProcess/Cocoa/UIDelegate.mm:
1980         (WebKit::UIDelegate::UIClient::createNewPage):
1981         * UIProcess/WebPageProxy.cpp:
1982         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1983         (WebKit::tryOptimizingLoad):
1984         (WebKit::WebPageProxy::createNewPage):
1985         * UIProcess/WebPageProxy.h:
1986
1987 2019-03-10  Tim Horton  <timothy_horton@apple.com>
1988
1989         Add SPI to retrieve the set of text inputs in a given rect, and later focus one
1990         https://bugs.webkit.org/show_bug.cgi?id=195499
1991
1992         Reviewed by Darin Adler.
1993
1994         * Scripts/webkit/messages.py:
1995         * Shared/TextInputContext.cpp: Added.
1996         (IPC::ArgumentCoder<WebKit::TextInputContext>::encode):
1997         (IPC::ArgumentCoder<WebKit::TextInputContext>::decode):
1998         * Shared/TextInputContext.h: Added.
1999         (WebKit::TextInputContext::operator== const):
2000         Add TextInputContext, which represents a minimal set of information
2001         about a text field.
2002
2003         * Sources.txt:
2004         * SourcesCocoa.txt:
2005         * UIProcess/API/Cocoa/WKWebView.mm:
2006         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
2007         (-[WKWebView _focusTextInputContext:completionHandler:]):
2008         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2009         Add SPI that allows clients to asynchronously request text input
2010         contexts for a given rect, and later focus a given context.
2011
2012         * UIProcess/API/Cocoa/_WKTextInputContext.h: Added.
2013         * UIProcess/API/Cocoa/_WKTextInputContext.mm: Added.
2014         (-[_WKTextInputContext _initWithTextInputContext:]):
2015         (-[_WKTextInputContext boundingRect]):
2016         (-[_WKTextInputContext _textInputContext]):
2017         (-[_WKTextInputContext isEqual:]):
2018         (-[_WKTextInputContext hash]):
2019         (-[_WKTextInputContext copyWithZone:]):
2020         * UIProcess/API/Cocoa/_WKTextInputContextInternal.h: Added.
2021         Add an SPI object that exposes a read-only window on a TextInputContext to clients.
2022
2023         * UIProcess/WebPageProxy.cpp:
2024         (WebKit::WebPageProxy::textInputContextsInRect):
2025         (WebKit::WebPageProxy::focusTextInputContext):
2026         * UIProcess/WebPageProxy.h:
2027         Plumbing from WKWebView<->WebPage.
2028
2029         * WebKit.xcodeproj/project.pbxproj:
2030         * WebProcess/WebPage/WebPage.cpp:
2031         (WebKit::elementRectInWindowCoordinates):
2032         (WebKit::isEditableTextInputElement):
2033         (WebKit::WebPage::textInputContextsInRect):
2034         Search the DOM for text input contexts: <input type='text'> (or other
2035         form fields that fall back on text field behavior), <textarea>, and
2036         contenteditable roots. Store the WebPage, Document, and Element identifiers
2037         so that we can find the element again later.
2038
2039         (WebKit::WebPage::focusTextInputContext):
2040         Find the element for a given (web page, document, element) triple and focus it,
2041         if it's still available.
2042
2043         * WebProcess/WebPage/WebPage.h:
2044         * WebProcess/WebPage/WebPage.messages.in:
2045
2046 2019-03-10  Tim Horton  <timothy_horton@apple.com>
2047
2048         iOS: Using ⌥ to scroll horizontally is no different than arrow key
2049         https://bugs.webkit.org/show_bug.cgi?id=195268
2050         <rdar://problem/48326682>
2051
2052         Reviewed by Brent Fulgham.
2053
2054         * UIProcess/ios/WKContentViewInteraction.mm:
2055         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:inDirection:]):
2056         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:]): Deleted.
2057         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
2058         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
2059         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
2060         (-[WKKeyboardScrollViewAnimator setDelegate:]):
2061         (-[WKKeyboardScrollViewAnimator distanceForIncrement:inDirection:]):
2062         (-[WKKeyboardScrollViewAnimator distanceForIncrement:]): Deleted.
2063         Add a direction parameter to -distanceForIncrement:, so the client
2064         can return a different page/document size based on the scrolling axis.
2065         Adopt it both in the default implementation and in WKContentViewInteraction.
2066         Make the option key scroll by page when scrolling horizontally, like it
2067         does when scrolling vertically.
2068
2069 2019-03-10  David Quesada  <david_quesada@apple.com>
2070
2071         ASSERT(m_downloads.isEmpty()) fails in DownloadProxyMap::~DownloadProxyMap()
2072         https://bugs.webkit.org/show_bug.cgi?id=152480
2073
2074         Reviewed by Chris Dumez.
2075
2076         * UIProcess/Downloads/DownloadProxyMap.cpp:
2077         (WebKit::DownloadProxyMap::downloadFinished):
2078             If the DownloadProxy is holding the last reference to the process pool, then
2079             invalidating the proxy will cause the process pool, the network process proxy,
2080             and this DownloadProxyMap to deallocate. Ensure that doesn't happen until this
2081             method has done everything it wants to do to clean up.
2082
2083 2019-03-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2084
2085         Fix some misleading function and variable names in WKContentViewInteraction.mm
2086         https://bugs.webkit.org/show_bug.cgi?id=195536
2087
2088         Reviewed by Tim Horton.
2089
2090         * UIProcess/ios/WKContentViewInteraction.mm:
2091         (shouldDeferZoomingToSelectionWhenRevealingFocusedElement):
2092
2093         Rename shouldZoomToRevealSelectionRect to shouldDeferZoomingToSelectionWhenRevealingFocusedElement; this
2094         function is used to determine whether we should zoom to the selection rect when revealing the focused element,
2095         and therefore affects whether we need to defer zooming until we get selection information.
2096
2097         (rectToRevealWhenZoomingToFocusedElement):
2098         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2099
2100         Rename shouldShowKeyboard to shouldShowInputView; this boolean indicates whether we should show not only the
2101         keyboard, but other UI for user input such as date and select pickers.
2102
2103         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]):
2104         (shouldZoomToRevealSelectionRect): Deleted.
2105
2106 2019-03-10  Simon Fraser  <simon.fraser@apple.com>
2107
2108         ScrollingTree should have the final say on where layers go
2109         https://bugs.webkit.org/show_bug.cgi?id=195507
2110
2111         Reviewed by Antti Koivisto.
2112
2113         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2114         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
2115         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2116         (WebKit::RemoteScrollingCoordinatorProxy::applyScrollingTreeLayerPositions):
2117         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
2118         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2119         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
2120
2121 2019-03-09  Darin Adler  <darin@apple.com>
2122
2123         [Cocoa] Code signing fails because services are copied into XPCServices after the framework is signed
2124         https://bugs.webkit.org/show_bug.cgi?id=195523
2125
2126         Reviewed by Dan Bernstein.
2127
2128         * WebKit.xcodeproj/project.pbxproj: Make symbolic links while building the WebKit
2129         framework instead of copying in the services after the framework is built.
2130
2131 2019-03-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2132
2133         REGRESSION (r242551): Sporadic hangs when tapping to change selection on iOS
2134         https://bugs.webkit.org/show_bug.cgi?id=195475
2135         <rdar://problem/48721153>
2136
2137         Reviewed by Chris Dumez.
2138
2139         r242551 refactored synchronous autocorrection context requests to send an async IPC message and then use
2140         waitForAndDispatchImmediately, instead of calling sendSync. However, this exposes a couple of existing issues in
2141         the implementation of waitForAndDispatchImmediately that causes sporadic IPC deadlocks when changing selection.
2142
2143         First, passing in InterruptWaitingIfSyncMessageArrives when synchronously waiting for an IPC message currently
2144         does not fulfill its intended behavior of interrupting waiting when a sync message arrives. This is because sync
2145         IPC messages, by default, may be dispatched while the receiver is waiting for a sync reply. This means that the
2146         logic in Connection::SyncMessageState::processIncomingMessage to dispatch an incoming sync message on the main
2147         thread will attempt to handle the incoming message by enqueueing it on the main thread, and then waking up the
2148         client runloop (i.e. signaling m_waitForSyncReplySemaphore). This works in the case of sendSync since the sync
2149         reply semaphore is used to block the main thread, but in the case of waitForAndDispatchImmediately, a different
2150         m_waitForMessageCondition is used instead, so SyncMessageState::processIncomingMessage will only enqueue the
2151         incoming sync message on the main thread, and not actually invoke it.
2152
2153         To fix this first issue, observe that there is pre-existing logic to enqueue the incoming message and signal
2154         m_waitForMessageCondition in Connection::processIncomingMessage. This codepath is currently not taken because we
2155         end up bailing early in the call to SyncMessageState::processIncomingMessage. Instead, we can move this early
2156         return further down in the function, such that if there is an incoming sync message and we're waiting with the
2157         InterruptWaitingIfSyncMessageArrives option, we will correctly enqueue the incoming message, wake the runloop,
2158         and proceed to handle the incoming message.
2159
2160         The second issue is more subtle; consider the scenario in which we send a sync message A from the web process to
2161         the UI process, and simultaneously, in the UI process, we schedule some work to be done on the main thread.
2162         Let's additionally suppose that this scheduled work will send an IPC message B to the web process and
2163         synchronously wait for a reply (in the case of this particular bug, this is the sync autocorrection context
2164         request). What happens upon receiving sync message A is that the IPC thread in the UI process will schedule A on
2165         the main thread; however, before the scheduled response to A is invoked, we will first invoke previously
2166         scheduled work that attempts to block synchronously until a message B is received. In summary:
2167
2168         1. (Web process)    sends sync IPC message A to UI process.
2169         2. (UI process)     schedules some main runloop task that will block synchronously on IPC message B.
2170         3. (UI process)     receives sync IPC message A and schedules A on the main runloop.
2171         4. (UI process)     carry out the task scheduled in (2) and block on B.
2172
2173         ...and then, the UI process and web process are now deadlocked because the UI process is waiting for B to
2174         arrive, but the web process can't send B because it's waiting for a reply for IPC message A! To fix this second
2175         deadlock, we first make an important observation: when using sendSync, we don't run into this problem because
2176         immediately before sending sync IPC, we will attempt to handle any incoming sync IPC messages that have been
2177         queued up. However, when calling waitForAndDispatchImmediately, we don't have this extra step, so a deadlock may
2178         occur in the manner described above. To fix this, we make waitForAndDispatchImmediately behave more like
2179         sendSync, by handling all incoming sync messages prior to blocking on an IPC response.
2180
2181         Test: editing/selection/ios/change-selection-by-tapping.html
2182
2183         * Platform/IPC/Connection.cpp:
2184         (IPC::Connection::waitForMessage):
2185         (IPC::Connection::processIncomingMessage):
2186
2187 2019-03-09  Andy Estes  <aestes@apple.com>
2188
2189         [Apple Pay] CanMakePaymentsWithActiveCard and OpenPaymentSetup should be async messages
2190         https://bugs.webkit.org/show_bug.cgi?id=195526
2191         <rdar://problem/48745636>
2192
2193         Reviewed by Chris Dumez.
2194
2195         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
2196         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard):
2197         (WebKit::WebPaymentCoordinatorProxy::openPaymentSetup):
2198         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
2199         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
2200         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
2201         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard):
2202         (WebKit::WebPaymentCoordinator::openPaymentSetup):
2203         (WebKit::generateCanMakePaymentsWithActiveCardReplyID): Deleted.
2204         (WebKit::generateOpenPaymentSetupReplyID): Deleted.
2205         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCardReply): Deleted.
2206         (WebKit::WebPaymentCoordinator::openPaymentSetupReply): Deleted.
2207         * WebProcess/ApplePay/WebPaymentCoordinator.h:
2208         * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
2209
2210 2019-03-09  Andy Estes  <aestes@apple.com>
2211
2212         [iOS] Remove unneeded entitlements and sandbox allowances from the Networking service
2213         https://bugs.webkit.org/show_bug.cgi?id=195527
2214
2215         Reviewed by Eric Carlson.
2216
2217         * Configurations/Network-iOS.entitlements:
2218         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2219
2220 2019-03-09  Chris Dumez  <cdumez@apple.com>
2221
2222         Use modern async IPC with reply for device orientation permission
2223         https://bugs.webkit.org/show_bug.cgi?id=195529
2224
2225         Reviewed by Ryosuke Niwa.
2226
2227         * UIProcess/WebPageProxy.cpp:
2228         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
2229         * UIProcess/WebPageProxy.h:
2230         * UIProcess/WebPageProxy.messages.in:
2231         * WebProcess/WebPage/WebPage.cpp:
2232         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
2233         (WebKit::nextDeviceOrientationAndMotionPermissionCallbackID): Deleted.
2234         (WebKit::WebPage::didReceiveDeviceOrientationAndMotionAccessDecision): Deleted.
2235         * WebProcess/WebPage/WebPage.h:
2236         * WebProcess/WebPage/WebPage.messages.in:
2237
2238 2019-03-09  Zalan Bujtas  <zalan@apple.com>
2239
2240         [ContentChangeObserver] Start observing for content change between touchEnd and mouseMoved start
2241         https://bugs.webkit.org/show_bug.cgi?id=195510
2242         <rdar://problem/48735695>
2243
2244         Reviewed by Simon Fraser.
2245
2246         * WebProcess/WebPage/ios/WebPageIOS.mm:
2247         (WebKit::WebPage::cancelPotentialTapInFrame):
2248
2249 2019-03-08  Chris Dumez  <cdumez@apple.com>
2250
2251         Enable ProcessAssertions on iOS Simulator
2252         https://bugs.webkit.org/show_bug.cgi?id=195479
2253
2254         Reviewed by Alexey Proskuryakov.
2255
2256         Enable ProcessAssertions on iOS Simulator. We have some layout tests timing out in the
2257         iOS Simulator due to the WebContent process suspending. Turning on ProcessAssertions in
2258         the iOS Simulator seems to make those tests pass.
2259
2260         * UIProcess/ProcessAssertion.cpp:
2261         * UIProcess/ProcessAssertion.h:
2262         * UIProcess/ios/ProcessAssertionIOS.mm:
2263
2264 2019-03-08  Chris Dumez  <cdumez@apple.com>
2265
2266         Add support for Device Orientation / Motion permission API
2267         https://bugs.webkit.org/show_bug.cgi?id=195329
2268         <rdar://problem/47645367>
2269
2270         Reviewed by Geoffrey Garen.
2271
2272         Add support for Device Orientation / Motion permission API:
2273         - https://github.com/w3c/deviceorientation/issues/57
2274
2275         This adds new SPI to WKUIDelegatePrivate, until we can make this API.
2276
2277         * Shared/WebPreferences.yaml:
2278         * UIProcess/API/APIUIClient.h:
2279         (API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
2280         * UIProcess/API/C/WKPage.cpp:
2281         (WKPageSetPageUIClient):
2282         * UIProcess/API/C/WKPageUIClient.h:
2283         * UIProcess/API/Cocoa/WKUIDelegate.h:
2284         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2285         * UIProcess/Cocoa/UIDelegate.h:
2286         * UIProcess/Cocoa/UIDelegate.mm:
2287         (WebKit::UIDelegate::setDelegate):
2288         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
2289         * UIProcess/WebPageProxy.cpp:
2290         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
2291         * UIProcess/WebPageProxy.h:
2292         * UIProcess/WebPageProxy.messages.in:
2293         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2294         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
2295         * WebProcess/WebCoreSupport/WebChromeClient.h:
2296         * WebProcess/WebPage/WebPage.cpp:
2297         (WebKit::nextDeviceOrientationAndMotionPermissionCallbackID):
2298         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
2299         (WebKit::WebPage::didReceiveDeviceOrientationAndMotionAccessDecision):
2300         * WebProcess/WebPage/WebPage.h:
2301         * WebProcess/WebPage/WebPage.messages.in:
2302
2303 2019-03-08  Brady Eidson  <beidson@apple.com>
2304
2305         Have the UIProcess take the UnboundedNetworking assertion when downloads are in progress.
2306         https://bugs.webkit.org/show_bug.cgi?id=195468
2307
2308         Reviewed by Andy Estes.
2309
2310         * UIProcess/Downloads/DownloadProxyMap.cpp:
2311         (WebKit::DownloadProxyMap::DownloadProxyMap):
2312         (WebKit::DownloadProxyMap::createDownloadProxy): If this is the first download, and the process has the entitlement,
2313           take the assertion.
2314         (WebKit::DownloadProxyMap::downloadFinished):
2315         (WebKit::DownloadProxyMap::processDidClose):
2316         * UIProcess/Downloads/DownloadProxyMap.h:
2317
2318 2019-03-08  Chris Dumez  <cdumez@apple.com>
2319
2320         Add assertions to help debug a WebProcessCache crash
2321         https://bugs.webkit.org/show_bug.cgi?id=195469
2322
2323         Reviewed by Brady Eidson.
2324
2325         I suspect the process's registrableDomain in null when evictProcess() gets
2326         called, thus crashing when lookup it up in the HashMap. Confirm this and
2327         how this could happen via assertions.
2328
2329         * UIProcess/WebProcessCache.cpp:
2330         (WebKit::WebProcessCache::evictProcess):
2331         * UIProcess/WebProcessProxy.cpp:
2332         (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
2333
2334 2019-03-08  Brady Eidson  <beidson@apple.com>
2335
2336         Rename AssertionState::Download.
2337         https://bugs.webkit.org/show_bug.cgi?id=195465
2338
2339         Reviewed by Andy Estes.
2340
2341         It's (currently) about uploads and downloads.
2342         Let's call it "UnboundedNetworking"
2343
2344         * NetworkProcess/Downloads/DownloadMap.cpp:
2345         (WebKit::DownloadMap::add):
2346
2347         * UIProcess/ProcessAssertion.h:
2348
2349         * UIProcess/WebProcessProxy.cpp:
2350         (WebKit::WebProcessProxy::didSetAssertionState):
2351
2352         * UIProcess/ios/ProcessAssertionIOS.mm:
2353         (WebKit::flagsForState):
2354         (WebKit::reasonForState):
2355
2356 2019-03-08  Simon Fraser  <simon.fraser@apple.com>
2357
2358         [macOS UI-side compositing] Mouse handling can trigger a crash before we have a scrolling tree root
2359         https://bugs.webkit.org/show_bug.cgi?id=195467
2360
2361         Reviewed by Antti Koivisto.
2362         
2363         When launching MiniBrowser with UI-side compositing enabled in a state where the window
2364         appears under the mouse, we can hit RemoteScrollingTree::handleMouseEvent() for a mouseEnter
2365         event before we have a scrolling tree root node, so add a null check.
2366
2367         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
2368         (WebKit::RemoteScrollingTree::handleMouseEvent):
2369
2370 2019-03-08  Carlos Garcia Campos  <cgarcia@igalia.com>
2371
2372         REGRESSION(r242624): [GTK] New rAF code path assumes AC mode
2373         https://bugs.webkit.org/show_bug.cgi?id=195459
2374
2375         Reviewed by Žan Doberšek.
2376
2377         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
2378         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
2379         The refresh monitor now calls scheduleLayerFlush() but when AC
2380         mode is disabled this method does nothing, so setNeedsDisplay()
2381         needs to be called instead.
2382
2383 2019-03-07  Tim Horton  <timothy_horton@apple.com>
2384
2385         Crash under RemoteLayerTreePropertyApplier::applyProperties
2386         https://bugs.webkit.org/show_bug.cgi?id=195448
2387         <rdar://problem/48588226>
2388
2389         Reviewed by Simon Fraser.
2390
2391         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
2392         (WebKit::RemoteLayerTreeHost::updateLayerTree):
2393         Under some currently-unknown circumstances, the UI process is receiving
2394         commits referring to layers that it does not know about.
2395         One understood case of this was fixed in r241899, but there seem to be
2396         cases remaining that are not understood.
2397         Also, add a release log so that we can identify any downstream effects.
2398
2399 2019-03-07  Zalan Bujtas  <zalan@apple.com>
2400
2401         [ContentChangeObserver] Introduce fixed duration content observation
2402         https://bugs.webkit.org/show_bug.cgi?id=195295
2403         <rdar://problem/48579913>
2404
2405         Reviewed by Simon Fraser.
2406
2407         * WebProcess/WebPage/ios/WebPageIOS.mm:
2408         (WebKit::WebPage::handleSyntheticClick):
2409         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
2410
2411 2019-03-07  Fujii Hironori  <Hironori.Fujii@sony.com>
2412
2413         [WinCairo][WebKit] Nothing is drawn after Web process crashed
2414         https://bugs.webkit.org/show_bug.cgi?id=195399
2415
2416         Reviewed by Alex Christensen.
2417
2418         PageClientImpl::viewSize returned 0x0 size after Web process
2419         crashed. Restored the original implementation using GetClientRect
2420         (Bug 52175).
2421
2422         * UIProcess/win/PageClientImpl.cpp:
2423         (WebKit::PageClientImpl::viewSize):
2424
2425 2019-03-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
2426
2427         requestAnimationFrame should execute before the next frame
2428         https://bugs.webkit.org/show_bug.cgi?id=177484
2429
2430         Reviewed by Simon Fraser.
2431
2432         Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by
2433         a single call to Page::renderingUpdate(). This new function implements 
2434         "Update the rendering" step of the HTML Event Loop specification
2435         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
2436
2437         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2438         (WebKit::AcceleratedDrawingArea::updateBackingStoreState):
2439         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
2440         (WebKit::LayerTreeHost::layerFlushTimerFired):
2441         * WebProcess/WebPage/DrawingAreaImpl.cpp:
2442         (WebKit::DrawingAreaImpl::display):
2443         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2444         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2445         * WebProcess/WebPage/WebPage.cpp:
2446         (WebKit::WebPage::layoutIfNeeded):
2447         (WebKit::WebPage::renderingUpdate):
2448         (WebKit::WebPage::willDisplayPage): Deleted.
2449         * WebProcess/WebPage/WebPage.h:
2450         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2451         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
2452
2453 2019-03-07  Zalan Bujtas  <zalan@apple.com>
2454
2455         [ContentChangeObserver] Add a setting to be able to turn content change observation on/off
2456         https://bugs.webkit.org/show_bug.cgi?id=195353
2457         <rdar://problem/48626394>
2458
2459         Reviewed by Simon Fraser.
2460
2461         * Shared/WebPreferences.yaml:
2462         * UIProcess/API/C/WKPreferences.cpp:
2463         (WKPreferencesSetContentChangeObserverEnabled):
2464         (WKPreferencesGetContentChangeObserverEnabled):
2465         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2466         * UIProcess/API/Cocoa/WKPreferences.mm:
2467         (-[WKPreferences _contentChangeObserverEnabled]):
2468         (-[WKPreferences _setContentChangeObserverEnabled:]):
2469         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2470         * WebProcess/WebPage/ios/WebPageIOS.mm:
2471         (WebKit::WebPage::handleSyntheticClick):
2472
2473 2019-03-07  Andy Estes  <aestes@apple.com>
2474
2475         [Apple Pay] Untangle PKPaymentAuthorizationViewController from WebPaymentCoordinatorProxy
2476         https://bugs.webkit.org/show_bug.cgi?id=195349
2477         <rdar://problem/48625510>
2478
2479         Reviewed by Alex Christensen.
2480
2481         Introduced PaymentAuthorizationPresenter and WKPaymentAuthorizationDelegate to encapsulate
2482         PKPaymentAuthorizationViewController and its delegate. Taught WebPaymentCoordinatorProxy to
2483         interact with PaymentAuthorizationPresenter rather than PKPAVC directly.
2484
2485         These changes will allow us to swap out PKPaymentAuthorizationViewController with PKPaymentAuthorizationController in a follow-on patch.
2486
2487         * Platform/cocoa/PaymentAuthorizationPresenter.h: Added. Defined the abstract interface for
2488         payment authorization presenters that use PKPA(V)C.
2489         * Platform/cocoa/PaymentAuthorizationPresenter.mm: Added.
2490         (WebKit::toPKPaymentAuthorizationStatus): Moved from WebPaymentCoordinatorProxyCocoa.mm.
2491         (WebKit::toPKPaymentErrorCode): Ditto.
2492         (WebKit::toNSError): Ditto.
2493         (WebKit::toNSErrors): Ditto.
2494         (WebKit::toPKShippingMethods): Ditto.
2495         (WebKit::PaymentAuthorizationPresenter::completeMerchantValidation): Added. Implements the
2496         logic previously in WebPaymentCoordinatorProxy::platformCompleteMerchantValidation.
2497         (WebKit::PaymentAuthorizationPresenter::completePaymentMethodSelection): Ditto for
2498         WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection.
2499         (WebKit::PaymentAuthorizationPresenter::completePaymentSession): Ditto for 
2500         (WebKit::PaymentAuthorizationPresenter::completeShippingContactSelection): Ditto for
2501         WebPaymentCoordinatorProxy::platformCompletePaymentSession.
2502         (WebKit::PaymentAuthorizationPresenter::completeShippingMethodSelection): Ditto for
2503         WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection.
2504         * Platform/cocoa/PaymentAuthorizationViewController.h: Added. Defined a subclass of PaymentAuthorizationPresenter for PKPaymentAuthorizationViewController.
2505         * Platform/cocoa/PaymentAuthorizationViewController.mm: Added.
2506         (-[WKPaymentAuthorizationViewControllerDelegate initWithPresenter:]): Added a PKPAVC
2507         delegate that's a subclass of WKPaymentAuthorizationDelegate.
2508         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]):
2509         Called -[WKPaymentAuthorizationDelegate _didFinish].
2510         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]): Called
2511         -[WKPaymentAuthorizationDelegate _didAuthorizePayment:completion:].
2512         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]): Called
2513         -[WKPaymentAuthorizationDelegate _didSelectShippingMethod:completion:].
2514         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]): Called
2515         -[WKPaymentAuthorizationDelegate _didSelectShippingContact:completion:].
2516         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]): Called
2517         -[WKPaymentAuthorizationDelegate _didSelectPaymentMethod:completion:].
2518         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:willFinishWithError:]):
2519         Called -[WKPaymentAuthorizationDelegate _willFinishWithError:].
2520         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didRequestMerchantSession:]): Called
2521         -[WKPaymentAuthorizationDelegate _didRequestMerchantSession:].
2522         * Platform/cocoa/WKPaymentAuthorizationDelegate.h: Added.
2523         * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: Added.
2524         (-[WKPaymentAuthorizationDelegate summaryItems]): Added a summaryItems getter.
2525         (-[WKPaymentAuthorizationDelegate shippingMethods]): Ditto for shippingMethods.
2526         (-[WKPaymentAuthorizationDelegate completeMerchantValidation:error:]): Called
2527         _didRequestMerchantSessionCompletion then set it to nil.
2528         (-[WKPaymentAuthorizationDelegate completePaymentMethodSelection:]): Ditto for
2529         _didSelectPaymentMethodCompletion.
2530         (-[WKPaymentAuthorizationDelegate completePaymentSession:errors:didReachFinalState:]): Ditto
2531         for _didAuthorizePaymentCompletion.
2532         (-[WKPaymentAuthorizationDelegate completeShippingContactSelection:summaryItems:shippingMethods:errors:]):
2533         Ditto for _didSelectShippingContactCompletion.
2534         (-[WKPaymentAuthorizationDelegate completeShippingMethodSelection:]): Ditto for
2535         _didSelectShippingMethodCompletion.
2536         (-[WKPaymentAuthorizationDelegate invalidate]): If there's an outstanding authorization
2537         callback, called -completePaymentSession:errors:didReachFinalState: with a state of
2538         PKPaymentAuthorizationStatusFailure.
2539         (-[WKPaymentAuthorizationDelegate _initWithPresenter:]):
2540         (-[WKPaymentAuthorizationDelegate _didAuthorizePayment:completion:]): Added. Implements the
2541         logic previously in WKPaymentAuthorizationViewControllerDelegate.
2542         (-[WKPaymentAuthorizationDelegate _didFinish]): Ditto.
2543         (-[WKPaymentAuthorizationDelegate _didRequestMerchantSession:]): Ditto.
2544         (-[WKPaymentAuthorizationDelegate _didSelectPaymentMethod:completion:]): Ditto.
2545         (-[WKPaymentAuthorizationDelegate _didSelectShippingContact:completion:]): Ditto.
2546         (toShippingMethod): Moved from WebPaymentCoordinatorProxyCocoa.mm.
2547         (-[WKPaymentAuthorizationDelegate _didSelectShippingMethod:completion:]): Added. Implements
2548         the logic previously in WKPaymentAuthorizationViewControllerDelegate.
2549         (-[WKPaymentAuthorizationDelegate _willFinishWithError:]): Ditto.
2550         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
2551         (WebKit::WebPaymentCoordinatorProxy::presenterWillValidateMerchant): To conform to
2552         PaymentAuthorizationPresenter::Client, renamed from validateMerchant.
2553         (WebKit::WebPaymentCoordinatorProxy::presenterDidAuthorizePayment): Renamed from
2554         didAuthorizePayment.
2555         (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Moved logic here that previously
2556         existed in WKPaymentAuthorizationViewControllerDelegate.
2557         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectShippingMethod): Renamed from
2558         didSelectShippingMethod.
2559         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectShippingContact): Renamed from
2560         didSelectShippingContact.
2561         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectPaymentMethod): Renamed from
2562         didSelectPaymentMethod.
2563         (WebKit::WebPaymentCoordinatorProxy::validateMerchant): Renamed to
2564         presenterWillValidateMerchant.
2565         (WebKit::WebPaymentCoordinatorProxy::didAuthorizePayment): Renamed to
2566         presenterDidAuthorizePayment.
2567         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingMethod): Renamed to
2568         presenterDidSelectShippingMethod.
2569         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingContact): Renamed to
2570         presenterDidSelectShippingContact.
2571         (WebKit::WebPaymentCoordinatorProxy::didSelectPaymentMethod): Renamed to
2572         didSelectPaymentMethod.
2573         * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Changed WebPaymentCoordinatorProxy to
2574         subclass PaymentAuthorizationPresenter::Client.
2575         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: Removed WKPaymentAuthorizationViewControllerDelegate interface and declared some helper functions
2576         needed by PaymentAuthorizationPresenter.
2577         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2578         (WebKit::toPKPaymentSummaryItemType): Removed static keyword.
2579         (WebKit::toDecimalNumber): Ditto.
2580         (WebKit::toPKPaymentSummaryItem): Ditto.
2581         (WebKit::toPKPaymentSummaryItems): Ditto.
2582         (WebKit::toPKShippingMethod): Ditto.
2583         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Changed to call
2584         m_authorizationPresenter.
2585         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession): Ditto.
2586         (WebKit::WebPaymentCoordinatorProxy::platformCompleteMerchantValidation): Ditto.
2587         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection): Ditto.
2588         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection): Ditto.
2589         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection): Ditto.
2590         (-[WKPaymentAuthorizationViewControllerDelegate initWithPaymentCoordinatorProxy:]): Deleted.
2591         (-[WKPaymentAuthorizationViewControllerDelegate invalidate]): Deleted.
2592         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:willFinishWithError:]): Deleted.
2593         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didRequestMerchantSession:]): Deleted.
2594         (toShippingMethod): Deleted.
2595         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]): Deleted.
2596         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]): Deleted.
2597         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]): Deleted.
2598         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]): Deleted.
2599         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:completion:]): Deleted.
2600         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:completion:]): Deleted.
2601         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:completion:]): Deleted.
2602         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:completion:]): Deleted.
2603         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]): Deleted.
2604         (WebKit::toPKPaymentAuthorizationStatus): Moved to PaymentAuthorizationPresenter.mm.
2605         (WebKit::toPKPaymentErrorCode): Ditto.
2606         (WebKit::toNSError): Ditto.
2607         (WebKit::toNSErrors): Ditto.
2608         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
2609         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Changed to present a
2610         PaymentAuthorizationPresenter rather than a PKPAVC.
2611         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Changed to dismiss a
2612         PaymentAuthorizationPresenter rather than a PKPAVC.
2613         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
2614         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Ditto.
2615         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Ditto.
2616         * SourcesCocoa.txt:
2617         * UIProcess/WebPageProxy.h:
2618         * UIProcess/ios/WebPageProxyIOS.mm:
2619         (WebKit::WebPageProxy::paymentCoordinatorAuthorizationPresenter): Added. Returns a new
2620         PaymentAuthorizationViewController.
2621         * WebKit.xcodeproj/project.pbxproj:
2622
2623 2019-03-07  Chris Dumez  <cdumez@apple.com>
2624
2625         Regression(r242580) WebKit.NetworkProcessCrashWithPendingConnection API is crashing on iOS debug
2626         https://bugs.webkit.org/show_bug.cgi?id=195416
2627
2628         Reviewed by Antti Koivisto.
2629
2630         Drop ASSERT_NOT_REACHED() in WebPage::didCompletePageTransition() when the tree is still frozen due to
2631         LayerTreeFreezeReason::ProcessSuspended. As demonstrated by this API test, nothing prevents a load from
2632         completing and WebPage::didCompletePageTransition() to get called *after* WebProcess::prepareToSuspend()
2633         has been called. From the logging during the test, I can tell that WebProcess::processDidResume() gets
2634         called later on and the LayerTreeFreezeReason::ProcessSuspended freezing reason gets dropped, as expected.
2635
2636         * WebProcess/WebPage/WebPage.cpp:
2637         (WebKit::WebPage::didCompletePageTransition):
2638
2639 2019-03-07  Chris Dumez  <cdumez@apple.com>
2640
2641         Clean up / simplify ProcessAssertion code
2642         https://bugs.webkit.org/show_bug.cgi?id=195394
2643
2644         Reviewed by Geoffrey Garen.
2645
2646         Clean up / simplify ProcessAssertion code to facilitate its maintenance and make it
2647         less error-prone.
2648
2649         * Platform/IPC/mac/ConnectionMac.mm:
2650         (IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
2651         * UIProcess/ProcessAssertion.cpp:
2652         (WebKit::ProcessAssertion::ProcessAssertion):
2653         (WebKit::ProcessAssertion::setState):
2654         * UIProcess/ProcessAssertion.h:
2655         (WebKit::ProcessAssertion::Client::~Client):
2656         (WebKit::ProcessAssertion::setClient):
2657         (WebKit::ProcessAssertion::client):
2658         * UIProcess/ProcessThrottler.cpp:
2659         (WebKit::ProcessThrottler::didConnectToProcess):
2660         * UIProcess/ProcessThrottler.h:
2661         * UIProcess/ios/ProcessAssertionIOS.mm:
2662         (-[WKProcessAssertionBackgroundTaskManager dealloc]):
2663         (-[WKProcessAssertionBackgroundTaskManager addAssertionNeedingBackgroundTask:]):
2664         (-[WKProcessAssertionBackgroundTaskManager removeAssertionNeedingBackgroundTask:]):
2665         (-[WKProcessAssertionBackgroundTaskManager _notifyAssertionsOfImminentSuspension]):
2666         (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]):
2667         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
2668         (WebKit::ProcessAssertion::ProcessAssertion):
2669         (WebKit::ProcessAssertion::processAssertionWasInvalidated):
2670         (WebKit::ProcessAssertion::setState):
2671         (WebKit::ProcessAndUIAssertion::updateRunInBackgroundCount):
2672         (WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):
2673         (WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
2674         (WebKit::ProcessAndUIAssertion::processAssertionWasInvalidated):
2675         (WebKit::ProcessAndUIAssertion::setState):
2676         (WebKit::ProcessAndUIAssertion::uiAssertionWillExpireImminently):
2677
2678 2019-03-07  Commit Queue  <commit-queue@webkit.org>
2679
2680         Unreviewed, rolling out r242297.
2681         https://bugs.webkit.org/show_bug.cgi?id=195430
2682
2683         Broke Microsoft Visio. (Requested by dydz on #webkit).
2684
2685         Reverted changeset:
2686
2687         "[iOS] Turn mouse event simulation on by default"
2688         https://bugs.webkit.org/show_bug.cgi?id=195218
2689         https://trac.webkit.org/changeset/242297
2690
2691 2019-03-07  John Wilander  <wilander@apple.com>
2692
2693         Resource Load Statistics: Log first-party navigations with link decoration
2694         https://bugs.webkit.org/show_bug.cgi?id=195301
2695         <rdar://problem/48569971>
2696
2697         Reviewed by Brent Fulgham.
2698
2699         This patch adds a call to the network process' resource load statistics to
2700         log cross-site navigations with link decoration. The logging checks if the
2701         source of the navigation is a prevalent resource and if so, sets the
2702         appropriate flag for the destination.
2703
2704         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2705         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
2706         (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
2707         (WebKit::ResourceLoadStatisticsDatabaseStore::logSubresourceRedirect):
2708         (WebKit::ResourceLoadStatisticsDatabaseStore::logCrossSiteLoadWithLinkDecoration):
2709         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
2710         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2711         (WebKit::ResourceLoadStatisticsMemoryStore::logCrossSiteLoadWithLinkDecoration):
2712         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
2713         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
2714         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2715         (WebKit::WebResourceLoadStatisticsStore::logCrossSiteLoadWithLinkDecoration):
2716         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2717         * NetworkProcess/NetworkProcess.cpp:
2718         (WebKit::NetworkProcess::committedCrossSiteLoadWithLinkDecoration):
2719             This now receives a completion handler. This is in preparation for
2720             test cases where we need to log such an event and wait for it to
2721             finish before continuing.
2722         * NetworkProcess/NetworkProcess.h:
2723         * NetworkProcess/NetworkProcess.messages.in:
2724         * UIProcess/Network/NetworkProcessProxy.cpp:
2725         (WebKit::NetworkProcessProxy::committedCrossSiteLoadWithLinkDecoration):
2726         * UIProcess/Network/NetworkProcessProxy.h:
2727         * UIProcess/WebPageProxy.cpp:
2728         (WebKit::WebPageProxy::didCommitLoadForFrame):
2729         * UIProcess/WebProcessPool.cpp:
2730         (WebKit::WebProcessPool::committedCrossSiteLoadWithLinkDecoration):
2731         * UIProcess/WebProcessPool.h:
2732
2733 2019-03-07  Per Arne Vollan  <pvollan@apple.com>
2734
2735         [iOS] Disable permissive call logging in sandbox
2736         https://bugs.webkit.org/show_bug.cgi?id=195288
2737         <rdar://problem/47683804>
2738
2739         Reviewed by Brent Fulgham.
2740
2741         As on macOS, we should enable strict call filtering in sandbox on iOS.
2742
2743         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2744
2745 2019-03-07  Youenn Fablet  <youenn@apple.com>
2746
2747         Introduce a quota manager for Cache API/Service Worker/IDB storage
2748         https://bugs.webkit.org/show_bug.cgi?id=195283
2749
2750         Reviewed by Chris Dumez.
2751
2752         Remove quota handling from Cache API storage and use StorageQuotaManager/StorageQuotaUser.
2753         CacheStorage::Caches becomes a quota user and has a StorageQuotaManager to check for space for any cache API write task.
2754         NetworkProcess is responsible to manage the quota managers.
2755         Quota managers will go through network process to ask UIProcess for quota extension.
2756
2757         Remove pending callback handling from CacheStorage since they are queued in QuotaManager now.
2758
2759         * NetworkProcess/NetworkProcess.cpp:
2760         (WebKit::NetworkProcess::~NetworkProcess):
2761         (WebKit::NetworkProcess::destroySession):
2762         (WebKit::NetworkProcess::cacheStorageRootPath):
2763         (WebKit::NetworkProcess::setCacheStorageParameters):
2764         (WebKit::NetworkProcess::storageQuotaManager):
2765         * NetworkProcess/NetworkProcess.h:
2766         * NetworkProcess/cache/CacheStorageEngine.cpp:
2767         (WebKit::CacheStorage::Engine::from):
2768         (WebKit::CacheStorage::Engine::Engine):
2769         (WebKit::CacheStorage::Engine::readCachesFromDisk):
2770         * NetworkProcess/cache/CacheStorageEngine.h:
2771         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
2772         (WebKit::CacheStorage::Cache::put):
2773         * NetworkProcess/cache/CacheStorageEngineCache.h:
2774         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2775         (WebKit::CacheStorage::Caches::Caches):
2776         (WebKit::CacheStorage::Caches::~Caches):
2777         (WebKit::CacheStorage::Caches::requestSpace):
2778         (WebKit::CacheStorage::Caches::writeRecord):
2779         * NetworkProcess/cache/CacheStorageEngineCaches.h:
2780
2781 2019-03-07  John Wilander  <wilander@apple.com>
2782
2783         Resource Load Statistics: Make it possible to purge only script-accessible cookies
2784         https://bugs.webkit.org/show_bug.cgi?id=195383
2785         <rdar://problem/48570136>
2786
2787         Reviewed by Brent Fulgham.
2788
2789         This patch provides the ability to purge all script-accessible cookies while leaving
2790         HttpOnly cookies in place.
2791
2792         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
2793         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
2794         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2795         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
2796             Support for a new boolean flag on whether or not to include HttpOnly Cookies.
2797         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2798         * NetworkProcess/NetworkProcess.cpp:
2799         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
2800             Support for a new boolean flag on whether or not to include HttpOnly Cookies.
2801         (WebKit::NetworkProcess::deleteCookiesForTesting):
2802             Test infrastructure.
2803         * NetworkProcess/NetworkProcess.h:
2804         * NetworkProcess/NetworkProcess.messages.in:
2805         * NetworkProcess/NetworkSession.cpp:
2806         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
2807             Support for a new boolean flag on whether or not to include HttpOnly Cookies.
2808         * NetworkProcess/NetworkSession.h:
2809         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2810         (WKWebsiteDataStoreStatisticsDeleteCookiesForTesting):
2811             Test infrastructure.
2812         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2813         * UIProcess/Network/NetworkProcessProxy.cpp:
2814         (WebKit::NetworkProcessProxy::deleteCookiesForTesting):
2815             Test infrastructure.
2816         * UIProcess/Network/NetworkProcessProxy.h:
2817         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2818         (WebKit::WebsiteDataStore::deleteCookiesForTesting):
2819             Test infrastructure.
2820         * UIProcess/WebsiteData/WebsiteDataStore.h:
2821
2822 2019-03-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2823
2824         REGRESSION(r242364): [WPE] Do not stop the compositing run loop update timer on suspend
2825         https://bugs.webkit.org/show_bug.cgi?id=195410
2826
2827         Reviewed by Žan Doberšek.
2828
2829         Calling CompositingRunLoop::stopUpdates() on suspend is leaving the threaded compositor in an inconsistent
2830         state, failing to resume and stopping the updates forever. This is causing timeouts in WPE layout tests. Instead
2831         of calling stopUpdates(), a new suspend() is called, that stops the update timer, without changing the current
2832         updae tha compositing state. A new method resume() is also added to schedule an update if needed.
2833
2834         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2835         (WebKit::CompositingRunLoop::suspend): Set state as suspended and stop the update timer.
2836         (WebKit::CompositingRunLoop::resume): Set state as not suspended and start the update timer if it was scheduled
2837         while suspended.
2838         (WebKit::CompositingRunLoop::scheduleUpdate): Do not start the update timer when suspended.
2839         (WebKit::CompositingRunLoop::compositionCompleted): Ditto.
2840         (WebKit::CompositingRunLoop::updateCompleted): Ditto.
2841         (WebKit::CompositingRunLoop::updateTimerFired): Add an assert to ensure the update timer is not fired while suspended.
2842         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
2843         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2844         (WebKit::ThreadedCompositor::suspend): Call CompositingRunLoop::suspend() instead of stopUpdates().
2845         (WebKit::ThreadedCompositor::resume): Call CompositingRunLoop::resume().
2846
2847 2019-03-06  Mark Lam  <mark.lam@apple.com>
2848
2849         Exception is a JSCell, not a JSObject.
2850         https://bugs.webkit.org/show_bug.cgi?id=195392
2851
2852         Reviewed by Saam Barati.
2853
2854         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
2855         (WebKit::JSNPObject::throwInvalidAccessError):
2856         * WebProcess/Plugins/Netscape/JSNPObject.h:
2857
2858 2019-03-07  Commit Queue  <commit-queue@webkit.org>
2859
2860         Unreviewed, rolling out r242354.
2861         https://bugs.webkit.org/show_bug.cgi?id=195402
2862
2863         breaks layout tests in all configurations (Requested by
2864         zdobersek on #webkit).
2865
2866         Reverted changeset:
2867
2868         "[WPE] Enable web process sandbox"
2869         https://bugs.webkit.org/show_bug.cgi?id=195169
2870         https://trac.webkit.org/changeset/242354
2871
2872 2019-03-06  Ross Kirsling  <ross.kirsling@sony.com>
2873
2874         [Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
2875         https://bugs.webkit.org/show_bug.cgi?id=195346
2876
2877         Reviewed by Fujii Hironori.
2878
2879         * Platform/IPC/win/ConnectionWin.cpp:
2880         (IPC::Connection::createServerAndClientIdentifiers):
2881         * Platform/win/ModuleWin.cpp:
2882         (WebKit::Module::load):
2883         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
2884         (WebKit::ProcessLauncher::launchProcess):
2885         * UIProcess/win/WebContextMenuProxyWin.cpp:
2886         (WebKit::createMenuItem):
2887         * UIProcess/win/WebView.cpp:
2888         (WebKit::WebView::setToolTip):
2889         * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp:
2890         (WebKit::InjectedBundle::initialize):
2891         Use wchar helpers as needed.
2892
2893 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2894
2895         Crash when attempting to change input type while dismissing datalist suggestions
2896         https://bugs.webkit.org/show_bug.cgi?id=195384
2897         <rdar://problem/48563718>
2898
2899         Reviewed by Brent Fulgham.
2900
2901         See WebCore ChangeLog for more details.
2902
2903         * WebProcess/WebPage/WebPage.cpp:
2904         (WebKit::WebPage::setActiveDataListSuggestionPicker):
2905         (WebKit::WebPage::didSelectDataListOption):
2906         (WebKit::WebPage::didCloseSuggestions):
2907         * WebProcess/WebPage/WebPage.h:
2908
2909         Turn m_activeDataListSuggestionPicker from a raw pointer into a WeakPtr.
2910
2911 2019-03-06  Chris Dumez  <cdumez@apple.com>
2912
2913         [iOS] ProcessDidResume() IPC should be sent upon resuming when ProcessWillSuspendImminently() IPC was sent
2914         https://bugs.webkit.org/show_bug.cgi?id=195382
2915         <rdar://problem/48642739>
2916
2917         Reviewed by Geoffrey Garen.
2918
2919         ProcessDidResume() IPC should be sent upon resuming when ProcessWillSuspendImminently() IPC was sent. Previously,
2920         we only send ProcessDidResume() to the WebProcess if PrepareToSuspend() was sent, not when the more urgent
2921         ProcessWillSuspendImminently() IPC was sent.
2922
2923         This mismatch has lead to bugs because the WebProcess does not know it got resumed and failed to unfreeze the
2924         layers it froze upon suspension.
2925
2926         * UIProcess/ProcessAssertion.h:
2927         (WebKit::ProcessAssertionClient::~ProcessAssertionClient):
2928
2929         * UIProcess/ProcessThrottler.cpp:
2930         (WebKit::ProcessThrottler::updateAssertion):
2931         (WebKit::ProcessThrottler::uiAssertionWillExpireImminently):
2932         (WebKit::ProcessThrottler::assertionWillExpireImminently): Deleted.
2933
2934         * UIProcess/ProcessThrottler.h:
2935         * UIProcess/ios/ProcessAssertionIOS.mm:
2936         (-[WKProcessAssertionBackgroundTaskManager _notifyClientsOfImminentSuspension]):
2937         (WebKit::ProcessAssertion::~ProcessAssertion):
2938         (WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
2939         (WebKit::ProcessAndUIAssertion::setClient):
2940
2941         * WebProcess/WebPage/WebPage.cpp:
2942         (WebKit::WebPage::didCompletePageTransition):
2943         Revert change that was landed in r242098 to work around this ProcessThrottler bug.
2944
2945         * WebProcess/WebPage/ios/WebPageIOS.mm:
2946         (WebKit::WebPage::applicationWillEnterForeground):
2947         Revert change that was landed in r242554 to work around this ProcessThrottler bug.
2948
2949 2019-03-06  Alex Christensen  <achristensen@webkit.org>
2950
2951         Add gettid to allowed syscalls on Mac
2952         https://bugs.webkit.org/show_bug.cgi?id=195386
2953         <rdar://problem/48651255>
2954
2955         Reviewed by Brent Fulgham.
2956
2957         * WebProcess/com.apple.WebProcess.sb.in:
2958
2959 2019-03-06  Per Arne Vollan  <pvollan@apple.com>
2960
2961         [macOS] Sandbox call violation causes WebContent process to crash
2962         https://bugs.webkit.org/show_bug.cgi?id=195379
2963         <rdar://problem/48647263>
2964
2965         Reviewed by Brent Fulgham.
2966
2967         A new call needs to be added to the allow list in the WebContent process' sandbox.
2968
2969         * WebProcess/com.apple.WebProcess.sb.in:
2970
2971 2019-03-06  Antti Koivisto  <antti@apple.com>
2972
2973         [iOS] Basic hit testing for content overlapping fast-scrollable overflow
2974         https://bugs.webkit.org/show_bug.cgi?id=195360
2975
2976         Reviewed by Simon Fraser.
2977
2978         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
2979         (WebKit::RemoteLayerTreeHost::makeNode):
2980
2981         Use new UIView subclass for tiled layer hosting (so we know they have content even when contents property is nil).
2982
2983         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
2984         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
2985         (collectDescendantViewsAtPoint):
2986
2987         Factor collection step into a function.
2988         Do basic skipping of event-transparent layers.
2989
2990         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
2991
2992         To handle overlap cases, find the scroll view that has the deepest non-transparent view hit as its descendant.
2993
2994         (-[UIView _web_recursiveFindDescendantInteractibleViewAtPoint:withEvent:]): Deleted.
2995
2996 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2997
2998         Move RenderObject::isTransparentOrFullyClippedRespectingParentFrames() to RenderLayer
2999         https://bugs.webkit.org/show_bug.cgi?id=195300
3000
3001         Reviewed by Simon Fraser.
3002
3003         Refactor some logic to use isTransparentOrFullyClippedRespectingParentFrames on RenderLayer rather than
3004         RenderObject; introduce a helper method to ask whether the enclosing layer of a renderer is transparent or
3005         clipped.
3006
3007         * WebProcess/WebPage/ios/WebPageIOS.mm:
3008         (WebKit::enclosingLayerIsTransparentOrFullyClipped):
3009         (WebKit::WebPage::platformEditorState const):
3010         (WebKit::WebPage::requestEvasionRectsAboveSelection):
3011         (WebKit::WebPage::getFocusedElementInformation):
3012
3013 2019-03-06  Chris Dumez  <cdumez@apple.com>
3014
3015         REGRESSION (r238490): YouTube.com: Returning PiP to Safari after sleeping device loses page
3016         https://bugs.webkit.org/show_bug.cgi?id=195364
3017         <rdar://problem/48538837>
3018
3019         Reviewed by Geoffrey Garen.
3020
3021         Make sure we unset the LayerTreeFreezeReason::ProcessSuspended layer tree freeze reason
3022         when WebPage::applicationWillEnterForeground() is called. This restores pre-r238490
3023         behavior and addresses the issue with PiP on youtube.com.
3024
3025         * WebProcess/WebPage/ios/WebPageIOS.mm:
3026         (WebKit::WebPage::applicationWillEnterForeground):
3027
3028 2019-03-05  Dean Jackson  <dino@apple.com>
3029
3030         Fix WKPasswordView compilation on iOS
3031         https://bugs.webkit.org/show_bug.cgi?id=195344
3032         <rdar://problem/48620066>
3033
3034         Reviewed by Dan Bates.
3035
3036         Use WebKitAdditions.
3037
3038         * UIProcess/ios/WKPasswordView.mm:
3039         (-[WKPasswordView showInScrollView:]):
3040
3041 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
3042
3043         [iOS] Frequent 1 second IPC deadlocks when showing a paste callout
3044         https://bugs.webkit.org/show_bug.cgi?id=195354
3045         <rdar://problem/48624675>
3046
3047         Reviewed by Tim Horton.
3048
3049         When triggering programmatic paste, we frequently hit deadlocks due to sync IPC going from the UI process to the
3050         web process and vice versa. What happens in this scenario is that prior to triggering programmatic paste, the
3051         page may try to move focus to a different element (e.g. a hidden editable area) before calling `execCommand`.
3052         This causes us to send an ElementDidFocus message to the UI process, followed by RequestDOMPasteAccess.
3053
3054         However, upon receiving ElementDidFocus, we reload input views and (in the process) UIKit requests the
3055         autocorrection context, which we implement in WebKit using a sync message to the web process due to
3056         <rdar://problem/16207002> and its blocking bug <rdar://problem/48383001>. This means we'll end up in a state
3057         where both the UI process and web process are blocked on each other waiting for a sync IPC response, and the UI
3058         process is hung for a second until the IPC message times out.
3059
3060         Ideally, we should fix this by addressing <rdar://problem/16207002>. However, this requires potentially large
3061         changes in UIKit (<rdar://problem/48383001>); for the time being, work around this deadlock by refactoring
3062         synchronous autocorrection context requests such that they can be resolved by an out-of-band IPC response
3063         (HandleAutocorrectionContext). Then prior to requesting DOM paste access, preemptively send a
3064         HandleAutocorrectionContext message to the UI process to unblock any pending synchronous autocorrection context
3065         requests.
3066
3067         * UIProcess/PageClient.h:
3068         * UIProcess/WebPageProxy.h:
3069         * UIProcess/WebPageProxy.messages.in:
3070         * UIProcess/ios/PageClientImplIOS.h:
3071         * UIProcess/ios/PageClientImplIOS.mm:
3072         (WebKit::PageClientImpl::handleAutocorrectionContext):
3073         * UIProcess/ios/WKContentViewInteraction.h:
3074
3075         Make it possible for WKContentView to remember its current pending autocorrection context completion handler.
3076         This is invoked and cleared out in `-_invokePendingAutocorrectionContextHandler:`.
3077
3078         * UIProcess/ios/WKContentViewInteraction.mm:
3079         (-[WKContentView _invokePendingAutocorrectionContextHandler:]):
3080         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
3081         (-[WKContentView _handleAutocorrectionContext:]):
3082
3083         Handle an autocorrection context response. This is invoked when the web process either handles an autocorrection
3084         context message, or when it preemptively sends an autocorrection context before requesting DOM paste access.
3085
3086         (+[WKAutocorrectionContext emptyAutocorrectionContext]):
3087
3088         Add a helper to create an empty autocorrection context.
3089
3090         * UIProcess/ios/WebPageProxyIOS.mm:
3091         (WebKit::WebPageProxy::requestAutocorrectionContext):
3092         (WebKit::WebPageProxy::handleAutocorrectionContext):
3093         (WebKit::WebPageProxy::autocorrectionContextSync): Deleted.
3094
3095         Removed this sync version, since we now only have requestAutocorrectionContext.
3096
3097         * WebProcess/WebPage/WebPage.cpp:
3098         (WebKit::WebPage::requestDOMPasteAccess):
3099
3100         Send WebPageProxy::HandleAutocorrectionContext, and add a FIXME referencing <rdar://problem/16207002>.
3101
3102         * WebProcess/WebPage/WebPage.h:
3103         * WebProcess/WebPage/WebPage.messages.in:
3104
3105         Split AutocorrectionContextSync into RequestAutocorrectionContext and HandleAutocorrectionContext; additionally,
3106         remove the existing RequestAutocorrectionContext message.
3107
3108         * WebProcess/WebPage/ios/WebPageIOS.mm:
3109         (WebKit::WebPage::requestAutocorrectionContext):
3110         (WebKit::WebPage::autocorrectionContextSync): Deleted.
3111
3112 2019-03-06  Rob Buis  <rbuis@igalia.com>
3113
3114         Consider supporting the `referrerpolicy` attribute.
3115         https://bugs.webkit.org/show_bug.cgi?id=179053
3116
3117         Reviewed by Darin Adler.
3118
3119         Add a runtime flag for referrerpolicy attribute.
3120
3121         * Shared/WebPreferences.yaml:
3122         * UIProcess/API/C/WKPreferences.cpp:
3123         (WKPreferencesSetReferrerPolicyAttributeEnabled):
3124         (WKPreferencesGetReferrerPolicyAttributeEnabled):
3125         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3126         * WebProcess/Network/WebLoaderStrategy.cpp:
3127         (WebKit::WebLoaderStrategy::loadResource): do not hardcode choosing
3128         the document referrer policy.
3129
3130 2019-03-06  Philippe Normand  <pnormand@igalia.com>
3131
3132         Unreviewed, WPE build fix after r242503
3133
3134         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
3135         ServiceWorker messages moved from network process to another
3136         header, so it needs to be included.
3137
3138 2019-03-05  David Quesada  <david_quesada@apple.com>
3139
3140         [WK2] It should be possible to follow links with 'download' attributes
3141         https://bugs.webkit.org/show_bug.cgi?id=195145
3142         rdar://problem/48462642
3143
3144         Reviewed by Alex Christensen.
3145
3146         When a link with a 'download' attribute is clicked and the navigation client
3147         says to allow the navigation (i.e. provides PolicyAction::Use),
3148         WebPageProxy::receivedNavigationPolicyDecision() should stop overriding this
3149         decision and downloading the link instead. Instead, web view should honor the
3150         policy chosen by the navigation delegate. This supports clients that want to
3151         offer the user the ability to view, rather than download, the contents of
3152         such links, which is permitted per the HTML spec.
3153
3154         This change is only made on Cocoa platforms for now since no other ports
3155         expose an API on their navigation action to express whether the page intends
3156         to download the linked resource.
3157
3158         * UIProcess/API/APINavigation.h:
3159         (API::Navigation::shouldPerformDownload const):
3160             Rename this to be in line with APINavigationAction's shouldPerformDownload()
3161             for consistency. 'Force' seems like too strong of a word for this property
3162             considering that 'forcing' the download isn't really an attribute inherent
3163             to the navigation, but a behavior implemented by the web page proxy.
3164         (API::Navigation::shouldForceDownload const): Deleted.
3165         * UIProcess/Cocoa/VersionChecks.h:
3166         * UIProcess/WebPageProxy.cpp:
3167         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3168
3169 2019-03-05  Takashi Komori  <Takashi.Komori@sony.com>
3170
3171         [Curl] Implement Cookie Accept Policy.
3172         https://bugs.webkit.org/show_bug.cgi?id=191645
3173
3174         Reviewed by Fujii Hironori.
3175
3176         * NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp:
3177         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
3178         (WebKit::WebCookieManager::platformGetHTTPCookieAcceptPolicy):
3179         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3180         (WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
3181         (WebKit::NetworkDataTaskCurl::handleCookieHeaders):
3182         * NetworkProcess/curl/NetworkDataTaskCurl.h:
3183
3184 2019-03-05  Youenn Fablet  <youenn@apple.com>
3185
3186         Introduce ServiceWorkerFetchTask
3187         https://bugs.webkit.org/show_bug.cgi?id=195130
3188
3189         Reviewed by Chris Dumez.
3190
3191         ServiceWorkerFetchTask is added to represent NetworkProcess side of an ongoing fetch intercepted by service worker.
3192         This patch should not change existing behavior.
3193
3194         * CMakeLists.txt:
3195         * DerivedSources-input.xcfilelist:
3196         * DerivedSources-output.xcfilelist:
3197         * DerivedSources.make:
3198         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3199         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
3200         * NetworkProcess/NetworkProcess.cpp:
3201         (WebKit::NetworkProcess::didFailFetch): Deleted.
3202         (WebKit::NetworkProcess::didNotHandleFetch): Deleted.
3203         (WebKit::NetworkProcess::didReceiveFetchRedirectResponse): Deleted.
3204         (WebKit::NetworkProcess::didReceiveFetchResponse): Deleted.
3205         (WebKit::NetworkProcess::didReceiveFetchData): Deleted.
3206         (WebKit::NetworkProcess::didReceiveFetchFormData): Deleted.
3207         (WebKit::NetworkProcess::didFinishFetch): Deleted.
3208         * NetworkProcess/NetworkProcess.h:
3209         * NetworkProcess/NetworkProcess.messages.in:
3210         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
3211         (WebKit::WebSWServerConnection::cancelFetch):
3212         (WebKit::WebSWServerConnection::continueDidReceiveFetchResponse):
3213         (WebKit::WebSWServerConnection::startFetch):
3214         (WebKit::WebSWServerConnection::didReceiveFetchRedirectResponse): Deleted.
3215         (WebKit::WebSWServerConnection::didReceiveFetchResponse): Deleted.
3216         (WebKit::WebSWServerConnection::didReceiveFetchData): Deleted.
3217         (WebKit::WebSWServerConnection::didReceiveFetchFormData): Deleted.
3218         (WebKit::WebSWServerConnection::didFinishFetch): Deleted.
3219         (WebKit::WebSWServerConnection::didFailFetch): Deleted.
3220         (WebKit::WebSWServerConnection::didNotHandleFetch): Deleted.
3221         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
3222         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
3223         (WebKit::WebSWServerToContextConnection::connectionClosed):
3224         (WebKit::WebSWServerToContextConnection::startFetch):
3225         (WebKit::WebSWServerToContextConnection::cancelFetch):
3226         (WebKit::WebSWServerToContextConnection::continueDidReceiveFetchResponse):
3227         (WebKit::WebSWServerToContextConnection::didReceiveFetchTaskMessage):
3228         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
3229         * SourcesCocoa.txt:
3230         * WebKit.xcodeproj/project.pbxproj:
3231         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3232         (WebKit::WebSWContextManagerConnection::startFetch):
3233         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
3234         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveRedirection):
3235         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse):
3236         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
3237         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish):
3238         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveBlobChunk):
3239         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
3240         (WebKit::WebServiceWorkerFetchTaskClient::didFinish):
3241         (WebKit::WebServiceWorkerFetchTaskClient::didNotHandle):
3242         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: Added.
3243         (WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse):
3244         (WebKit::ServiceWorkerFetchTask::didReceiveResponse):
3245         (WebKit::ServiceWorkerFetchTask::didReceiveData):
3246         (WebKit::ServiceWorkerFetchTask::didReceiveFormData):
3247         (WebKit::ServiceWorkerFetchTask::didFinish):
3248         (WebKit::ServiceWorkerFetchTask::didFail):
3249         (WebKit::ServiceWorkerFetchTask::didNotHandle):
3250         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h: Added.
3251         (WebKit::ServiceWorkerFetchTask::create):
3252         (WebKit::ServiceWorkerFetchTask::Identifier::hash const):
3253         (WebKit::ServiceWorkerFetchTask::identifier const):
3254         (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask):
3255         (WebKit::operator==):
3256         (WTF::ServiceWorkerFetchTaskIdentifierHash::hash):
3257         (WTF::ServiceWorkerFetchTaskIdentifierHash::equal):
3258         (WTF::HashTraits<WebKit::ServiceWorkerFetchTask::Identifier>::emptyValue):
3259         (WTF::HashTraits<WebKit::ServiceWorkerFetchTask::Identifier>::constructDeletedValue):
3260         (WTF::HashTraits<WebKit::ServiceWorkerFetchTask::Identifier>::isDeletedValue):
3261         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.messages.in: Added.
3262
3263 2019-03-05  Youenn Fablet  <youenn@apple.com>
3264
3265         Rename requestCacheStorageSpace to requestStorageSpace
3266         https://bugs.webkit.org/show_bug.cgi?id=195282
3267
3268         Reviewed by Chris Dumez.
3269
3270         Make the name more abstract as it might be used in the future for other storage
3271         like IDB or service worker registrations.
3272
3273         * NetworkProcess/NetworkProcess.cpp:
3274         (WebKit::NetworkProcess::requestStorageSpace):
3275         (WebKit::NetworkProcess::requestCacheStorageSpace): Deleted.
3276         * NetworkProcess/NetworkProcess.h:
3277         * NetworkProcess/cache/CacheStorageEngine.cpp:
3278         (WebKit::CacheStorage::Engine::requestSpace):
3279         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3280         (WebsiteDataStoreClient::WebsiteDataStoreClient):
3281         * UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h:
3282         * UIProcess/Network/NetworkProcessProxy.cpp:
3283         (WebKit::NetworkProcessProxy::requestStorageSpace):
3284         (WebKit::NetworkProcessProxy::requestCacheStorageSpace): Deleted.
3285         * UIProcess/Network/NetworkProcessProxy.h:
3286         * UIProcess/Network/NetworkProcessProxy.messages.in:
3287         * UIProcess/WebsiteData/WebsiteDataStoreClient.h:
3288         (WebKit::WebsiteDataStoreClient::requestStorageSpace):
3289         (WebKit::WebsiteDataStoreClient::requestCacheStorageSpace): Deleted.
3290
3291 2019-03-05  Chris Dumez  <cdumez@apple.com>
3292
3293         Drop cached WebProcesses for a given session when this session is destroyed
3294         https://bugs.webkit.org/show_bug.cgi?id=195212
3295         <rdar://problem/48301483>
3296
3297         Reviewed by Geoffrey Garen.
3298
3299         Drop cached WebProcesses for a give session when this session is destroyed. This way, when you close
3300         your private browsing window, all the processes it used get cleared and it cannot leave any state
3301         behind.
3302
3303         * UIProcess/WebProcessCache.cpp:
3304         (WebKit::WebProcessCache::canCacheProcess const):
3305         (WebKit::WebProcessCache::addProcessIfPossible):
3306         (WebKit::WebProcessCache::addProcess):
3307         (WebKit::WebProcessCache::clearAllProcessesForSession):
3308         * UIProcess/WebProcessCache.h:
3309         (WebKit::WebProcessCache::capacity const):
3310         * UIProcess/WebProcessPool.cpp:
3311         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
3312         (WebKit::WebProcessPool::hasPagesUsingWebsiteDataStore const):
3313         * UIProcess/WebProcessPool.h:
3314
3315 2019-03-05  Brady Eidson  <beidson@apple.com>
3316
3317         Correctly handle sandbox extensions when the same WKWebView loads multiple file:// URLs.
3318         <rdar://problem/47820581> and https://bugs.webkit.org/show_bug.cgi?id=195291
3319
3320         Reviewed by Tim Horton.
3321
3322         * WebProcess/WebPage/WebPage.cpp:
3323         (WebKit::WebPage::SandboxExtensionTracker::shouldReuseCommittedSandboxExtension): If there is a pendingProvisionalSandboxExtension
3324           then its existence should override our willingness to reuse the existing committed extension.
3325         (WebKit::shouldReuseCommittedSandboxExtension): Deleted.
3326         * WebProcess/WebPage/WebPage.h:
3327
3328 2019-03-05  Ryan Haddad  <ryanhaddad@apple.com>
3329
3330         Unreviewed, rolling out r242403.
3331
3332         Caused layout test crashes on iOS simulator.
3333
3334         Reverted changeset:
3335
3336         "[ContentChangeObserver] Introduce fixed duration content
3337         observation"
3338         https://bugs.webkit.org/show_bug.cgi?id=195295
3339         https://trac.webkit.org/changeset/242403
3340
3341 2019-03-05  Loïc Yhuel  <loic.yhuel@softathome.com>
3342
3343         [WPE] Do not create a PlatformDisplay in the Service Worker process
3344         https://bugs.webkit.org/show_bug.cgi?id=194830
3345
3346         Reviewed by Žan Doberšek.
3347
3348         It avoids opening the Wayland socket in this WPEWebProcess, which might cause issues
3349         depending on the platform, and allocates unneeded resources.
3350
3351         * Shared/WebProcessCreationParameters.cpp:
3352         (WebKit::WebProcessCreationParameters::encode const):
3353         (WebKit::WebProcessCreationParameters::decode):
3354         * Shared/WebProcessCreationParameters.h: Add new isServiceWorkerProcess parameter.
3355         * UIProcess/WebProcessPool.cpp:
3356         (WebKit::WebProcessPool::initializeNewWebProcess): Set isServiceWorkerProcess parameter.
3357         * UIProcess/glib/WebProcessPoolGLib.cpp:
3358         (WebKit::WebProcessPool::platformInitializeWebProcess): No implementationLibraryName and hostClientFileDescriptor for Service Worker.
3359         * WebProcess/glib/WebProcessGLib.cpp:
3360         (WebKit::WebProcess::platformInitializeWebProcess): No wpe_loader_init nor PlatformDisplayLibWPE for Service Worker.
3361
3362 2019-03-04  Brady Eidson  <beidson@apple.com>
3363
3364         Unreviewed, rolling out r242376.
3365
3366         Broke some tests
3367
3368         Reverted changeset:
3369
3370         "Correctly handle sandbox extensions when the same WKWebView
3371         loads multiple file:// URLs."
3372         https://bugs.webkit.org/show_bug.cgi?id=195291
3373         https://trac.webkit.org/changeset/242376
3374
3375 2019-03-04  Fujii Hironori  <Hironori.Fujii@sony.com>
3376
3377         Use a SQLite database to hold the ResourceLoadStatistics data
3378         https://bugs.webkit.org/show_bug.cgi?id=194867
3379         <rdar://problem/24240854>
3380
3381         Unreviewed build fix for WinCairo.
3382
3383         ResourceLoadStatisticsDebug and RELEASE_LOG_INFO_IF are not
3384         defined because WinCairo port defines RELEASE_LOG_DISABLED.
3385
3386         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3387         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess): Enclosed RELEASE_LOG_INFO_IF with #if !RELEASE_LOG_DISABLED.
3388         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener): Ditto.
3389         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking): Ditto.
3390
3391 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
3392
3393         Use a SQLite database to hold the ResourceLoadStatistics data
3394         https://bugs.webkit.org/show_bug.cgi?id=194867
3395         <rdar://problem/24240854>
3396
3397         Reviewed by Chris Dumez.
3398
3399         The ResourceLoadStatistics database plist is inefficient. It requires more memory use
3400         than it needs, and forces lots of looping and string comparisons to find information.
3401
3402         This problem has already been solved in the form of relational databases. We use them
3403         elsewhere in WebKit, and should do so for this storage as well.
3404
3405         This patch creates an optional SQLite database to handle ITP operations.
3406
3407         1. It adds a new internal experimental feature flag to activate it. It requires the user
3408            exit and restart the process to take effect.
3409         2. It populates itself from the existing plist file (if it exists).
3410         3. It stops using the plist in favor of the database.
3411         4. It does queries and other operations using the database instead of the old hash table
3412            implementation.
3413
3414         This patch refactors the exisiting ResourceLoadStatisticsMemoryStore class into a base
3415         ResourceLoadStatisticsStore class, which ResourceLoadStatisticsMemoryStore is based on.
3416         It adds a new ResourceLoadStatisticsDatabaseStore that is implemented in terms of SQL
3417         operations.
3418
3419         These code changes should not have any impact on existing operations, and when enabled
3420         should produce the same test results.
3421
3422         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: Added.
3423         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
3424         (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
3425         (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements):
3426         (WebKit::ResourceLoadStatisticsDatabaseStore::insertObservedDomain):
3427         (WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const):
3428         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationship):
3429         (WebKit::ResourceLoadStatisticsDatabaseStore::confirmDomainDoesNotExist const):
3430         (WebKit::ResourceLoadStatisticsDatabaseStore::domainIDFromString const):
3431         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
3432         (WebKit::ResourceLoadStatisticsDatabaseStore::databaseIsEmpty const):
3433         (WebKit::ResourceLoadStatisticsDatabaseStore::populateFromMemoryStore):
3434         (WebKit::ResourceLoadStatisticsDatabaseStore::calculateAndSubmitTelemetry const):
3435         (WebKit::ResourceLoadStatisticsDatabaseStore::incrementRecordsDeletedCountForDomains):
3436         (WebKit::ResourceLoadStatisticsDatabaseStore::recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain):
3437         (WebKit::buildList):
3438         (WebKit::ResourceLoadStatisticsDatabaseStore::markAsPrevalentIfHasRedirectedToPrevalent):
3439         (WebKit::listToString):
3440         (WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources):
3441         (WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
3442         (WebKit::ResourceLoadStatisticsDatabaseStore::classifyPrevalentResources):
3443         (WebKit::ResourceLoadStatisticsDatabaseStore::syncStorageIfNeeded):
3444         (WebKit::ResourceLoadStatisticsDatabaseStore::syncStorageImmediately):
3445         (WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess):
3446         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
3447         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
3448         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
3449         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
3450         (WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
3451         (WebKit::ResourceLoadStatisticsDatabaseStore::ensurePrevalentResourcesForDebugMode):
3452         (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation):
3453         (WebKit::ResourceLoadStatisticsDatabaseStore::logSubresourceLoading):
3454         (WebKit::ResourceLoadStatisticsDatabaseStore::logSubresourceRedirect):
3455         (WebKit::ResourceLoadStatisticsDatabaseStore::setUserInteraction):
3456         (WebKit::ResourceLoadStatisticsDatabaseStore::logUserInteraction):
3457         (WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction):
3458         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
3459         (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
3460         (WebKit::ResourceLoadStatisticsDatabaseStore::setDomainsAsPrevalent):
3461         (WebKit::ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics const):
3462         (WebKit::ResourceLoadStatisticsDatabaseStore::predicateValueForDomain const):
3463         (WebKit::ResourceLoadStatisticsDatabaseStore::isPrevalentResource const):
3464         (WebKit::ResourceLoadStatisticsDatabaseStore::isVeryPrevalentResource const):
3465         (WebKit::ResourceLoadStatisticsDatabaseStore::isRegisteredAsSubresourceUnder const):
3466         (WebKit::ResourceLoadStatisticsDatabaseStore::isRegisteredAsSubFrameUnder const):
3467         (WebKit::ResourceLoadStatisticsDatabaseStore::isRegisteredAsRedirectingTo const):
3468         (WebKit::ResourceLoadStatisticsDatabaseStore::clearPrevalentResource):
3469         (WebKit::ResourceLoadStatisticsDatabaseStore::setGrandfathered):
3470         (WebKit::ResourceLoadStatisticsDatabaseStore::isGrandfathered const):
3471         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubframeUnderTopFrameOrigin):
3472         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUnderTopFrameOrigin):
3473         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectTo):
3474         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectFrom):
3475         (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectTo):
3476         (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectFrom):
3477         (WebKit::ResourceLoadStatisticsDatabaseStore::ensureResourceStatisticsForPrimaryDomain):
3478         (WebKit::ResourceLoadStatisticsDatabaseStore::clear):
3479         (WebKit::ResourceLoadStatisticsDatabaseStore::cookieTreatmentForOrigin const):
3480         (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt):
3481         (WebKit::ResourceLoadStatisticsDatabaseStore::domainsToBlock const):
3482         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking):
3483         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlockingForDomains):
3484         (WebKit::ResourceLoadStatisticsDatabaseStore::clearBlockingStateForDomains):
3485         (WebKit::ResourceLoadStatisticsDatabaseStore::processStatistics const):
3486         (WebKit::ResourceLoadStatisticsDatabaseStore::prevalentDomains const):
3487         (WebKit::ResourceLoadStatisticsDatabaseStore::findExpiredUserInteractions const):
3488         (WebKit::ResourceLoadStatisticsDatabaseStore::clearExpiredUserInteractions):
3489         (WebKit::ResourceLoadStatisticsDatabaseStore::clearGrandfathering):
3490         (WebKit::ResourceLoadStatisticsDatabaseStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
3491         (WebKit::ResourceLoadStatisticsDatabaseStore::pruneStatisticsIfNeeded):
3492         (WebKit::ResourceLoadStatisticsDatabaseStore::updateLastSeen):
3493         (WebKit::ResourceLoadStatisticsDatabaseStore::setLastSeen):
3494         (WebKit::ResourceLoadStatisticsDatabaseStore::setVeryPrevalentResource):
3495         (WebKit::ResourceLoadStatisticsDatabaseStore::removeAllStorageAccess):
3496         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: Added.
3497         (WebKit::ResourceLoadStatisticsDatabaseStore::isEmpty const):
3498         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3499         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
3500         (WebKit::ResourceLoadStatisticsMemoryStore::incrementRecordsDeletedCountForDomains):
3501         (WebKit::ResourceLoadStatisticsMemoryStore::classifyPrevalentResources):
3502         (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageIfNeeded):
3503         (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageImmediately):
3504         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherDataForDomains):
3505         (WebKit::domainsToString): Deleted.
3506         (WebKit::OperatingDate::fromWallTime): Deleted.
3507         (WebKit::OperatingDate::today): Deleted.
3508         (WebKit::OperatingDate::secondsSinceEpoch const): Deleted.
3509         (WebKit::OperatingDate::operator== const): Deleted.
3510         (WebKit::OperatingDate::operator< const): Deleted.
3511         (WebKit::OperatingDate::operator<= const): Deleted.
3512         (WebKit::OperatingDate::OperatingDate): Deleted.
3513         (WebKit::mergeOperatingDates): Deleted.
3514         (WebKit::computeImportance): Deleted.
3515         (WebKit::ResourceLoadStatisticsMemoryStore::~ResourceLoadStatisticsMemoryStore): Deleted.
3516         (WebKit::ResourceLoadStatisticsMemoryStore::setNotifyPagesWhenDataRecordsWereScanned): Deleted.
3517         (WebKit::ResourceLoadStatisticsMemoryStore::setShouldClassifyResourcesBeforeDataRecordsRemoval): Deleted.
3518         (WebKit::ResourceLoadStatisticsMemoryStore::setShouldSubmitTelemetry): Deleted.
3519         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords): Deleted.
3520         (WebKit::ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords): Deleted.
3521         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData): Deleted.
3522         (WebKit::ResourceLoadStatisticsMemoryStore::setResourceLoadStatisticsDebugMode): Deleted.
3523         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode): Deleted.
3524         (WebKit::ResourceLoadStatisticsMemoryStore::scheduleStatisticsProcessingRequestIfNecessary): Deleted.
3525         (WebKit::ResourceLoadStatisticsMemoryStore::cancelPendingStatisticsProcessingRequest): Deleted.
3526         (WebKit::ResourceLoadStatisticsMemoryStore::setTimeToLiveUserInteraction): Deleted.
3527         (WebKit::ResourceLoadStatisticsMemoryStore::setMinimumTimeBetweenDataRecordsRemoval): Deleted.
3528         (WebKit::ResourceLoadStatisticsMemoryStore::setGrandfatheringTime): Deleted.
3529         (WebKit::ResourceLoadStatisticsMemoryStore::setCacheMaxAgeCap): Deleted.
3530         (WebKit::ResourceLoadStatisticsMemoryStore::updateCacheMaxAgeCap): Deleted.
3531         (WebKit::ResourceLoadStatisticsMemoryStore::setAgeCapForClientSideCookies): Deleted.
3532         (WebKit::ResourceLoadStatisticsMemoryStore::updateClientSideCookiesAgeCap): Deleted.
3533         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveDataRecords const): Deleted.
3534         (WebKit::ResourceLoadStatisticsMemoryStore::setDataRecordsBeingRemoved): Deleted.
3535         (WebKit::debugLogDomainsInBatches): Deleted.
3536         (WebKit::ResourceLoadStatisticsMemoryStore::includeTodayAsOperatingDateIfNecessary): Deleted.
3537         (WebKit::ResourceLoadStatisticsMemoryStore::hasStatisticsExpired const): Deleted.
3538         (WebKit::ResourceLoadStatisticsMemoryStore::setMaxStatisticsEntries): Deleted.
3539         (WebKit::ResourceLoadStatisticsMemoryStore::setPruneEntriesDownTo): Deleted.
3540         (WebKit::ResourceLoadStatisticsMemoryStore::resetParametersToDefaultValues): Deleted.
3541         (WebKit::ResourceLoadStatisticsMemoryStore::logTestingEvent): Deleted.
3542         (WebKit::ResourceLoadStatisticsMemoryStore::didCreateNetworkProcess): Deleted.
3543         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
3544         (WebKit::ResourceLoadStatisticsMemoryStore::data const):
3545         (WebKit::ResourceLoadStatisticsMemoryStore::isDebugModeEnabled const): Deleted.
3546         (WebKit::ResourceLoadStatisticsMemoryStore::store const): Deleted.
3547         (WebKit::ResourceLoadStatisticsMemoryStore::setStorageAccessPromptsEnabled): Deleted.
3548         (WebKit::ResourceLoadStatisticsMemoryStore::setDebugLogggingEnabled): Deleted.
3549         (): Deleted.
3550         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: Added.
3551         (WebKit::domainsToString):
3552         (WebKit::OperatingDate::fromWallTime):
3553         (WebKit::OperatingDate::today):
3554         (WebKit::OperatingDate::secondsSinceEpoch const):
3555         (WebKit::OperatingDate::operator== const):
3556         (WebKit::OperatingDate::operator< const):
3557         (WebKit::OperatingDate::operator<= const):
3558         (WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
3559         (WebKit::ResourceLoadStatisticsStore::~ResourceLoadStatisticsStore):
3560         (WebKit::ResourceLoadStatisticsStore::calculateAndSubmitTelemetry const):
3561         (WebKit::ResourceLoadStatisticsStore::computeImportance):
3562         (WebKit::ResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
3563         (WebKit::ResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
3564         (WebKit::ResourceLoadStatisticsStore::setShouldSubmitTelemetry):
3565         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
3566         (WebKit::ResourceLoadStatisticsStore::processStatisticsAndDataRecords):
3567         (WebKit::ResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
3568         (WebKit::ResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
3569         (WebKit::ResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
3570         (WebKit::ResourceLoadStatisticsStore::scheduleStatisticsProcessingRequestIfNecessary):
3571         (WebKit::ResourceLoadStatisticsStore::cancelPendingStatisticsProcessingRequest):
3572         (WebKit::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
3573         (WebKit::ResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
3574         (WebKit::ResourceLoadStatisticsStore::setGrandfatheringTime):
3575         (WebKit::ResourceLoadStatisticsStore::setCacheMaxAgeCap):
3576         (WebKit::ResourceLoadStatisticsStore::updateCacheMaxAgeCap):
3577         (WebKit::ResourceLoadStatisticsStore::setAgeCapForClientSideCookies):
3578         (WebKit::ResourceLoadStatisticsStore::updateClientSideCookiesAgeCap):
3579         (WebKit::ResourceLoadStatisticsStore::shouldRemoveDataRecords const):
3580         (WebKit::ResourceLoadStatisticsStore::setDataRecordsBeingRemoved):
3581         (WebKit::ResourceLoadStatisticsStore::updateCookieBlockingForDomains):
3582         (WebKit::ResourceLoadStatisticsStore::clearBlockingStateForDomains):
3583         (WebKit::ResourceLoadStatisticsStore::processStatistics const):
3584         (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const):
3585         (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates):
3586         (WebKit::ResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
3587         (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const):
3588         (WebKit::ResourceLoadStatisticsStore::setMaxStatisticsEntries):
3589         (WebKit::ResourceLoadStatisticsStore::setPruneEntriesDownTo):
3590         (WebKit::ResourceLoadStatisticsStore::resetParametersToDefaultValues):
3591         (WebKit::ResourceLoadStatisticsStore::logTestingEvent):
3592         (WebKit::ResourceLoadStatisticsStore::removeAllStorageAccess):
3593         (WebKit::ResourceLoadStatisticsStore::didCreateNetworkProcess):
3594         (WebKit::ResourceLoadStatisticsStore::debugLogDomainsInBatches):
3595         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: Copied from Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h.
3596         (WebKit::OperatingDate::OperatingDate):
3597         (WebKit::ResourceLoadStatisticsStore::isEmpty const):
3598         (WebKit::ResourceLoadStatisticsStore::data const):
3599         (WebKit::ResourceLoadStatisticsStore::isDebugModeEnabled const):
3600         (WebKit::ResourceLoadStatisticsStore::store const):
3601         (WebKit::ResourceLoadStatisticsStore::setStorageAccessPromptsEnabled):
3602         (WebKit::ResourceLoadStatisticsStore::setDebugLogggingEnabled):
3603         * NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm: Renamed from Source/WebKit/UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm.
3604         (WebKit::ResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
3605         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3606         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
3607         (WebKit::WebResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
3608         (WebKit::WebResourceLoadStatisticsStore::setShouldSubmitTelemetry):
3609         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
3610         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
3611         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
3612         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
3613         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
3614         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
3615         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
3616         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
3617         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
3618         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
3619         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
3620         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading):
3621         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading):
3622         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect):
3623         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
3624         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
3625         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
3626         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
3627         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
3628         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
3629         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
3630         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
3631         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder):
3632         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
3633         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
3634         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
3635         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
3636         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
3637         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
3638         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
3639         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
3640         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
3641         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
3642         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
3643         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdate):
3644         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains):
3645         (WebKit::WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains):
3646         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
3647         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
3648         (WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
3649         (WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
3650         (WebKit::WebResourceLoadStatisticsStore::setMaxStatisticsEntries):
3651         (WebKit::WebResourceLoadStatisticsStore::setPruneEntriesDownTo):
3652         (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
3653         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3654         * NetworkProcess/NetworkProcess.cpp:
3655         (WebKit::NetworkProcess::initializeNetworkProcess):
3656         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3657         (WebKit::NetworkProcessCreationParameters::encode const):
3658         (WebKit::NetworkProcessCreationParameters::decode):
3659         * NetworkProcess/NetworkProcessCreationParameters.h:
3660         * Platform/classifier/ResourceLoadStatisticsClassifier.cpp:
3661         (WebKit::ResourceLoadStatisticsClassifier::calculateResourcePrevalence):
3662         * Platform/classifier/ResourceLoadStatisticsClassifier.h:
3663         * Shared/WebPreferences.yaml:
3664         * Sources.txt:
3665         * SourcesCocoa.txt:
3666         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3667         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3668         * UIProcess/WebProcessPool.cpp:
3669         * WebKit.xcodeproj/project.pbxproj:
3670
3671 2019-03-04  Zalan Bujtas  <zalan@apple.com>
3672
3673         [ContentChangeObserver] Introduce fixed duration content observation
3674         https://bugs.webkit.org/show_bug.cgi?id=195295
3675         <rdar://problem/48579913>
3676
3677         Reviewed by Simon Fraser.
3678
3679         * WebProcess/WebPage/ios/WebPageIOS.mm:
3680         (WebKit::WebPage::handleSyntheticClick):
3681
3682 2019-03-04  Truitt Savell  <tsavell@apple.com>
3683
3684         Unreviewed, rolling out r242396.
3685
3686         Found issue to be unrelated. reverting my rollout.
3687
3688         Reverted changeset:
3689
3690         "Unreviewed, rolling out r242222."
3691         https://bugs.webkit.org/show_bug.cgi?id=193683
3692         https://trac.webkit.org/changeset/242396
3693
3694 2019-03-04  Jiewen Tan  <jiewen_tan@apple.com>
3695
3696         Unreviewed, a followup after r242336
3697
3698         * UIProcess/WebPageProxy.cpp:
3699         (WebKit::WebPageProxy::webViewDidMoveToWindow):
3700         Copy the list of observers before iterating it to avoid observers modifying the list.
3701
3702 2019-03-04  Truitt Savell  <tsavell@apple.com>
3703
3704         Unreviewed, rolling out r242222.
3705
3706         Broke internal debug testing
3707
3708         Reverted changeset:
3709
3710         "[iOS] Move calls to [UIKeyboard isInHardwareKeyboardMode] to
3711         the UI process."
3712         https://bugs.webkit.org/show_bug.cgi?id=193683
3713         https://trac.webkit.org/changeset/242222
3714
3715 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
3716
3717         Unreviewed build fix after r242378
3718
3719         * UIProcess/ios/EditableImageController.mm:
3720         (WebKit::EditableImageController::associateWithAttachment):
3721
3722 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
3723
3724         Check contextIDs when handling WebContent messages
3725         https://bugs.webkit.org/show_bug.cgi?id=195289
3726         <rdar://problem/48475870>
3727
3728         Reviewed by Alex Christensen.
3729
3730         The WebContent process is untrusted because it handles arbitrary markup and javascript from untrusted sources.
3731         We should handle its messages with suspicion, and make sure the arguments are valid and usable before honoring them.
3732
3733         This patch hardens the message passing layer by performing MESSAGE_CHECK in places that had been overlooked.
3734
3735         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
3736         (WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID):
3737         (WebKit::PlaybackSessionManagerProxy::currentTimeChanged):
3738         (WebKit::PlaybackSessionManagerProxy::bufferedTimeChanged):
3739         (WebKit::PlaybackSessionManagerProxy::seekableRangesVectorChanged):
3740         (WebKit::PlaybackSessionManagerProxy::canPlayFastReverseChanged):
3741         (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionOptionsChanged):
3742         (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionOptionsChanged):
3743         (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionIndexChanged):
3744         (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionIndexChanged):
3745         (WebKit::PlaybackSessionManagerProxy::externalPlaybackPropertiesChanged):
3746         (WebKit::PlaybackSessionManagerProxy::wirelessVideoPlaybackDisabledChanged):
3747         (WebKit::PlaybackSessionManagerProxy::mutedChanged):
3748         (WebKit::PlaybackSessionManagerProxy::volumeChanged):
3749         (WebKit::PlaybackSessionManagerProxy::durationChanged):
3750         (WebKit::PlaybackSessionManagerProxy::playbackStartedTimeChanged):
3751         (WebKit::PlaybackSessionManagerProxy::rateChanged):
3752         (WebKit::PlaybackSessionManagerProxy::pictureInPictureSupportedChanged):
3753         (WebKit::PlaybackSessionManagerProxy::pictureInPictureActiveChanged):
3754         (WebKit::PlaybackSessionManagerProxy::handleControlledElementIDResponse const):
3755         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
3756         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
3757         (WebKit::UserMediaCaptureManagerProxy::startProducingData):
3758         (WebKit::UserMediaCaptureManagerProxy::stopProducingData):
3759         (WebKit::UserMediaCaptureManagerProxy::end):
3760         (WebKit::UserMediaCaptureManagerProxy::capabilities):
3761         (WebKit::UserMediaCaptureManagerProxy::setMuted):
3762         (WebKit::UserMediaCaptureManagerProxy::applyConstraints):
3763         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
3764         (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
3765         (WebKit::VideoFullscreenManagerProxy::setHasVideo):
3766         (WebKit::VideoFullscreenManagerProxy::setVideoDimensions):
3767         (WebKit::VideoFullscreenManagerProxy::enterFullscreen):
3768         (WebKit::VideoFullscreenManagerProxy::exitFullscreen):
3769         (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode):
3770         (WebKit::VideoFullscreenManagerProxy::setInlineRect):
3771         (WebKit::VideoFullscreenManagerProxy::setHasVideoContentLayer):
3772         (WebKit::VideoFullscreenManagerProxy::cleanupFullscreen):
3773         (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline):
3774         (WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen):
3775         * UIProcess/ios/EditableImageController.mm:
3776         (WebKit::EditableImageController::didCreateEditableImage):
3777         (WebKit::EditableImageController::didDestroyEditableImage):
3778         (WebKit::EditableImageController::associateWithAttachment):
3779
3780 2019-03-04  Alex Christensen  <achristensen@webkit.org>
3781
3782         Fix crashes when NetworkResourceLoader/NetworkLoadChecker are destroyed during HTTPS upgrade check
3783         https://bugs.webkit.org/show_bug.cgi?id=195238
3784         <rdar://problem/47598656>
3785
3786         Reviewed by Chris Dumez.
3787
3788         * NetworkProcess/NetworkLoadChecker.cpp:
3789         (WebKit::NetworkLoadChecker::checkRequest):
3790
3791 2019-03-04  Brady Eidson  <beidson@apple.com>
3792
3793         Correctly handle sandbox extensions when the same WKWebView loads multiple file:// URLs.
3794         <rdar://problem/47820581> and https://bugs.webkit.org/show_bug.cgi?id=195291
3795
3796         Reviewed by Andy Estes.
3797
3798         * WebProcess/WebPage/WebPage.cpp:
3799         (WebKit::shouldReuseCommittedSandboxExtension): Only retain the previous sandbox extension if the file URL
3800           we're currently loading is functionally equivalent to the previous one.
3801
3802 2019-03-04  Chris Dumez  <cdumez@apple.com>
3803
3804         Drop legacy userAgentForURL injected bundle SPI
3805         https://bugs.webkit.org/show_bug.cgi?id=195222
3806         <rdar://problem/46734147>
3807
3808         Reviewed by Darin Adler.
3809
3810         Drop legacy userAgentForURL injected bundle SPI. There are no longer any clients, and using
3811         WebsitePolicies.customUserAgent is the way to go nowadays.
3812
3813         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
3814         (API::InjectedBundle::PageLoaderClient::willDestroyFrame):
3815         (API::InjectedBundle::PageLoaderClient::userAgentForURL const): Deleted.
3816         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
3817         * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:
3818         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3819         (setUpPageLoaderClient):
3820         (userAgentForURL): Deleted.
3821         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
3822         (WebKit::InjectedBundlePageLoaderClient::userAgentForURL const): Deleted.
3823         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
3824         * WebProcess/WebPage/WebPage.cpp:
3825         (WebKit::WebPage::userAgent const):
3826
3827 2019-03-04  Chris Dumez  <cdumez@apple.com>
3828
3829         Do not share WebProcesses between private and regular sessions
3830         https://bugs.webkit.org/show_bug.cgi?id=195189
3831         <rdar://problem/48421064>
3832
3833         Reviewed by Alex Christensen.
3834
3835         Do not share WebProcesses between private and regular sessions. There are some privacy concerns.
3836         Also, some of the WebsiteDataStore informations are passed via WebProcessCreationParameters (e.g.
3837         ApplicationCache path) and cannot be updated later.
3838
3839         There were 2 cases where this could happen and that are fixed in the patch:
3840         - A process may be prewarmed with a given website data store and then later on used for a page
3841           associated with a different data store. We now prevent this. While this is not necessary for
3842           privacy reasons, it is still useful because our code currently does not support well uses
3843           different sessions inside a single WebProcess, as mentioned above.
3844         - The client can force a WebsiteDataStore swap when responding to the decidePolicyForNavigationAction,
3845           via the WebsitePolicies. To address the issue, we now force a process swap whenever the client
3846           makes such a change.
3847
3848         As a result, WebProcessProxy::websiteDataStore() now makes sense and is always correct. It can
3849         also only contains pages whose WebPageProxy::websiteDataStore() returns the same store.
3850
3851         * UIProcess/API/C/WKContext.cpp:
3852         (WKContextWarmInitialProcess):
3853         * UIProcess/API/Cocoa/WKProcessPool.mm:
3854         (-[WKProcessPool _warmInitialProcess]):
3855         * UIProcess/ProvisionalPageProxy.cpp:
3856         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
3857         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
3858         * UIProcess/WebPageProxy.cpp:
3859         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
3860         (WebKit::WebPageProxy::reattachToWebProcess):
3861         (WebKit::WebPageProxy::swapToWebProcess):
3862         (WebKit::WebPageProxy::close):
3863         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3864         (WebKit::WebPageProxy::commitProvisionalPage):
3865         (WebKit::WebPageProxy::creationParameters):
3866         * UIProcess/WebPageProxy.h:
3867         (WebKit::WebPageProxy::websiteDataStore):
3868         * UIProcess/WebProcessPool.cpp:
3869         (WebKit::WebProcessPool::ensureNetworkProcess):
3870         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
3871         (WebKit::WebProcessPool::prewarmProcess):
3872         (WebKit::WebProcessPool::createWebPage):
3873         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
3874         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
3875         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
3876         (WebKit::WebProcessPool::processForNavigation):
3877         (WebKit::WebProcessPool::processForNavigationInternal):
3878         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
3879         * UIProcess/WebProcessPool.h:
3880         (WebKit::WebProcessPool::sendToOneProcess):
3881         * UIProcess/WebProcessProxy.cpp:
3882         (WebKit::WebProcessProxy::createWebPage):
3883         (WebKit::WebProcessProxy::addExistingWebPage):
3884         (WebKit::WebProcessProxy::removeWebPage):
3885         * UIProcess/WebProcessProxy.h:
3886
3887 2019-03-04  Chris Dumez  <cdumez@apple.com>
3888
3889         [iOS] Improve our file picker
3890         https://bugs.webkit.org/show_bug.cgi?id=195284
3891         <rdar://problem/45655856>
3892
3893         Reviewed by Tim Horton and Wenson Hsieh.
3894
3895         Improve our file picker on iOS so that:
3896         - Accepted file extensions specified in the HTML (e.g. <input type="file"> accept=".pdf">) are now
3897           properly reflected in the file picker. Previously, we only we only supported MIME types in the
3898           accept attribute that only Image / Video ones.
3899         - If accepted types are specified in the HTML and not of them are Video or Image types, then bypass
3900           the UIDocumentMenuViewController and show the file picker directly (as if the user had tapped on
3901           "Browse..." on that menu). Other menu items such as "Take Photo or Video" and "Photo Library" do
3902           not make sense if the page only accepts PDF files for example.
3903
3904         Things that we should do but are not fixed in this patch:
3905         - Stop using UIDocumentMenuViewController entirely since it was deprecated in favor of using
3906           UIDocumentPickerViewController directly.
3907         - Add multiple selection support, which is supported both on the HTML side and in the
3908           UIDocumentPickerViewController API.
3909
3910         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3911         (arrayContainsUTIThatConformsTo):
3912         (-[WKFileUploadPanel dealloc]):
3913         (-[WKFileUploadPanel pres