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