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