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