[Cocoa] Add new API around WKWebpagePreferences in WKNavigationDelegate and WKWebView...
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         [Cocoa] Add new API around WKWebpagePreferences in WKNavigationDelegate and WKWebViewConfiguration
4         https://bugs.webkit.org/show_bug.cgi?id=196284
5         <rdar://problem/47228232>
6
7         Reviewed by Tim Horton.
8
9         Tests for both of these APIs will be added in a subsequent patch.
10
11         * Shared/API/Cocoa/WebKit.h:
12         * UIProcess/API/APIPageConfiguration.cpp:
13         (API::PageConfiguration::defaultWebsitePolicies const):
14         (API::PageConfiguration::setDefaultWebsitePolicies):
15         * UIProcess/API/APIPageConfiguration.h:
16         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
17
18         Add a new navigation delegate hook to allow clients to return a WKWebpagePreference targeting the given
19         navigation action.
20
21         * UIProcess/API/Cocoa/WKWebView.mm:
22         (-[WKWebView _initializeWithConfiguration:]):
23         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
24         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
25
26         Add new API on WKWebViewConfiguration to specify a default WKWebpagePreference to use when navigating.
27
28         (-[WKWebViewConfiguration copyWithZone:]):
29         (-[WKWebViewConfiguration defaultWebpagePreferences]):
30         (-[WKWebViewConfiguration setDefaultWebpagePreferences:]):
31         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
32         * UIProcess/Cocoa/NavigationState.h:
33         * UIProcess/Cocoa/NavigationState.mm:
34         (WebKit::NavigationState::setNavigationDelegate):
35         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
36
37         Invoke the new WKWebpagePreferences-based navigation delegate method.
38
39         * WebKit.xcodeproj/project.pbxproj:
40         * mac/postprocess-framework-headers.sh:
41         * mac/replace-webkit-additions-in-framework-headers.sh: Added.
42
43         Move logic in the "Postprocess Framework Headers" step responsible for stripping away included files from
44         WebKitAdditions out into a separate build phase, called "Replace WebKitAdditions in Framework Headers". This
45         ensures headers attempting to include from WebKitAdditions have these additional statements removed.
46
47 2019-04-02  Geoffrey Garen  <ggaren@apple.com>
48
49         Eliminate plugin sandbox exceptions
50         https://bugs.webkit.org/show_bug.cgi?id=196510
51
52         Reviewed by Chris Dumez.
53
54         * PluginProcess/mac/PluginProcessMac.mm:
55         (WebKit::PluginProcess::initializeSandbox):
56         * UIProcess/Plugins/PluginInfoStore.cpp:
57         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed): Deleted.
58         * UIProcess/Plugins/PluginInfoStore.h:
59         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
60         (WebKit::PluginInfoStore::shouldUsePlugin):
61         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed): Deleted.
62
63 2019-04-02  Alex Christensen  <achristensen@webkit.org>
64
65         Fix assertion in http/tests/adClickAttribution/store-ad-click-attribution.html
66         https://bugs.webkit.org/show_bug.cgi?id=196503
67
68         Reviewed by Chris Dumez.
69
70         In WebPageProxy::didDestroyNavigation we try to ignore a request to destroy a navigation from a page being navigated from
71         during a cross-site navigation, but if the old web process sends the message after WebPageProxy::commitProvisionalPage
72         has been called, we can still destroy a navigation when we are continuing a navigation in another process.  To prevent this,
73         have the process not send the message when it knows the navigation is continuing in another process.
74         Also make the use of unchecked navigation pointers more robust by checking it for nullity.
75
76         * UIProcess/WebPageProxy.cpp:
77         (WebKit::WebPageProxy::didCommitLoadForFrame):
78         * WebProcess/WebPage/WebFrame.cpp:
79         (WebKit::WebFrame::didReceivePolicyDecision):
80         (WebKit::WebFrame::documentLoaderDetached):
81         * WebProcess/WebPage/WebFrame.h:
82
83 2019-04-02  Per Arne Vollan  <pvollan@apple.com>
84
85         [iOS] Fix iokit-get-properties sandbox violation in the WebContent process
86         https://bugs.webkit.org/show_bug.cgi?id=196500
87         <rdar://problem/49497788>
88
89         Reviewed by Brent Fulgham.
90
91         Attempting to get the iokit properties 'product-description', 'artwork-display-gamut' and
92         'artwork-scale-factor' is causing sandbox violations.
93
94         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
95
96 2019-04-02  Chris Dumez  <cdumez@apple.com>
97
98         [WK2] Add support for Window's beforeprint / afterprint events
99         https://bugs.webkit.org/show_bug.cgi?id=196478
100
101         Reviewed by Alex Christensen.
102
103         Add support for Window's beforeprint / afterprint events as per:
104         - https://html.spec.whatwg.org/#dom-print
105
106         Blink and Gecko already support this.
107
108         * WebProcess/WebPage/WebPage.cpp:
109         (WebKit::WebPage::beginPrinting):
110         (WebKit::WebPage::endPrinting):
111
112 2019-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
113
114         REGRESSION (r243726): Crash at unrecognized selector: -[WKWebpagePreferences webpagePreferences]
115         https://bugs.webkit.org/show_bug.cgi?id=196496
116         <rdar://problem/49521634>
117
118         Reviewed by Chris Dumez.
119
120         r243726 made an incorrect assumption that all callers of -decidePolicyForNavigationAction:decisionHandler: and
121         -decidePolicyForNavigationAction:userInfo:decisionHandler: must be instances of _WKWebsitePolicies, as opposed
122         to the new WKWebpagePreferences. However, it's possible for clients (in this case, Safari) to already generate
123         and pass in an instance of WKWebpagePreferences by bridging the C API opaque ref (WKWebsitePoliciesRef) into the
124         Objective-C object (which is now WKWebpagePreferences, after my change).
125
126         To maintain binary compatibility of trunk WebKit against prior versions of Safari, we need to handle both
127         WKWebpagePreferences and the soon-to-be-deprecated _WKWebsitePolicies in the navigation action policy decision
128         handler.
129
130         Tests:  WebKit.WebsitePoliciesWithBridgingCast
131                 WebKit.WebsitePoliciesWithUnexpectedType
132
133         * UIProcess/Cocoa/NavigationState.mm:
134         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
135
136 2019-04-01  Chris Dumez  <cdumez@apple.com>
137
138         Unreviewed, drop debug logging landed as part of r242903 by mistake.
139
140         * UIProcess/WebPageProxy.cpp:
141         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
142
143 2019-04-01  Remy Demarest  <rdemarest@apple.com>
144
145         Add SPI to give injected bundles access to displayed PDFDocuments
146         https://bugs.webkit.org/show_bug.cgi?id=196471
147         <rdar://problem/48080768>
148
149         Reviewed by Tim Horton.
150
151         * WebKit.xcodeproj/project.pbxproj:
152
153         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.h: Added.
154         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.mm: Added.
155         (WKBundlePageGetPDFDocumentInFrame):
156
157 2019-04-01  Wenson Hsieh  <wenson_hsieh@apple.com>
158
159         [WebKit2] Introduce a public version of WKWebsitePolicies
160         https://bugs.webkit.org/show_bug.cgi?id=195989
161         <rdar://problem/47228232>
162
163         Reviewed by Tim Horton.
164
165         Expose the existing _WKWebsitePolicies object as WKWebpagePreferences, in what will eventually become a public
166         header in the WebKit SDK (WKWebpagePreferences.h). Following a similar transitioning strategy as
167         _WKWebsiteDataStore and WKWebsiteDataStore, we move existing logic from _WKWebsitePolicies to WKWebpagePreferences
168         and make _WKWebsitePolicies a wrapper around WKWebpagePreferences.
169
170         No change in behavior.
171
172         * Shared/Cocoa/APIObject.mm:
173         (API::Object::newObject):
174
175         Wrap API::WebsitePolicies with WKWebpagePreferences.
176
177         * SourcesCocoa.txt:
178         * UIProcess/API/Cocoa/WKWebView.mm:
179         (-[WKWebView _updateWebsitePolicies:]):
180         * UIProcess/API/Cocoa/WKWebpagePreferences.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h.
181         * UIProcess/API/Cocoa/WKWebpagePreferences.mm: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm.
182
183         Introduce WKWebpagePreferences.
184
185         (+[WKWebpagePreferences defaultPreferences]):
186         (-[WKWebpagePreferences dealloc]):
187         (-[WKWebpagePreferences init]):
188         (-[WKWebpagePreferences _setContentBlockersEnabled:]):
189         (-[WKWebpagePreferences _contentBlockersEnabled]):
190         (-[WKWebpagePreferences _setAllowedAutoplayQuirks:]):
191         (-[WKWebpagePreferences _allowedAutoplayQuirks]):
192         (-[WKWebpagePreferences _setAutoplayPolicy:]):
193         (-[WKWebpagePreferences _autoplayPolicy]):
194         (-[WKWebpagePreferences _setDeviceOrientationAndMotionAccessPolicy:]):
195         (-[WKWebpagePreferences _deviceOrientationAndMotionAccessPolicy]):
196         (-[WKWebpagePreferences _setPopUpPolicy:]):
197         (-[WKWebpagePreferences _popUpPolicy]):
198         (-[WKWebpagePreferences _customHeaderFields]):
199         (-[WKWebpagePreferences _setCustomHeaderFields:]):
200         (-[WKWebpagePreferences _websiteDataStore]):
201         (-[WKWebpagePreferences _setWebsiteDataStore:]):
202         (-[WKWebpagePreferences _setCustomUserAgent:]):
203         (-[WKWebpagePreferences _customUserAgent]):
204         (-[WKWebpagePreferences _setCustomJavaScriptUserAgentAsSiteSpecificQuirks:]):
205         (-[WKWebpagePreferences _customJavaScriptUserAgentAsSiteSpecificQuirks]):
206         (-[WKWebpagePreferences _setCustomNavigatorPlatform:]):
207         (-[WKWebpagePreferences _customNavigatorPlatform]):
208         (-[WKWebpagePreferences _apiObject]):
209         * UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h.
210         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.h.
211
212         Reintroduce all the interfaces currently available on _WKWebsitePolicies as underscore-prefixed SPI on
213         WKWebpagePreferences.
214
215         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
216         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
217
218         Make _WKWebsitePolicies wrap WKWebpagePreferences, and plumb all existing SPI on WKWebsitePolicies through to
219         WKWebpagePreferences.
220
221         (-[_WKWebsitePolicies init]):
222         (-[_WKWebsitePolicies webpagePreferences]):
223         (-[_WKWebsitePolicies setContentBlockersEnabled:]):
224         (-[_WKWebsitePolicies contentBlockersEnabled]):
225         (-[_WKWebsitePolicies setAllowedAutoplayQuirks:]):
226         (-[_WKWebsitePolicies allowedAutoplayQuirks]):
227         (-[_WKWebsitePolicies setAutoplayPolicy:]):
228         (-[_WKWebsitePolicies autoplayPolicy]):
229         (-[_WKWebsitePolicies setDeviceOrientationAndMotionAccessPolicy:]):
230         (-[_WKWebsitePolicies deviceOrientationAndMotionAccessPolicy]):
231         (-[_WKWebsitePolicies setPopUpPolicy:]):
232         (-[_WKWebsitePolicies popUpPolicy]):
233         (-[_WKWebsitePolicies customHeaderFields]):
234         (-[_WKWebsitePolicies setCustomHeaderFields:]):
235         (-[_WKWebsitePolicies websiteDataStore]):
236         (-[_WKWebsitePolicies setWebsiteDataStore:]):
237         (-[_WKWebsitePolicies setCustomUserAgent:]):
238         (-[_WKWebsitePolicies customUserAgent]):
239         (-[_WKWebsitePolicies setCustomJavaScriptUserAgentAsSiteSpecificQuirks:]):
240         (-[_WKWebsitePolicies customJavaScriptUserAgentAsSiteSpecificQuirks]):
241         (-[_WKWebsitePolicies setCustomNavigatorPlatform:]):
242         (-[_WKWebsitePolicies customNavigatorPlatform]):
243         (-[_WKWebsitePolicies description]):
244         (-[_WKWebsitePolicies _apiObject]):
245         (-[_WKWebsitePolicies dealloc]): Deleted.
246         * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h:
247         * UIProcess/Cocoa/NavigationState.mm:
248         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
249         * WebKit.xcodeproj/project.pbxproj:
250
251 2019-04-01  Wenson Hsieh  <wenson_hsieh@apple.com>
252
253         Unable to copy and paste a PDF from Notes into Mail compose body
254         https://bugs.webkit.org/show_bug.cgi?id=196442
255         <rdar://problem/48573098>
256
257         Reviewed by Tim Horton.
258
259         Relax the -canPerformAction: logic in the case of pasting an attachment. Consider an NSItemProvider to possibly
260         paste as an attachment if either it has a preferred presentation style of UIPreferredPresentationStyleAttachment
261         or has a style of UIPreferredPresentationStyleUnspecified, but has a suggested file name.
262
263         This allows for the "Paste" action to be shown in the callout menu when copying and pasting a non-text file.
264
265         * UIProcess/ios/WKContentViewInteraction.mm:
266         (-[WKContentView canPerformActionForWebView:withSender:]):
267
268 2019-04-01  Tim Horton  <timothy_horton@apple.com>
269
270         Make UIWKDocumentContext rects per-character instead of per-word
271         https://bugs.webkit.org/show_bug.cgi?id=196459
272
273         Reviewed by Wenson Hsieh.
274
275         * WebProcess/WebPage/ios/WebPageIOS.mm:
276         (WebKit::WebPage::requestDocumentEditingContext):
277         Switch to CharacterIterator instead of TextIterator directly, to get
278         per-character rects as the API requests.
279
280 2019-04-01  Chris Dumez  <cdumez@apple.com>
281
282         UIProcess crash when a prewarmed process is terminated
283         https://bugs.webkit.org/show_bug.cgi?id=196451
284         <rdar://problem/49245471>
285
286         Reviewed by Geoffrey Garen.
287
288         Stop assuming that WebProcessProxy::m_websiteDataStore is non-null as this is no longer
289         true after r243384. For example, prewarmed WebContent processe do not get a data store
290         until they actually get used.
291
292         * UIProcess/API/Cocoa/WKProcessPool.mm:
293         (-[WKProcessPool _prewarmedProcessIdentifier]):
294         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
295         * UIProcess/WebProcessPool.cpp:
296         (WebKit::WebProcessPool::networkProcessIdentifier):
297         (WebKit::WebProcessPool::prewarmedProcessIdentifier):
298         * UIProcess/WebProcessPool.h:
299         * UIProcess/WebProcessProxy.cpp:
300         (WebKit::WebProcessProxy::didClose):
301         (WebKit::WebProcessProxy::didFinishLaunching):
302         (WebKit::WebProcessProxy::requestTermination):
303         (WebKit::WebProcessProxy::isReleaseLoggingAllowed const):
304         * UIProcess/WebProcessProxy.h:
305
306 2019-04-01  Patrick Griffis  <pgriffis@igalia.com>
307
308         [GTK][WPE] Add more websitedatastore directories to web process sandbox
309         https://bugs.webkit.org/show_bug.cgi?id=196447
310
311         Reviewed by Michael Catanzaro.
312
313         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
314         (WebKit::bubblewrapSpawn):
315         * UIProcess/glib/WebProcessProxyGLib.cpp:
316         (WebKit::WebProcessProxy::platformGetLaunchOptions):
317
318 2019-04-01  Per Arne Vollan  <pvollan@apple.com>
319
320         [macOS] Crash when loading Twitter with autoplay video enabled.
321         https://bugs.webkit.org/show_bug.cgi?id=196446
322         <rdar://problem/49060359>
323
324         Reviewed by Brent Fulgham.
325
326         This is caused by a syscall violation.
327
328         * WebProcess/com.apple.WebProcess.sb.in:
329
330 2019-04-01  Patrick Griffis  <pgriffis@igalia.com>
331
332         [GTK][WPE] Fix seccomp rule for blacklisting TIOCSTI
333         https://bugs.webkit.org/show_bug.cgi?id=196297
334
335         Reviewed by Michael Catanzaro.
336
337         More information can be found here: https://www.exploit-db.com/exploits/46594
338
339         Note that this sandbox never made it into production so does not
340         warrant any CVE specific to WebKit.
341
342         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
343         (WebKit::setupSeccomp):
344
345 2019-03-31  Wenson Hsieh  <wenson_hsieh@apple.com>
346
347         [iOS] Crash when changing inputmode for certain types of focusable elements
348         https://bugs.webkit.org/show_bug.cgi?id=196431
349         <rdar://problem/49454962>
350
351         Reviewed by Tim Horton.
352
353         The crash is happening because WebPage::focusedElementDidChangeInputMode assumes that the document's focused
354         element must be the same as m_focusedElement in WebPage. However, this is not the case, since m_focusedElement
355         is only set for certain types of elements that require user input (e.g. text fields, editable content, select
356         menus, etc.). The function then attempts to dereference m_focusedElement, which may be null if the document's
357         focused element doesn't fall into one of the aforementioned categories.
358
359         To fix this, bail if the element that is changing inputmode is not equal to the WebPage's current focused
360         element. See below for more details.
361
362         Test: fast/forms/change-inputmode-crash.html
363
364         * WebProcess/WebPage/WebPage.cpp:
365         (WebKit::isTextFormControlOrEditableContent):
366
367         Clean up some existing logic by introducing a helper method for determining whether an element should
368         propagate inputmode attribute changes to the UI process. Also, check the element type using type traits instead
369         of checking against the tag name.
370
371         (WebKit::WebPage::elementDidFocus):
372         (WebKit::WebPage::focusedElementDidChangeInputMode):
373
374 2019-03-31  Sam Weinig  <weinig@apple.com>
375
376         Remove more i386 specific configurations
377         https://bugs.webkit.org/show_bug.cgi?id=196430
378
379         Reviewed by Alexey Proskuryakov.
380
381         * Configurations/BaseTarget.xcconfig:
382         WK_HAVE_CORE_PREDICTION can now be enabled unconditionally.
383  
384         * Configurations/FeatureDefines.xcconfig:
385         ENABLE_WEB_AUTHN_macosx can now be enabled unconditionally on macOS.
386
387 2019-03-31  Andy Estes  <aestes@apple.com>
388
389         [iOS] WebKit should consult the navigation response policy delegate before previewing a QuickLook document
390         https://bugs.webkit.org/show_bug.cgi?id=196433
391         <rdar://problem/49293305>
392
393         Reviewed by Tim Horton.
394
395         Added WKWebViewConfiguration SPI for setting the QuickLook navigation response policy
396         decision behavior. The configuration setting defaults to YES for clients linked on or after
397         this WebKit change and NO otherwise.
398
399         * NetworkProcess/NetworkResourceLoader.cpp:
400         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
401         * Shared/WebPreferences.yaml:
402         * Shared/ios/QuickLookDocumentData.cpp:
403         (WebKit::QuickLookDocumentData::isEmpty const):
404         * Shared/ios/QuickLookDocumentData.h:
405         * UIProcess/API/Cocoa/WKWebView.mm:
406         (-[WKWebView _initializeWithConfiguration:]):
407         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
408         (defaultShouldDecidePolicyBeforeLoadingQuickLookPreview):
409         (-[WKWebViewConfiguration init]):
410         (-[WKWebViewConfiguration encodeWithCoder:]):
411         (-[WKWebViewConfiguration initWithCoder:]):
412         (-[WKWebViewConfiguration copyWithZone:]):
413         (-[WKWebViewConfiguration _shouldDecidePolicyBeforeLoadingQuickLookPreview]):
414         (-[WKWebViewConfiguration _setShouldDecidePolicyBeforeLoadingQuickLookPreview:]):
415         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
416         * UIProcess/Cocoa/VersionChecks.h:
417         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp:
418         (WebKit::WebPreviewLoaderClient::didReceiveDataArray):
419
420 2019-03-30  Zalan Bujtas  <zalan@apple.com>
421
422         [ContentChangeObserver] Subframe load should not reset content observation on the mainframe
423         https://bugs.webkit.org/show_bug.cgi?id=196408
424         <rdar://problem/49436797>
425
426         Reviewed by Simon Fraser.
427
428         Hover intent fails when an unrelated frame commits a load the same time.
429         cancelPotentialTapInFrame is called from didCommitLoad, but what we are looking for here is the user initiated cancel of a tap (cancelPotentialTap).
430         (If the current frame navigates away, willDetachPage takes care of canceling the observation.)
431
432         * WebProcess/WebPage/ios/WebPageIOS.mm:
433         (WebKit::WebPage::cancelPotentialTap):
434         (WebKit::WebPage::cancelPotentialTapInFrame):
435
436 2019-03-29  John Wilander  <wilander@apple.com>
437
438         Move WebResourceLoadStatisticsStore IPC calls from the UI process to the network process
439         https://bugs.webkit.org/show_bug.cgi?id=196407
440         <rdar://problem/47859936>
441
442         Reviewed by Brent Fulgham.
443
444         The two WebResourceLoadStatisticsStore IPC endpoints were left behind when we
445         moved Resource Load Statistics from the UI process to the network process. One
446         of the endpoints is the message RequestStorageAccessUnderOpener which underpins
447         our compatibility fix for federated logins using popups. This patch redirects
448         these IPC calls to the network process and cleans up some assumptions around
449         them.
450
451         * CMakeLists.txt:
452             Removed the old IPC receiver.
453         * DerivedSources.make:
454             Removed the old IPC receiver.
455         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
456         (WebKit::WebResourceLoadStatisticsStore::requestUpdate): Deleted.
457             This is no longer needed since there is a dedicated update mechanism
458             that actually sends the update.
459         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
460         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
461         (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
462         (WebKit::NetworkConnectionToWebProcess::requestStorageAccessUnderOpener):
463             Two new IPC receivers to pipe the calls to the network process.
464         (WebKit::NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate): Deleted.
465             NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated now serves
466             this purpose.
467         * NetworkProcess/NetworkConnectionToWebProcess.h:
468         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
469         * UIProcess/WebResourceLoadStatisticsStore.messages.in: Removed.
470             Removed the old IPC receiver.
471         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
472         * WebKit.xcodeproj/project.pbxproj:
473         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
474         (WKBundleResourceLoadStatisticsNotifyObserver):
475             Function name update.
476         * WebProcess/WebProcess.cpp:
477             Now calls IPC to the network process instead of the UI process.
478
479 2019-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
480
481         Delete WebMetal implementation in favor of WebGPU
482         https://bugs.webkit.org/show_bug.cgi?id=195418
483
484         Reviewed by Dean Jackson.
485
486         * Configurations/FeatureDefines.xcconfig:
487         * Shared/WebPreferences.yaml:
488         * WebProcess/InjectedBundle/InjectedBundle.cpp:
489         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
490
491 2019-03-29  Takashi Komori  <Takashi.Komori@sony.com>
492
493         [Curl] Add Server Trust Evaluation Support.
494         https://bugs.webkit.org/show_bug.cgi?id=191646
495
496         Reviewed by Fujii Hironori.
497
498         Tests: http/tests/ssl/iframe-upgrade.https.html
499                http/tests/ssl/mixedContent/insecure-websocket.html
500                http/tests/ssl/upgrade-origin-usage.html
501
502         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
503         (WebKit::NetworkDataTaskCurl::curlDidFailWithError):
504         (WebKit::NetworkDataTaskCurl::tryServerTrustEvaluation):
505         (WebKit::NetworkDataTaskCurl::restartWithCredential):
506         * NetworkProcess/curl/NetworkDataTaskCurl.h:
507
508 2019-03-29  Cathie Chen  <cathiechen@igalia.com>
509
510         Implement ResizeObserver.
511         https://bugs.webkit.org/show_bug.cgi?id=157743
512
513         Reviewed by Simon Fraser.
514
515         Add WebPreferences and FeatureDefines for ResizeObserver.
516
517         * Configurations/FeatureDefines.xcconfig:
518         * Shared/WebPreferences.yaml:
519
520 2019-03-28  Timothy Hatcher  <timothy@apple.com>
521
522         CFDictionary encoder crashes on non-string keys.
523         https://bugs.webkit.org/show_bug.cgi?id=196388
524         rdar://problem/49339242
525
526         Reviewed by Ryosuke Niwa.
527
528         Allow non-string keys in CFDictionary encoding/decoding. Encode the correct
529         size for dictionaries and arrays when unknown keys or values are skipped.
530         Allow null array encoding and decoding like dictionary already allowed.
531
532         * Shared/cf/ArgumentCodersCF.cpp:
533         (IPC::encode):
534         (IPC::decode):
535
536 2019-03-28  John Wilander  <wilander@apple.com>
537
538         Resource Load Statistics: IPC to the WebsiteDataStore in the UI process from NetworkProcess::deleteWebsiteDataForRegistrableDomains()
539         https://bugs.webkit.org/show_bug.cgi?id=196281
540         <rdar://problem/48938748>
541
542         Reviewed by Alex Christensen.
543
544         The move of Resource Load Statistics to the network process requires that it
545         calls the UI process when clearing website data (previously the other way
546         around). This patch achieves that.
547
548         Specifically, NetworkProcess::deleteWebsiteDataForRegistrableDomains() now
549         filters its WebsiteDataTypes down to just the ones applicable for the UI
550         process and then calls DeleteWebsiteDataInUIProcessForRegistrableDomains over
551         IPC.
552
553         NetworkProcessProxy::deleteWebsiteDataInUIProcessForRegistrableDomains() on
554         the UI process side makes use of the re-introduced
555         WebsiteDataStore::fetchDataForRegistrableDomains() function to get the relevant
556         data records and call WebsiteDataStore::removeData(). The re-introduced
557         WebsiteDataStore::fetchDataForRegistrableDomains() was removed as dead code in
558         https://trac.webkit.org/changeset/242056/webkit, then under the name
559         WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains(). The reason it
560         was dead code was the lack of IPC call that this patch adds.
561
562         * NetworkProcess/NetworkProcess.cpp:
563         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
564            Now calls DeleteWebsiteDataInUIProcessForRegistrableDomains over IPC if there
565            are WebsiteDataTypes applicable to the UI process.
566         * NetworkProcess/NetworkProcess.h:
567         * Shared/WebsiteData/WebsiteData.cpp:
568         (WebKit::WebsiteData::ownerProcess):
569         (WebKit::WebsiteData::filter):
570             Convenience functions to manage process ownership of website data types.
571         * Shared/WebsiteData/WebsiteData.h:
572         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
573         (WKWebsiteDataStoreStatisticsHasLocalStorage):
574             Test infrastructure, called by the TestRunner.
575         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
576         * UIProcess/Network/NetworkProcessProxy.cpp:
577         (WebKit::NetworkProcessProxy::deleteWebsiteDataInUIProcessForRegistrableDomains):
578             New function to be called from the network process.
579         * UIProcess/Network/NetworkProcessProxy.h:
580         * UIProcess/Network/NetworkProcessProxy.messages.in:
581         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
582         (WebKit::WebsiteDataRecord::matches const):
583             Now matches with WebCore::RegistrableDomain instead of a string.
584         (WebKit::WebsiteDataRecord::matchesTopPrivatelyControlledDomain const): Deleted.
585             Replaced by WebsiteDataRecord::matches().
586         * UIProcess/WebsiteData/WebsiteDataRecord.h:
587         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
588         (WebKit::WebsiteDataStore::fetchDataForRegistrableDomains):
589             Re-introduced. It was removed as dead code in r242056.
590         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
591         (WebKit::WebsiteDataStore::hasLocalStorageForTesting const):
592             Test infrastructure, called by the TestRunner.
593         * UIProcess/WebsiteData/WebsiteDataStore.h:
594
595 2019-03-28  Jiewen Tan  <jiewen_tan@apple.com>
596
597         API::Data::createWithoutCopying should do a null check before calling CFRelease
598         https://bugs.webkit.org/show_bug.cgi?id=196276
599         <rdar://problem/48059859>
600
601         Reviewed by Alex Christensen.
602
603         * Shared/Cocoa/APIDataCocoa.mm:
604         (API::Data::createWithoutCopying):
605
606 2019-03-28  Per Arne Vollan  <pvollan@apple.com>
607
608         [iOS] Automatic focus of input field is flaky
609         https://bugs.webkit.org/show_bug.cgi?id=196302
610
611         Reviewed by Brent Fulgham.
612
613         Sometimes the status of whether a keyboard is connected can be incorrect, both in the UI process, and in
614         the WebContent process. Fix this by sending the keyboard status to the WebContent process as part of the
615         Web page creation parameters. Stop caching the keyboard status in the Web process proxy, and call
616         [UIKeyboard isInHardwareKeyboardMode] instead, since this method is swizzled in the test harness.
617
618         * Shared/WebPageCreationParameters.cpp:
619         (WebKit::WebPageCreationParameters::encode const):
620         (WebKit::WebPageCreationParameters::decode):
621         * Shared/WebPageCreationParameters.h:
622         * UIProcess/API/Cocoa/WKWebView.mm:
623         (hardwareKeyboardAvailabilityChangedCallback):
624         * UIProcess/WebPageProxy.cpp:
625         (WebKit::WebPageProxy::creationParameters):
626         * UIProcess/WebPageProxy.h:
627         * UIProcess/WebProcessProxy.cpp:
628         * UIProcess/WebProcessProxy.h:
629         (WebKit::WebProcessProxy::setKeyboardIsAttached): Deleted.
630         (WebKit::WebProcessProxy::keyboardIsAttached const): Deleted.
631         * UIProcess/ios/WKContentViewInteraction.mm:
632         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
633         * UIProcess/ios/WebPageProxyIOS.mm:
634         (WebKit::WebPageProxy::isInHardwareKeyboardMode):
635         (WebKit::WebPageProxy::applicationWillEnterForeground):
636         * WebProcess/WebPage/WebPage.cpp:
637         * WebProcess/WebPage/WebPage.h:
638
639 2019-03-28  Tim Horton  <timothy_horton@apple.com>
640
641         Fix the build.
642
643         * UIProcess/ios/WKActionSheetAssistant.mm:
644         (-[WKActionSheetAssistant showImageSheet]):
645         * UIProcess/ios/WKContentViewInteraction.mm:
646         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
647
648 2019-03-28  Michael Catanzaro  <mcatanzaro@igalia.com>
649
650         [WPE][GTK] webkit_web_resource_get_data_finish can return NULL without setting error
651         https://bugs.webkit.org/show_bug.cgi?id=186276
652
653         Reviewed by Carlos Garcia Campos.
654
655         Currently it's possible for webkit_web_resource_get_data_finish() to return NULL without
656         setting the error parameter. This is illegal because it is an API guarantee (and a GObject
657         convention) that if an error parameter exists, it should be set whenever a function call
658         returns NULL. Epiphany correctly dereferences the error in this case without checking if it
659         is NULL, because it knows it does not have to, and crashes. Fix this. We'll return a byte
660         array of length 1 containing a NUL character. This isn't great, but there's not really any
661         better solution without deprecating the API or returning an error code to indicate an empty
662         resource, and it at least fixes the Epiphany crash.
663
664         This does not fix bug #186276, in which this function incorrectly returns no data when it
665         ought to. But that is a different bug. Now, at least we won't crash when no data is
666         available.
667
668         * UIProcess/API/glib/WebKitWebResource.cpp:
669         (resourceDataCallback):
670
671 2019-03-28  Daniel Bates  <dabates@apple.com>
672
673         [iPad] Tapping on a popup form control may not show a popover
674         https://bugs.webkit.org/show_bug.cgi?id=196322
675         <rdar://problem/49229632>
676
677         Reviewed by Wenson Hsieh.
678
679         Stop taking advantage of -[WKContentView inputView] being called when we invoke -reloadInputViews
680         to "lazily" allocate the input peripheral for the currently focused element. In theory, UIKit only
681         needs to call -inputView when it actually needs to display the input view (the keyboard). For
682         popup menu buttons, like <select>, no keyboard is needed. Instead we should create the peripheral
683         as part of the logic in the UI process to focus a new element before we call -reloadInputViews.
684
685         * UIProcess/ios/WKContentViewInteraction.mm:
686         (-[WKContentView inputView]): Extract logic to allocate the peripheral from here and moved it to createInputPeripheralWithView().
687         (-[WKContentView accessoryTab:]): While I am here, add a FIXME comment to explain why we need to
688         end the input sessions and nullify the input peripheral before we tell the web process to switch
689         focus as opposed to letting this happen after the web process tells us it focused a new element.
690         (createInputPeripheralWithView): Added.
691         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
692         Write in terms of createInputPeripheralWithView(). Create the input peripheral after becoming
693         first responder because creating the peripheral has known side-effects: for popup buttons it
694         tells the popup controller to present the popover. For key input to popovers to work from the get-go,
695         the content view must be the first responder. See <https://bugs.webkit.org/show_bug.cgi?id=196272>
696         for more details.
697
698 2019-03-28  Víctor Manuel Jáquez Leal  <vjaquez@igalia.com>
699
700         Silence lot of warnings when compiling with clang
701         https://bugs.webkit.org/show_bug.cgi?id=196310
702
703         Reviewed by Michael Catanzaro.
704
705         * UIProcess/API/glib/WebKitInjectedBundleClient.cpp: add missing
706         override clause.
707         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: add
708         missing override clause.
709
710 2019-03-27  Ryosuke Niwa  <rniwa@webkit.org>
711
712         [macOS] Select element doesn't show popup if select element had lost focus while popup was previosuly shown
713         https://bugs.webkit.org/show_bug.cgi?id=196336
714
715         Reviewed by Tim Horton.
716
717         The bug was caused by WebPopupMenu::hide never notifying PopupClient that the popup had been dismissed.
718         This resulted in RenderMenuList::m_popupIsVisible to be never reset.
719
720         Also fixed a bug in WebPopupMenuProxyMac::hidePopupMenu that this function was never dismissing
721         the popup as the selector "dismissPopUp", on the contrary to its name, does not dimiss the popup.
722         Send cancelTracking to NSMenu instead, which DOES dismiss the popup.
723
724         Tests: fast/forms/select/mac-wk2/blur-dismisses-select-popup.html
725                fast/forms/select/mac-wk2/open-select-popup-after-dismissing-by-blur.html
726
727         * UIProcess/mac/WebPopupMenuProxyMac.mm:
728         (WebKit::WebPopupMenuProxyMac::hidePopupMenu):
729         * WebProcess/WebCoreSupport/WebPopupMenu.cpp:
730         (WebKit::WebPopupMenu::hide):
731
732 2019-03-27  Dean Jackson  <dino@apple.com>
733
734         [ARKit] Black view when opening a 3D model usdz file in new tab
735         https://bugs.webkit.org/show_bug.cgi?id=196333
736         <rdar://problem/47693367>
737
738         Reviewed by Tim Horton.
739
740         When opening a new WKSystemPreviewView, we were exiting if there was no
741         presentingViewController. This code was unnecessary, and causing blank
742         content when opening a new tab.
743
744         * UIProcess/ios/WKSystemPreviewView.mm:
745         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
746         Remove the code looking for a presentingViewController.
747
748 2019-03-27  Wenson Hsieh  <wenson_hsieh@apple.com>
749
750         Need a way to include WebKitAdditions code in WebKit API headers
751         https://bugs.webkit.org/show_bug.cgi?id=196173
752
753         Reviewed by Tim Horton.
754
755         Introduce a mechanism that allows us to insert code from WebKitAdditions into public or private SDK headers
756         using `#import`s of the form:
757
758         ```
759         #if USE(APPLE_INTERNAL_SDK)
760         #import <WebKitAdditions/WKWebViewConfigurationAdditions.h>
761         #endif
762         ```
763
764         The resulting header in the built products directory will contain the contents of the imported file inserted in
765         place of the `#if USE(APPLE_INTERNAL_SDK) … #endif` block; however, when building with the Apple internal SDK,
766         the additions header content will be imported by the usual means.
767
768         * mac/postprocess-framework-headers.sh:
769         * mac/replace-webkit-additions-includes.py: Added.
770
771         Add a step when post-processing framework headers to replace instances of `#if USE(APPLE_INTERNAL_SDK) … #endif`
772         with the text content of the additions files. The replacement script first searches in the built products
773         directory for the matching additions file, and falls back to the SDK if no matching file is found. If neither
774         are present (e.g. a build using the public SDK), then the block is simply replaced by the empty string.
775
776         (read_content_from_webkit_additions):
777         (main):
778
779 2019-03-27  Andy Estes  <aestes@apple.com>
780
781         REGRESSION (r242686): package-root creates roots with broken symlinks in WebKit.framework/XPCServices/
782         https://bugs.webkit.org/show_bug.cgi?id=196317
783
784         Reviewed by Dan Bernstein.
785
786         Removed some remnants of the Storage Process.
787
788         * Configurations/BaseTarget.xcconfig:
789         * Resources/SandboxProfiles/ios/com.apple.WebKit.Storage.sb: Removed.
790         * WebKit.xcodeproj/project.pbxproj:
791
792 2019-03-27  Keith Rollin  <krollin@apple.com>
793
794         Include the CFNetworking task UUID to the NSError when a resource-load fails
795         https://bugs.webkit.org/show_bug.cgi?id=196156
796
797         Reviewed by Alex Christensen.
798
799         In order to help track the connection between a failed resource-load
800         and a user-visible error message, include the CFNetworking task UUID
801         in the associated error as an element of the userInfo property. This
802         can then be pulled out and reported in the logging at the point the
803         error is reported to the user.
804
805         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
806         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
807
808 2019-03-27  Chris Dumez  <cdumez@apple.com>
809
810         [ iOS Sim ] REGRESSION (r242277) Layout Test http/tests/cookies/same-site/lax-samesite-cookie-after-cross-site-history-load.php is a flaky timeout
811         https://bugs.webkit.org/show_bug.cgi?id=195425
812         <rdar://problem/48682403>
813
814         Reviewed by Alex Christensen.
815
816         When process-swapping on history navigation, we lookup the WebProcessProxy we'd like to use from the
817         process identifier that is saved on the WebBackForwardListItem, to try and load the item in the process
818         in which it was previously loaded. However, we were failing to check if the WebProcess in question was
819         still running so we could potentially try to use a process that's already exited.
820
821         * UIProcess/WebProcessPool.cpp:
822         (WebKit::WebProcessPool::processForNavigationInternal):
823
824 2019-03-27  Zalan Bujtas  <zalan@apple.com>
825
826         [ContentChangeObserver] Always dispatch the synthetic click asynchronously
827         https://bugs.webkit.org/show_bug.cgi?id=196278
828         <rdar://problem/49299968>
829
830         Reviewed by Simon Fraser.
831
832         This patch ensures that all completeSyntheticClick() calls happen in an asynchronous manner (unless the feature is turned off).
833
834         * WebProcess/WebPage/ios/WebPageIOS.mm:
835         (WebKit::dispatchSyntheticMouseMove):
836         (WebKit::WebPage::handleSyntheticClick):
837
838 2019-03-27  Tim Horton  <timothy_horton@apple.com>
839
840         Fix some more deprecation warnings in WKDrawingView
841         https://bugs.webkit.org/show_bug.cgi?id=196282
842         <rdar://problem/47637608>
843
844         Reviewed by Wenson Hsieh.
845
846         * Platform/spi/ios/PencilKitSPI.h:
847         * SourcesCocoa.txt:
848         * UIProcess/ios/PencilKitSoftLink.h:
849         * UIProcess/ios/PencilKitSoftLink.mm:
850         * UIProcess/ios/WKContentViewInteraction.mm:
851         * UIProcess/ios/WKDrawingCoordinator.h:
852         * UIProcess/ios/WKDrawingCoordinator.mm:
853         (-[WKDrawingCoordinator initWithContentView:]):
854         (-[WKDrawingCoordinator currentInk]):
855         (-[WKDrawingCoordinator undoManagerForInkPicker:]):
856         (-[WKDrawingCoordinator containingViewForInkPicker:]):
857         (-[WKDrawingCoordinator inkPickerDidToggleRuler:]):
858         (-[WKDrawingCoordinator inkPickerDidChangeInk:]):
859         (-[WKDrawingCoordinator installInkPickerForDrawing:]):
860         (-[WKDrawingCoordinator uninstallInkPicker]):
861         (-[WKDrawingCoordinator inkPicker]): Deleted.
862         (-[WKDrawingCoordinator didChangeRulerState:]): Deleted.
863         (-[WKDrawingCoordinator didChangeInk:]): Deleted.
864         * UIProcess/ios/WKDrawingView.mm:
865         (-[WKDrawingView _canvasViewWillBeginDrawing:]):
866         * UIProcess/ios/WKInkPickerView.h: Removed.
867         * UIProcess/ios/WKInkPickerView.mm: Removed.
868         * WebKit.xcodeproj/project.pbxproj:
869         Adopt the new names.
870
871 2019-03-27  Carlos Garcia Campos  <cgarcia@igalia.com>
872
873         Geolocation request not complete when watch request was started in a different web process
874         https://bugs.webkit.org/show_bug.cgi?id=195996
875
876         Reviewed by Alex Christensen.
877
878         In WebGeolocationManagerProxy::startUpdating() we do nothing when the provider is already updating. We should
879         reply with a DidChangePosition using the last known position, if available. If we are updating, but we still
880         don't have a known position, the request will be completed when
881         WebGeolocationManagerProxy::providerDidChangePosition() is called since it always notifies all web
882         processes.
883
884         * UIProcess/WebGeolocationManagerProxy.cpp:
885         (WebKit::WebGeolocationManagerProxy::providerDidChangePosition): Cache the position.
886         (WebKit::WebGeolocationManagerProxy::startUpdating): Reply using cached position if already known.
887         * UIProcess/WebGeolocationManagerProxy.h:
888         (WebKit::WebGeolocationManagerProxy::lastPosition const): Return cached position.
889         * WebProcess/WebCoreSupport/WebGeolocationClient.cpp:
890         (WebKit::WebGeolocationClient::lastPosition): Remove the FIXME since we don't want this feature.
891
892 2019-03-26  Brent Fulgham  <bfulgham@apple.com>
893
894         [macOS] Correct kerberos-related sandbox violations
895         https://bugs.webkit.org/show_bug.cgi?id=196279
896         <rdar://problem/48622502>
897
898         Reviewed by Per Arne Vollan.
899
900         We need to allow communications with a Kerberos-related service on macOS
901         until <rdar://problem/35542803> is fixed.
902
903         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
904
905 2019-03-26  Chris Dumez  <cdumez@apple.com>
906
907         [macOS] The network process is not exiting reliably when the WebProcessPool is destroyed
908         https://bugs.webkit.org/show_bug.cgi?id=196277
909         <rdar://problem/49127581>
910
911         Reviewed by Alex Christensen.
912
913         When, an AuxiliaryProcess receives the AuxiliaryProcess::Terminate IPC, it calls stopRunLoop()
914         to exit. WebProcess overrides AuxiliaryProcess::stopRunLoop() to call exit(0) on the main
915         thread. Other auxiliary processes such as the NetworkProcess would end up calling
916         platformStopRunLoop(). On iOS and iOSMac, platformStopRunLoop() calls XPCServiceExit(), which
917         makes sense since auxiliary processes run their run loop by calling xpc_main(). However, on
918         macOS, platformStopRunLoop() was calling RunLoop::main().stop() to exit instead, which was
919         unreliable as demonstrated by the test app attached to the radar.
920
921         Updating platformStopRunLoop() to call XPCServiceExit() on macOS fixes the problem and I now
922         see the NetworkProcess exiting reliably there. This is the approach I have chosen in this
923         patch since it appears to be reliable and it makes the code consistent on all Cocoa platforms.
924
925         * Shared/AuxiliaryProcess.cpp:
926         * Shared/Cocoa/AuxiliaryProcessCocoa.mm:
927         (WebKit::AuxiliaryProcess::platformStopRunLoop):
928         * Shared/ios/AuxiliaryProcessIOS.mm:
929         (WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted.
930         * Shared/mac/AuxiliaryProcessMac.mm:
931         (WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted.
932
933 2019-03-26  Keith Rollin  <krollin@apple.com>
934
935         Inhibit CFNetwork logging in private sessions
936         https://bugs.webkit.org/show_bug.cgi?id=196268
937         <rdar://problem/48210793>
938
939         Reviewed by Alex Christensen.
940
941         Before performing any logging, the NetworkProcess checks to see if
942         it's performing an operation associated with a private (ephemeral)
943         browsing session. If so, it skips the logging. However, networking
944         layers below the NetworkProcess don't know about private browsing, so
945         they would still perform their own logging. CFNetwork now has a flag
946         that lets us control that, so set it to False if private browsing.
947
948         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
949         (WebKit::configurationForSessionID):
950
951 2019-03-26  Chris Dumez  <cdumez@apple.com>
952
953         Add basic layout test coverage for File Picker on iOS
954         https://bugs.webkit.org/show_bug.cgi?id=196265
955
956         Reviewed by Wenson Hsieh.
957
958         Add layout test infrastructure to test the file picker on iOS.
959
960         * UIProcess/API/Cocoa/WKWebView.mm:
961         (-[WKWebView _dismissFilePicker]):
962         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
963         * UIProcess/ios/WKContentViewInteraction.h:
964         * UIProcess/ios/WKContentViewInteraction.mm:
965         (-[WKContentView dismissFilePicker]):
966         (-[WKContentView _contentsOfUserInterfaceItem:]):
967         * UIProcess/ios/forms/WKFileUploadPanel.h:
968         * UIProcess/ios/forms/WKFileUploadPanel.mm:
969         (-[WKFileUploadPanel currentAvailableActionTitles]):
970
971 2019-03-26  Daniel Bates  <dabates@apple.com>
972
973         [iOS][WK2] Use a better concept to describe the reason we defer zooming a focused element: selectabiltiy
974         https://bugs.webkit.org/show_bug.cgi?id=196264
975
976         Reviewed by Wenson Hsieh.
977
978         Rename shouldDeferZoomingToSelectionWhenRevealingFocusedElement() to mayContainSelectableText() to describe
979         the criterion that we will use to decide whether to defer zooming or not. We defer zooming only for elements
980         that may support text selection on initial focus because we do not have an up-to-date selection rect at that
981         time. For element, like <select>, that do not support text selection, we can zoom them immediately when focused.
982
983         * UIProcess/ios/WKContentViewInteraction.mm:
984         (mayContainSelectableText): Renamed from shouldDeferZoomingToSelectionWhenRevealingFocusedElement.
985         List all the input types in the switch block and remove the default case to force the compiler to check that we
986         covered all cases. This will prevent unforseen keyboard issues (why isn't the keyboard shown? or why is the keyboard shown?)
987         for future input types that we may add.
988         (rectToRevealWhenZoomingToFocusedElement): Update for renaming.
989         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): Add a
990         comment to explain why we may need to defer the zoom: the focused element supports text selection and we need
991         to wait for the web process to call back to provide an up-to-date selection rect for us to zoom and reveal.
992         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]): Update for renaming.
993         (shouldDeferZoomingToSelectionWhenRevealingFocusedElement): Deleted.
994
995 2019-03-26  Wenson Hsieh  <wenson_hsieh@apple.com>
996
997         Implement async paste method on UIWKInteractionViewProtocol
998         https://bugs.webkit.org/show_bug.cgi?id=196267
999         <rdar://problem/49236346>
1000
1001         Reviewed by Tim Horton.
1002
1003         Implement a new UIWKInteractionViewProtocol hook to perform a paste command, and invoke the given completion
1004         handler when pasting is finished.
1005
1006         Test: UIPasteboardTests.PasteWithCompletionHandler
1007
1008         * UIProcess/ios/WKContentViewInteraction.mm:
1009         (-[WKContentView pasteWithCompletionHandler:]):
1010
1011 2019-03-26  Per Arne Vollan  <pvollan@apple.com>
1012
1013         [macOS] Fix sandbox violations
1014         https://bugs.webkit.org/show_bug.cgi?id=196262
1015         <rdar://problem/47738015>
1016
1017         Reviewed by Brent Fulgham.
1018
1019         Fix various observed sandbox violations.
1020
1021         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
1022         * WebProcess/com.apple.WebProcess.sb.in:
1023
1024 2019-03-26  Tomoki Imai  <Tomoki.Imai@sony.com>
1025
1026         Assertion failure !isInAcceleratedCompositingMode() in DrawingAreaProxyCoordinatedGraphics::incorporateUpdate when forceCompositingMode is turned on
1027         https://bugs.webkit.org/show_bug.cgi?id=195879
1028
1029         Reviewed by Carlos Garcia Campos.
1030
1031         The root cause is that DrawingAreaProxyCoordinatedGraphics::isInAcceleratedCompositingMode checks both of alwaysUseCompositing() and !m_layerTreeContext.isEmpty().
1032         alwaysUseCompositing() refers preferences, which is written by the application (UIProcess).
1033         On the other hand, m_layerTreeContext is changed when it receives enterAcceleratedCompositingMode/exitAcceleratedCompositingMode from WebProcess.
1034
1035         It results when we set forceCompositingMode and acceleratedCompositingEnabled to true, WebProcess and UIProcess is out of sync until WebProcess sends enterAcceleratedCompositingMode message.
1036         In such situation, WebProcess sends incorporateUpdate to UIProcess because WebProcess is in non-AC mode, but isInAcceleratedCompositingMode becomes true in UIProcess side.
1037
1038         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
1039         (WebKit::DrawingAreaProxyCoordinatedGraphics::~DrawingAreaProxyCoordinatedGraphics): Should call exitAcceleratedCompositingMode even when alwaysUseCompositing is true.
1040         (WebKit::DrawingAreaProxyCoordinatedGraphics::enterAcceleratedCompositingMode): enterAcceleratedCompositingMode should check enterAcceleratedCompositingMode is not called twice.
1041         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h: Remove alwaysUseCompositing from isInAcceleratedCompositingMode
1042
1043 2019-03-26  Antoine Quint  <graouts@apple.com>
1044
1045         Remove mousemoveEventHandlingPreventsDefault internal setting and quirk
1046         https://bugs.webkit.org/show_bug.cgi?id=196254
1047         <rdar://problem/49124334>
1048
1049         Reviewed by Dean Jackson.
1050
1051         * Shared/WebPreferences.yaml:
1052
1053 2019-03-26  Philippe Normand  <pnormand@igalia.com>
1054
1055         [WPE][Qt] Uninitialized racy ViewBackend
1056         https://bugs.webkit.org/show_bug.cgi?id=196247
1057
1058         Reviewed by Carlos Garcia Campos.
1059
1060         * UIProcess/API/wpe/qt/WPEQtView.h: Initialize the backend pointer to nullptr.
1061
1062 2019-03-26  Carlos Garcia Campos  <cgarcia@igalia.com>
1063
1064         Unreviewed. Fix typo in GLib geolocation API after r243285.
1065
1066         gelocation -> geolocation.
1067
1068         * UIProcess/API/glib/WebKitGeolocationManager.cpp:
1069         (webkit_geolocation_manager_class_init):
1070         (webkit_geolocation_manager_update_position):
1071         (webkit_geolocation_manager_failed):
1072         (webkit_gelocation_manager_update_position): Deleted.
1073         (webkit_gelocation_manager_failed): Deleted.
1074         * UIProcess/API/gtk/WebKitGeolocationManager.h:
1075         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1076         * UIProcess/API/wpe/WebKitGeolocationManager.h:
1077         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
1078
1079 2019-03-26  Patrick Griffis  <pgriffis@igalia.com>
1080
1081         [GTK][WPE] Disable process warming
1082         https://bugs.webkit.org/show_bug.cgi?id=196208
1083
1084         Reviewed by Chris Dumez.
1085
1086         Fixes crash caused by r243384.
1087
1088         Process warming is incompatible with our launcher as it expects a valid
1089         WebsiteDataStore at initialization time for sandbox permissions.
1090
1091         * UIProcess/glib/WebProcessPoolGLib.cpp:
1092         (WebKit::WebProcessPool::platformInitialize):
1093
1094 2019-03-25  Alex Christensen  <achristensen@webkit.org>
1095
1096         Do not terminate the NetworkProcess if a third party application sends a NSCredential with a SecIdentityRef
1097         https://bugs.webkit.org/show_bug.cgi?id=196213
1098
1099         Reviewed by Geoff Garen.
1100
1101         A release assertion added in r230225 was reachable.  I reached it in a unit test that responds to a challenge
1102         with a SecIdentityRef wrapped in an NSCredential.
1103
1104         * Shared/cf/ArgumentCodersCF.cpp:
1105         (IPC::decode):
1106
1107 2019-03-25  Chris Dumez  <cdumez@apple.com>
1108
1109         Regression(r242369) Trying to change profile picture on linked in shows file picker, not the image picker
1110         https://bugs.webkit.org/show_bug.cgi?id=196205
1111         <rdar://problem/49083324>
1112
1113         Reviewed by Geoffrey Garen.
1114
1115         Update our FileUploadPanel code on iOS to properly deal with the MIME types containing
1116         wild cards (e.g. "image/*") that are defined in the HTML specification:
1117         - https://html.spec.whatwg.org/multipage/input.html#attr-input-accept
1118
1119         Previously, we would fail to convert those to UTIs.
1120
1121         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1122
1123 2019-03-25  Tim Horton  <timothy_horton@apple.com>
1124
1125         Remove some now-unnecessary dynamic class lookup
1126         https://bugs.webkit.org/show_bug.cgi?id=196237
1127
1128         Reviewed by Simon Fraser.
1129
1130         * Shared/DocumentEditingContext.mm:
1131         (WebKit::DocumentEditingContext::toPlatformContext):
1132
1133 2019-03-25  Tim Horton  <timothy_horton@apple.com>
1134
1135         Get rid of ENABLE(ANIMATED_KEYBOARD_SCROLLING)
1136         https://bugs.webkit.org/show_bug.cgi?id=196224
1137
1138         Reviewed by Simon Fraser.
1139
1140         * Platform/spi/ios/AccessibilitySupportSPI.h:
1141         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
1142         (-[WKKeyboardScrollingAnimator invalidate]):
1143         (perpendicularAbsoluteUnitVector):
1144         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
1145         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
1146         (-[WKKeyboardScrollingAnimator willStartInteractiveScroll]):
1147         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
1148         (-[WKKeyboardScrollViewAnimator scrollWithScrollToExtentAnimationTo:]):
1149         (-[WKKeyboardScrollingAnimator startRepeatTimerIfNeeded]): Deleted.
1150         (-[WKKeyboardScrollingAnimator stopRepeatTimer]): Deleted.
1151         (-[WKKeyboardScrollingAnimator performDiscreteScroll]): Deleted.
1152
1153 2019-03-25  Fujii Hironori  <Hironori.Fujii@sony.com>
1154
1155         Enable IPC sending and receiving non-default-constructible types
1156         https://bugs.webkit.org/show_bug.cgi?id=196132
1157         <rdar://problem/49229221>
1158
1159         Unreviewed build fix for WinCairo port.
1160
1161         error C2440: '=': cannot convert from 'int' to 'HANDLE'
1162
1163         * Platform/win/SharedMemoryWin.cpp:
1164         (WebKit::SharedMemory::Handle::Handle): std::exchange HANDLE with nullptr, not 0.
1165         (WebKit::SharedMemory::Handle::operator=): Ditto.
1166
1167 2019-03-25  Fujii Hironori  <Hironori.Fujii@sony.com>
1168
1169         [Coordinated Graphics][WinCairo] ASSERTION FAILED: state.id == m_nicosia.state.id
1170         https://bugs.webkit.org/show_bug.cgi?id=196190
1171
1172         Reviewed by Žan Doberšek.
1173
1174         This assertion assumes the pre-committed and the committed scenes
1175         are identical. But, the pre-committed scene is updated in the main
1176         thread. Removed the false assertion.
1177
1178         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1179         (WebKit::CoordinatedGraphicsScene::purgeGLResources): Remove the
1180         assertion. Removed layers of committed scene, not pre-committed
1181         scene.
1182
1183 2019-03-25  Brady Eidson  <beidson@apple.com>
1184
1185         Add socket-delegate to another entitlements config
1186         rdar://problem/48090350 and https://bugs.webkit.org/show_bug.cgi?id=196227
1187
1188         Reviewed by Geoffrey Garen.
1189
1190         * Configurations/Network-iOSMac.entitlements:
1191
1192 2019-03-25  Commit Queue  <commit-queue@webkit.org>
1193
1194         Unreviewed, rolling out r243465.
1195         https://bugs.webkit.org/show_bug.cgi?id=196226
1196
1197         the test doesn't build (Requested by thorton on #webkit).
1198
1199         Reverted changeset:
1200
1201         "Do not terminate the NetworkProcess if a third party
1202         application sends a NSCredential with a SecIdentityRef"
1203         https://bugs.webkit.org/show_bug.cgi?id=196213
1204         https://trac.webkit.org/changeset/243465
1205
1206 2019-03-25  Simon Fraser  <simon.fraser@apple.com>
1207
1208         REGRESSION (r242687): Flicker when pinch-zooming pages in macOS Safari
1209         https://bugs.webkit.org/show_bug.cgi?id=196126
1210         rdar://problem/49095791
1211
1212         Reviewed by Tim Horton.
1213         
1214         I fumbled the commit after the enum rename. Make this actually work.
1215
1216         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1217         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1218
1219 2019-03-25  Simon Fraser  <simon.fraser@apple.com>
1220
1221         Zoom on macOS is centered around a point lower than the cursor
1222         https://bugs.webkit.org/show_bug.cgi?id=196225
1223         rdar://problem/49213574
1224
1225         Reviewed by Tim Horton.
1226         
1227         The origin handed to ViewGestureController::handleMagnificationGestureEvent is in WKWebView
1228         coordinates, but we end up setting the transform on the RenderView's layer, so we need
1229         to subtract the topContentInset.
1230
1231         * UIProcess/mac/ViewGestureControllerMac.mm:
1232         (WebKit::ViewGestureController::handleMagnificationGestureEvent):
1233
1234 2019-03-25  Alex Christensen  <achristensen@webkit.org>
1235
1236         Do not terminate the NetworkProcess if a third party application sends a NSCredential with a SecIdentityRef
1237         https://bugs.webkit.org/show_bug.cgi?id=196213
1238
1239         Reviewed by Geoff Garen.
1240
1241         A release assertion added in r230225 was reachable.  I reached it in a unit test that responds to a challenge
1242         with a SecIdentityRef wrapped in an NSCredential.
1243
1244         * Shared/cf/ArgumentCodersCF.cpp:
1245         (IPC::decode):
1246
1247 2019-03-25  Chris Dumez  <cdumez@apple.com>
1248
1249         Get rid of WebPage::m_shouldResetDrawingAreaAfterSuspend flag
1250         https://bugs.webkit.org/show_bug.cgi?id=196210
1251         <rdar://problem/48681326>
1252
1253         Reviewed by Geoffrey Garen.
1254
1255         Get rid of WebPage::m_shouldResetDrawingAreaAfterSuspend flag and use the drawing area identifier
1256         instead to reset the DrawingArea in the WebProcess whenever the UIProcess did.
1257
1258         This is less error-prone and guarantees that the WebProcess and the UIProcess can reliably
1259         communicate via DrawingArea IPC.
1260
1261         * WebProcess/WebPage/WebPage.cpp:
1262         (WebKit::WebPage::reinitializeWebPage):
1263         (WebKit::WebPage::setIsSuspended):
1264         * WebProcess/WebPage/WebPage.h:
1265
1266 2019-03-25  Alex Christensen  <achristensen@webkit.org>
1267
1268         Enable IPC sending and receiving non-default-constructible types
1269         https://bugs.webkit.org/show_bug.cgi?id=196132
1270
1271         Reviewed by Geoff Garen.
1272
1273         * Platform/IPC/ArgumentCoder.h:
1274         * Platform/IPC/ArgumentCoders.h:
1275         (IPC::TupleEncoder::encode):
1276         (IPC::tupleFromTupleAndObject):
1277         (IPC::TupleDecoderImpl::decode):
1278         (IPC::TupleDecoderImpl<Type>::decode):
1279         (IPC::TupleDecoder::decode):
1280         (IPC::TupleDecoder<0>::decode):
1281         (IPC::TupleCoder::encode): Deleted.
1282         (IPC::TupleCoder::decode): Deleted.
1283         * Platform/IPC/Connection.h:
1284         (IPC::Connection::sendWithReply):
1285         (IPC::TupleMover::move):
1286         (IPC::moveTuple):
1287         (IPC::Connection::sendSync):
1288         * Platform/IPC/Decoder.h:
1289         (IPC::Decoder::decode):
1290         (IPC::Decoder::operator>>):
1291         * Platform/IPC/HandleMessage.h:
1292         (IPC::handleMessage):
1293         (IPC::handleMessageSynchronous):
1294         (IPC::handleMessageSynchronousWantsConnection):
1295         (IPC::handleMessageAsync):
1296         * Platform/SharedMemory.h:
1297         * Scripts/webkit/LegacyMessages-expected.h:
1298         * Scripts/webkit/Messages-expected.h:
1299         * Scripts/webkit/MessagesSuperclass-expected.h:
1300         * Scripts/webkit/messages.py:
1301         * Shared/Databases/IndexedDB/WebIDBResult.h:
1302         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
1303         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1304         * Shared/ShareableBitmap.h:
1305         * Shared/ShareableResource.h:
1306         * Shared/UpdateInfo.h:
1307         * Shared/WebEvent.h:
1308         * Shared/WebProcessCreationParameters.cpp:
1309         * Shared/WebProcessCreationParameters.h:
1310         * Shared/mac/SecItemResponseData.cpp:
1311         (WebKit::SecItemResponseData::SecItemResponseData):
1312         (WebKit::SecItemResponseData::decode):
1313         * Shared/mac/SecItemResponseData.h:
1314         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h:
1315
1316 2019-03-25  Tim Horton  <timothy_horton@apple.com>
1317
1318         Animated keyboard scrolling is extremely chaotic
1319         https://bugs.webkit.org/show_bug.cgi?id=196164
1320         <rdar://problem/48702444>
1321
1322         Reviewed by Simon Fraser.
1323
1324         * UIProcess/ios/WKContentViewInteraction.mm:
1325         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
1326         Consume keyboard events instead of interpreting them traditionally
1327         if WKKeyboardScrollingAnimator is animating.
1328
1329         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
1330         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
1331         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
1332         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
1333         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
1334         (-[WKKeyboardScrollingAnimator scrollTriggeringKeyIsPressed]):
1335         (-[WKKeyboardScrollingAnimator displayLinkFired:]):
1336         (-[WKKeyboardScrollViewAnimator scrollTriggeringKeyIsPressed]):
1337         Expose the current state of interactive scrolling, and rename the related member.
1338
1339 2019-03-25  Keith Rollin  <krollin@apple.com>
1340
1341         Add WebKit logging for first paint and other interesting layout milestones
1342         https://bugs.webkit.org/show_bug.cgi?id=196159
1343         <rdar://problem/49128952>
1344
1345         Reviewed by Simon Fraser.
1346
1347         Add some logging to indicate what layout milestones have been reached.
1348         This should help us determine if there's a client, rendering, layout,
1349         or some other issue when page content does not appear in the client
1350         window.
1351
1352         The logging is being added to
1353         WebFrameLoaderClient::dispatchDidReachLayoutMilestone. This seems like
1354         a nice central place to capture layout milestones. However, it will
1355         only log notifications that are being sent to clients. It does not
1356         indicate all milestones that have occurred. That is, it does not
1357         report milestones that are filtered out due to client disinterest.
1358         There doesn't seem to be a good central place to capture all
1359         milestones, regardless of client interest.
1360
1361         * Platform/Logging.h:
1362         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1363         (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
1364
1365 2019-03-25  Patrick Griffis  <pgriffis@igalia.com>
1366
1367         [GTK][WPE] Remove network access from web process sandbox
1368         https://bugs.webkit.org/show_bug.cgi?id=189967
1369
1370         Reviewed by Michael Catanzaro.
1371
1372         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
1373         (WebKit::createFlatpakInfo):
1374         (WebKit::bubblewrapSpawn):
1375         * UIProcess/Launcher/glib/FlatpakLauncher.cpp:
1376         (WebKit::flatpakSpawn):
1377
1378 2019-03-25  Andy Estes  <aestes@apple.com>
1379
1380         [Apple Pay] Call +canMakePayments on a work queue
1381         https://bugs.webkit.org/show_bug.cgi?id=196179
1382         <rdar://problem/45388749>
1383
1384         Reviewed by Brady Eidson.
1385
1386         Calling +canMakePayments on either PKPaymentAuthorizationController or
1387         PKPaymentAuthorizationViewController results in synchronous IPC and is therefore very
1388         expensive to call on the main thread. On iOS, these calls are made in the network process,
1389         and on Mac in the UI process.
1390
1391         Call these methods on a work queue to avoid main thread spins.
1392
1393         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
1394         (WebKit::WebPaymentCoordinatorProxy::canMakePayments):
1395         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
1396         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
1397         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
1398         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
1399         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
1400
1401 2019-03-25  Andy Estes  <aestes@apple.com>
1402
1403         [Apple Pay] Remove the AvailablePaymentNetworks synchronous message
1404         https://bugs.webkit.org/show_bug.cgi?id=196180
1405
1406         Reviewed by Youenn Fablet.
1407
1408         Unlike many PassKit interactions, it's ok to call +[PKPaymentRequest availableNetworks]
1409         without an entitlement. Therefore, we can call it from the web process directly rather than
1410         synchronously messaging the entitled UI or networking process.
1411
1412         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
1413         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
1414         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
1415         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1416         * SourcesCocoa.txt:
1417         * WebKit.xcodeproj/project.pbxproj:
1418         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
1419         (WebKit::WebPaymentCoordinator::availablePaymentNetworks):
1420         * WebProcess/ApplePay/WebPaymentCoordinator.h:
1421         * WebProcess/ApplePay/cocoa/WebPaymentCoordinatorCocoa.mm: Added.
1422         (WebKit::WebPaymentCoordinator::platformAvailablePaymentNetworks const):
1423         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
1424         (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
1425         (-[WKAccessibilityWebPageObjectBase setWebPage:]):
1426
1427 2019-03-25  Chris Dumez  <cdumez@apple.com>
1428
1429         Unreviewed, tiny fix after r243388 to address API test failures on iOS
1430
1431         m_processType was properly initialized on macOS but not iOS.
1432
1433         * WebProcess/cocoa/WebProcessCocoa.mm:
1434         (WebKit::WebProcess::platformInitializeProcess):
1435
1436 2019-03-25  Carlos Garcia Campos  <cgarcia@igalia.com>
1437
1438         [GTK][WPE] Do not allow changes in active URI before provisional load starts for non-API requests
1439         https://bugs.webkit.org/show_bug.cgi?id=194208
1440
1441         Reviewed by Michael Catanzaro.
1442
1443         * UIProcess/API/glib/WebKitWebView.cpp:
1444         (webkitWebViewWillStartLoad): Block updates of active URL.
1445         (webkitWebViewLoadChanged): Unblock updates of active URL on WEBKIT_LOAD_STARTED.
1446
1447 2019-03-25  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
1448
1449         Remove NavigatorContentUtils in WebCore/Modules
1450         https://bugs.webkit.org/show_bug.cgi?id=196070
1451
1452         Reviewed by Alex Christensen.
1453
1454         NavigatorContentUtils was to support the custom scheme spec [1].
1455         However, in WebKit side, no port has supported the feature in
1456         WebKit layer after EFL port was removed. So there has been the
1457         only IDL implementation of the NavigatorContentUtils in WebCore.
1458         So we don't need to keep the implementation in WebCore anymore.
1459
1460         [1] https://html.spec.whatwg.org/multipage/system-state.html#custom-handlers
1461
1462         * Configurations/FeatureDefines.xcconfig:
1463         * WebProcess/WebCoreSupport/WebNavigatorContentUtilsClient.h: Removed.
1464
1465 2019-03-24  Zan Dobersek  <zdobersek@igalia.com>
1466
1467         Unreviewed WPE build fix.
1468
1469         * UIProcess/wpe/WebPasteboardProxyWPE.cpp:
1470         Add an explicit CompletionHandler.h include to avoid a trip-up in
1471         unified builds.
1472
1473 2019-03-24  Fujii Hironori  <Hironori.Fujii@sony.com>
1474
1475         [WinCairo] WebProcessDataStoreParameters.h(32): error C2653: 'SandboxExtension': is not a class or namespace name
1476         https://bugs.webkit.org/show_bug.cgi?id=196192
1477
1478         Unreviewed for WinCairo port.
1479
1480         * Shared/WebProcessDataStoreParameters.h: Added #include "SandboxExtension.h".
1481
1482 2019-03-24  Andy Estes  <aestes@apple.com>
1483
1484         [watchOS] Remove unused Proximity Networking code
1485         https://bugs.webkit.org/show_bug.cgi?id=196188
1486
1487         Reviewed by Tim Horton.
1488
1489         * Configurations/WebKit.xcconfig:
1490         * NetworkProcess/NetworkProcess.cpp:
1491         (WebKit::NetworkProcess::NetworkProcess):
1492         * NetworkProcess/NetworkProcess.h:
1493         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1494         (WebKit::NetworkProcessCreationParameters::encode const):
1495         (WebKit::NetworkProcessCreationParameters::decode):
1496         * NetworkProcess/NetworkProcessCreationParameters.h:
1497         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1498         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1499         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1500         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1501         (WebKit::NetworkProcess::platformPrepareToSuspend):
1502         (WebKit::NetworkProcess::platformProcessDidResume):
1503         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
1504         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
1505         * NetworkProcess/watchos/NetworkProximityAssertion.h: Removed.
1506         * NetworkProcess/watchos/NetworkProximityAssertion.mm: Removed.
1507         * NetworkProcess/watchos/NetworkProximityManager.h: Removed.
1508         * NetworkProcess/watchos/NetworkProximityManager.mm: Removed.
1509         * SourcesCocoa.txt:
1510         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1511         (API::ProcessPoolConfiguration::copy):
1512         * UIProcess/API/APIProcessPoolConfiguration.h:
1513         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1514         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1515         (-[_WKProcessPoolConfiguration wirelessContextIdentifier]):
1516         (-[_WKProcessPoolConfiguration setWirelessContextIdentifier:]):
1517         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1518         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1519         * WebKit.xcodeproj/project.pbxproj:
1520
1521 2019-03-23  Chris Dumez  <cdumez@apple.com>
1522
1523         Unreviewed, fix typo in comment added in r243379.
1524
1525         * UIProcess/API/Cocoa/WKProcessGroup.mm:
1526         (-[WKProcessGroup setDelegate:]):
1527
1528 2019-03-23  Simon Fraser  <simon.fraser@apple.com>
1529
1530         REGRESSION (iOS 8): Scrollbar can't be hidden when webkit-overflow-scrolling is set to touch
1531         https://bugs.webkit.org/show_bug.cgi?id=137043
1532         rdar://problem/16595330
1533
1534         Reviewed by Zalan Bujtas.
1535
1536         Plumb horizontalScrollbarHiddenByStyle/verticalScrollbarHiddenByStyle through ScrollableAreaParameters
1537         to the UI process, and use it to set UIScrollView indicators visible or not.
1538         
1539         The scroll snap changes in ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren() fix a bug
1540         where hasChangedProperty(HorizontalSnapOffsets) was nested inside another set of hasChangedProperty()
1541         tests, so would never get called.
1542
1543         * Shared/WebCoreArgumentCoders.cpp:
1544         (IPC::ArgumentCoder<ScrollableAreaParameters>::encode):
1545         (IPC::ArgumentCoder<ScrollableAreaParameters>::decode):
1546         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1547         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
1548
1549 2019-03-23  Zalan Bujtas  <zalan@apple.com>
1550
1551         [ContentChangeObserver] Taping on a form control should always result in click.
1552         https://bugs.webkit.org/show_bug.cgi?id=196177
1553
1554         Reviewed by Simon Fraser.
1555
1556         This patch enures that we send a synthetic click when the traget node is a form control (button, edit field etc) even if
1557         the mousemove brings up some hover content.
1558
1559         * WebProcess/WebPage/ios/WebPageIOS.mm:
1560         (WebKit::WebPage::handleSyntheticClick):
1561
1562 2019-03-23  Andy Estes  <aestes@apple.com>
1563
1564         [Apple Pay] Stop calling PKPaymentAuthorizationViewController class methods on iOS
1565         https://bugs.webkit.org/show_bug.cgi?id=196163
1566         <rdar://problem/48787564>
1567
1568         Reviewed by Anders Carlsson.
1569
1570         Now that we've transitioned to PKPaymentAuthorizationController on iOS, we should stop
1571         calling PKPaymentAuthorizationViewController class methods on iOS in favor of their
1572         PKPaymentAuthorizationController alternatives.
1573
1574         While we're here, we should also transition to calling
1575         +paymentServicesMerchantURLForAPIType:completion: on both
1576         PKPaymentAuthorizationViewController and PKPaymentAuthorizationController.
1577
1578         * Platform/cocoa/PaymentAuthorizationViewController.mm:
1579         (-[WKPaymentAuthorizationViewControllerDelegate _paymentServicesMerchantURLForAPIType:completion:]):
1580         * Platform/cocoa/WKPaymentAuthorizationDelegate.h:
1581         * Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
1582         (-[WKPaymentAuthorizationDelegate _initWithRequest:presenter:]):
1583         (-[WKPaymentAuthorizationDelegate _paymentServicesMerchantURLForAPIType:completion:]):
1584         * Platform/ios/PaymentAuthorizationController.mm:
1585         (-[WKPaymentAuthorizationControllerDelegate _paymentServicesMerchantURLForAPIType:completion:]):
1586         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1587         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments): Deleted.
1588         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
1589         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
1590         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
1591         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
1592
1593 2019-03-23  Carlos Garcia Campos  <cgarcia@igalia.com>
1594
1595         Unreviewed. Fix GTK build after r243409.
1596
1597         Build failure is actually unrelated to r243409, it's yet another unified build failure that happens when source
1598         file list changes.
1599
1600         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
1601         (WebKit::WebInspectorProxy::platformShowCertificate): Use WebCore namespace for CertificateInfo parameter.
1602
1603 2019-03-23  Carlos Garcia Campos  <cgarcia@igalia.com>
1604
1605         [GTK] Remove build time dependency on Geoclue2
1606         https://bugs.webkit.org/show_bug.cgi?id=195994
1607
1608         Reviewed by Michael Catanzaro.
1609
1610         Add GeoclueGeolocationProvider class to provide geolocation position updates using Geoclue2 DBus service.
1611
1612         * PlatformGTK.cmake:
1613         * PlatformWPE.cmake:
1614         * SourcesGTK.txt:
1615         * SourcesWPE.txt:
1616         * UIProcess/API/glib/WebKitGeolocationManager.cpp:
1617         (_WebKitGeolocationPosition::_WebKitGeolocationPosition):
1618         (webkitGeolocationManagerStop):
1619         (webkitGeolocationManagerSetEnableHighAccuracy):
1620         (webkitGeolocationManagerDispose):
1621         (webkit_geolocation_manager_class_init):
1622         * UIProcess/geoclue/GeoclueGeolocationProvider.cpp: Added.
1623         (WebKit::GeoclueGeolocationProvider::GeoclueGeolocationProvider):
1624         (WebKit::GeoclueGeolocationProvider::~GeoclueGeolocationProvider):
1625         (WebKit::GeoclueGeolocationProvider::start):
1626         (WebKit::GeoclueGeolocationProvider::stop):
1627         (WebKit::GeoclueGeolocationProvider::setEnableHighAccuracy):
1628         (WebKit::GeoclueGeolocationProvider::destroyManagerLater):
1629         (WebKit::GeoclueGeolocationProvider::destroyManager):
1630         (WebKit::GeoclueGeolocationProvider::setupManager):
1631         (WebKit::GeoclueGeolocationProvider::createClient):
1632         (WebKit::GeoclueGeolocationProvider::setupClient):
1633         (WebKit::GeoclueGeolocationProvider::startClient):
1634         (WebKit::GeoclueGeolocationProvider::stopClient):
1635         (WebKit::GeoclueGeolocationProvider::requestAccuracyLevel):
1636         (WebKit::GeoclueGeolocationProvider::clientLocationUpdatedCallback):
1637         (WebKit::GeoclueGeolocationProvider::createLocation):
1638         (WebKit::GeoclueGeolocationProvider::locationUpdated):
1639         (WebKit::GeoclueGeolocationProvider::didFail):
1640         * UIProcess/geoclue/GeoclueGeolocationProvider.h: Added.
1641
1642 2019-03-22  Simon Fraser  <simon.fraser@apple.com>
1643
1644         Undo collision with r243390.
1645
1646         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1647         (stringForSSLProtocol):
1648
1649 2019-03-22  Simon Fraser  <simon.fraser@apple.com>
1650
1651         Fix internal builds.
1652
1653         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1654         (stringForSSLProtocol):
1655
1656 2019-03-22  Keith Rollin  <krollin@apple.com>
1657
1658         Enable ThinLTO support in Production builds
1659         https://bugs.webkit.org/show_bug.cgi?id=190758
1660         <rdar://problem/45413233>
1661
1662         Reviewed by Daniel Bates.
1663
1664         Enable building with Thin LTO in Production when using Xcode 10.2 or
1665         later. This change results in a 1.45% progression in PLT5. Full
1666         Production build times increase about 2-3%. Incremental build times
1667         are more severely affected, and so LTO is not enabled for local
1668         engineering builds.
1669
1670         LTO is enabled only on macOS for now, until rdar://problem/49013399,
1671         which affects ARM builds, is fixed.
1672
1673         To change the LTO setting when building locally:
1674
1675         - If building with `make`, specify WK_LTO_MODE={none,thin,full} on the
1676           command line.
1677         - If building with `build-webkit`, specify --lto-mode={none,thin,full}
1678           on the command line.
1679         - If building with `build-root`, specify --lto={none,thin,full} on the
1680           command line.
1681         - If building with Xcode, create a LocalOverrides.xcconfig file at the
1682           top level of your repository directory (if needed) and define
1683           WK_LTO_MODE to full, thin, or none.
1684
1685         * Configurations/Base.xcconfig:
1686
1687 2019-03-22  Chris Dumez  <cdumez@apple.com>
1688
1689         Unreviewed build fix after r243388.
1690
1691         * WebProcess/WebProcess.h:
1692
1693 2019-03-22  Per Arne Vollan  <pvollan@apple.com>
1694
1695         [macOS] Fix sandbox violation
1696         https://bugs.webkit.org/show_bug.cgi?id=196153
1697         <rdar://problem/49123855>
1698
1699         Reviewed by Brent Fulgham.
1700
1701         The sandbox on macOS is blocking the mach lookup.
1702
1703         * WebProcess/com.apple.WebProcess.sb.in:
1704
1705 2019-03-21  Ryan Haddad  <ryanhaddad@apple.com>
1706
1707         Unreviewed, fix the build with recent SDKs.
1708
1709         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1710         (stringForSSLProtocol):
1711
1712 2019-03-22  Chris Dumez  <cdumez@apple.com>
1713
1714         Implement WebProcess freezer opt-in completely on WebContent process side
1715         https://bugs.webkit.org/show_bug.cgi?id=196149
1716
1717         Reviewed by Brady Eidson.
1718
1719         Implement WebProcess freezer opt-in completely on WebContent process side, we do not need
1720         to involve the UIProcess with this and rely on IPC which may be fragile.
1721
1722         In the future, we may want to set freezable state from the UIProcess when the API supports
1723         it. We can move the logic to be fully on the UIProcess side then. In the mean time, it is
1724         likely best not to rely on IPC and process coordination for this.
1725
1726         * UIProcess/WebProcessProxy.cpp:
1727         (WebKit::globalPageMap):
1728         (WebKit::WebProcessProxy::WebProcessProxy):
1729         (WebKit::WebProcessProxy::setIsInProcessCache):
1730         (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
1731         (WebKit::WebProcessProxy::didFinishLaunching):
1732         (WebKit::WebProcessProxy::validateFreezerStatus): Deleted.
1733         * UIProcess/WebProcessProxy.h:
1734         (WebKit::WebProcessProxy::removeProvisionalPageProxy):
1735         (WebKit::WebProcessProxy::WebPageProxyMap::WebPageProxyMap): Deleted.
1736         (WebKit::WebProcessProxy::WebPageProxyMap::size const): Deleted.
1737         (WebKit::WebProcessProxy::WebPageProxyMap::values): Deleted.
1738         (WebKit::WebProcessProxy::WebPageProxyMap::values const): Deleted.
1739         (WebKit::WebProcessProxy::WebPageProxyMap::begin): Deleted.
1740         (WebKit::WebProcessProxy::WebPageProxyMap::end): Deleted.
1741         (WebKit::WebProcessProxy::WebPageProxyMap::get): Deleted.
1742         (WebKit::WebProcessProxy::WebPageProxyMap::contains const): Deleted.
1743         (WebKit::WebProcessProxy::WebPageProxyMap::isEmpty const): Deleted.
1744         (WebKit::WebProcessProxy::WebPageProxyMap::set): Deleted.
1745         (WebKit::WebProcessProxy::WebPageProxyMap::take): Deleted.
1746         * WebProcess/WebProcess.cpp:
1747         (WebKit::WebProcess::setIsInProcessCache):
1748         (WebKit::WebProcess::markIsNoLongerPrewarmed):
1749         (WebKit::WebProcess::actualPrepareToSuspend):
1750         (WebKit::WebProcess::setFreezable): Deleted.
1751         * WebProcess/WebProcess.h:
1752         * WebProcess/WebProcess.messages.in:
1753         * WebProcess/cocoa/WebProcessCocoa.mm:
1754         (WebKit::WebProcess::updateProcessName):
1755         (WebKit::WebProcess::shouldFreezeOnSuspension const):
1756         (WebKit::WebProcess::updateFreezerStatus):
1757
1758 2019-03-22  Chris Dumez  <cdumez@apple.com>
1759
1760         Prewarmed processes should be usable with any website data store
1761         https://bugs.webkit.org/show_bug.cgi?id=196104
1762
1763         Reviewed by Alex Christensen.
1764
1765         Split WebsiteDataStore-specific data out of WebProcessCreationParameters and into a new
1766         WebProcessDataStoreParameters struct so that we do not need a WebsiteDataStore in order
1767         to lauch and initialize a WebProcess. When the process finally gets used and we thus
1768         know which WebsiteDataStore they will be used for, we send the WebProcessDataStoreParameters
1769         to the process to that it can do its data store-specific initialization.
1770
1771         This allows prewarmed processes not not have a WebsiteDataStore assocated with them. They
1772         can then be used for any WebsiteDataStore when we need them.
1773
1774         This is also used by our dummy WebProcessProxy since it does not have a backing process and
1775         thus has no associated WebsiteDataStore.
1776
1777         * Shared/WebProcessCreationParameters.cpp:
1778         (WebKit::WebProcessCreationParameters::encode const):
1779         (WebKit::WebProcessCreationParameters::decode):
1780         * Shared/WebProcessCreationParameters.h:
1781         * Shared/WebProcessDataStoreParameters.h: Added.
1782         (WebKit::WebProcessDataStoreParameters::encode const):
1783         (WebKit::WebProcessDataStoreParameters::decode):
1784         * UIProcess/API/C/WKContext.cpp:
1785         (WKContextWarmInitialProcess):
1786         * UIProcess/API/Cocoa/WKProcessPool.mm:
1787         (-[WKProcessPool _warmInitialProcess]):
1788         * UIProcess/ServiceWorkerProcessProxy.cpp:
1789         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
1790         * UIProcess/WebPageProxy.cpp:
1791         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
1792         * UIProcess/WebProcessPool.cpp:
1793         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
1794         (WebKit::WebProcessPool::createNewWebProcess):
1795         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
1796         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
1797         (WebKit::WebProcessPool::initializeNewWebProcess):
1798         (WebKit::WebProcessPool::prewarmProcess):
1799         (WebKit::WebProcessPool::processForRegistrableDomain):
1800         (WebKit::WebProcessPool::createWebPage):
1801         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
1802         * UIProcess/WebProcessPool.h:
1803         (WebKit::WebProcessPool::sendToOneProcess):
1804         * UIProcess/WebProcessProxy.cpp:
1805         (WebKit::WebProcessProxy::create):
1806         (WebKit::WebProcessProxy::WebProcessProxy):
1807         (WebKit::WebProcessProxy::setWebsiteDataStore):
1808         (WebKit::WebProcessProxy::addExistingWebPage):
1809         * UIProcess/WebProcessProxy.h:
1810         (WebKit::WebProcessProxy::websiteDataStore const):
1811         * WebKit.xcodeproj/project.pbxproj:
1812         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
1813         (WebKit::WebMediaKeyStorageManager::setWebsiteDataStore):
1814         * WebProcess/MediaCache/WebMediaKeyStorageManager.h:
1815         * WebProcess/WebProcess.cpp:
1816         (WebKit::WebProcess::initializeWebProcess):
1817         (WebKit::WebProcess::setWebsiteDataStoreParameters):
1818         * WebProcess/WebProcess.h:
1819         * WebProcess/WebProcess.messages.in:
1820         * WebProcess/WebProcessSupplement.h:
1821         (WebKit::WebProcessSupplement::initialize):
1822         (WebKit::WebProcessSupplement::setWebsiteDataStore):
1823         * WebProcess/cocoa/WebProcessCocoa.mm:
1824         (WebKit::WebProcess::platformInitializeWebProcess):
1825         (WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
1826         * WebProcess/win/WebProcessWin.cpp:
1827         (WebKit::WebProcess::platformInitializeWebProcess):
1828         (WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
1829
1830 2019-03-22  Simon Fraser  <simon.fraser@apple.com>
1831
1832         REGRESSION (r242687): Flicker when pinch-zooming pages in macOS Safari
1833         https://bugs.webkit.org/show_bug.cgi?id=196126
1834         rdar://problem/49095791
1835
1836         Reviewed by Antti Koivisto.
1837
1838         The scrolling tree doesn't have an accurate picture of the main view's scroll position
1839         during pinch-zooming, so don't have it apply layer positions if a transient zoom is
1840         in progress.
1841
1842         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1843         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1844         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1845         (WebKit::TiledCoreAnimationDrawingArea::applyTransientZoomToPage):
1846
1847 2019-03-22  Antti Koivisto  <antti@apple.com>
1848
1849         Handle UI side hit testing for ScrollPositioningBehavior::Stationary positioned nodes
1850         https://bugs.webkit.org/show_bug.cgi?id=196100
1851         <rdar://problem/49117933>
1852
1853         Reviewed by Simon Fraser.
1854
1855         Test: fast/scrolling/ios/overflow-scroll-overlap-6.html
1856
1857         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
1858         (WebKit::RemoteLayerTreeNode::relatedScrollContainerIDs const):
1859         (WebKit::RemoteLayerTreeNode::relatedScrollContainerPositioningBehavior const):
1860
1861         Make more generic and save the associated positioning behavior.
1862
1863         (WebKit::RemoteLayerTreeNode::nonAncestorScrollContainerIDs const): Deleted.
1864         (WebKit::RemoteLayerTreeNode::addNonAncestorScrollContainerID): Deleted.
1865         (WebKit::RemoteLayerTreeNode::clearNonAncestorScrollContainerIDs): Deleted.
1866         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
1867         (WebKit::RemoteLayerTreeNode::setRelatedScrollContainerBehaviorAndIDs):
1868         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
1869         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1870         (WebKit::isScrolledBy):
1871
1872         Stationary relationship means the layer won't scroll the scroller.
1873
1874         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1875         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
1876
1877 2019-03-22  Chris Dumez  <cdumez@apple.com>
1878
1879         REGRESSION (r243094): ePub files do not render or open in Books
1880         https://bugs.webkit.org/show_bug.cgi?id=196119
1881         <rdar://problem/49121686>
1882
1883         Reviewed by Brady Eidson.
1884
1885         Do not delay the WebProcess launch until a load when contructing a web view and the client
1886         may observe when its injected bundle is loaded via WKProcessGroupDelegate's
1887         didCreateConnectionToWebProcessPlugIn.
1888
1889         * UIProcess/API/Cocoa/WKProcessGroup.mm:
1890         (-[WKProcessGroup setDelegate:]):
1891         * UIProcess/WebInspectorUtilities.cpp:
1892         (WebKit::inspectorProcessPool):
1893         * UIProcess/WebProcessPool.cpp:
1894         (WebKit::WebProcessPool::createWebPage):
1895         * UIProcess/WebProcessPool.h:
1896
1897 2019-03-22  Carlos Garcia Campos  <cgarcia@igalia.com>
1898
1899         REGRESSION(r243094): Automation: browser crash in WebAutomationSession::exitFullscreenWindowForPage()
1900         https://bugs.webkit.org/show_bug.cgi?id=196140
1901
1902         Reviewed by Chris Dumez.
1903
1904         Since r243094, the WebPageProxy fullscreen manager is not created in the constructor, but once the page has a
1905         process launched.
1906
1907         * UIProcess/Automation/WebAutomationSession.cpp:
1908         (WebKit::WebAutomationSession::exitFullscreenWindowForPage): Null check WebPageProxy::fullScreenManager() before
1909         using it.
1910
1911 2019-03-22  Timothy Hatcher  <timothy@apple.com>
1912
1913         Change macosx() to macos() in WK_API... and JSC_API... macros.
1914         https://bugs.webkit.org/show_bug.cgi?id=196106
1915
1916         Reviewed by Brian Burg.
1917
1918         * Shared/API/Cocoa/WKBrowsingContextHandle.h:
1919         * Shared/API/Cocoa/WKDragDestinationAction.h:
1920         * Shared/API/Cocoa/WKMain.h:
1921         * Shared/API/Cocoa/_WKFrameHandle.h:
1922         * Shared/API/Cocoa/_WKHitTestResult.h:
1923         * Shared/API/Cocoa/_WKNSWindowExtras.h:
1924         * Shared/API/Cocoa/_WKRemoteObjectInterface.h:
1925         * Shared/API/Cocoa/_WKRemoteObjectRegistry.h:
1926         * Shared/API/Cocoa/_WKRenderingProgressEvents.h:
1927         * Shared/API/Cocoa/_WKSameDocumentNavigationType.h:
1928         * UIProcess/API/C/WKPage.h:
1929         * UIProcess/API/Cocoa/NSAttributedString.h:
1930         * UIProcess/API/Cocoa/WKBackForwardList.h:
1931         * UIProcess/API/Cocoa/WKBackForwardListItem.h:
1932         * UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h:
1933         * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegate.h:
1934         * UIProcess/API/Cocoa/WKContentRuleList.h:
1935         * UIProcess/API/Cocoa/WKContentRuleListStore.h:
1936         * UIProcess/API/Cocoa/WKError.h:
1937         * UIProcess/API/Cocoa/WKErrorPrivate.h:
1938         * UIProcess/API/Cocoa/WKFrameInfo.h:
1939         * UIProcess/API/Cocoa/WKFrameInfoPrivate.h:
1940         * UIProcess/API/Cocoa/WKHTTPCookieStore.h:
1941         * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h:
1942         * UIProcess/API/Cocoa/WKNavigation.h:
1943         * UIProcess/API/Cocoa/WKNavigationAction.h:
1944         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
1945         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
1946         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1947         * UIProcess/API/Cocoa/WKNavigationResponse.h:
1948         * UIProcess/API/Cocoa/WKOpenPanelParameters.h:
1949         * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h:
1950         * UIProcess/API/Cocoa/WKPreferences.h:
1951         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1952         * UIProcess/API/Cocoa/WKProcessPool.h:
1953         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1954         * UIProcess/API/Cocoa/WKScriptMessage.h:
1955         * UIProcess/API/Cocoa/WKSecurityOrigin.h:
1956         * UIProcess/API/Cocoa/WKSnapshotConfiguration.h:
1957         * UIProcess/API/Cocoa/WKUIDelegate.h:
1958         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1959         * UIProcess/API/Cocoa/WKURLSchemeHandler.h:
1960         * UIProcess/API/Cocoa/WKURLSchemeTask.h:
1961         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
1962         * UIProcess/API/Cocoa/WKUserContentController.h:
1963         * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
1964         * UIProcess/API/Cocoa/WKUserScript.h:
1965         * UIProcess/API/Cocoa/WKUserScriptPrivate.h:
1966         * UIProcess/API/Cocoa/WKViewPrivate.h:
1967         * UIProcess/API/Cocoa/WKWebView.h:
1968         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
1969         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1970         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1971         * UIProcess/API/Cocoa/WKWebsiteDataRecord.h:
1972         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
1973         * UIProcess/API/Cocoa/WKWebsiteDataStore.h:
1974         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1975         * UIProcess/API/Cocoa/WKWindowFeatures.h:
1976         * UIProcess/API/Cocoa/WKWindowFeaturesPrivate.h:
1977         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
1978         * UIProcess/API/Cocoa/_WKApplicationManifest.h:
1979         * UIProcess/API/Cocoa/_WKAttachment.h:
1980         * UIProcess/API/Cocoa/_WKAutomationDelegate.h:
1981         * UIProcess/API/Cocoa/_WKAutomationSession.h:
1982         * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h:
1983         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
1984         * UIProcess/API/Cocoa/_WKContextMenuElementInfo.h:
1985         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
1986         * UIProcess/API/Cocoa/_WKDownload.h:
1987         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
1988         * UIProcess/API/Cocoa/_WKElementAction.h:
1989         * UIProcess/API/Cocoa/_WKExperimentalFeature.h:
1990         * UIProcess/API/Cocoa/_WKFindOptions.h:
1991         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
1992         * UIProcess/API/Cocoa/_WKFormInputSession.h:
1993         * UIProcess/API/Cocoa/_WKFullscreenDelegate.h:
1994         * UIProcess/API/Cocoa/_WKGeolocationCoreLocationProvider.h:
1995         * UIProcess/API/Cocoa/_WKInspector.h:
1996         * UIProcess/API/Cocoa/_WKInspectorWindow.h:
1997         * UIProcess/API/Cocoa/_WKInternalDebugFeature.h:
1998         * UIProcess/API/Cocoa/_WKLayoutMode.h:
1999         * UIProcess/API/Cocoa/_WKLinkIconParameters.h:
2000         * UIProcess/API/Cocoa/_WKOverlayScrollbarStyle.h:
2001         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2002         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h:
2003         * UIProcess/API/Cocoa/_WKSessionState.h:
2004         * UIProcess/API/Cocoa/_WKTextInputContext.h:
2005         * UIProcess/API/Cocoa/_WKThumbnailView.h:
2006         * UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:
2007         * UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h:
2008         * UIProcess/API/Cocoa/_WKUserContentFilter.h:
2009         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
2010         * UIProcess/API/Cocoa/_WKUserContentWorld.h:
2011         * UIProcess/API/Cocoa/_WKUserInitiatedAction.h:
2012         * UIProcess/API/Cocoa/_WKUserStyleSheet.h:
2013         * UIProcess/API/Cocoa/_WKVisitedLinkStore.h:
2014         * UIProcess/API/Cocoa/_WKWebsiteDataSize.h:
2015         * UIProcess/API/Cocoa/_WKWebsiteDataStore.h:
2016         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2017         * UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h:
2018         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2019         * WebProcess/API/Cocoa/WKWebProcess.h:
2020         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h:
2021         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
2022         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.h:
2023         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
2024         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
2025         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroup.h:
2026         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h:
2027         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.h:
2028         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h:
2029         * WebProcess/InjectedBundle/API/mac/WKDOMElement.h:
2030         * WebProcess/InjectedBundle/API/mac/WKDOMNode.h:
2031         * WebProcess/InjectedBundle/API/mac/WKDOMRange.h:
2032         * WebProcess/InjectedBundle/API/mac/WKDOMText.h:
2033         * WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.h:
2034         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
2035         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h:
2036         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
2037
2038 2019-03-22  Yousuke Kimoto  <Yousuke.Kimoto@sony.com>
2039
2040         Unreviewed build fix.
2041
2042         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2043
2044 2019-03-22  Tim Horton  <timothy_horton@apple.com>
2045
2046         Fix the build after r243354
2047         https://bugs.webkit.org/show_bug.cgi?id=196138
2048         <rdar://problem/49145951>
2049
2050         * Platform/spi/ios/UIKitSPI.h:
2051         * Shared/DocumentEditingContext.mm:
2052         (WebKit::DocumentEditingContext::toPlatformContext):
2053         * UIProcess/ios/WKContentViewInteraction.mm:
2054
2055 2019-03-21  Simon Fraser  <simon.fraser@apple.com>
2056
2057         Clean up some TiledCoreAnimationDrawingArea members
2058         https://bugs.webkit.org/show_bug.cgi?id=196124
2059
2060         Reviewed by Tim Horton.
2061
2062         The giant m_transform was unused.
2063         
2064         Group the bools etc.
2065
2066         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2067         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2068         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
2069         (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer):
2070
2071 2019-03-21  Brady Eidson  <beidson@apple.com>
2072
2073         Certain WebProcesses should opt-out of the freezer.
2074         <rdar://problem/42846139> and https://bugs.webkit.org/show_bug.cgi?id=196062
2075
2076         Reviewed by Andy Estes.
2077
2078         WebProcesses should opt-in and opt-out of the freezer as is appropriate.
2079         By default a WebProcess is freezer eligible.
2080         If any of the following become true then it should become ineligible:
2081         - The WebProcess is a pre-warmed process.
2082         - The WebProcess is in the process cache.
2083         - The WebProcess is not actively hosting any web pages (e.g. it only has suspending web pages)
2084
2085         The most complicated part of the above is guaranteeing that any operation that changes
2086         the active pages hosted by the process causes a recalculation of the freezer opt-in state.
2087
2088         To do that this replaces the basic WebPageProxyMap with a custom class.
2089
2090         * UIProcess/WebProcessProxy.cpp:
2091         (WebKit::globalPageMap):
2092         (WebKit::WebProcessProxy::WebProcessProxy):
2093         (WebKit::WebProcessProxy::validateFreezerStatus):
2094         (WebKit::WebProcessProxy::setIsInProcessCache):
2095         (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
2096         (WebKit::WebProcessProxy::didFinishLaunching):
2097         * UIProcess/WebProcessProxy.h:
2098         (WebKit::WebProcessProxy::WebPageProxyMap::WebPageProxyMap):
2099         (WebKit::WebProcessProxy::WebPageProxyMap::size const):
2100         (WebKit::WebProcessProxy::WebPageProxyMap::values):
2101         (WebKit::WebProcessProxy::WebPageProxyMap::values const):
2102         (WebKit::WebProcessProxy::WebPageProxyMap::begin):
2103         (WebKit::WebProcessProxy::WebPageProxyMap::end):
2104         (WebKit::WebProcessProxy::WebPageProxyMap::get):
2105         (WebKit::WebProcessProxy::WebPageProxyMap::contains const):
2106         (WebKit::WebProcessProxy::WebPageProxyMap::isEmpty const):
2107         (WebKit::WebProcessProxy::WebPageProxyMap::set):
2108         (WebKit::WebProcessProxy::WebPageProxyMap::take):
2109
2110         * WebProcess/WebProcess.cpp:
2111         (WebKit::WebProcess::setFreezable):
2112         * WebProcess/WebProcess.h:
2113         * WebProcess/WebProcess.messages.in:
2114
2115 2019-03-21  Tim Horton  <timothy_horton@apple.com>
2116
2117         Adopt UIWKDocumentContext
2118         https://bugs.webkit.org/show_bug.cgi?id=196040
2119         <rdar://problem/48642440>
2120
2121         Reviewed by Ryosuke Niwa.
2122
2123         * Platform/spi/ios/UIKitSPI.h:
2124         * Scripts/webkit/messages.py:
2125         * Shared/DocumentEditingContext.h: Added.
2126         * Shared/DocumentEditingContext.mm: Added.
2127         (WebKit::toNSRange):
2128         (WebKit::DocumentEditingContext::toPlatformContext):
2129         (IPC::ArgumentCoder<WebKit::DocumentEditingContext::Range>::encode):
2130         (IPC::ArgumentCoder<WebKit::DocumentEditingContext::Range>::decode):
2131         (IPC::ArgumentCoder<WebKit::DocumentEditingContext::TextRect>::encode):
2132         (IPC::ArgumentCoder<WebKit::DocumentEditingContext::TextRect>::decode):
2133         (IPC::ArgumentCoder<WebKit::DocumentEditingContext>::encode):
2134         (IPC::ArgumentCoder<WebKit::DocumentEditingContext>::decode):
2135         (IPC::ArgumentCoder<WebKit::DocumentEditingContextRequest>::encode):
2136         (IPC::ArgumentCoder<WebKit::DocumentEditingContextRequest>::decode):
2137         Add DocumentEditingContext(Request), and coders.
2138         Also expose DocumentEditingContext::toPlatformContext, which populates
2139         a UIWKDocumentContext with the relevant values.
2140
2141         * SourcesCocoa.txt:
2142         * UIProcess/WebPageProxy.h:
2143         * UIProcess/ios/WKContentViewInteraction.mm:
2144         (toWebDocumentRequestOptions):
2145         (toWebRequest):
2146         (-[WKContentView adjustSelectionWithDelta:completionHandler:]):
2147         (-[WKContentView requestDocumentContext:completionHandler:]):
2148         (-[WKContentView selectPositionAtPoint:withContextRequest:completionHandler:]):
2149         * UIProcess/ios/WebPageProxyIOS.mm:
2150         (WebKit::WebPageProxy::adjustSelectionWithDelta):
2151         (WebKit::WebPageProxy::requestDocumentEditingContext):
2152         * WebKit.xcodeproj/project.pbxproj:
2153         * WebProcess/WebPage/WebPage.h:
2154         * WebProcess/WebPage/WebPage.messages.in:
2155         Plumb DocumentEditingContext(Request) around.
2156
2157         * WebProcess/WebPage/ios/WebPageIOS.mm:
2158         (WebKit::WebPage::adjustSelectionWithDelta):
2159         Adjust the current selection given deltas to apply to the location and length.
2160
2161         (WebKit::visiblePositionAdjacentToVisiblePosition):
2162         (WebKit::visiblePositionForPointInRootViewCoordinates):
2163         (WebKit::WebPage::requestDocumentEditingContext):
2164         Retrieve the relevant part of the selection, as well as the context,
2165         given either the selection, or a rect.
2166         If we're collecting context for a rect, we split the context between
2167         before and after (except for the part that intersects the selection).
2168         The three strings will always be directly adjacent, and any of the three
2169         can sometimes be null.
2170
2171 2019-03-21  James Magahern  <jmagahern@apple.com>
2172
2173         Long press gesture recognizers in WKWebView are conflicting with internal scroll view long press gesture recognizers
2174         https://bugs.webkit.org/show_bug.cgi?id=195726
2175         rdar://problem/48582449
2176
2177         Reviewed by Megan Gardner.
2178
2179         We just need to add another clause to WKContentViewInteraction's
2180         canPreventGestureRecognizer whitelist. 
2181
2182         * UIProcess/ios/WKContentViewInteraction.mm:
2183         (-[WKContentView gestureRecognizer:canPreventGestureRecognizer:]):
2184
2185 2019-03-21  Simon Fraser  <simon.fraser@apple.com>
2186
2187         [iOS WK2] Turn on async overflow scrolling by default
2188         https://bugs.webkit.org/show_bug.cgi?id=196011
2189         rdar://problem/48453859
2190
2191         Reviewed by Antti Koivisto.
2192
2193         * Shared/WebPreferences.yaml:
2194         * Shared/WebPreferencesDefaultValues.h:
2195
2196 2019-03-21  Alex Christensen  <achristensen@webkit.org>
2197
2198         Remove last use of LegacySync IPC messages
2199         https://bugs.webkit.org/show_bug.cgi?id=196113
2200
2201         Reviewed by Chris Dumez.
2202
2203         Also rename "Delayed" to "Synchronous" now that there's only one type of synchronous message.
2204
2205         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2206         * NetworkProcess/NetworkProcess.messages.in:
2207         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
2208         (WebKit::WebSWServerConnection::syncTerminateWorkerFromClient):
2209         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
2210         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
2211         * Platform/IPC/Connection.cpp:
2212         (IPC::Connection::dispatchMessage):
2213         * Platform/IPC/HandleMessage.h:
2214         (IPC::handleMessageSynchronous):
2215         (IPC::handleMessageSynchronousWantsConnection):
2216         (IPC::handleMessageLegacySync): Deleted.
2217         (IPC::handleMessageDelayed): Deleted.
2218         (IPC::handleMessageDelayedWantsConnection): Deleted.
2219         * PluginProcess/PluginControllerProxy.messages.in:
2220         * PluginProcess/WebProcessConnection.messages.in:
2221         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
2222         (WebKit::WebPage::didReceiveSyncWebPageMessage):
2223         * Scripts/webkit/MessageReceiver-expected.cpp:
2224         (WebKit::WebPage::didReceiveSyncMessage):
2225         * Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
2226         (Messages::WebPage::TestSyncMessage::send):
2227         (Messages::WebPage::TestSynchronousMessage::send):
2228         (WebKit::WebPage::didReceiveSyncMessage):
2229         (Messages::WebPage::TestDelayedMessage::send): Deleted.
2230         * Scripts/webkit/MessagesSuperclass-expected.h:
2231         (Messages::WebPage::TestSynchronousMessage::name):
2232         (Messages::WebPage::TestSynchronousMessage::TestSynchronousMessage):
2233         (Messages::WebPage::TestDelayedMessage::receiverName): Deleted.
2234         (Messages::WebPage::TestDelayedMessage::name): Deleted.
2235         (Messages::WebPage::TestDelayedMessage::TestDelayedMessage): Deleted.
2236         (Messages::WebPage::TestDelayedMessage::arguments const): Deleted.
2237         * Scripts/webkit/messages.py:
2238         * Scripts/webkit/messages_unittest.py:
2239         * Scripts/webkit/test-legacy-messages.in:
2240         * Scripts/webkit/test-messages.in:
2241         * Scripts/webkit/test-superclass-messages.in:
2242         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
2243         * Shared/Plugins/NPObjectMessageReceiver.messages.in:
2244         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
2245         * UIProcess/Plugins/PluginProcessProxy.messages.in:
2246         * UIProcess/WebFullScreenManagerProxy.messages.in:
2247         * UIProcess/WebPageProxy.messages.in:
2248         * UIProcess/WebPasteboardProxy.messages.in:
2249         * UIProcess/WebProcessPool.messages.in:
2250         * UIProcess/WebProcessProxy.messages.in:
2251         * UIProcess/WebStorage/StorageManager.messages.in:
2252         * UIProcess/mac/SecItemShimProxy.messages.in:
2253         * WebProcess/Plugins/PluginProcessConnection.messages.in:
2254         * WebProcess/Plugins/PluginProxy.messages.in:
2255         * WebProcess/Storage/WebSWClientConnection.cpp:
2256         (WebKit::WebSWClientConnection::syncTerminateWorker):
2257         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2258         * WebProcess/WebPage/WebPage.messages.in:
2259         * WebProcess/WebProcess.messages.in:
2260
2261 2019-03-21  Brian Burg  <bburg@apple.com>
2262
2263         Web Automation: support uploading non-local file paths
2264         https://bugs.webkit.org/show_bug.cgi?id=196081
2265         <rdar://problem/45819897>
2266
2267         Reviewed by Devin Rousso and Joseph Pecoraro.
2268
2269         To support cases where supplied file paths do not exist on the session host, add support for
2270         receiving file contents via Automation.setFilesToSelectForFileUpload.
2271
2272         * UIProcess/Automation/Automation.json: Add new parameter.
2273
2274         * UIProcess/Automation/WebAutomationSession.h:
2275         * UIProcess/Automation/WebAutomationSession.cpp:
2276         (WebKit::WebAutomationSession::setFilesToSelectForFileUpload):
2277         Add support for receiving and saving file contents to a temporary directory. Rewrite the used paths so
2278         that WebCore knows to look at the revised paths where the file contents have been saved.
2279
2280         (WebKit::WebAutomationSession::platformGenerateLocalFilePathForRemoteFile):
2281         Since WebKit does not have usable FileSystem implementations for all ports, shell out the actual
2282         saving of base64-encoded file data. Provide a Cocoa implementation, since that's what I can test.
2283
2284         * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
2285         (WebKit::WebAutomationSession::platformGenerateLocalFilePathForRemoteFile):
2286         Use WTF::FileSystem to create a temporary directory, and use Cocoa methods to actually write the file.
2287
2288 2019-03-21  Youenn Fablet  <youenn@apple.com>
2289
2290         Cache API and IDB space usages should be initialized on first quota check
2291         https://bugs.webkit.org/show_bug.cgi?id=195707
2292
2293         Reviewed by Chris Dumez.
2294
2295         When the quota manager is created, make sure it delays quota check decisions until IDB and Cache API quota users are initialized.
2296         For IDB, the creation is synchronous but it may not be synchronous for Cache API.
2297         For that purpose, add a temporary quota user that will stay uninitialized until these two quota users are added.
2298         Once added, the temporary quota user is removed.
2299         The addition of the real users is made asynchronously as this is triggered by the creation of one of the two quota users.
2300
2301         In the case of a Cache API caches being cleared, make sure to reset the size to zero and to redo the quota user initialization dance.
2302
2303         * NetworkProcess/NetworkProcess.cpp:
2304         (WebKit::QuotaUserInitializer::initialize):
2305         (WebKit::QuotaUserInitializer::~QuotaUserInitializer):
2306         (WebKit::QuotaUserInitializer::QuotaUserInitializer):
2307         (WebKit::NetworkProcess::storageQuotaManager):
2308         * NetworkProcess/cache/CacheStorageEngine.cpp:
2309         (WebKit::CacheStorage::Engine::initializeQuotaUser):
2310         * NetworkProcess/cache/CacheStorageEngine.h:
2311         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2312         (WebKit::CacheStorage::Caches::clear):
2313
2314 2019-03-21  Per Arne Vollan  <pvollan@apple.com>
2315
2316         [iOS][macOS] Fix sandbox call violations
2317         https://bugs.webkit.org/show_bug.cgi?id=195809
2318         <rdar://problem/48829655>
2319
2320         Reviewed by Brent Fulgham.
2321
2322         An additional syscall needs to be added to the sandbox allow list.
2323
2324         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2325         * WebProcess/com.apple.WebProcess.sb.in:
2326
2327 2019-03-21  Eric Carlson  <eric.carlson@apple.com>
2328
2329         Add UI process WebRTC runtime logging.
2330         https://bugs.webkit.org/show_bug.cgi?id=196020
2331         <rdar://problem/49071443>
2332
2333         Reviewed by Youenn Fablet.
2334
2335         * Platform/Logging.cpp:
2336         (WebKit::getLogChannel): New.
2337         * Platform/Logging.h:
2338         * Shared/WebCoreArgumentCoders.h: Add coders for WTFLogChannelState and WTFLogLevel.
2339
2340         Add runtime logging.
2341         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2342         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy):
2343         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture):
2344         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
2345         (WebKit::UserMediaPermissionRequestManagerProxy::clearCachedState):
2346         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
2347         (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest):
2348         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
2349         (WebKit::UserMediaPermissionRequestManagerProxy::resetAccess):
2350         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess):
2351         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2352         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
2353         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionInvalidRequest):
2354         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest):
2355         (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
2356         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
2357         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged):
2358         (WebKit::UserMediaPermissionRequestManagerProxy::watchdogTimerFired):
2359         (WebKit::UserMediaPermissionRequestManagerProxy::logChannel const):
2360         (WebKit::convertEnumerationToString):
2361
2362         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2363         (WTF::LogArgument<WebKit::UserMediaPermissionRequestManagerProxy::RequestAction>::toString):
2364         * UIProcess/UserMediaPermissionRequestProxy.cpp:
2365         (WebKit::convertEnumerationToString): Add an enum specialization for logging.
2366
2367         * UIProcess/UserMediaPermissionRequestProxy.h:
2368         (WTF::LogArgument<WebKit::UserMediaPermissionRequestProxy::UserMediaAccessDenialReason>::toString): Ditto.
2369
2370         * UIProcess/WebPageProxy.cpp:
2371         (WebKit::WebPageProxy::logger):
2372         (WebKit::WebPageProxy::configureLoggingChannel):
2373         * UIProcess/WebPageProxy.h:
2374         * UIProcess/WebPageProxy.messages.in:
2375
2376         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2377         (WebKit::WebChromeClient::configureLoggingChannel):
2378         * WebProcess/WebCoreSupport/WebChromeClient.h:
2379         * WebProcess/WebPage/WebPage.cpp:
2380         (WebKit::WebPage::configureLoggingChannel):
2381         * WebProcess/WebPage/WebPage.h:
2382
2383 2019-03-21  Alex Christensen  <achristensen@webkit.org>
2384
2385         Stop using LegacySync messages in WebPageProxy
2386         https://bugs.webkit.org/show_bug.cgi?id=196056
2387
2388         Reviewed by Chris Dumez.
2389
2390         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2391         (WebKit::WebPageProxy::loadRecentSearches):
2392         * UIProcess/ProvisionalPageProxy.cpp:
2393         (WebKit::ProvisionalPageProxy::backForwardGoToItem):
2394         (WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
2395         * UIProcess/ProvisionalPageProxy.h:
2396         * UIProcess/WebPageProxy.cpp:
2397         (WebKit::WebPageProxy::handleSynchronousMessage):
2398         (WebKit::WebPageProxy::hasInsecureContent):
2399         (WebKit::WebPageProxy::accessibilityScreenToRootView):
2400         (WebKit::WebPageProxy::rootViewToAccessibilityScreen):
2401         (WebKit::WebPageProxy::printFrame):
2402         (WebKit::WebPageProxy::backForwardGoToItem):
2403         (WebKit::WebPageProxy::backForwardGoToItemShared):
2404         (WebKit::WebPageProxy::backForwardItemAtIndex):
2405         (WebKit::WebPageProxy::backForwardBackListCount):
2406         (WebKit::WebPageProxy::backForwardForwardListCount):
2407         (WebKit::WebPageProxy::canUndoRedo):
2408         (WebKit::WebPageProxy::executeUndoRedo):
2409         (WebKit::WebPageProxy::checkTextOfParagraph):
2410         (WebKit::WebPageProxy::checkSpellingOfString):
2411         (WebKit::WebPageProxy::checkGrammarOfString):
2412         (WebKit::WebPageProxy::spellingUIIsShowing):
2413         (WebKit::WebPageProxy::getGuessesForWord):
2414         (WebKit::WebPageProxy::substitutionsPanelIsShowing):
2415         (WebKit::WebPageProxy::showCorrectionPanel):
2416         (WebKit::WebPageProxy::dismissCorrectionPanel):
2417         (WebKit::WebPageProxy::dismissCorrectionPanelSoon):
2418         (WebKit::WebPageProxy::recordAutocorrectionResponse):
2419         (WebKit::WebPageProxy::dictationAlternatives):
2420         (WebKit::WebPageProxy::wrapCryptoKey):
2421         (WebKit::WebPageProxy::unwrapCryptoKey):
2422         (WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
2423         (WebKit::WebPageProxy::serializedAttachmentDataForIdentifiers):
2424         (WebKit::WebPageProxy::speechSynthesisVoiceList):
2425         (WebKit::WebPageProxy::printMainFrame): Deleted.
2426         * UIProcess/WebPageProxy.h:
2427         * UIProcess/WebPageProxy.messages.in:
2428         * UIProcess/gtk/WebPageProxyGtk.cpp:
2429         (WebKit::WebPageProxy::createPluginContainer):
2430         * UIProcess/ios/WebPageProxyIOS.mm:
2431         (WebKit::WebPageProxy::interpretKeyEvent):
2432         * UIProcess/mac/WebPageProxyMac.mm:
2433         (WebKit::WebPageProxy::getIsSpeaking):
2434         (WebKit::WebPageProxy::executeSavedCommandBySelector):
2435         (WebKit::WebPageProxy::showPDFContextMenu):
2436
2437 2019-03-21  Alex Christensen  <achristensen@webkit.org>
2438
2439         Stop using LegacySync messages in WebPage
2440         https://bugs.webkit.org/show_bug.cgi?id=196057
2441
2442         Reviewed by Chris Dumez.
2443
2444         * WebProcess/WebPage/WebPage.h:
2445         (WebKit::WebPage::markLayersVolatile):
2446         * WebProcess/WebPage/WebPage.messages.in:
2447         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2448         (WebKit::WebPage::getCenterForZoomGesture):
2449         * WebProcess/WebPage/ios/WebPageIOS.mm:
2450         (WebKit::WebPage::readSelectionFromPasteboard):
2451         (WebKit::WebPage::getStringSelectionForPasteboard):
2452         (WebKit::WebPage::getDataSelectionForPasteboard):
2453         (WebKit::WebPage::shouldDelayWindowOrderingEvent):
2454         (WebKit::WebPage::acceptsFirstMouse):
2455         * WebProcess/WebPage/mac/WebPageMac.mm:
2456         (WebKit::WebPage::replaceSelectionWithPasteboardData):
2457         (WebKit::WebPage::readSelectionFromPasteboard):
2458         (WebKit::WebPage::getStringSelectionForPasteboard):
2459         (WebKit::WebPage::getDataSelectionForPasteboard):
2460         (WebKit::WebPage::shouldDelayWindowOrderingEvent):
2461         (WebKit::WebPage::acceptsFirstMouse):
2462
2463 2019-03-21  Alex Christensen  <achristensen@webkit.org>
2464
2465         Stop using LegacySync messages in WebPasteboardProxy
2466         https://bugs.webkit.org/show_bug.cgi?id=196060
2467
2468         Reviewed by Chris Dumez.
2469
2470         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
2471         (WebKit::WebPasteboardProxy::getPasteboardTypes):
2472         (WebKit::WebPasteboardProxy::getPasteboardPathnamesForType):
2473         (WebKit::WebPasteboardProxy::getPasteboardStringForType):
2474         (WebKit::WebPasteboardProxy::getPasteboardStringsForType):
2475         (WebKit::WebPasteboardProxy::getPasteboardBufferForType):
2476         (WebKit::WebPasteboardProxy::pasteboardCopy):
2477         (WebKit::WebPasteboardProxy::getPasteboardChangeCount):
2478         (WebKit::WebPasteboardProxy::getPasteboardUniqueName):
2479         (WebKit::WebPasteboardProxy::getPasteboardColor):
2480         (WebKit::WebPasteboardProxy::getPasteboardURL):
2481         (WebKit::WebPasteboardProxy::addPasteboardTypes):
2482         (WebKit::WebPasteboardProxy::setPasteboardTypes):
2483         (WebKit::WebPasteboardProxy::setPasteboardURL):
2484         (WebKit::WebPasteboardProxy::setPasteboardColor):
2485         (WebKit::WebPasteboardProxy::setPasteboardStringForType):
2486         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
2487         (WebKit::WebPasteboardProxy::getNumberOfFiles):
2488         (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
2489         (WebKit::WebPasteboardProxy::writeCustomData):
2490         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
2491         (WebKit::WebPasteboardProxy::readURLFromPasteboard):
2492         (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
2493         (WebKit::WebPasteboardProxy::getPasteboardItemsCount):
2494         (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
2495         (WebKit::WebPasteboardProxy::informationForItemAtIndex):
2496         * UIProcess/WebPasteboardProxy.cpp:
2497         (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
2498         (WebKit::WebPasteboardProxy::writeCustomData):
2499         * UIProcess/WebPasteboardProxy.h:
2500         * UIProcess/WebPasteboardProxy.messages.in:
2501         * UIProcess/gtk/WebPasteboardProxyGtk.cpp:
2502         (WebKit::WebPasteboardProxy::writeToClipboard):
2503         (WebKit::WebPasteboardProxy::readFromClipboard):
2504         * UIProcess/wpe/WebPasteboardProxyWPE.cpp:
2505         (WebKit::WebPasteboardProxy::getPasteboardTypes):
2506         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
2507         (WebKit::WebPasteboardProxy::writeWebContentToPasteboard):
2508         (WebKit::WebPasteboardProxy::writeStringToPasteboard):
2509
2510 2019-03-21  Andy Estes  <aestes@apple.com>
2511
2512         [iOS] Apple Pay should be available in documents with no user agent scripts
2513         https://bugs.webkit.org/show_bug.cgi?id=196061
2514         <rdar://problem/48649391>
2515
2516         Reviewed by Brady Eidson.
2517
2518         * Shared/AuxiliaryProcess.h:
2519         * Shared/Cocoa/AuxiliaryProcessCocoa.mm:
2520         (WebKit::AuxiliaryProcess::parentProcessHasEntitlement):
2521
2522         Added a convenience function for checking parent process entitlements.
2523
2524         * Shared/WebPreferences.yaml:
2525         * Shared/WebPreferencesDefaultValues.h:
2526         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2527         (-[WKWebViewConfiguration init]):
2528
2529         Enabled Apple Pay by default on platforms that enable APPLE_PAY_REMOTE_UI.
2530
2531         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
2532         (WebKit::WebPaymentCoordinator::supportsUnrestrictedApplePay const):
2533         * WebProcess/ApplePay/WebPaymentCoordinator.h:
2534
2535         Implemented supportsUnrestrictedApplePay by checking for the
2536         com.apple.private.WebKit.UnrestrictedApplePay entitlement on platforms that enable
2537         APPLE_PAY_REMOTE_UI.
2538
2539         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
2540         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2541         (didClearWindowObjectForFrame):
2542         (setUpPageLoaderClient):
2543
2544         Added injected bundle SPI that TestWebKitAPI uses to inject the WebCore Internals interface.
2545
2546         * WebProcess/WebPage/WebPage.cpp:
2547         (WebKit::WebPage::runJavaScript):
2548
2549         Changed to call ScriptController::executeUserAgentScriptInWorld.
2550
2551 2019-03-21  Chris Dumez  <cdumez@apple.com>
2552
2553         WebKit should throw when trying to create a WKWebView with a related view that is using a different data store
2554         https://bugs.webkit.org/show_bug.cgi?id=196041
2555         <rdar://problem/49083230>
2556
2557         Reviewed by Alex Christensen.
2558
2559         WebKit should throw when trying to create a WKWebView with a related view that is using a different data store.
2560         We do not support having several WebsiteDataStores sharing the same WebProcess.
2561
2562         * UIProcess/API/Cocoa/WKWebView.mm:
2563         (-[WKWebView _initializeWithConfiguration:]):
2564         * UIProcess/WebProcessPool.cpp:
2565         (WebKit::WebProcessPool::createWebPage):
2566
2567 2019-03-21  Alex Christensen  <achristensen@webkit.org>
2568
2569         Add SPI to inform applications of WKContentRuleList actions
2570         https://bugs.webkit.org/show_bug.cgi?id=195965
2571         <rdar://problem/42664365>
2572
2573         Reviewed by Geoff Garen.
2574
2575         * NetworkProcess/NetworkLoadChecker.cpp:
2576         (WebKit::NetworkLoadChecker::checkRequest):
2577         (WebKit::NetworkLoadChecker::processContentRuleListsForLoad):
2578         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad): Deleted.
2579         * NetworkProcess/NetworkLoadChecker.h:
2580         * UIProcess/API/APINavigationClient.h:
2581         (API::NavigationClient::contentRuleListNotification):
2582         * UIProcess/API/C/WKPage.cpp:
2583         (WKPageSetPageNavigationClient):
2584         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2585         * UIProcess/Cocoa/NavigationState.h:
2586         * UIProcess/Cocoa/NavigationState.mm:
2587         (WebKit::NavigationState::setNavigationDelegate):
2588         (WebKit::NavigationState::NavigationClient::contentRuleListNotification):
2589         * UIProcess/WebPageProxy.cpp:
2590         (WebKit::WebPageProxy::contentRuleListNotification):
2591         * UIProcess/WebPageProxy.h:
2592         * UIProcess/WebPageProxy.messages.in:
2593         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2594         (WebKit::WebChromeClient::contentRuleListNotification):
2595         * WebProcess/WebCoreSupport/WebChromeClient.h:
2596
2597 2019-03-21  Simon Fraser  <simon.fraser@apple.com>
2598
2599         Add an internal feature flag to disable the -webkit-overflow-scrolling CSS property
2600         https://bugs.webkit.org/show_bug.cgi?id=196058
2601         rdar://problem/49078202
2602
2603         Reviewed by Antti Koivisto.
2604
2605         Add an internal feature flag called "LegacyOverflowScrollingTouchEnabled", initially
2606         on by default.
2607
2608         * Shared/WebPreferences.yaml:
2609
2610 2019-03-21  Antti Koivisto  <antti@apple.com>
2611
2612         UI-process hit-testing needs to know about containing block relationships
2613         https://bugs.webkit.org/show_bug.cgi?id=195845
2614         <rdar://problem/48949633>
2615
2616         Reviewed by Simon Fraser.
2617
2618         Test: fast/scrolling/ios/overflow-scroll-overlap-5.html
2619
2620         When an overflow scroller contains a positioned element the element may not be on a descendant layer of the scroller,
2621         yet should move along with it. This needs to be taken into account in UI-side hit testing.
2622
2623         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
2624         (WebKit::RemoteLayerTreeNode::nonAncestorScrollContainerIDs const):
2625         (WebKit::RemoteLayerTreeNode::addNonAncestorScrollContainerID):
2626         (WebKit::RemoteLayerTreeNode::clearNonAncestorScrollContainerIDs):
2627
2628         Maintain non-ancestor scrolling relationships for layers.
2629
2630         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2631         (WebKit::RemoteScrollingCoordinatorProxy::commitScrollingTreeState):
2632         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
2633         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
2634         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
2635         (WebKit::isScrolledBy):
2636
2637         Helper to figure out who scrolls who.
2638
2639         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
2640         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2641         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
2642
2643         After commit, pull the non-ancestor scrolling relationships from the scrolling tree and update the layer tree.
2644
2645 2019-03-21  Daniel Bates  <dabates@apple.com>
2646
2647         [iOS] Inline -_ensureFormAccessoryView into -formAccessoryView and have -_updateAccessory ensure we have a form accessory
2648         https://bugs.webkit.org/show_bug.cgi?id=196021
2649
2650         Reviewed by Wenson Hsieh.
2651
2652         Every caller of -_ensureFormAccessoryView, except -formAccessoryView, immediately follows the call
2653         with a call to -_updateAccessory. Let's just have -_updateAccessory ensure we have a form accessory
2654         view and inline the implementation of -_ensureFormAccessoryView into -formAccessoryView so we can
2655         remove one method.
2656
2657         * UIProcess/ios/WKContentViewInteraction.mm:
2658         (-[WKContentView inputView]): Remove call to -_ensureFormAccessoryView, -_updateAccessory will do
2659         the equivalent work for us.
2660         (-[WKContentView formAccessoryView]): Moved implementation of -_ensureFormAccessoryView into here.
2661         (-[WKContentView _updateAccessory]): Call self.formAccessoryView to ensure we have a form accessory view.
2662         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2663         Remove call to -_ensureFormAccessoryView, -_updateAccessory will do
2664         the equivalent work for us.
2665         (-[WKContentView _ensureFormAccessoryView]): Deleted.
2666
2667 2019-03-21  Shawn Roberts  <sroberts@apple.com>
2668
2669         Unreviewed, rolling out r243250.
2670
2671         Causing 109 Failures and 2 crashes on iOS Sim Debug
2672         OpenSource/Internal queues
2673
2674         Reverted changeset:
2675
2676         "[iOS WK2] Turn on async overflow scrolling by default"
2677         https://bugs.webkit.org/show_bug.cgi?id=196011
2678         https://trac.webkit.org/changeset/243250
2679
2680 2019-03-21  Brent Fulgham  <bfulgham@apple.com>
2681
2682         Fix possible memory leak when dismissing a color picker
2683         https://bugs.webkit.org/show_bug.cgi?id=196026
2684         <rdar://problem/48778568>
2685
2686         Reviewed by Wenson Hsieh.
2687
2688         Fix a problem with WebPageProxy::endColorPicker where an early return could leave a color picker
2689         with a +1 reference count after dismissing it.
2690
2691         * UIProcess/WebColorPicker.cpp:
2692         (WebKit::WebColorPicker::endPicker):
2693         * UIProcess/WebPageProxy.cpp:
2694         (WebKit::WebPageProxy::endColorPicker):
2695         (WebKit::WebPageProxy::didEndColorPicker):
2696
2697 2019-03-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2698
2699         [GTK][WPE] Add API to provide geolocation information
2700         https://bugs.webkit.org/show_bug.cgi?id=195940
2701
2702         Reviewed by Michael Catanzaro.
2703
2704         Add WebKitGeolocationManager public class to handle geolocation position updates. WebKitGeolocationProvider has
2705         been removed and the default implementation based on GeoClue is done by WebKitGeolocationManager.
2706
2707         * PlatformGTK.cmake:
2708         * PlatformWPE.cmake:
2709         * SourcesGTK.txt:
2710         * SourcesWPE.txt:
2711         * UIProcess/API/glib/WebKitGeolocationManager.cpp: Added.
2712         (_WebKitGeolocationPosition::_WebKitGeolocationPosition):
2713         (webkit_geolocation_position_new):
2714         (webkit_geolocation_position_copy):
2715         (webkit_geolocation_position_free):
2716         (webkit_geolocation_position_set_timestamp):
2717         (webkit_geolocation_position_set_altitude):
2718         (webkit_geolocation_position_set_altitude_accuracy):
2719         (webkit_geolocation_position_set_heading):
2720         (webkit_geolocation_position_set_speed):
2721         (webkitGeolocationManagerStop):
2722         (webkitGeolocationManagerSetEnableHighAccuracy):
2723         (webkitGeolocationManagerCreate):
2724         (webkitGeolocationManagerGetProperty):
2725         (webkit_geolocation_manager_class_init):
2726         (webkit_gelocation_manager_update_position):
2727         (webkit_gelocation_manager_failed):
2728         (webkit_geolocation_manager_get_enable_high_accuracy):
2729         * UIProcess/API/glib/WebKitGeolocationManagerPrivate.h: Copied from Source/WebCore/platform/geoclue/GeolocationProviderGeoclueClient.h.
2730         * UIProcess/API/glib/WebKitGeolocationProvider.cpp: Removed.
2731         * UIProcess/API/glib/WebKitGeolocationProvider.h: Removed.
2732         * UIProcess/API/glib/WebKitWebContext.cpp:
2733         (webkitWebContextConstructed): Create a WebKitGeolocationManager instead of a WebKitGeolocationProvider.
2734         (webkit_web_context_get_geolocation_manager): Get the WebKitGeolocationManager.
2735         * UIProcess/API/gtk/WebKitGeolocationManager.h: Added.
2736         * UIProcess/API/gtk/WebKitWebContext.h:
2737         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
2738         * UIProcess/API/gtk/docs/webkit2gtk-4.0.types:
2739         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
2740         * UIProcess/API/gtk/webkit2.h:
2741         * UIProcess/API/wpe/WebKitGeolocationManager.h: Added.
2742         * UIProcess/API/wpe/WebKitWebContext.h:
2743         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
2744         * UIProcess/API/wpe/docs/wpe-docs.sgml:
2745         * UIProcess/API/wpe/webkit.h:
2746
2747 2019-03-20  Youenn Fablet  <youenn@apple.com>
2748
2749         Compute quota after network process restart based on default quota and space used
2750         https://bugs.webkit.org/show_bug.cgi?id=195804
2751
2752         Reviewed by Chris Dumez.
2753
2754         Make sure that Cache Storage quota user waits to declare as initialized to its manager
2755         until all data is loaded so that it can report a valid space used from the start.
2756
2757         Add test API to reset the quota to its default value and compute it according current space use.
2758
2759         * NetworkProcess/NetworkProcess.cpp:
2760         (WebKit::NetworkProcess::updateQuotaBasedOnSpaceUsageForTesting):
2761         * NetworkProcess/NetworkProcess.h:
2762         * NetworkProcess/NetworkProcess.messages.in:
2763         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2764         (WebKit::CacheStorage::Caches::create):
2765         (WebKit::CacheStorage::Caches::Caches):
2766         (WebKit::CacheStorage::Caches::whenInitialized):
2767         * NetworkProcess/cache/CacheStorageEngineCaches.h:
2768         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
2769         (WebKit::CacheStorageEngineConnection::dereference):
2770         * WebProcess/Cache/WebCacheStorageConnection.cpp:
2771         (WebKit::WebCacheStorageConnection::setQuotaBasedOnSpaceUsage):
2772         * WebProcess/Cache/WebCacheStorageConnection.h:
2773
2774 2019-03-20  Simon Fraser  <simon.fraser@apple.com>
2775
2776         Rename ENABLE_ACCELERATED_OVERFLOW_SCROLLING macro to ENABLE_OVERFLOW_SCROLLING_TOUCH
2777         https://bugs.webkit.org/show_bug.cgi?id=196049
2778
2779         Reviewed by Tim Horton.
2780
2781         This macro is about the -webkit-overflow-scrolling CSS property, not accelerated
2782         overflow scrolling in general, so rename it.
2783
2784         * Configurations/FeatureDefines.xcconfig:
2785
2786 2019-03-20  Jiewen Tan  <jiewen_tan@apple.com>
2787
2788         Extend Networking Process sandbox for some system frameworks
2789         https://bugs.webkit.org/show_bug.cgi?id=196036
2790         <rdar://problem/47594150>
2791
2792         Reviewed by Brent Fulgham.
2793
2794         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2795         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2796
2797 2019-03-20  Alex Christensen  <achristensen@webkit.org>
2798
2799         Reduce use of LegacySync IPC message type
2800         https://bugs.webkit.org/show_bug.cgi?id=194835
2801
2802         Reviewed by Darin Adler.
2803
2804         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2805         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
2806         (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
2807         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
2808         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
2809         (WebKit::NetworkConnectionToWebProcess::blobSize):
2810         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
2811         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
2812         * NetworkProcess/NetworkConnectionToWebProcess.h:
2813         (WebKit::NetworkConnectionToWebProcess::getNetworkLoadInformationRequest):
2814         (WebKit::NetworkConnectionToWebProcess::getNetworkLoadInformationResponse):
2815         (WebKit::NetworkConnectionToWebProcess::getNetworkLoadIntermediateInformation):
2816         (WebKit::NetworkConnectionToWebProcess::takeNetworkLoadInformationMetrics):
2817         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2818         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2819         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
2820         (WebKit::UserMediaCaptureManagerProxy::capabilities):
2821         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
2822         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
2823         * UIProcess/Plugins/PluginProcessProxy.h:
2824         * UIProcess/Plugins/PluginProcessProxy.messages.in:
2825         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
2826         (WebKit::PluginProcessProxy::launchProcess):
2827         (WebKit::PluginProcessProxy::launchApplicationAtURL):
2828         (WebKit::PluginProcessProxy::openURL):
2829         (WebKit::PluginProcessProxy::openFile):
2830         * UIProcess/WebFullScreenManagerProxy.cpp:
2831         (WebKit::WebFullScreenManagerProxy::supportsFullScreen):
2832         * UIProcess/WebFullScreenManagerProxy.h:
2833         * UIProcess/WebFullScreenManagerProxy.messages.in:
2834         * WebProcess/WebProcess.cpp:
2835         (WebKit::WebProcess::fetchWebsiteData):
2836         (WebKit::WebProcess::deleteWebsiteData):
2837         (WebKit::WebProcess::deleteWebsiteDataForOrigins):
2838         (WebKit::WebProcess::processWillSuspendImminently):
2839         * WebProcess/WebProcess.h:
2840         * WebProcess/WebProcess.messages.in:
2841
2842 2019-03-20  Keith Rollin  <krollin@apple.com>
2843
2844         Update checks that determine if WebKit is system WebKit
2845         https://bugs.webkit.org/show_bug.cgi?id=195756
2846
2847         Unreviewed tweak of r243251 after unreviewed build fix after r243230.
2848
2849         * Shared/mac/AuxiliaryProcessMac.mm:
2850         (WebKit::AuxiliaryProcess::isSystemWebKit):
2851
2852 2019-03-20  Keith Rollin  <krollin@apple.com>
2853
2854         Update checks that determine if WebKit is system WebKit
2855         https://bugs.webkit.org/show_bug.cgi?id=195756
2856
2857         Unreviewed build fix after r243230.
2858
2859         * Shared/mac/AuxiliaryProcessMac.mm:
2860         (WebKit::AuxiliaryProcess::isSystemWebKit):
2861
2862 2019-03-20  Simon Fraser  <simon.fraser@apple.com>
2863
2864         [iOS WK2] Turn on async overflow scrolling by default
2865         https://bugs.webkit.org/show_bug.cgi?id=196011
2866         rdar://problem/48453859
2867
2868         Reviewed by Antti Koivisto.
2869
2870         Turn async overflow scroll on by default for iOS WK2.
2871
2872         * Shared/WebPreferences.yaml:
2873         * Shared/WebPreferencesDefaultValues.h:
2874
2875 2019-03-20  Youenn Fablet  <youenn@apple.com>
2876
2877         Have smaller default quotas for third party frames
2878         https://bugs.webkit.org/show_bug.cgi?id=195841
2879
2880         Reviewed by Geoffrey Garen.
2881
2882         * NetworkProcess/NetworkProcess.cpp:
2883         (WebKit::NetworkProcess::storageQuotaManager):
2884         For third party iframes, use the default quota divided by 10.
2885
2886 2019-03-20  Dean Jackson  <dino@apple.com>
2887
2888         [iOS] Enable fast clicking everywhere
2889         https://bugs.webkit.org/show_bug.cgi?id=196023
2890         <rdar://problem/49073589>
2891
2892         Reviewed by Wenson Hsieh.
2893
2894         Set FastClicksEverywhere to on by default for iPhone & iPad.
2895
2896         * Shared/WebPreferences.yaml:
2897         * Shared/WebPreferencesDefaultValues.h:
2898
2899 2019-03-20  Chris Dumez  <cdumez@apple.com>
2900
2901         Regression(PSON): ViewGestureController is not properly notified of process swaps on iOS
2902         https://bugs.webkit.org/show_bug.cgi?id=196029
2903         <rdar://problem/48954651>
2904
2905         Reviewed by Tim Horton.
2906
2907         If there is a ViewGestureController when process swapping, make sure we disconnect it
2908         from the old process and reconnect it to the new one. This matches what is done in
2909         WebViewImpl for macOS (see r238356).
2910
2911         * UIProcess/API/Cocoa/WKWebView.mm:
2912         (-[WKWebView _processWillSwap]):
2913         (-[WKWebView _processDidExit]):
2914         (-[WKWebView _didRelaunchProcess]):
2915
2916 2019-03-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2917
2918         [GTK] REGRESSION(r243094): crash when launching minibrowser
2919         https://bugs.webkit.org/show_bug.cgi?id=195951
2920
2921         Reviewed by Joseph Pecoraro.
2922
2923         Always return the inspector from WebPageProxy::inspector() when the page hasn't been closed. The inspector is
2924         created in WebPageProxy constructor and it's safe to use even before a process has been launched, because
2925         m_inspectedPage is null-checked everywhere.
2926
2927         * UIProcess/WebPageProxy.cpp:
2928         (WebKit::WebPageProxy::inspector const):
2929
2930 2019-03-20  Keith Rollin  <krollin@apple.com>
2931
2932         Update checks that determine if WebKit is system WebKit
2933         https://bugs.webkit.org/show_bug.cgi?id=195756
2934
2935         Reviewed by Alexey Proskuryakov.
2936
2937         The system WebKit can be installed in additional locations, so check
2938         for and allow those, too.
2939
2940         * Shared/mac/AuxiliaryProcessMac.mm:
2941         (WebKit::AuxiliaryProcess::isSystemWebKit):
2942
2943 2019-03-20  Per Arne Vollan  <pvollan@apple.com>
2944
2945         [iOS] Unable to PiP web videos in Safari due to sandbox violation
2946         https://bugs.webkit.org/show_bug.cgi?id=196015
2947         <rdar://problem/48867037>
2948
2949         Reviewed by Brent Fulgham.
2950
2951         The sandbox should allow getting the iokit property 'ui-pip'.
2952
2953         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2954
2955 2019-03-20  John Wilander  <wilander@apple.com>
2956
2957         (Test fix) Override minimumTimeBetweenDataRecordsRemoval in ResourceLoadStatisticsStore::shouldRemoveDataRecord() during layout tests
2958         https://bugs.webkit.org/show_bug.cgi?id=196017
2959
2960         Unreviewed test fix.
2961
2962         This patch adds a check of parameters().isRunningTest to the return of
2963         ResourceLoadStatisticsStore::shouldRemoveDataRecord() to allow successive
2964         layout tests to remove website data, effectively overriding the
2965         minimumTimeBetweenDataRecordsRemoval setting.
2966
2967         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
2968         (WebKit::ResourceLoadStatisticsStore::shouldRemoveDataRecords const):
2969
2970 2019-03-20  Daniel Bates  <dabates@apple.com>
2971
2972         [iOS] Group UIWebFormAccessoryDelegate-related code and tighten it up a bit
2973         https://bugs.webkit.org/show_bug.cgi?id=196018
2974
2975         Reviewed by Wenson Hsieh.
2976
2977         * UIProcess/ios/WKContentViewInteraction.mm:
2978         (-[WKContentView accessoryClear]): Use uniform initializer syntax. Code could send the empty
2979         string, but I resisted since null string, as we do now, likely encodes more compactly and we
2980         avoid a per-process alloc.
2981         (-[WKContentView accessoryTab:]): Fix style nit; missing space between capture list and arguments
2982         in lambda. Also use lamdba capture initializer syntax and remove a local.
2983         (-[WKContentView _updateAccessory]): Remove a FIXME as it can't be satified with the current
2984         design without more bookkeeping. The design for showing and hiding an AutoFill button added in
2985         r166933 requires knowing the title for the button when showing it via -setAccessoryViewCustomButtonTitle.
2986         We could re-implement such that -setAccessoryViewCustomButtonTitle: stores the title and calls
2987         -_updateAccessory, but that has the disadvantage of increasing the memory footprint of WKContentView
2988         for the stored title and that seems worse than centralizing the logic in _updateAccessory. So,
2989         let's not fix this FIXME. Now that we are removing the FIXME, change to use an early return style.
2990         (-[WKContentView _hideKeyboard]): Micro optimization; only call _updateAccessory if we have
2991         a form accessory view. This method is called everytime we load a page (more precisely when we
2992         commit the load for a page) in addition to everytime we blur (defocus) an element. No need to
2993         update an accessory if we don't have one.
2994  
2995 2019-03-20  Olivier Robin  <olivierrobin@chromium.org>
2996
2997         Fix _getContentsAsAttributedStringWithCompletionHandler availability for iOS.
2998         https://bugs.webkit.org/show_bug.cgi?id=195999
2999
3000         Reviewed by Tim Horton.
3001
3002         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3003
3004 2019-03-20  Brent Fulgham  <bfulgham@apple.com>
3005
3006         Adopt RegistrableDomain in the Storage Access API prompt code paths
3007         https://bugs.webkit.org/show_bug.cgi?id=195957
3008         <rdar://problem/49048028>
3009
3010         Reviewed by Chris Dumez.
3011
3012         While making the code changes in Bug 195866 we noticed that strings were being
3013         used to pass the origins for the API calls. We should adopt the RegistrableDomain
3014         class to improve type safety and avoid introducing bugs in the future.
3015
3016         * UIProcess/API/APIUIClient.h:
3017         (API::UIClient::requestStorageAccessConfirm):
3018         * UIProcess/API/C/WKPage.cpp:
3019         (WKPageSetPageUIClient):
3020         * UIProcess/Cocoa/UIDelegate.h:
3021         * UIProcess/Cocoa/UIDelegate.mm:
3022         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
3023         * UIProcess/Cocoa/WKStorageAccessAlert.h:
3024         * UIProcess/Cocoa/WKStorageAccessAlert.mm:
3025         (WebKit::presentStorageAccessAlert):
3026         * UIProcess/WebPageProxy.cpp:
3027         (WebKit::WebPageProxy::requestStorageAccessConfirm):
3028
3029 2019-03-20  Chris Dumez  <cdumez@apple.com>
3030
3031         Unreviewed, fix typo in comment added in r243156.
3032
3033         * UIProcess/WebPageProxy.cpp:
3034         (WebKit::WebPageProxy::postMessageToInjectedBundle):
3035
3036 2019-03-20  Chris Dumez  <cdumez@apple.com>
3037
3038         Unreviewed, drop invalid assertions landed in r243163.
3039
3040         Those assertions were causing some API tests to crash.
3041         Also include some post-review suggestions from Darin.
3042
3043         * Shared/CallbackID.h:
3044         (WebKit::CallbackID::operator=):
3045         * Shared/OptionalCallbackID.h:
3046         (WebKit::OptionalCallbackID::operator=):
3047
3048 2019-03-20  Chris Dumez  <cdumez@apple.com>
3049
3050         Unreviewed, fix assertion failures in API tests after r243159.
3051
3052         * UIProcess/VisitedLinkStore.cpp:
3053         (WebKit::VisitedLinkStore::removeProcess):
3054
3055 2019-03-20  Tim Horton  <timothy_horton@apple.com>
3056
3057         Add an platform-driven spell-checking mechanism
3058         https://bugs.webkit.org/show_bug.cgi?id=195795
3059
3060         Reviewed by Ryosuke Niwa.
3061
3062         * DerivedSources-input.xcfilelist:
3063         * DerivedSources-output.xcfilelist:
3064         * DerivedSources.make:
3065         * SourcesCocoa.txt:
3066         * UIProcess/Cocoa/TextCheckingController.h: Added.
3067         * UIProcess/Cocoa/TextCheckingController.mm: Added.
3068         (WebKit::TextCheckingController::TextCheckingController):
3069         (WebKit::TextCheckingController::replaceRelativeToSelection):
3070         (WebKit::TextCheckingController::removeAnnotationRelativeToSelection):
3071         * UIProcess/ios/WKContentViewInteraction.h:
3072         * UIProcess/ios/WKContentViewInteraction.mm:
3073         (-[WKContentView setupInteraction]):
3074         (-[WKContentView replaceSelectionOffset:length:withAnnotatedString:relativeReplacementRange:]):
3075         (-[WKContentView removeAnnotation:forSelectionOffset:length:]):
3076         * WebKit.xcodeproj/project.pbxproj:
3077         * WebProcess/WebPage/WebPage.cpp:
3078         * WebProcess/WebPage/WebPage.h:
3079         (WebKit::WebPage::textCheckingController):
3080         Plumb two UITextInput methods through to the Web Content process.
3081         I added a new object instead of just sticking things on WebPage
3082         because there are quite a few more related ones coming down the pipeline,
3083         and will also end up being messages going in the opposite direction.
3084
3085         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h: Added.
3086         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.messages.in: Added.
3087         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm: Added.
3088         (WebKit::TextCheckingControllerProxy::TextCheckingControllerProxy):
3089         (WebKit::TextCheckingControllerProxy::~TextCheckingControllerProxy):
3090         (WebKit::relevantMarkerTypes):
3091         (WebKit::TextCheckingControllerProxy::rangeAndOffsetRelativeToSelection):
3092         (WebKit::TextCheckingControllerProxy::replaceRelativeToSelection):
3093         (WebKit::TextCheckingControllerProxy::removeAnnotationRelativeToSelection):
3094         Make it possible for the platform to maintain arbitrary key-value pairs
3095         attached to document ranges, as a way for it to keep track of various
3096         text checking context (e.g. if something has been checked, replaced,
3097         what language it might be, ...).
3098
3099         Allow it to replace the text of a range and the annotations in that range,
3100         or remove annotations in a range. Ranges are specified relative to
3101         the selection.
3102
3103         One large missing piece is giving the platform the ability to retrieve
3104         annotations in a range; that is coming in a future patch.
3105
3106         We translate certain annotations into traditional WebCore spelling
3107         and grammar document markers, for normal display-time treatment.
3108
3109         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
3110         (-[WKAccessibilityWebPageObject convertScreenPointToRootView:]):
3111         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
3112         Unified sources fixes.
3113
3114 2019-03-19  Jiewen Tan  <jiewen_tan@apple.com>
3115
3116         [WebAuthN] Implement FIDO AppID extension
3117         https://bugs.webkit.org/show_bug.cgi?id=143491
3118         <rdar://problem/48298273>
3119
3120         Reviewed by Brent Fulgham.
3121
3122         In U2fHidAuthenticator::continueSignCommandAfterResponseReceived, it will retry the current command
3123         with the AppID if it exists when SW_WRONG_DATA is received from devices. Noted, it will not set
3124         the AuthenticationExtensionsClientOutputs::appid to false in any circumstances. In other words, the
3125         field will be empty if AppID is supplied in AuthenticationExtensionsClientInputs and not used.
3126
3127         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
3128         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
3129         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
3130         * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp:
3131         (WebKit::U2fHidAuthenticator::issueSignCommand):
3132         (WebKit::U2fHidAuthenticator::continueSignCommandAfterResponseReceived):
3133         * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.h:
3134
3135 2019-03-19  Ross Kirsling  <ross.kirsling@sony.com>
3136
3137         Unreviewed adjustment to r242842 per Darin's request.
3138
3139         * Platform/win/LoggingWin.cpp:
3140         (WebKit::logLevelString):
3141
3142 2019-03-19  Gyuyoung Kim  <gyuyoung.kim@lge.com>
3143
3144         [WPE] Fix build warnings because of missing an argument when initializing wpe_input_axis_event
3145         https://bugs.webkit.org/show_bug.cgi?id=195931
3146
3147         Reviewed by Michael Catanzaro.
3148
3149         There are still build warnings when building wpe port. It looks like
3150         these build warnings have been caused by missing to set an argument
3151         for the modifier parameter of wpe_input_axis_event. This patch sets 0
3152         for the modifier argument to avoid the build warnings.
3153
3154         * UIProcess/API/wpe/ScrollGestureController.cpp:
3155         (WebKit::ScrollGestureController::handleEvent):
3156
3157 2019-03-19  John Wilander  <wilander@apple.com>
3158
3159         Resource Load Statistics (experimental): Clear non-cookie website data for sites that have been navigated to, with link decoration, by a prevalent resource
3160         https://bugs.webkit.org/show_bug.cgi?id=195923
3161         <rdar://problem/49001272>
3162
3163         Reviewed by Alex Christensen.
3164
3165         Cross-site trackers abuse link query parameters to transport user identifiers and then store
3166         them in first-party storage space. To address this, we've done three things:
3167         - r236448 capped all persistent client-side cookies to seven days of storage.
3168         - r242288 further capped persistent client-side cookies for navigations with link decoration from prevalent resources.
3169         - r242603 added logging of navigations with link decoration from prevalent resources.
3170
3171         This patch introduces an experimental feature that removes non-cookie website data for sites
3172         that have been navigated to, with link decoration, by a prevalent resource.
3173
3174         To achieve this, resource domains to remove website data for are now marked with an enum called
3175         WebsiteDataToRemove with values All, AllButHttpOnlyCookies, AllButCookies. As resources are
3176         iterated, they are marked for either of these values and the new function
3177         ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor() leads to the marking with
3178         WebsiteDataToRemove::AllButCookies.
3179
3180         Then NetworkProcess::deleteWebsiteDataForRegistrableDomains() looks at this setting and removes
3181         website data accordingly.
3182
3183         The thinking behind this is that the lifetime cap applied in r236448 and r242288 take care of
3184         script writable cookies, and this patch takes care of all other script writable storage.
3185
3186         The infrastructure to handle user interaction expiration is now parameterized so that multiple
3187         expiries can be applied. In this particular case, seven days of browser use.
3188
3189         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3190         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
3191         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
3192         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
3193         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllWebsiteDataFor const):
3194         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllButCookiesFor const):
3195         (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor):
3196         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
3197         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3198         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUserInteraction):
3199         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUnexpiredRecentUserInteraction const):
3200         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllWebsiteDataFor const):
3201         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor const):
3202         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor):
3203         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
3204         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
3205         (WebKit::domainsToString):
3206         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
3207         (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const):
3208         (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates):
3209         (WebKit::ResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
3210         (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const):
3211         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
3212         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3213         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
3214         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomains):
3215         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
3216            Renamed to reflect that it actually takes a parameter for which types of data to remove.
3217         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3218         * NetworkProcess/NetworkProcess.cpp:
3219         (WebKit::NetworkProcess::initializeNetworkProcess):
3220         (WebKit::NetworkProcess::setCrossSiteLoadWithLinkDecorationForTesting):
3221         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
3222         (WebKit::NetworkProcess::deleteCookiesForTesting):
3223         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
3224            Renamed to reflect that it actually takes a parameter for which types of data to remove.
3225         * NetworkProcess/NetworkProcess.h:
3226         * NetworkProcess/NetworkProcess.messages.in:
3227         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3228         (WebKit::NetworkProcessCreationParameters::encode const):
3229         (WebKit::NetworkProcessCreationParameters::decode):
3230         * NetworkProcess/NetworkProcessCreationParameters.h:
3231         * NetworkProcess/NetworkSession.cpp:
3232         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomains):
3233         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
3234            Renamed to reflect that it actually takes a parameter for which types of data to remove.
3235         * NetworkProcess/NetworkSession.h:
3236         * Shared/WebPreferences.yaml:
3237         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3238         (WKWebsiteDataStoreSetStatisticsCrossSiteLoadWithLinkDecoration):
3239         (WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction):
3240         (WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords):
3241         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3242         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3243         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3244         * UIProcess/Network/NetworkProcessProxy.cpp:
3245         (WebKit::NetworkProcessProxy::setCrossSiteLoadWithLinkDecorationForTesting):
3246         * UIProcess/Network/NetworkProcessProxy.h:
3247         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3248         (WebKit::WebsiteDataStore::setCrossSiteLoadWithLinkDecorationForTesting):
3249         * UIProcess/WebsiteData/WebsiteDataStore.h:
3250
3251 2019-03-19  Chris Dumez  <cdumez@apple.com>
3252
3253         Unreviewed build fix after r243173.
3254
3255         * UIProcess/Cocoa/UIDelegate.mm:
3256         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
3257
3258 2019-03-19  Brent Fulgham  <bfulgham@apple.com>
3259
3260         Add default prompt implementation for the Storage Access API
3261         https://bugs.webkit.org/show_bug.cgi?id=195866
3262         <rdar://problem/45150009>
3263
3264         Reviewed by Chris Dumez.
3265
3266         This patch revises the UIDelegate implementation with a default permission dialog
3267         for the Storage Access API. This allows us to use and test the API in MiniBrowser,
3268         rather than requiring a full-fledged web browser to drive testing.
3269  
3270         * UIProcess/Cocoa/UIDelegate.h:
3271         * UIProcess/Cocoa/UIDelegate.mm:
3272         (WebKit::UIDelegate::UIClient::presentStorageAccessConfirmDialog): Added.
3273         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm): Modify to call new default
3274         implementation if the WKWebVIew client doesn't implement the necessary SPI.
3275         * UIProcess/Cocoa/WKStorageAccessAlert.h: Added.
3276         * UIProcess/Cocoa/WKStorageAccessAlert.mm: Added.
3277         (WebKit::presentStorageAccessAlert):
3278         * WebKit.xcodeproj/project.pbxproj:
3279
3280 2019-03-19  Conrad Shultz  <conrad_shultz@apple.com>
3281
3282         REGRESSION (r242369): Only use picker-supported UTIs when creating image picker
3283         https://bugs.webkit.org/show_bug.cgi?id=195955
3284
3285         Reviewed by Chris Dumez and Wenson Hsieh.
3286
3287         r242369 started passing UTIs to -[UIImagePickerController setMediaTypes:] that correspond to types accepted by the
3288         file input element. However, UIImagePickerController expects a specific subset of UTIs. In the worst case, if no
3289         expected types are passed, this can cause a crash.
3290
3291         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3292         (UTIsForMIMETypes):
3293         Return a set rather than an array.
3294         (-[WKFileUploadPanel _mediaTypesForPickerSourceType:]):
3295         Rather than hardcode specific UTIs, ask UIImagePickerController for its available types. If an accepted type
3296         is in the list of available types, use it. Otherwise, if an accepted type conforms to an available type,
3297         use the available type. This is an O(n^2) process, but there typically are only a handful of types, so
3298         this seems acceptable.
3299         (-[WKFileUploadPanel _showDocumentPickerMenu]):
3300         Convert the set from UTIsForMIMETypes() to an array.
3301
3302 2019-03-19  Michael Catanzaro  <mcatanzaro@igalia.com>
3303
3304         Build cleanly with GCC 9
3305         https://bugs.webkit.org/show_bug.cgi?id=195920
3306
3307         Reviewed by Chris Dumez.
3308
3309         WebKit triggers three new GCC 9 warnings:
3310
3311         """
3312         -Wdeprecated-copy, implied by -Wextra, warns about the C++11 deprecation of implicitly
3313         declared copy constructor and assignment operator if one of them is user-provided.
3314         """
3315
3316         Solution is to either add a copy constructor or copy assignment operator, if required, or
3317         else remove one if it is redundant.
3318
3319         """
3320         -Wredundant-move, implied by -Wextra, warns about redundant calls to std::move.
3321         -Wpessimizing-move, implied by -Wall, warns when a call to std::move prevents copy elision.
3322         """
3323
3324         These account for most of this patch. Solution is to just remove the bad WTFMove().
3325
3326         Additionally, -Wclass-memaccess has been enhanced to catch a few cases that GCC 8 didn't.
3327         These are solved by casting nontrivial types to void* before using memcpy. (Of course, it
3328         would be safer to not use memcpy on nontrivial types, but that's too complex for this
3329         patch. Searching for memcpy used with static_cast<void*> will reveal other cases to fix.)
3330
3331         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
3332         (WebKit::CacheStorage::Cache::decode):
3333         * Platform/IPC/ArgumentCoders.h:
3334         * Shared/CallbackID.h:
3335         (WebKit::CallbackID::operator=):
3336         * Shared/OptionalCallbackID.h:
3337         (WebKit::OptionalCallbackID::operator=):
3338         * Shared/Plugins/NPIdentifierData.cpp:
3339         (WebKit::NPIdentifierData::decode):
3340         * Shared/Plugins/NPVariantData.cpp:
3341         (WebKit::NPVariantData::decode):
3342         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
3343         (WebKit::NetscapePluginModule::getOrCreate):
3344         * Shared/RTCNetwork.cpp:
3345         (WebKit::RTCNetwork::IPAddress::decode):
3346         * Shared/SessionState.cpp:
3347         (WebKit::HTTPBody::Element::decode):
3348         (WebKit::FrameState::decode):
3349         (WebKit::BackForwardListItemState::decode):
3350         * Shared/WebCompiledContentRuleListData.cpp:
3351         (WebKit::WebCompiledContentRuleListData::decode):
3352         * Shared/WebCoreArgumentCoders.cpp:
3353         (IPC::ArgumentCoder<FloatPoint>::decode):
3354         (IPC::ArgumentCoder<FloatRect>::decode):
3355         (IPC::ArgumentCoder<FloatQuad>::decode):
3356         (IPC::ArgumentCoder<ViewportArguments>::decode):
3357         (IPC::ArgumentCoder<IntPoint>::decode):
3358         (IPC::ArgumentCoder<IntRect>::decode):
3359         (IPC::ArgumentCoder<IntSize>::decode):
3360         (IPC::ArgumentCoder<MimeClassInfo>::decode):
3361         (IPC::ArgumentCoder<PluginInfo>::decode):
3362         (IPC::ArgumentCoder<SelectionRect>::decode):
3363         (IPC::ArgumentCoder<CompositionUnderline>::decode):
3364         (IPC::ArgumentCoder<BlobPart>::decode):
3365         (IPC::ArgumentCoder<TextIndicatorData>::decode):
3366         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
3367         (IPC::ArgumentCoder<ScrollOffsetRange<float>>::decode):
3368         * Shared/WebPageCreationParameters.cpp:
3369         (WebKit::WebPageCreationParameters::decode):
3370         * Shared/WebPlatformTouchPoint.cpp:
3371         (WebKit::WebPlatformTouchPoint::decode):
3372         * Shared/WebsiteData/WebsiteData.cpp:
3373         (WebKit::WebsiteData::Entry::decode):
3374         * Shared/WebsiteDataStoreParameters.cpp:
3375         (WebKit::WebsiteDataStoreParameters::decode):
3376         * UIProcess/API/APIContentRuleListStore.cpp:
3377         (API::decodeContentRuleListMetaData):
3378         * UIProcess/WebPageProxy.cpp:
3379         (WebKit::WebPageProxy::launchProcessForReload):
3380         (WebKit::WebPageProxy::launchProcessWithItem):
3381         (WebKit::WebPageProxy::loadRequest):
3382         (WebKit::WebPageProxy::loadFile):
3383         (WebKit::WebPageProxy::loadData):
3384         (WebKit::WebPageProxy::reload):
3385         * UIProcess/WebProcessCache.cpp:
3386         (WebKit::WebProcessCache::takeProcess):
3387         * UIProcess/WebProcessPool.cpp:
3388         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
3389         * WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.cpp:
3390         (WebKit::InjectedBundleCSSStyleDeclarationHandle::getOrCreate):
3391         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
3392         (WebKit::InjectedBundleRangeHandle::getOrCreate):
3393         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3394         (WebKit::InjectedBundle::create):
3395         * WebProcess/Network/WebLoaderStrategy.cpp:
3396         (WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler):
3397         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3398         (WebKit::CompositingCoordinator::createGraphicsLayer):
3399         * WebProcess/WebPage/WebPage.cpp:
3400         (WebKit::WebPage::pdfSnapshotAtSize):
3401         (WebKit::WebPage::createDocumentLoader):
3402         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
3403         (WebKit::StorageNamespaceImpl::copy):
3404
3405 2019-03-19  Chris Dumez  <cdumez@apple.com>
3406
3407         Spew: Unhandled web process message 'VisitedLinkTableController:VisitedLinkStateChanged'
3408         https://bugs.webkit.org/show_bug.cgi?id=194787
3409         <rdar://problem/48175520>
3410
3411         Reviewed by Geoff Garen.
3412
3413         The unhandled 'VisitedLinkTableController:VisitedLinkStateChanged' message logging happens
3414         when IPC is sent to a WebProcess which does not have a VisitedLinkTableController with the
3415         given identifier. VisitedLinkTableController are kept alive by the WebPage in the WebProcess
3416         side so this indicates that there is no WebPage using this VisitedLinkTableController anymore.
3417
3418         In the UIProcess side, our tracking of who is using which VisitedLinkStore was very poor.
3419         WebPageProxy objects would ask their process to register itself with the page's visitedLinkStore
3420         as soon as the WebPage object has been created on the WebProcess side. This part was fine.
3421         However, unregistration from the visitedLinkStores would only happen when either the
3422         visitedLinkStore would get destroyed or when the WebProcess would shutdown. This means that
3423         WebProcess could stay registered with a visitedLinkStore even after the page that was using it
3424         has been closed, which would lead to such logging.
3425
3426         To address the issue, the WebProcessProxy now keeps track for which pages are using which
3427         visitedLinkStore. When a visitedLinkStore is used by a page for the first time, the
3428         WebProcessProxy will register itself with the visitedLinkStore. Similarly, when the last page
3429         using a given visitedLinkStore is closed, the process unregisters itself from the
3430         visitedLinkStore, thus avoiding the bug.
3431
3432         I also simplified a lot the logic for having a page telling the WebProcessProxy it started
3433         using a visitedLinkStore. Previously, it would have to wait until the process is done launching
3434         before notifying the WebProcessProxy. Now, the WebPageProxy merely tells the WebProcessProxy
3435         that it is starting to use a visitedLinkStore as soon as it sent the CreateWebPage IPC to the
3436         WebProcess (no matter if the process is still launching or not). At this point, the
3437         WebProcessProxy registers the page as a user of the visitedLinkStore and takes care of waiting
3438         until it is done launching before registering itself with the visitedLinkStore.
3439
3440         * UIProcess/ProvisionalPageProxy.cpp:
3441         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
3442         (WebKit::ProvisionalPageProxy::initializeWebPage):
3443         (WebKit::ProvisionalPageProxy::processDidFinishLaunching): Deleted.
3444         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
3445         * UIProcess/ProvisionalPageProxy.h:
3446         * UIProcess/VisitedLinkStore.cpp:
3447         (WebKit::VisitedLinkStore::~VisitedLinkStore):
3448         (WebKit::VisitedLinkStore::addProcess):
3449         * UIProcess/WebPageProxy.cpp:
3450         (WebKit::WebPageProxy::finishAttachingToWebProcess):
3451         (WebKit::WebPageProxy::initializeWebPage):
3452         (WebKit::WebPageProxy::resetStateAfterProcessExited):
3453         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
3454         (WebKit::WebPageProxy::processDidFinishLaunching): Deleted.
3455         * UIProcess/WebPageProxy.h:
3456         * UIProcess/WebProcessProxy.cpp:
3457         (WebKit::WebProcessProxy::shutDown):
3458         (WebKit::WebProcessProxy::removeWebPage):
3459         (WebKit::WebProcessProxy::addVisitedLinkStoreUser):
3460         (WebKit::WebProcessProxy::removeVisitedLinkStoreUser):
3461         (WebKit::WebProcessProxy::addWebUserContentControllerProxy):
3462         (WebKit::WebProcessProxy::didFinishLaunching):
3463         (WebKit::WebProcessProxy::addVisitedLinkStore): Deleted.
3464         (WebKit::WebProcessProxy::didDestroyVisitedLinkStore): Deleted.
3465         * UIProcess/WebProcessProxy.h:
3466
3467 2019-03-19  Chris Dumez  <cdumez@apple.com>
3468
3469         REGRESSION (r243094): internal media test fairplay-hls-error.html is failing
3470         https://bugs.webkit.org/show_bug.cgi?id=195954
3471         <rdar://problem/49005981>
3472
3473         Reviewed by Geoffrey Garen.
3474
3475         TestController::resetStateToConsistentValues() tries to send a "reset" message to its
3476         injected bundle. Part of the "reset" message sets the external hosts that we're allowed
3477         to load. If there is no WebProcess yet when WKPagePostMessageToInjectedBundle() is called,
3478         then this message does not get sent and the allowed hosts do not get set, causing this
3479         test failure.
3480
3481         To address the issue, make sure we launch the initial process if necessary when
3482         WebPageProxy::postMessageToInjectedBundle() is called, in order to maintain backward
3483         compatibility.
3484
3485         * UIProcess/WebPageProxy.cpp:
3486         (WebKit::WebPageProxy::postMessageToInjectedBundle):
3487
3488 2019-03-19  Chris Dumez  <cdumez@apple.com>
3489
3490         Unreviewed, rolling out r243142.
3491
3492         Caused assertion hits in WK2 Debug
3493
3494         Reverted changeset:
3495
3496         "Spew: Unhandled web process message
3497         'VisitedLinkTableController:VisitedLinkStateChanged'"
3498         https://bugs.webkit.org/show_bug.cgi?id=194787
3499         https://trac.webkit.org/changeset/243142
3500
3501 2019-03-19  Daniel Bates  <dabates@apple.com>
3502
3503         [iOS] Focus not preserved when switching between tabs
3504         https://bugs.webkit.org/show_bug.cgi?id=195820
3505         <rdar://problem/43614450>
3506
3507         Reviewed by Brent Fulgham.
3508
3509         Fixes a usability annoyance when using a hardware keyboard; focus is not preserved when switching between tabs.
3510         Do not unconditionally tell the WebProcess to blur the currently focused element when the content view (WKContentView)
3511         resigns first responder. Instead only tell it to blur when the content view is resigning because either the
3512         accessory view was dismissed (Done button was pressed) or the keyboard was dismissed (the hide keyboard button
3513         was pressed).
3514
3515         * UIProcess/ios/WKContentViewInteraction.h:
3516         * UIProcess/ios/WKContentViewInteraction.mm: Add new ivar to track whether the content view is resigning
3517         first responder status because the accessory view is being dismissed.
3518         (-[WKContentView resignFirstResponderForWebView]): Only tell WebKit to blur the focused element if we are
3519         resigning because the accessory view is being dismissed or the keyboard was hidden. We continue to do all
3520         other steps when resigning, including hiding the keyboard. Note that by not telling WebKit to blur the
3521         focused element we let it's focus controller manage the focused element with respect to the current
3522         page activation state (i.e. whether the content view is first responder or not). When the content view
3523         becomes the first responder then WebKit's focus controller will be told that the page has become activated
3524         and will tell the UIProcess to focus the currently focused element, which will bring up the keyboard.
3525         (-[WKContentView accessoryDone]): Update state so we know that a subsequent call to resign first responder
3526         was due to the accessory view being dismissed.
3527
3528 2019-03-19  Per Arne Vollan  <pvollan@apple.com>
3529
3530         [iOS] Remove overridden rules in sandbox
3531         https://bugs.webkit.org/show_bug.cgi?id=193840
3532         <rdar://problem/47558526>
3533
3534         Reviewed by Brent Fulgham.
3535
3536         On iOS, there are some rules overridden in the same sandbox file. The overridden rules
3537         should be removed.
3538
3539         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3540
3541 2019-03-19  Timothy Hatcher  <timothy@apple.com>
3542
3543         Make WebKit/NSAttributedString.h a public header.
3544         https://bugs.webkit.org/show_bug.cgi?id=195944
3545
3546         Reviewed by Dean Jackson.
3547
3548         * WebKit.xcodeproj/project.pbxproj:
3549
3550 2019-03-19  Chris Dumez  <cdumez@apple.com>
3551
3552         Drop NetworkCacheStatistics code
3553         https://bugs.webkit.org/show_bug.cgi?id=195910
3554
3555         Reviewed by Antti Koivisto.
3556
3557         Drop NetworkCacheStatistics code. It was a temporary experiment and has not been used in a long time.
3558
3559         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3560         (WebKit::NetworkProcessCreationParameters::encode const):
3561         (WebKit::NetworkProcessCreationParameters::decode):
3562         * NetworkProcess/NetworkProcessCreationParameters.h:
3563         * NetworkProcess/cache/NetworkCache.cpp:
3564         (WebKit::NetworkCache::Cache::Cache):
3565         (WebKit::NetworkCache::Cache::retrieve):
3566         (WebKit::NetworkCache::Cache::store):
3567         (WebKit::NetworkCache::Cache::storeRedirect):
3568         (WebKit::NetworkCache::Cache::update):
3569         (WebKit::NetworkCache::Cache::clear):
3570         * NetworkProcess/cache/NetworkCache.h:
3571         * NetworkProcess/cache/NetworkCacheStatistics.cpp: Removed.
3572         * NetworkProcess/cache/NetworkCacheStatistics.h: Removed.
3573         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3574         (WebKit::NetworkCache::traverseRecordsFiles):
3575         * NetworkProcess/cache/NetworkCacheStorage.h:
3576         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3577         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
3578         * NetworkProcess/soup/NetworkProcessSoup.cpp:
3579         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
3580         * Sources.txt:
3581         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3582         (WebKit::registerUserDefaultsIfNeeded):
3583         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3584         * UIProcess/soup/WebProcessPoolSoup.cpp:
3585         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3586         * WebKit.xcodeproj/project.pbxproj:
3587
3588 2019-03-19  Chris Dumez  <cdumez@apple.com>
3589
3590         Spew: Unhandled web process message 'VisitedLinkTableController:VisitedLinkStateChanged'
3591         https://bugs.webkit.org/show_bug.cgi?id=194787
3592         <rdar://problem/48175520>
3593
3594         Reviewed by Geoffrey Garen.
3595
3596         The unhandled 'VisitedLinkTableController:VisitedLinkStateChanged' message logging happens
3597         when IPC is sent to a WebProcess which does not have a VisitedLinkTableController with the
3598         given identifier. VisitedLinkTableController are kept alive by the WebPage in the WebProcess
3599         side so this indicates that there is no WebPage using this VisitedLinkTableController anymore.
3600
3601         In the UIProcess side, our tracking of who is using which VisitedLinkStore was very poor.
3602         WebPageProxy objects would ask their process to register itself with the page's visitedLinkStore
3603         as soon as the WebPage object has been created on the WebProcess side. This part was fine.
3604         However, unregistration from the visitedLinkStores would only happen when either the
3605         visitedLinkStore would get destroyed or when the WebProcess would shutdown. This means that
3606         WebProcess could stay registered with a visitedLinkStore even after the page that was using it
3607         has been closed, which would lead to such logging.
3608
3609         To address the issue, the WebProcessProxy now keeps track for which pages are using which
3610         visitedLinkStore. When a visitedLinkStore is used by a page for the first time, the
3611         WebProcessProxy will register itself with the visitedLinkStore. Similarly, when the last page
3612         using a given visitedLinkStore is closed, the process unregisters itself from the
3613         visitedLinkStore, thus avoiding the bug.
3614
3615         I also simplified a lot the logic for having a page telling the WebProcessProxy it started
3616         using a visitedLinkStore. Previously, it would have to wait until the process is done launching
3617         before notifying the WebProcessProxy. Now, the WebPageProxy merely tells the WebProcessProxy
3618         that it is starting to use a visitedLinkStore as soon as it sent the CreateWebPage IPC to the
3619         WebProcess (no matter if the process is still launching or not). At this point, the
3620         WebProcessProxy registers the page as a user of the visitedLinkStore and takes care of waiting
3621         until it is done launching before registering itself with the visitedLinkStore.
3622
3623         * UIProcess/ProvisionalPageProxy.cpp:
3624         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
3625         (WebKit::ProvisionalPageProxy::initializeWebPage):
3626         (WebKit::ProvisionalPageProxy::processDidFinishLaunching): Deleted.
3627         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
3628         * UIProcess/ProvisionalPageProxy.h:
3629         * UIProcess/VisitedLinkStore.cpp:
3630         (WebKit::VisitedLinkStore::~VisitedLinkStore):
3631         (WebKit::VisitedLinkStore::addProcess):
3632         * UIProcess/WebPageProxy.cpp:
3633         (WebKit::WebPageProxy::finishAttachingToWebProcess):
3634         (WebKit::WebPageProxy::initializeWebPage):
3635         (WebKit::WebPageProxy::resetStateAfterProcessExited):
3636         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
3637         (WebKit::WebPageProxy::processDidFinishLaunching): Deleted.
3638         * UIProcess/WebPageProxy.h:
3639         * UIProcess/WebProcessProxy.cpp:
3640         (WebKit::WebProcessProxy::shutDown):
3641         (WebKit::WebProcessProxy::removeWebPage):
3642         (WebKit::WebProcessProxy::addVisitedLinkStoreUser):
3643         (WebKit::WebProcessProxy::removeVisitedLinkStoreUser):
3644         (WebKit::WebProcessProxy::addWebUserContentControllerProxy):
3645         (WebKit::WebProcessProxy::didFinishLaunching):
3646         (WebKit::WebProcessProxy::addVisitedLinkStore): Deleted.
3647         (WebKit::WebProcessProxy::didDestroyVisitedLinkStore): Deleted.
3648         * UIProcess/WebProcessProxy.h:
3649
3650 2019-03-19  Alex Christensen  <achristensen@webkit.org>
3651
3652         Make WTFLogChannelState and WTFLogLevel enum classes
3653         https://bugs.webkit.org/show_bug.cgi?id=195904
3654
3655         Reviewed by Eric Carlson.
3656
3657         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
3658         (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
3659         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
3660         (WebKit::NetworkRTCProvider::NetworkRTCProvider):
3661
3662 2019-03-19  Michael Catanzaro  <mcatanzaro@igalia.com>
3663
3664         Unreviewed, rolling out r243132.
3665
3666         Broke GTK build
3667
3668         Reverted changeset:
3669
3670         "Make WTFLogChannelState and WTFLogLevel enum classes"
3671         https://bugs.webkit.org/show_bug.cgi?id=195904
3672         https://trac.webkit.org/changeset/243132
3673
3674 2019-03-19  Antti Koivisto  <antti@apple.com>
3675
3676         Layer with no backing store should still hit-test over a scroller
3677         https://bugs.webkit.org/show_bug.cgi?id=195378
3678         <rdar://problem/48652078>
3679
3680         Reviewed by Simon Fraser.
3681
3682         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
3683         (WebKit::RemoteLayerTreeHost::makeNode):
3684         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
3685         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
3686         (WebKit::collectDescendantViewsAtPoint):
3687
3688         No need for special WKTiledBackingView, tiled views now have correct event regions.
3689
3690 2019-03-18  Alex Christensen  <achristensen@webkit.org>
3691
3692         Make WTFLogChannelState and WTFLogLevel enum classes
3693         https://bugs.webkit.org/show_bug.cgi?id=195904
3694
3695         Reviewed by Eric Carlson.
3696
3697         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
3698         (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
3699         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
3700         (WebKit::NetworkRTCProvider::NetworkRTCProvider):
3701
3702 2019-03-18  Commit Queue  <commit-queue@webkit.org>
3703
3704         Unreviewed, rolling out r243092 and r243096.
3705         https://bugs.webkit.org/show_bug.cgi?id=195926
3706
3707         Caused assertions in tests (Requested by smfr on #webkit).
3708
3709         Reverted changesets:
3710
3711         "Layer with no backing store should still hit-test over a
3712         scroller"
3713         https://bugs.webkit.org/show_bug.cgi?id=195378
3714         https://trac.webkit.org/changeset/243092
3715
3716         "Try to fix Windows build."
3717         https://trac.webkit.org/changeset/243096
3718
3719 2019-03-18  Timothy Hatcher  <timothy@apple.com>
3720
3721         WKWebView.GetContentsShouldReturnAttributedString is crashing on iOS Simulator.
3722         https://bugs.webkit.org/show_bug.cgi?id=195916
3723
3724         Reviewed by Tim Horton.
3725
3726         Add direct support for UIColor so it does not try to use the NSSecureCoding path.
3727         This avoids needs to list the classes when decoding the attributes NSDictionary
3728         and matches the macOS NSColor encoder/decoder.
3729
3730         * Shared/Cocoa/ArgumentCodersCocoa.mm:
3731         (IPC::typeFromObject):
3732         (IPC::encodeColorInternal):
3733         (IPC::decodeColorInternal):
3734         (IPC::encodeObject):
3735         (IPC::decodeObject):
3736
3737 2019-03-18  Timothy Hatcher  <timothy@apple.com>
3738
3739         Add new NSAttributedString API for converting HTML.
3740         https://bugs.webkit.org/show_bug.cgi?id=195636
3741         rdar://problem/45055697
3742
3743         Reviewed by Tim Horton.
3744
3745         * Platform/spi/ios/UIKitSPI.h:
3746         * SourcesCocoa.txt:
3747         * UIProcess/API/Cocoa/NSAttributedString.h: Added.
3748         * UIProcess/API/Cocoa/NSAttributedString.mm: Added.
3749         (-[_WKAttributedStringNavigationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
3750         (-[_WKAttributedStringNavigationDelegate webView:didFailProvisionalNavigation:withError:]):
3751         (-[_WKAttributedStringNavigationDelegate webView:didFailNavigation:withError:]):
3752         (-[_WKAttributedStringNavigationDelegate webView:didFinishNavigation:]):
3753         (+[_WKAttributedStringWebViewCache cache]):
3754         (+[_WKAttributedStringWebViewCache configuration]):
3755         (+[_WKAttributedStringWebViewCache clearConfiguration]):
3756         (+[_WKAttributedStringWebViewCache retrieveOrCreateWebView]):
3757         (+[_WKAttributedStringWebViewCache cacheWebView:]):
3758         (+[_WKAttributedStringWebViewCache resetPurgeDelay]):
3759         (+[_WKAttributedStringWebViewCache purgeSingleWebView]):
3760         (+[_WKAttributedStringWebViewCache purgeAllWebViews]):
3761         (+[NSAttributedString _loadFromHTMLWithOptions:contentLoader:completionHandler:]):
3762         (+[NSAttributedString loadFromHTMLWithRequest:options:completionHandler:]):
3763         (+[NSAttributedString loadFromHTMLWithFileURL:options:completionHandler:]):
3764         (+[NSAttributedString loadFromHTMLWithString:options:completionHandler:]):
3765         (+[NSAttributedString loadFromHTMLWithData:options:completionHandler:]):
3766         * UIProcess/API/Cocoa/NSAttributedStringPrivate.h: Copied from Source/WebKit/UIProcess/API/Cocoa/WKErrorInternal.h.
3767         * UIProcess/API/Cocoa/WKError.h:
3768         * UIProcess/API/Cocoa/WKError.mm:
3769         (localizedDescriptionForErrorCode):
3770         (createNSError):
3771         * UIProcess/API/Cocoa/WKErrorInternal.h:
3772         * WebKit.xcodeproj/project.pbxproj:
3773         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
3774         (WebKit::WebPage::getContentsAsAttributedString):
3775
3776 2019-03-18  Alex Christensen  <achristensen@webkit.org>
3777
3778         Implement DownloadMonitor to prevent long-running slow downloads from background apps
3779         https://bugs.webkit.org/show_bug.cgi?id=195785
3780
3781         Reviewed by Geoffrey Garen.
3782
3783         This is similar to what was updated in <rdar://problem/42677685> but for WebKit Downloads.
3784         To test it I implemented a throttled TCP server, SPI to speed up DownloadMonitor's timer,
3785         and SPI to synthesize the application going into the background and foreground, which
3786         NSNotificationCenter does on iOS.
3787
3788         * NetworkProcess/Downloads/Download.cpp:
3789         (WebKit::Download::didReceiveData):
3790         (WebKit::Download::didFinish):
3791         (WebKit::Download::didFail):
3792         (WebKit::Download::didCancel):
3793         * NetworkProcess/Downloads/Download.h:
3794         (WebKit::Download::applicationEnteredBackground):
3795         (WebKit::Download::applicationEnteredForeground):
3796         (WebKit::Download::manager const):
3797         * NetworkProcess/Downloads/DownloadManager.cpp:
3798         (WebKit::DownloadManager::downloadFinished):
3799         (WebKit::DownloadManager::applicationDidEnterBackground):
3800         (WebKit::DownloadManager::applicationWillEnterForeground):
3801         * NetworkProcess/Downloads/DownloadManager.h:
3802         * NetworkProcess/Downloads/DownloadMap.cpp:
3803         (WebKit::DownloadMap::values):
3804         * NetworkProcess/Downloads/DownloadMap.h:
3805         * NetworkProcess/Downloads/DownloadMonitor.cpp: Added.
3806         (WebKit::operator _kbps):
3807         (WebKit::timeUntilNextInterval):
3808         (WebKit::DownloadMonitor::DownloadMonitor):
3809         (WebKit::DownloadMonitor::measuredThroughputRate const):
3810         (WebKit::DownloadMonitor::downloadReceivedBytes):
3811         (WebKit::DownloadMonitor::applicationEnteredForeground):
3812         (WebKit::DownloadMonitor::applicationEnteredBackground):
3813         (WebKit::DownloadMonitor::speedMultiplier const):
3814         (WebKit::DownloadMonitor::timerFired):
3815         * NetworkProcess/Downloads/DownloadMonitor.h: Added.
3816         * NetworkProcess/NetworkProcess.cpp:
3817         (WebKit::NetworkProcess::initializeNetworkProcess):
3818         (WebKit::NetworkProcess::applicationDidEnterBackground):
3819         (WebKit::NetworkProcess::applicationWillEnterForeground):
3820         * NetworkProcess/NetworkProcess.h:
3821         * NetworkProcess/NetworkProcess.messages.in:
3822         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3823         (WebKit::NetworkProcessCreationParameters::encode const):
3824         (WebKit::NetworkProcessCreationParameters::decode):
3825         * NetworkProcess/NetworkProcessCreationParameters.h:
3826         * Sources.txt:
3827         * SourcesCocoa.txt:
3828         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3829         (API::ProcessPoolConfiguration::copy):
3830         * UIProcess/API/APIProcessPoolConfiguration.h:
3831         * UIProcess/API/C/WKContext.cpp:
3832         (WKContextDownloadURLRequest):
3833         (WKContextResumeDownload):
3834         * UIProcess/API/Cocoa/WKProcessPool.mm:
3835         (-[WKProcessPool _synthesizeAppIsBackground:]):
3836         (-[WKProcessPool _downloadURLRequest:originatingWebView:]):
3837         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3838         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3839         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3840         (-[_WKProcessPoolConfiguration downloadMonitorSpeedMultiplier]):
3841         (-[_WKProcessPoolConfiguration setDownloadMonitorSpeedMultiplier:]):
3842         * UIProcess/Cocoa/DownloadProxyMapCocoa.mm: Added.
3843         (WebKit::DownloadProxyMap::platformCreate):
3844         (WebKit::DownloadProxyMap::platformDestroy):
3845         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3846         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3847         * UIProcess/Downloads/DownloadProxy.cpp:
3848         (WebKit::DownloadProxy::didFinish):
3849         (WebKit::DownloadProxy::didFail):
3850         (WebKit::DownloadProxy::didCancel):
3851         * UIProcess/Downloads/DownloadProxyMap.cpp:
3852         (WebKit::DownloadProxyMap::DownloadProxyMap):
3853         (WebKit::DownloadProxyMap::~DownloadProxyMap):
3854         (WebKit::DownloadProxyMap::platformCreate):
3855         (WebKit::DownloadProxyMap::platformDestroy):
3856         (WebKit::DownloadProxyMap::applicationDidEnterBackground):
3857         (WebKit::DownloadProxyMap::applicationWillEnterForeground):
3858         (WebKit::DownloadProxyMap::createDownloadProxy):
3859         (WebKit::DownloadProxyMap::downloadFinished):
3860         * UIProcess/Downloads/DownloadProxyMap.h:
3861         * UIProcess/Network/NetworkProcessProxy.cpp:
3862         (WebKit::NetworkProcessProxy::synthesizeAppIsBackground):
3863         (WebKit::NetworkProcessProxy::createDownloadProxy):
3864         * UIProcess/Network/NetworkProcessProxy.h:
3865         * UIProcess/PageClient.h:
3866         * UIProcess/WebPageProxy.cpp:
3867         (WebKit::WebPageProxy::receivedPolicyDecision):
3868         (WebKit::WebPageProxy::handleDownloadRequest):
3869         * UIProcess/WebPageProxy.h:
3870         * UIProcess/WebProcessPool.cpp:
3871         (WebKit::WebProcessPool::download):
3872         (WebKit::WebProcessPool::resumeDownload):
3873         (WebKit::WebProcessPool::createDownloadProxy):
3874         (WebKit::WebProcessPool::synthesizeAppIsBackground):
3875         * UIProcess/WebProcessPool.h:
3876         * UIProcess/ios/PageClientImplIOS.h:
3877         * UIProcess/ios/PageClientImplIOS.mm:
3878         (WebKit::PageClientImpl::handleDownloadRequest):
3879         * UIProcess/mac/PageClientImplMac.h:
3880         * UIProcess/mac/PageClientImplMac.mm:
3881         (WebKit::PageClientImpl::handleDownloadRequest):
3882         * WebKit.xcodeproj/project.pbxproj:
3883
3884 2019-03-18  Wenson Hsieh  <wenson_hsieh@apple.com>
3885
3886         [iOS] Native selection views sometimes appear in hidden editable areas after losing focus
3887         https://bugs.webkit.org/show_bug.cgi?id=195894
3888         <rdar://problem/48849989>
3889
3890         Reviewed by Tim Horton.
3891
3892         On certain websites, focus is moved away from an editable element while maintaining a selection inside the
3893         editable element. In the case where the editable element is hidden, this currently breaks our text interaction
3894         suppression heuristics, which suppress text selection gestures and overlays inside focused hidden editable
3895         elements. To fix this, we refactor our text interaction suppression heuristics, such that they are not dependent
3896         on an editable element being focused. See changes below for more details.
3897
3898         Test: editing/selection/ios/hide-selection-in-non-focused-element.html
3899
3900         * Shared/EditorState.cpp:
3901         (WebKit::EditorState::PostLayoutData::encode const):
3902         (WebKit::EditorState::PostLayoutData::decode):
3903         * Shared/EditorState.h:
3904
3905         Rename elementIsTransparentOrFullyClipped to editableRootIsTransparentOrFullyClipped, and additionally compute
3906         this flag by checking whether the root editable element containing the selection is transparent or clipped,
3907         instead of using the currently focused element.
3908
3909         * Shared/FocusedElementInformation.cpp:
3910         (WebKit::FocusedElementInformation::encode const):
3911         (WebKit::FocusedElementInformation::decode):
3912         * Shared/FocusedElementInformation.h:
3913
3914         Remove the elementIsTransparentOrFullyClipped flag from FocusedElementInformation (see below for more detail).
3915
3916         * UIProcess/ios/WKContentViewInteraction.h:
3917
3918         Rename FocusedElementIsTransparentOrFullyClipped to EditableRootIsTransparentOrFullyClipped.
3919
3920         * UIProcess/ios/WKContentViewInteraction.mm:
3921         (-[WKContentView _zoomToRevealFocusedElement]):
3922         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3923
3924         Remove logic that currently uses state on FocusedElementInformation to determine whether to suppress platform
3925         text interactions; instead, only use EditorState to make this determination. This logic was originally added in
3926         the initial implementation of the text interaction suppression heuristic as a way to begin suppressing text
3927         selection state before zooming to reveal the focused element; however, since we now zoom to reveal the text
3928         selection when focusing editable elements, zooming is deferred until the next complete EditorState update
3929         arrives in the UI process so we don't need to worry about beginning to suppress text interactions prior to this
3930         initial editor state update.
3931
3932         (-[WKContentView _elementDidBlur]):
3933         (-[WKContentView _updateSelectionAssistantSuppressionState]):
3934
3935         Add a helper method that updates text selection suppression state using the current EditorState.
3936
3937         (-[WKContentView _selectionChanged]):
3938         (-[WKContentView _updateChangedSelection:]):
3939
3940         Always update text suppression state when receiving an EditorState, instead of only doing so when processing a
3941         text selection gesture.
3942
3943         (-[WKContentView _startSuppressingSelectionAssistantForReason:]):
3944
3945         Renamed from _beginSuppressingSelectionAssistantForReason:, to better match "start/end" terminology of
3946         _endSuppressingSelectionAssistantForReason:.
3947
3948         (-[WKContentView dropInteraction:performDrop:]):
3949         (-[WKContentView _beginSuppressingSelectionAssistantForReason:]): Deleted.
3950         * UIProcess/ios/WebPageProxyIOS.mm:
3951         (WebKit::WebPageProxy::editorStateChanged):
3952
3953         Ensure that we run logic to zoom to the focused element *after* updating text selection suppression state, so we
3954         don't erroneously zoom to reveal hidden editable elements.
3955
3956         * WebProcess/WebPage/ios/WebPageIOS.mm:
3957         (WebKit::WebPage::platformEditorState const):
3958         (WebKit::WebPage::getFocusedElementInformation):
3959
3960 2019-03-18  Chris Dumez  <cdumez@apple.com>
3961
3962         Delay WebProcess launch until a load is triggered in a Web view
3963         https://bugs.webkit.org/show_bug.cgi?id=195758
3964         <rdar://problem/48126013>
3965
3966         Reviewed by Geoff Garen.
3967
3968         This is achieved by constructing WebPageProxy objects with a WebProcessProxy that is in
3969         terminated state (because it never launched its process). This is convenient because
3970         it is a state that the WebPageProxy supports, which normally happened by the WebProcess
3971         crashes. When trying to do a load, we were already checking if the WebPageProxy's process
3972         was running (via an isValid() check) and we would re-launch the WebProcess if necessary
3973         by calling reattachToWebProcess(). For clarity, given that this state is no longer
3974         indicating that the WebProcess crashed, I renamed isValid() to hasRunningProcess() and
3975         reattachToWebProcess() to launchProcess().
3976
3977         The reason delaying the WebProcess launch until the first load is useful is because it
3978         allows us to leverage the WebProcessCache given that we now know which registrable
3979         domain is going to be loaded in the process.
3980
3981         This is a progression from a power usage standpoint. When it comes&nbs