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