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