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