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