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