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