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