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