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