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