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