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