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