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