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