9be35372e413dc282e54d4f9d3e498d905051fcd
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-03-25  Simon Fraser  <simon.fraser@apple.com>
2
3         REGRESSION (r242687): Flicker when pinch-zooming pages in macOS Safari
4         https://bugs.webkit.org/show_bug.cgi?id=196126
5         rdar://problem/49095791
6
7         Reviewed by Tim Horton.
8         
9         I fumbled the commit after the enum rename. Make this actually work.
10
11         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
12         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
13
14 2019-03-25  Simon Fraser  <simon.fraser@apple.com>
15
16         Zoom on macOS is centered around a point lower than the cursor
17         https://bugs.webkit.org/show_bug.cgi?id=196225
18         rdar://problem/49213574
19
20         Reviewed by Tim Horton.
21         
22         The origin handed to ViewGestureController::handleMagnificationGestureEvent is in WKWebView
23         coordinates, but we end up setting the transform on the RenderView's layer, so we need
24         to subtract the topContentInset.
25
26         * UIProcess/mac/ViewGestureControllerMac.mm:
27         (WebKit::ViewGestureController::handleMagnificationGestureEvent):
28
29 2019-03-25  Alex Christensen  <achristensen@webkit.org>
30
31         Do not terminate the NetworkProcess if a third party application sends a NSCredential with a SecIdentityRef
32         https://bugs.webkit.org/show_bug.cgi?id=196213
33
34         Reviewed by Geoff Garen.
35
36         A release assertion added in r230225 was reachable.  I reached it in a unit test that responds to a challenge
37         with a SecIdentityRef wrapped in an NSCredential.
38
39         * Shared/cf/ArgumentCodersCF.cpp:
40         (IPC::decode):
41
42 2019-03-25  Chris Dumez  <cdumez@apple.com>
43
44         Get rid of WebPage::m_shouldResetDrawingAreaAfterSuspend flag
45         https://bugs.webkit.org/show_bug.cgi?id=196210
46         <rdar://problem/48681326>
47
48         Reviewed by Geoffrey Garen.
49
50         Get rid of WebPage::m_shouldResetDrawingAreaAfterSuspend flag and use the drawing area identifier
51         instead to reset the DrawingArea in the WebProcess whenever the UIProcess did.
52
53         This is less error-prone and guarantees that the WebProcess and the UIProcess can reliably
54         communicate via DrawingArea IPC.
55
56         * WebProcess/WebPage/WebPage.cpp:
57         (WebKit::WebPage::reinitializeWebPage):
58         (WebKit::WebPage::setIsSuspended):
59         * WebProcess/WebPage/WebPage.h:
60
61 2019-03-25  Alex Christensen  <achristensen@webkit.org>
62
63         Enable IPC sending and receiving non-default-constructible types
64         https://bugs.webkit.org/show_bug.cgi?id=196132
65
66         Reviewed by Geoff Garen.
67
68         * Platform/IPC/ArgumentCoder.h:
69         * Platform/IPC/ArgumentCoders.h:
70         (IPC::TupleEncoder::encode):
71         (IPC::tupleFromTupleAndObject):
72         (IPC::TupleDecoderImpl::decode):
73         (IPC::TupleDecoderImpl<Type>::decode):
74         (IPC::TupleDecoder::decode):
75         (IPC::TupleDecoder<0>::decode):
76         (IPC::TupleCoder::encode): Deleted.
77         (IPC::TupleCoder::decode): Deleted.
78         * Platform/IPC/Connection.h:
79         (IPC::Connection::sendWithReply):
80         (IPC::TupleMover::move):
81         (IPC::moveTuple):
82         (IPC::Connection::sendSync):
83         * Platform/IPC/Decoder.h:
84         (IPC::Decoder::decode):
85         (IPC::Decoder::operator>>):
86         * Platform/IPC/HandleMessage.h:
87         (IPC::handleMessage):
88         (IPC::handleMessageSynchronous):
89         (IPC::handleMessageSynchronousWantsConnection):
90         (IPC::handleMessageAsync):
91         * Platform/SharedMemory.h:
92         * Scripts/webkit/LegacyMessages-expected.h:
93         * Scripts/webkit/Messages-expected.h:
94         * Scripts/webkit/MessagesSuperclass-expected.h:
95         * Scripts/webkit/messages.py:
96         * Shared/Databases/IndexedDB/WebIDBResult.h:
97         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
98         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
99         * Shared/ShareableBitmap.h:
100         * Shared/ShareableResource.h:
101         * Shared/UpdateInfo.h:
102         * Shared/WebEvent.h:
103         * Shared/WebProcessCreationParameters.cpp:
104         * Shared/WebProcessCreationParameters.h:
105         * Shared/mac/SecItemResponseData.cpp:
106         (WebKit::SecItemResponseData::SecItemResponseData):
107         (WebKit::SecItemResponseData::decode):
108         * Shared/mac/SecItemResponseData.h:
109         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h:
110
111 2019-03-25  Tim Horton  <timothy_horton@apple.com>
112
113         Animated keyboard scrolling is extremely chaotic
114         https://bugs.webkit.org/show_bug.cgi?id=196164
115         <rdar://problem/48702444>
116
117         Reviewed by Simon Fraser.
118
119         * UIProcess/ios/WKContentViewInteraction.mm:
120         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
121         Consume keyboard events instead of interpreting them traditionally
122         if WKKeyboardScrollingAnimator is animating.
123
124         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
125         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
126         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
127         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
128         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
129         (-[WKKeyboardScrollingAnimator scrollTriggeringKeyIsPressed]):
130         (-[WKKeyboardScrollingAnimator displayLinkFired:]):
131         (-[WKKeyboardScrollViewAnimator scrollTriggeringKeyIsPressed]):
132         Expose the current state of interactive scrolling, and rename the related member.
133
134 2019-03-25  Keith Rollin  <krollin@apple.com>
135
136         Add WebKit logging for first paint and other interesting layout milestones
137         https://bugs.webkit.org/show_bug.cgi?id=196159
138         <rdar://problem/49128952>
139
140         Reviewed by Simon Fraser.
141
142         Add some logging to indicate what layout milestones have been reached.
143         This should help us determine if there's a client, rendering, layout,
144         or some other issue when page content does not appear in the client
145         window.
146
147         The logging is being added to
148         WebFrameLoaderClient::dispatchDidReachLayoutMilestone. This seems like
149         a nice central place to capture layout milestones. However, it will
150         only log notifications that are being sent to clients. It does not
151         indicate all milestones that have occurred. That is, it does not
152         report milestones that are filtered out due to client disinterest.
153         There doesn't seem to be a good central place to capture all
154         milestones, regardless of client interest.
155
156         * Platform/Logging.h:
157         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
158         (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
159
160 2019-03-25  Patrick Griffis  <pgriffis@igalia.com>
161
162         [GTK][WPE] Remove network access from web process sandbox
163         https://bugs.webkit.org/show_bug.cgi?id=189967
164
165         Reviewed by Michael Catanzaro.
166
167         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
168         (WebKit::createFlatpakInfo):
169         (WebKit::bubblewrapSpawn):
170         * UIProcess/Launcher/glib/FlatpakLauncher.cpp:
171         (WebKit::flatpakSpawn):
172
173 2019-03-25  Andy Estes  <aestes@apple.com>
174
175         [Apple Pay] Call +canMakePayments on a work queue
176         https://bugs.webkit.org/show_bug.cgi?id=196179
177         <rdar://problem/45388749>
178
179         Reviewed by Brady Eidson.
180
181         Calling +canMakePayments on either PKPaymentAuthorizationController or
182         PKPaymentAuthorizationViewController results in synchronous IPC and is therefore very
183         expensive to call on the main thread. On iOS, these calls are made in the network process,
184         and on Mac in the UI process.
185
186         Call these methods on a work queue to avoid main thread spins.
187
188         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
189         (WebKit::WebPaymentCoordinatorProxy::canMakePayments):
190         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
191         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
192         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
193         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
194         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
195
196 2019-03-25  Andy Estes  <aestes@apple.com>
197
198         [Apple Pay] Remove the AvailablePaymentNetworks synchronous message
199         https://bugs.webkit.org/show_bug.cgi?id=196180
200
201         Reviewed by Youenn Fablet.
202
203         Unlike many PassKit interactions, it's ok to call +[PKPaymentRequest availableNetworks]
204         without an entitlement. Therefore, we can call it from the web process directly rather than
205         synchronously messaging the entitled UI or networking process.
206
207         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
208         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
209         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
210         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
211         * SourcesCocoa.txt:
212         * WebKit.xcodeproj/project.pbxproj:
213         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
214         (WebKit::WebPaymentCoordinator::availablePaymentNetworks):
215         * WebProcess/ApplePay/WebPaymentCoordinator.h:
216         * WebProcess/ApplePay/cocoa/WebPaymentCoordinatorCocoa.mm: Added.
217         (WebKit::WebPaymentCoordinator::platformAvailablePaymentNetworks const):
218         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
219         (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
220         (-[WKAccessibilityWebPageObjectBase setWebPage:]):
221
222 2019-03-25  Chris Dumez  <cdumez@apple.com>
223
224         Unreviewed, tiny fix after r243388 to address API test failures on iOS
225
226         m_processType was properly initialized on macOS but not iOS.
227
228         * WebProcess/cocoa/WebProcessCocoa.mm:
229         (WebKit::WebProcess::platformInitializeProcess):
230
231 2019-03-25  Carlos Garcia Campos  <cgarcia@igalia.com>
232
233         [GTK][WPE] Do not allow changes in active URI before provisional load starts for non-API requests
234         https://bugs.webkit.org/show_bug.cgi?id=194208
235
236         Reviewed by Michael Catanzaro.
237
238         * UIProcess/API/glib/WebKitWebView.cpp:
239         (webkitWebViewWillStartLoad): Block updates of active URL.
240         (webkitWebViewLoadChanged): Unblock updates of active URL on WEBKIT_LOAD_STARTED.
241
242 2019-03-25  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
243
244         Remove NavigatorContentUtils in WebCore/Modules
245         https://bugs.webkit.org/show_bug.cgi?id=196070
246
247         Reviewed by Alex Christensen.
248
249         NavigatorContentUtils was to support the custom scheme spec [1].
250         However, in WebKit side, no port has supported the feature in
251         WebKit layer after EFL port was removed. So there has been the
252         only IDL implementation of the NavigatorContentUtils in WebCore.
253         So we don't need to keep the implementation in WebCore anymore.
254
255         [1] https://html.spec.whatwg.org/multipage/system-state.html#custom-handlers
256
257         * Configurations/FeatureDefines.xcconfig:
258         * WebProcess/WebCoreSupport/WebNavigatorContentUtilsClient.h: Removed.
259
260 2019-03-24  Zan Dobersek  <zdobersek@igalia.com>
261
262         Unreviewed WPE build fix.
263
264         * UIProcess/wpe/WebPasteboardProxyWPE.cpp:
265         Add an explicit CompletionHandler.h include to avoid a trip-up in
266         unified builds.
267
268 2019-03-24  Fujii Hironori  <Hironori.Fujii@sony.com>
269
270         [WinCairo] WebProcessDataStoreParameters.h(32): error C2653: 'SandboxExtension': is not a class or namespace name
271         https://bugs.webkit.org/show_bug.cgi?id=196192
272
273         Unreviewed for WinCairo port.
274
275         * Shared/WebProcessDataStoreParameters.h: Added #include "SandboxExtension.h".
276
277 2019-03-24  Andy Estes  <aestes@apple.com>
278
279         [watchOS] Remove unused Proximity Networking code
280         https://bugs.webkit.org/show_bug.cgi?id=196188
281
282         Reviewed by Tim Horton.
283
284         * Configurations/WebKit.xcconfig:
285         * NetworkProcess/NetworkProcess.cpp:
286         (WebKit::NetworkProcess::NetworkProcess):
287         * NetworkProcess/NetworkProcess.h:
288         * NetworkProcess/NetworkProcessCreationParameters.cpp:
289         (WebKit::NetworkProcessCreationParameters::encode const):
290         (WebKit::NetworkProcessCreationParameters::decode):
291         * NetworkProcess/NetworkProcessCreationParameters.h:
292         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
293         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
294         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
295         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
296         (WebKit::NetworkProcess::platformPrepareToSuspend):
297         (WebKit::NetworkProcess::platformProcessDidResume):
298         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
299         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
300         * NetworkProcess/watchos/NetworkProximityAssertion.h: Removed.
301         * NetworkProcess/watchos/NetworkProximityAssertion.mm: Removed.
302         * NetworkProcess/watchos/NetworkProximityManager.h: Removed.
303         * NetworkProcess/watchos/NetworkProximityManager.mm: Removed.
304         * SourcesCocoa.txt:
305         * UIProcess/API/APIProcessPoolConfiguration.cpp:
306         (API::ProcessPoolConfiguration::copy):
307         * UIProcess/API/APIProcessPoolConfiguration.h:
308         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
309         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
310         (-[_WKProcessPoolConfiguration wirelessContextIdentifier]):
311         (-[_WKProcessPoolConfiguration setWirelessContextIdentifier:]):
312         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
313         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
314         * WebKit.xcodeproj/project.pbxproj:
315
316 2019-03-23  Chris Dumez  <cdumez@apple.com>
317
318         Unreviewed, fix typo in comment added in r243379.
319
320         * UIProcess/API/Cocoa/WKProcessGroup.mm:
321         (-[WKProcessGroup setDelegate:]):
322
323 2019-03-23  Simon Fraser  <simon.fraser@apple.com>
324
325         REGRESSION (iOS 8): Scrollbar can't be hidden when webkit-overflow-scrolling is set to touch
326         https://bugs.webkit.org/show_bug.cgi?id=137043
327         rdar://problem/16595330
328
329         Reviewed by Zalan Bujtas.
330
331         Plumb horizontalScrollbarHiddenByStyle/verticalScrollbarHiddenByStyle through ScrollableAreaParameters
332         to the UI process, and use it to set UIScrollView indicators visible or not.
333         
334         The scroll snap changes in ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren() fix a bug
335         where hasChangedProperty(HorizontalSnapOffsets) was nested inside another set of hasChangedProperty()
336         tests, so would never get called.
337
338         * Shared/WebCoreArgumentCoders.cpp:
339         (IPC::ArgumentCoder<ScrollableAreaParameters>::encode):
340         (IPC::ArgumentCoder<ScrollableAreaParameters>::decode):
341         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
342         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
343
344 2019-03-23  Zalan Bujtas  <zalan@apple.com>
345
346         [ContentChangeObserver] Taping on a form control should always result in click.
347         https://bugs.webkit.org/show_bug.cgi?id=196177
348
349         Reviewed by Simon Fraser.
350
351         This patch enures that we send a synthetic click when the traget node is a form control (button, edit field etc) even if
352         the mousemove brings up some hover content.
353
354         * WebProcess/WebPage/ios/WebPageIOS.mm:
355         (WebKit::WebPage::handleSyntheticClick):
356
357 2019-03-23  Andy Estes  <aestes@apple.com>
358
359         [Apple Pay] Stop calling PKPaymentAuthorizationViewController class methods on iOS
360         https://bugs.webkit.org/show_bug.cgi?id=196163
361         <rdar://problem/48787564>
362
363         Reviewed by Anders Carlsson.
364
365         Now that we've transitioned to PKPaymentAuthorizationController on iOS, we should stop
366         calling PKPaymentAuthorizationViewController class methods on iOS in favor of their
367         PKPaymentAuthorizationController alternatives.
368
369         While we're here, we should also transition to calling
370         +paymentServicesMerchantURLForAPIType:completion: on both
371         PKPaymentAuthorizationViewController and PKPaymentAuthorizationController.
372
373         * Platform/cocoa/PaymentAuthorizationViewController.mm:
374         (-[WKPaymentAuthorizationViewControllerDelegate _paymentServicesMerchantURLForAPIType:completion:]):
375         * Platform/cocoa/WKPaymentAuthorizationDelegate.h:
376         * Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
377         (-[WKPaymentAuthorizationDelegate _initWithRequest:presenter:]):
378         (-[WKPaymentAuthorizationDelegate _paymentServicesMerchantURLForAPIType:completion:]):
379         * Platform/ios/PaymentAuthorizationController.mm:
380         (-[WKPaymentAuthorizationControllerDelegate _paymentServicesMerchantURLForAPIType:completion:]):
381         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
382         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments): Deleted.
383         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
384         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
385         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
386         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
387
388 2019-03-23  Carlos Garcia Campos  <cgarcia@igalia.com>
389
390         Unreviewed. Fix GTK build after r243409.
391
392         Build failure is actually unrelated to r243409, it's yet another unified build failure that happens when source
393         file list changes.
394
395         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
396         (WebKit::WebInspectorProxy::platformShowCertificate): Use WebCore namespace for CertificateInfo parameter.
397
398 2019-03-23  Carlos Garcia Campos  <cgarcia@igalia.com>
399
400         [GTK] Remove build time dependency on Geoclue2
401         https://bugs.webkit.org/show_bug.cgi?id=195994
402
403         Reviewed by Michael Catanzaro.
404
405         Add GeoclueGeolocationProvider class to provide geolocation position updates using Geoclue2 DBus service.
406
407         * PlatformGTK.cmake:
408         * PlatformWPE.cmake:
409         * SourcesGTK.txt:
410         * SourcesWPE.txt:
411         * UIProcess/API/glib/WebKitGeolocationManager.cpp:
412         (_WebKitGeolocationPosition::_WebKitGeolocationPosition):
413         (webkitGeolocationManagerStop):
414         (webkitGeolocationManagerSetEnableHighAccuracy):
415         (webkitGeolocationManagerDispose):
416         (webkit_geolocation_manager_class_init):
417         * UIProcess/geoclue/GeoclueGeolocationProvider.cpp: Added.
418         (WebKit::GeoclueGeolocationProvider::GeoclueGeolocationProvider):
419         (WebKit::GeoclueGeolocationProvider::~GeoclueGeolocationProvider):
420         (WebKit::GeoclueGeolocationProvider::start):
421         (WebKit::GeoclueGeolocationProvider::stop):
422         (WebKit::GeoclueGeolocationProvider::setEnableHighAccuracy):
423         (WebKit::GeoclueGeolocationProvider::destroyManagerLater):
424         (WebKit::GeoclueGeolocationProvider::destroyManager):
425         (WebKit::GeoclueGeolocationProvider::setupManager):
426         (WebKit::GeoclueGeolocationProvider::createClient):
427         (WebKit::GeoclueGeolocationProvider::setupClient):
428         (WebKit::GeoclueGeolocationProvider::startClient):
429         (WebKit::GeoclueGeolocationProvider::stopClient):
430         (WebKit::GeoclueGeolocationProvider::requestAccuracyLevel):
431         (WebKit::GeoclueGeolocationProvider::clientLocationUpdatedCallback):
432         (WebKit::GeoclueGeolocationProvider::createLocation):
433         (WebKit::GeoclueGeolocationProvider::locationUpdated):
434         (WebKit::GeoclueGeolocationProvider::didFail):
435         * UIProcess/geoclue/GeoclueGeolocationProvider.h: Added.
436
437 2019-03-22  Simon Fraser  <simon.fraser@apple.com>
438
439         Undo collision with r243390.
440
441         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
442         (stringForSSLProtocol):
443
444 2019-03-22  Simon Fraser  <simon.fraser@apple.com>
445
446         Fix internal builds.
447
448         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
449         (stringForSSLProtocol):
450
451 2019-03-22  Keith Rollin  <krollin@apple.com>
452
453         Enable ThinLTO support in Production builds
454         https://bugs.webkit.org/show_bug.cgi?id=190758
455         <rdar://problem/45413233>
456
457         Reviewed by Daniel Bates.
458
459         Enable building with Thin LTO in Production when using Xcode 10.2 or
460         later. This change results in a 1.45% progression in PLT5. Full
461         Production build times increase about 2-3%. Incremental build times
462         are more severely affected, and so LTO is not enabled for local
463         engineering builds.
464
465         LTO is enabled only on macOS for now, until rdar://problem/49013399,
466         which affects ARM builds, is fixed.
467
468         To change the LTO setting when building locally:
469
470         - If building with `make`, specify WK_LTO_MODE={none,thin,full} on the
471           command line.
472         - If building with `build-webkit`, specify --lto-mode={none,thin,full}
473           on the command line.
474         - If building with `build-root`, specify --lto={none,thin,full} on the
475           command line.
476         - If building with Xcode, create a LocalOverrides.xcconfig file at the
477           top level of your repository directory (if needed) and define
478           WK_LTO_MODE to full, thin, or none.
479
480         * Configurations/Base.xcconfig:
481
482 2019-03-22  Chris Dumez  <cdumez@apple.com>
483
484         Unreviewed build fix after r243388.
485
486         * WebProcess/WebProcess.h:
487
488 2019-03-22  Per Arne Vollan  <pvollan@apple.com>
489
490         [macOS] Fix sandbox violation
491         https://bugs.webkit.org/show_bug.cgi?id=196153
492         <rdar://problem/49123855>
493
494         Reviewed by Brent Fulgham.
495
496         The sandbox on macOS is blocking the mach lookup.
497
498         * WebProcess/com.apple.WebProcess.sb.in:
499
500 2019-03-21  Ryan Haddad  <ryanhaddad@apple.com>
501
502         Unreviewed, fix the build with recent SDKs.
503
504         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
505         (stringForSSLProtocol):
506
507 2019-03-22  Chris Dumez  <cdumez@apple.com>
508
509         Implement WebProcess freezer opt-in completely on WebContent process side
510         https://bugs.webkit.org/show_bug.cgi?id=196149
511
512         Reviewed by Brady Eidson.
513
514         Implement WebProcess freezer opt-in completely on WebContent process side, we do not need
515         to involve the UIProcess with this and rely on IPC which may be fragile.
516
517         In the future, we may want to set freezable state from the UIProcess when the API supports
518         it. We can move the logic to be fully on the UIProcess side then. In the mean time, it is
519         likely best not to rely on IPC and process coordination for this.
520
521         * UIProcess/WebProcessProxy.cpp:
522         (WebKit::globalPageMap):
523         (WebKit::WebProcessProxy::WebProcessProxy):
524         (WebKit::WebProcessProxy::setIsInProcessCache):
525         (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
526         (WebKit::WebProcessProxy::didFinishLaunching):
527         (WebKit::WebProcessProxy::validateFreezerStatus): Deleted.
528         * UIProcess/WebProcessProxy.h:
529         (WebKit::WebProcessProxy::removeProvisionalPageProxy):
530         (WebKit::WebProcessProxy::WebPageProxyMap::WebPageProxyMap): Deleted.
531         (WebKit::WebProcessProxy::WebPageProxyMap::size const): Deleted.
532         (WebKit::WebProcessProxy::WebPageProxyMap::values): Deleted.
533         (WebKit::WebProcessProxy::WebPageProxyMap::values const): Deleted.
534         (WebKit::WebProcessProxy::WebPageProxyMap::begin): Deleted.
535         (WebKit::WebProcessProxy::WebPageProxyMap::end): Deleted.
536         (WebKit::WebProcessProxy::WebPageProxyMap::get): Deleted.
537         (WebKit::WebProcessProxy::WebPageProxyMap::contains const): Deleted.
538         (WebKit::WebProcessProxy::WebPageProxyMap::isEmpty const): Deleted.
539         (WebKit::WebProcessProxy::WebPageProxyMap::set): Deleted.
540         (WebKit::WebProcessProxy::WebPageProxyMap::take): Deleted.
541         * WebProcess/WebProcess.cpp:
542         (WebKit::WebProcess::setIsInProcessCache):
543         (WebKit::WebProcess::markIsNoLongerPrewarmed):
544         (WebKit::WebProcess::actualPrepareToSuspend):
545         (WebKit::WebProcess::setFreezable): Deleted.
546         * WebProcess/WebProcess.h:
547         * WebProcess/WebProcess.messages.in:
548         * WebProcess/cocoa/WebProcessCocoa.mm:
549         (WebKit::WebProcess::updateProcessName):
550         (WebKit::WebProcess::shouldFreezeOnSuspension const):
551         (WebKit::WebProcess::updateFreezerStatus):
552
553 2019-03-22  Chris Dumez  <cdumez@apple.com>
554
555         Prewarmed processes should be usable with any website data store
556         https://bugs.webkit.org/show_bug.cgi?id=196104
557
558         Reviewed by Alex Christensen.
559
560         Split WebsiteDataStore-specific data out of WebProcessCreationParameters and into a new
561         WebProcessDataStoreParameters struct so that we do not need a WebsiteDataStore in order
562         to lauch and initialize a WebProcess. When the process finally gets used and we thus
563         know which WebsiteDataStore they will be used for, we send the WebProcessDataStoreParameters
564         to the process to that it can do its data store-specific initialization.
565
566         This allows prewarmed processes not not have a WebsiteDataStore assocated with them. They
567         can then be used for any WebsiteDataStore when we need them.
568
569         This is also used by our dummy WebProcessProxy since it does not have a backing process and
570         thus has no associated WebsiteDataStore.
571
572         * Shared/WebProcessCreationParameters.cpp:
573         (WebKit::WebProcessCreationParameters::encode const):
574         (WebKit::WebProcessCreationParameters::decode):
575         * Shared/WebProcessCreationParameters.h:
576         * Shared/WebProcessDataStoreParameters.h: Added.
577         (WebKit::WebProcessDataStoreParameters::encode const):
578         (WebKit::WebProcessDataStoreParameters::decode):
579         * UIProcess/API/C/WKContext.cpp:
580         (WKContextWarmInitialProcess):
581         * UIProcess/API/Cocoa/WKProcessPool.mm:
582         (-[WKProcessPool _warmInitialProcess]):
583         * UIProcess/ServiceWorkerProcessProxy.cpp:
584         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
585         * UIProcess/WebPageProxy.cpp:
586         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
587         * UIProcess/WebProcessPool.cpp:
588         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
589         (WebKit::WebProcessPool::createNewWebProcess):
590         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
591         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
592         (WebKit::WebProcessPool::initializeNewWebProcess):
593         (WebKit::WebProcessPool::prewarmProcess):
594         (WebKit::WebProcessPool::processForRegistrableDomain):
595         (WebKit::WebProcessPool::createWebPage):
596         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
597         * UIProcess/WebProcessPool.h:
598         (WebKit::WebProcessPool::sendToOneProcess):
599         * UIProcess/WebProcessProxy.cpp:
600         (WebKit::WebProcessProxy::create):
601         (WebKit::WebProcessProxy::WebProcessProxy):
602         (WebKit::WebProcessProxy::setWebsiteDataStore):
603         (WebKit::WebProcessProxy::addExistingWebPage):
604         * UIProcess/WebProcessProxy.h:
605         (WebKit::WebProcessProxy::websiteDataStore const):
606         * WebKit.xcodeproj/project.pbxproj:
607         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
608         (WebKit::WebMediaKeyStorageManager::setWebsiteDataStore):
609         * WebProcess/MediaCache/WebMediaKeyStorageManager.h:
610         * WebProcess/WebProcess.cpp:
611         (WebKit::WebProcess::initializeWebProcess):
612         (WebKit::WebProcess::setWebsiteDataStoreParameters):
613         * WebProcess/WebProcess.h:
614         * WebProcess/WebProcess.messages.in:
615         * WebProcess/WebProcessSupplement.h:
616         (WebKit::WebProcessSupplement::initialize):
617         (WebKit::WebProcessSupplement::setWebsiteDataStore):
618         * WebProcess/cocoa/WebProcessCocoa.mm:
619         (WebKit::WebProcess::platformInitializeWebProcess):
620         (WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
621         * WebProcess/win/WebProcessWin.cpp:
622         (WebKit::WebProcess::platformInitializeWebProcess):
623         (WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
624
625 2019-03-22  Simon Fraser  <simon.fraser@apple.com>
626
627         REGRESSION (r242687): Flicker when pinch-zooming pages in macOS Safari
628         https://bugs.webkit.org/show_bug.cgi?id=196126
629         rdar://problem/49095791
630
631         Reviewed by Antti Koivisto.
632
633         The scrolling tree doesn't have an accurate picture of the main view's scroll position
634         during pinch-zooming, so don't have it apply layer positions if a transient zoom is
635         in progress.
636
637         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
638         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
639         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
640         (WebKit::TiledCoreAnimationDrawingArea::applyTransientZoomToPage):
641
642 2019-03-22  Antti Koivisto  <antti@apple.com>
643
644         Handle UI side hit testing for ScrollPositioningBehavior::Stationary positioned nodes
645         https://bugs.webkit.org/show_bug.cgi?id=196100
646         <rdar://problem/49117933>
647
648         Reviewed by Simon Fraser.
649
650         Test: fast/scrolling/ios/overflow-scroll-overlap-6.html
651
652         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
653         (WebKit::RemoteLayerTreeNode::relatedScrollContainerIDs const):
654         (WebKit::RemoteLayerTreeNode::relatedScrollContainerPositioningBehavior const):
655
656         Make more generic and save the associated positioning behavior.
657
658         (WebKit::RemoteLayerTreeNode::nonAncestorScrollContainerIDs const): Deleted.
659         (WebKit::RemoteLayerTreeNode::addNonAncestorScrollContainerID): Deleted.
660         (WebKit::RemoteLayerTreeNode::clearNonAncestorScrollContainerIDs): Deleted.
661         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
662         (WebKit::RemoteLayerTreeNode::setRelatedScrollContainerBehaviorAndIDs):
663         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
664         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
665         (WebKit::isScrolledBy):
666
667         Stationary relationship means the layer won't scroll the scroller.
668
669         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
670         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
671
672 2019-03-22  Chris Dumez  <cdumez@apple.com>
673
674         REGRESSION (r243094): ePub files do not render or open in Books
675         https://bugs.webkit.org/show_bug.cgi?id=196119
676         <rdar://problem/49121686>
677
678         Reviewed by Brady Eidson.
679
680         Do not delay the WebProcess launch until a load when contructing a web view and the client
681         may observe when its injected bundle is loaded via WKProcessGroupDelegate's
682         didCreateConnectionToWebProcessPlugIn.
683
684         * UIProcess/API/Cocoa/WKProcessGroup.mm:
685         (-[WKProcessGroup setDelegate:]):
686         * UIProcess/WebInspectorUtilities.cpp:
687         (WebKit::inspectorProcessPool):
688         * UIProcess/WebProcessPool.cpp:
689         (WebKit::WebProcessPool::createWebPage):
690         * UIProcess/WebProcessPool.h:
691
692 2019-03-22  Carlos Garcia Campos  <cgarcia@igalia.com>
693
694         REGRESSION(r243094): Automation: browser crash in WebAutomationSession::exitFullscreenWindowForPage()
695         https://bugs.webkit.org/show_bug.cgi?id=196140
696
697         Reviewed by Chris Dumez.
698
699         Since r243094, the WebPageProxy fullscreen manager is not created in the constructor, but once the page has a
700         process launched.
701
702         * UIProcess/Automation/WebAutomationSession.cpp:
703         (WebKit::WebAutomationSession::exitFullscreenWindowForPage): Null check WebPageProxy::fullScreenManager() before
704         using it.
705
706 2019-03-22  Timothy Hatcher  <timothy@apple.com>
707
708         Change macosx() to macos() in WK_API... and JSC_API... macros.
709         https://bugs.webkit.org/show_bug.cgi?id=196106
710
711         Reviewed by Brian Burg.
712
713         * Shared/API/Cocoa/WKBrowsingContextHandle.h:
714         * Shared/API/Cocoa/WKDragDestinationAction.h:
715         * Shared/API/Cocoa/WKMain.h:
716         * Shared/API/Cocoa/_WKFrameHandle.h:
717         * Shared/API/Cocoa/_WKHitTestResult.h:
718         * Shared/API/Cocoa/_WKNSWindowExtras.h:
719         * Shared/API/Cocoa/_WKRemoteObjectInterface.h:
720         * Shared/API/Cocoa/_WKRemoteObjectRegistry.h:
721         * Shared/API/Cocoa/_WKRenderingProgressEvents.h:
722         * Shared/API/Cocoa/_WKSameDocumentNavigationType.h:
723         * UIProcess/API/C/WKPage.h:
724         * UIProcess/API/Cocoa/NSAttributedString.h:
725         * UIProcess/API/Cocoa/WKBackForwardList.h:
726         * UIProcess/API/Cocoa/WKBackForwardListItem.h:
727         * UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h:
728         * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegate.h:
729         * UIProcess/API/Cocoa/WKContentRuleList.h:
730         * UIProcess/API/Cocoa/WKContentRuleListStore.h:
731         * UIProcess/API/Cocoa/WKError.h:
732         * UIProcess/API/Cocoa/WKErrorPrivate.h:
733         * UIProcess/API/Cocoa/WKFrameInfo.h:
734         * UIProcess/API/Cocoa/WKFrameInfoPrivate.h:
735         * UIProcess/API/Cocoa/WKHTTPCookieStore.h:
736         * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h:
737         * UIProcess/API/Cocoa/WKNavigation.h:
738         * UIProcess/API/Cocoa/WKNavigationAction.h:
739         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
740         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
741         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
742         * UIProcess/API/Cocoa/WKNavigationResponse.h:
743         * UIProcess/API/Cocoa/WKOpenPanelParameters.h:
744         * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h:
745         * UIProcess/API/Cocoa/WKPreferences.h:
746         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
747         * UIProcess/API/Cocoa/WKProcessPool.h:
748         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
749         * UIProcess/API/Cocoa/WKScriptMessage.h:
750         * UIProcess/API/Cocoa/WKSecurityOrigin.h:
751         * UIProcess/API/Cocoa/WKSnapshotConfiguration.h:
752         * UIProcess/API/Cocoa/WKUIDelegate.h:
753         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
754         * UIProcess/API/Cocoa/WKURLSchemeHandler.h:
755         * UIProcess/API/Cocoa/WKURLSchemeTask.h:
756         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
757         * UIProcess/API/Cocoa/WKUserContentController.h:
758         * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
759         * UIProcess/API/Cocoa/WKUserScript.h:
760         * UIProcess/API/Cocoa/WKUserScriptPrivate.h:
761         * UIProcess/API/Cocoa/WKViewPrivate.h:
762         * UIProcess/API/Cocoa/WKWebView.h:
763         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
764         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
765         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
766         * UIProcess/API/Cocoa/WKWebsiteDataRecord.h:
767         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
768         * UIProcess/API/Cocoa/WKWebsiteDataStore.h:
769         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
770         * UIProcess/API/Cocoa/WKWindowFeatures.h:
771         * UIProcess/API/Cocoa/WKWindowFeaturesPrivate.h:
772         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
773         * UIProcess/API/Cocoa/_WKApplicationManifest.h:
774         * UIProcess/API/Cocoa/_WKAttachment.h:
775         * UIProcess/API/Cocoa/_WKAutomationDelegate.h:
776         * UIProcess/API/Cocoa/_WKAutomationSession.h:
777         * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h:
778         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
779         * UIProcess/API/Cocoa/_WKContextMenuElementInfo.h:
780         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
781         * UIProcess/API/Cocoa/_WKDownload.h:
782         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
783         * UIProcess/API/Cocoa/_WKElementAction.h:
784         * UIProcess/API/Cocoa/_WKExperimentalFeature.h:
785         * UIProcess/API/Cocoa/_WKFindOptions.h:
786         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
787         * UIProcess/API/Cocoa/_WKFormInputSession.h:
788         * UIProcess/API/Cocoa/_WKFullscreenDelegate.h:
789         * UIProcess/API/Cocoa/_WKGeolocationCoreLocationProvider.h:
790         * UIProcess/API/Cocoa/_WKInspector.h:
791         * UIProcess/API/Cocoa/_WKInspectorWindow.h:
792         * UIProcess/API/Cocoa/_WKInternalDebugFeature.h:
793         * UIProcess/API/Cocoa/_WKLayoutMode.h:
794         * UIProcess/API/Cocoa/_WKLinkIconParameters.h:
795         * UIProcess/API/Cocoa/_WKOverlayScrollbarStyle.h:
796         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
797         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h:
798         * UIProcess/API/Cocoa/_WKSessionState.h:
799         * UIProcess/API/Cocoa/_WKTextInputContext.h:
800         * UIProcess/API/Cocoa/_WKThumbnailView.h:
801         * UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:
802         * UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h:
803         * UIProcess/API/Cocoa/_WKUserContentFilter.h:
804         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
805         * UIProcess/API/Cocoa/_WKUserContentWorld.h:
806         * UIProcess/API/Cocoa/_WKUserInitiatedAction.h:
807         * UIProcess/API/Cocoa/_WKUserStyleSheet.h:
808         * UIProcess/API/Cocoa/_WKVisitedLinkStore.h:
809         * UIProcess/API/Cocoa/_WKWebsiteDataSize.h:
810         * UIProcess/API/Cocoa/_WKWebsiteDataStore.h:
811         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
812         * UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h:
813         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
814         * WebProcess/API/Cocoa/WKWebProcess.h:
815         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h:
816         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
817         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.h:
818         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
819         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
820         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroup.h:
821         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h:
822         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.h:
823         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h:
824         * WebProcess/InjectedBundle/API/mac/WKDOMElement.h:
825         * WebProcess/InjectedBundle/API/mac/WKDOMNode.h:
826         * WebProcess/InjectedBundle/API/mac/WKDOMRange.h:
827         * WebProcess/InjectedBundle/API/mac/WKDOMText.h:
828         * WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.h:
829         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
830         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h:
831         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
832
833 2019-03-22  Yousuke Kimoto  <Yousuke.Kimoto@sony.com>
834
835         Unreviewed build fix.
836
837         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
838
839 2019-03-22  Tim Horton  <timothy_horton@apple.com>
840
841         Fix the build after r243354
842         https://bugs.webkit.org/show_bug.cgi?id=196138
843         <rdar://problem/49145951>
844
845         * Platform/spi/ios/UIKitSPI.h:
846         * Shared/DocumentEditingContext.mm:
847         (WebKit::DocumentEditingContext::toPlatformContext):
848         * UIProcess/ios/WKContentViewInteraction.mm:
849
850 2019-03-21  Simon Fraser  <simon.fraser@apple.com>
851
852         Clean up some TiledCoreAnimationDrawingArea members
853         https://bugs.webkit.org/show_bug.cgi?id=196124
854
855         Reviewed by Tim Horton.
856
857         The giant m_transform was unused.
858         
859         Group the bools etc.
860
861         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
862         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
863         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
864         (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer):
865
866 2019-03-21  Brady Eidson  <beidson@apple.com>
867
868         Certain WebProcesses should opt-out of the freezer.
869         <rdar://problem/42846139> and https://bugs.webkit.org/show_bug.cgi?id=196062
870
871         Reviewed by Andy Estes.
872
873         WebProcesses should opt-in and opt-out of the freezer as is appropriate.
874         By default a WebProcess is freezer eligible.
875         If any of the following become true then it should become ineligible:
876         - The WebProcess is a pre-warmed process.
877         - The WebProcess is in the process cache.
878         - The WebProcess is not actively hosting any web pages (e.g. it only has suspending web pages)
879
880         The most complicated part of the above is guaranteeing that any operation that changes
881         the active pages hosted by the process causes a recalculation of the freezer opt-in state.
882
883         To do that this replaces the basic WebPageProxyMap with a custom class.
884
885         * UIProcess/WebProcessProxy.cpp:
886         (WebKit::globalPageMap):
887         (WebKit::WebProcessProxy::WebProcessProxy):
888         (WebKit::WebProcessProxy::validateFreezerStatus):
889         (WebKit::WebProcessProxy::setIsInProcessCache):
890         (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
891         (WebKit::WebProcessProxy::didFinishLaunching):
892         * UIProcess/WebProcessProxy.h:
893         (WebKit::WebProcessProxy::WebPageProxyMap::WebPageProxyMap):
894         (WebKit::WebProcessProxy::WebPageProxyMap::size const):
895         (WebKit::WebProcessProxy::WebPageProxyMap::values):
896         (WebKit::WebProcessProxy::WebPageProxyMap::values const):
897         (WebKit::WebProcessProxy::WebPageProxyMap::begin):
898         (WebKit::WebProcessProxy::WebPageProxyMap::end):
899         (WebKit::WebProcessProxy::WebPageProxyMap::get):
900         (WebKit::WebProcessProxy::WebPageProxyMap::contains const):
901         (WebKit::WebProcessProxy::WebPageProxyMap::isEmpty const):
902         (WebKit::WebProcessProxy::WebPageProxyMap::set):
903         (WebKit::WebProcessProxy::WebPageProxyMap::take):
904
905         * WebProcess/WebProcess.cpp:
906         (WebKit::WebProcess::setFreezable):
907         * WebProcess/WebProcess.h:
908         * WebProcess/WebProcess.messages.in:
909
910 2019-03-21  Tim Horton  <timothy_horton@apple.com>
911
912         Adopt UIWKDocumentContext
913         https://bugs.webkit.org/show_bug.cgi?id=196040
914         <rdar://problem/48642440>
915
916         Reviewed by Ryosuke Niwa.
917
918         * Platform/spi/ios/UIKitSPI.h:
919         * Scripts/webkit/messages.py:
920         * Shared/DocumentEditingContext.h: Added.
921         * Shared/DocumentEditingContext.mm: Added.
922         (WebKit::toNSRange):
923         (WebKit::DocumentEditingContext::toPlatformContext):
924         (IPC::ArgumentCoder<WebKit::DocumentEditingContext::Range>::encode):
925         (IPC::ArgumentCoder<WebKit::DocumentEditingContext::Range>::decode):
926         (IPC::ArgumentCoder<WebKit::DocumentEditingContext::TextRect>::encode):
927         (IPC::ArgumentCoder<WebKit::DocumentEditingContext::TextRect>::decode):
928         (IPC::ArgumentCoder<WebKit::DocumentEditingContext>::encode):
929         (IPC::ArgumentCoder<WebKit::DocumentEditingContext>::decode):
930         (IPC::ArgumentCoder<WebKit::DocumentEditingContextRequest>::encode):
931         (IPC::ArgumentCoder<WebKit::DocumentEditingContextRequest>::decode):
932         Add DocumentEditingContext(Request), and coders.
933         Also expose DocumentEditingContext::toPlatformContext, which populates
934         a UIWKDocumentContext with the relevant values.
935
936         * SourcesCocoa.txt:
937         * UIProcess/WebPageProxy.h:
938         * UIProcess/ios/WKContentViewInteraction.mm:
939         (toWebDocumentRequestOptions):
940         (toWebRequest):
941         (-[WKContentView adjustSelectionWithDelta:completionHandler:]):
942         (-[WKContentView requestDocumentContext:completionHandler:]):
943         (-[WKContentView selectPositionAtPoint:withContextRequest:completionHandler:]):
944         * UIProcess/ios/WebPageProxyIOS.mm:
945         (WebKit::WebPageProxy::adjustSelectionWithDelta):
946         (WebKit::WebPageProxy::requestDocumentEditingContext):
947         * WebKit.xcodeproj/project.pbxproj:
948         * WebProcess/WebPage/WebPage.h:
949         * WebProcess/WebPage/WebPage.messages.in:
950         Plumb DocumentEditingContext(Request) around.
951
952         * WebProcess/WebPage/ios/WebPageIOS.mm:
953         (WebKit::WebPage::adjustSelectionWithDelta):
954         Adjust the current selection given deltas to apply to the location and length.
955
956         (WebKit::visiblePositionAdjacentToVisiblePosition):
957         (WebKit::visiblePositionForPointInRootViewCoordinates):
958         (WebKit::WebPage::requestDocumentEditingContext):
959         Retrieve the relevant part of the selection, as well as the context,
960         given either the selection, or a rect.
961         If we're collecting context for a rect, we split the context between
962         before and after (except for the part that intersects the selection).
963         The three strings will always be directly adjacent, and any of the three
964         can sometimes be null.
965
966 2019-03-21  James Magahern  <jmagahern@apple.com>
967
968         Long press gesture recognizers in WKWebView are conflicting with internal scroll view long press gesture recognizers
969         https://bugs.webkit.org/show_bug.cgi?id=195726
970         rdar://problem/48582449
971
972         Reviewed by Megan Gardner.
973
974         We just need to add another clause to WKContentViewInteraction's
975         canPreventGestureRecognizer whitelist. 
976
977         * UIProcess/ios/WKContentViewInteraction.mm:
978         (-[WKContentView gestureRecognizer:canPreventGestureRecognizer:]):
979
980 2019-03-21  Simon Fraser  <simon.fraser@apple.com>
981
982         [iOS WK2] Turn on async overflow scrolling by default
983         https://bugs.webkit.org/show_bug.cgi?id=196011
984         rdar://problem/48453859
985
986         Reviewed by Antti Koivisto.
987
988         * Shared/WebPreferences.yaml:
989         * Shared/WebPreferencesDefaultValues.h:
990
991 2019-03-21  Alex Christensen  <achristensen@webkit.org>
992
993         Remove last use of LegacySync IPC messages
994         https://bugs.webkit.org/show_bug.cgi?id=196113
995
996         Reviewed by Chris Dumez.
997
998         Also rename "Delayed" to "Synchronous" now that there's only one type of synchronous message.
999
1000         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1001         * NetworkProcess/NetworkProcess.messages.in:
1002         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
1003         (WebKit::WebSWServerConnection::syncTerminateWorkerFromClient):
1004         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
1005         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
1006         * Platform/IPC/Connection.cpp:
1007         (IPC::Connection::dispatchMessage):
1008         * Platform/IPC/HandleMessage.h:
1009         (IPC::handleMessageSynchronous):
1010         (IPC::handleMessageSynchronousWantsConnection):
1011         (IPC::handleMessageLegacySync): Deleted.
1012         (IPC::handleMessageDelayed): Deleted.
1013         (IPC::handleMessageDelayedWantsConnection): Deleted.
1014         * PluginProcess/PluginControllerProxy.messages.in:
1015         * PluginProcess/WebProcessConnection.messages.in:
1016         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
1017         (WebKit::WebPage::didReceiveSyncWebPageMessage):
1018         * Scripts/webkit/MessageReceiver-expected.cpp:
1019         (WebKit::WebPage::didReceiveSyncMessage):
1020         * Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
1021         (Messages::WebPage::TestSyncMessage::send):
1022         (Messages::WebPage::TestSynchronousMessage::send):
1023         (WebKit::WebPage::didReceiveSyncMessage):
1024         (Messages::WebPage::TestDelayedMessage::send): Deleted.
1025         * Scripts/webkit/MessagesSuperclass-expected.h:
1026         (Messages::WebPage::TestSynchronousMessage::name):
1027         (Messages::WebPage::TestSynchronousMessage::TestSynchronousMessage):
1028         (Messages::WebPage::TestDelayedMessage::receiverName): Deleted.
1029         (Messages::WebPage::TestDelayedMessage::name): Deleted.
1030         (Messages::WebPage::TestDelayedMessage::TestDelayedMessage): Deleted.
1031         (Messages::WebPage::TestDelayedMessage::arguments const): Deleted.
1032         * Scripts/webkit/messages.py:
1033         * Scripts/webkit/messages_unittest.py:
1034         * Scripts/webkit/test-legacy-messages.in:
1035         * Scripts/webkit/test-messages.in:
1036         * Scripts/webkit/test-superclass-messages.in:
1037         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
1038         * Shared/Plugins/NPObjectMessageReceiver.messages.in:
1039         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
1040         * UIProcess/Plugins/PluginProcessProxy.messages.in:
1041         * UIProcess/WebFullScreenManagerProxy.messages.in:
1042         * UIProcess/WebPageProxy.messages.in:
1043         * UIProcess/WebPasteboardProxy.messages.in:
1044         * UIProcess/WebProcessPool.messages.in:
1045         * UIProcess/WebProcessProxy.messages.in:
1046         * UIProcess/WebStorage/StorageManager.messages.in:
1047         * UIProcess/mac/SecItemShimProxy.messages.in:
1048         * WebProcess/Plugins/PluginProcessConnection.messages.in:
1049         * WebProcess/Plugins/PluginProxy.messages.in:
1050         * WebProcess/Storage/WebSWClientConnection.cpp:
1051         (WebKit::WebSWClientConnection::syncTerminateWorker):
1052         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1053         * WebProcess/WebPage/WebPage.messages.in:
1054         * WebProcess/WebProcess.messages.in:
1055
1056 2019-03-21  Brian Burg  <bburg@apple.com>
1057
1058         Web Automation: support uploading non-local file paths
1059         https://bugs.webkit.org/show_bug.cgi?id=196081
1060         <rdar://problem/45819897>
1061
1062         Reviewed by Devin Rousso and Joseph Pecoraro.
1063
1064         To support cases where supplied file paths do not exist on the session host, add support for
1065         receiving file contents via Automation.setFilesToSelectForFileUpload.
1066
1067         * UIProcess/Automation/Automation.json: Add new parameter.
1068
1069         * UIProcess/Automation/WebAutomationSession.h:
1070         * UIProcess/Automation/WebAutomationSession.cpp:
1071         (WebKit::WebAutomationSession::setFilesToSelectForFileUpload):
1072         Add support for receiving and saving file contents to a temporary directory. Rewrite the used paths so
1073         that WebCore knows to look at the revised paths where the file contents have been saved.
1074
1075         (WebKit::WebAutomationSession::platformGenerateLocalFilePathForRemoteFile):
1076         Since WebKit does not have usable FileSystem implementations for all ports, shell out the actual
1077         saving of base64-encoded file data. Provide a Cocoa implementation, since that's what I can test.
1078
1079         * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
1080         (WebKit::WebAutomationSession::platformGenerateLocalFilePathForRemoteFile):
1081         Use WTF::FileSystem to create a temporary directory, and use Cocoa methods to actually write the file.
1082
1083 2019-03-21  Youenn Fablet  <youenn@apple.com>
1084
1085         Cache API and IDB space usages should be initialized on first quota check
1086         https://bugs.webkit.org/show_bug.cgi?id=195707
1087
1088         Reviewed by Chris Dumez.
1089
1090         When the quota manager is created, make sure it delays quota check decisions until IDB and Cache API quota users are initialized.
1091         For IDB, the creation is synchronous but it may not be synchronous for Cache API.
1092         For that purpose, add a temporary quota user that will stay uninitialized until these two quota users are added.
1093         Once added, the temporary quota user is removed.
1094         The addition of the real users is made asynchronously as this is triggered by the creation of one of the two quota users.
1095
1096         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.
1097
1098         * NetworkProcess/NetworkProcess.cpp:
1099         (WebKit::QuotaUserInitializer::initialize):
1100         (WebKit::QuotaUserInitializer::~QuotaUserInitializer):
1101         (WebKit::QuotaUserInitializer::QuotaUserInitializer):
1102         (WebKit::NetworkProcess::storageQuotaManager):
1103         * NetworkProcess/cache/CacheStorageEngine.cpp:
1104         (WebKit::CacheStorage::Engine::initializeQuotaUser):
1105         * NetworkProcess/cache/CacheStorageEngine.h:
1106         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1107         (WebKit::CacheStorage::Caches::clear):
1108
1109 2019-03-21  Per Arne Vollan  <pvollan@apple.com>
1110
1111         [iOS][macOS] Fix sandbox call violations
1112         https://bugs.webkit.org/show_bug.cgi?id=195809
1113         <rdar://problem/48829655>
1114
1115         Reviewed by Brent Fulgham.
1116
1117         An additional syscall needs to be added to the sandbox allow list.
1118
1119         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1120         * WebProcess/com.apple.WebProcess.sb.in:
1121
1122 2019-03-21  Eric Carlson  <eric.carlson@apple.com>
1123
1124         Add UI process WebRTC runtime logging.
1125         https://bugs.webkit.org/show_bug.cgi?id=196020
1126         <rdar://problem/49071443>
1127
1128         Reviewed by Youenn Fablet.
1129
1130         * Platform/Logging.cpp:
1131         (WebKit::getLogChannel): New.
1132         * Platform/Logging.h:
1133         * Shared/WebCoreArgumentCoders.h: Add coders for WTFLogChannelState and WTFLogLevel.
1134
1135         Add runtime logging.
1136         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1137         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy):
1138         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture):
1139         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
1140         (WebKit::UserMediaPermissionRequestManagerProxy::clearCachedState):
1141         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
1142         (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest):
1143         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
1144         (WebKit::UserMediaPermissionRequestManagerProxy::resetAccess):
1145         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess):
1146         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
1147         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
1148         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionInvalidRequest):
1149         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest):
1150         (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
1151         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
1152         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged):
1153         (WebKit::UserMediaPermissionRequestManagerProxy::watchdogTimerFired):
1154         (WebKit::UserMediaPermissionRequestManagerProxy::logChannel const):
1155         (WebKit::convertEnumerationToString):
1156
1157         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1158         (WTF::LogArgument<WebKit::UserMediaPermissionRequestManagerProxy::RequestAction>::toString):
1159         * UIProcess/UserMediaPermissionRequestProxy.cpp:
1160         (WebKit::convertEnumerationToString): Add an enum specialization for logging.
1161
1162         * UIProcess/UserMediaPermissionRequestProxy.h:
1163         (WTF::LogArgument<WebKit::UserMediaPermissionRequestProxy::UserMediaAccessDenialReason>::toString): Ditto.
1164
1165         * UIProcess/WebPageProxy.cpp:
1166         (WebKit::WebPageProxy::logger):
1167         (WebKit::WebPageProxy::configureLoggingChannel):
1168         * UIProcess/WebPageProxy.h:
1169         * UIProcess/WebPageProxy.messages.in:
1170
1171         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1172         (WebKit::WebChromeClient::configureLoggingChannel):
1173         * WebProcess/WebCoreSupport/WebChromeClient.h:
1174         * WebProcess/WebPage/WebPage.cpp:
1175         (WebKit::WebPage::configureLoggingChannel):
1176         * WebProcess/WebPage/WebPage.h:
1177
1178 2019-03-21  Alex Christensen  <achristensen@webkit.org>
1179
1180         Stop using LegacySync messages in WebPageProxy
1181         https://bugs.webkit.org/show_bug.cgi?id=196056
1182
1183         Reviewed by Chris Dumez.
1184
1185         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1186         (WebKit::WebPageProxy::loadRecentSearches):
1187         * UIProcess/ProvisionalPageProxy.cpp:
1188         (WebKit::ProvisionalPageProxy::backForwardGoToItem):
1189         (WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
1190         * UIProcess/ProvisionalPageProxy.h:
1191         * UIProcess/WebPageProxy.cpp:
1192         (WebKit::WebPageProxy::handleSynchronousMessage):
1193         (WebKit::WebPageProxy::hasInsecureContent):
1194         (WebKit::WebPageProxy::accessibilityScreenToRootView):
1195         (WebKit::WebPageProxy::rootViewToAccessibilityScreen):
1196         (WebKit::WebPageProxy::printFrame):
1197         (WebKit::WebPageProxy::backForwardGoToItem):
1198         (WebKit::WebPageProxy::backForwardGoToItemShared):
1199         (WebKit::WebPageProxy::backForwardItemAtIndex):
1200         (WebKit::WebPageProxy::backForwardBackListCount):
1201         (WebKit::WebPageProxy::backForwardForwardListCount):
1202         (WebKit::WebPageProxy::canUndoRedo):
1203         (WebKit::WebPageProxy::executeUndoRedo):
1204         (WebKit::WebPageProxy::checkTextOfParagraph):
1205         (WebKit::WebPageProxy::checkSpellingOfString):
1206         (WebKit::WebPageProxy::checkGrammarOfString):
1207         (WebKit::WebPageProxy::spellingUIIsShowing):
1208         (WebKit::WebPageProxy::getGuessesForWord):
1209         (WebKit::WebPageProxy::substitutionsPanelIsShowing):
1210         (WebKit::WebPageProxy::showCorrectionPanel):
1211         (WebKit::WebPageProxy::dismissCorrectionPanel):
1212         (WebKit::WebPageProxy::dismissCorrectionPanelSoon):
1213         (WebKit::WebPageProxy::recordAutocorrectionResponse):
1214         (WebKit::WebPageProxy::dictationAlternatives):
1215         (WebKit::WebPageProxy::wrapCryptoKey):
1216         (WebKit::WebPageProxy::unwrapCryptoKey):
1217         (WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
1218         (WebKit::WebPageProxy::serializedAttachmentDataForIdentifiers):
1219         (WebKit::WebPageProxy::speechSynthesisVoiceList):
1220         (WebKit::WebPageProxy::printMainFrame): Deleted.
1221         * UIProcess/WebPageProxy.h:
1222         * UIProcess/WebPageProxy.messages.in:
1223         * UIProcess/gtk/WebPageProxyGtk.cpp:
1224         (WebKit::WebPageProxy::createPluginContainer):
1225         * UIProcess/ios/WebPageProxyIOS.mm:
1226         (WebKit::WebPageProxy::interpretKeyEvent):
1227         * UIProcess/mac/WebPageProxyMac.mm:
1228         (WebKit::WebPageProxy::getIsSpeaking):
1229         (WebKit::WebPageProxy::executeSavedCommandBySelector):
1230         (WebKit::WebPageProxy::showPDFContextMenu):
1231
1232 2019-03-21  Alex Christensen  <achristensen@webkit.org>
1233
1234         Stop using LegacySync messages in WebPage
1235         https://bugs.webkit.org/show_bug.cgi?id=196057
1236
1237         Reviewed by Chris Dumez.
1238
1239         * WebProcess/WebPage/WebPage.h:
1240         (WebKit::WebPage::markLayersVolatile):
1241         * WebProcess/WebPage/WebPage.messages.in:
1242         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1243         (WebKit::WebPage::getCenterForZoomGesture):
1244         * WebProcess/WebPage/ios/WebPageIOS.mm:
1245         (WebKit::WebPage::readSelectionFromPasteboard):
1246         (WebKit::WebPage::getStringSelectionForPasteboard):
1247         (WebKit::WebPage::getDataSelectionForPasteboard):
1248         (WebKit::WebPage::shouldDelayWindowOrderingEvent):
1249         (WebKit::WebPage::acceptsFirstMouse):
1250         * WebProcess/WebPage/mac/WebPageMac.mm:
1251         (WebKit::WebPage::replaceSelectionWithPasteboardData):
1252         (WebKit::WebPage::readSelectionFromPasteboard):
1253         (WebKit::WebPage::getStringSelectionForPasteboard):
1254         (WebKit::WebPage::getDataSelectionForPasteboard):
1255         (WebKit::WebPage::shouldDelayWindowOrderingEvent):
1256         (WebKit::WebPage::acceptsFirstMouse):
1257
1258 2019-03-21  Alex Christensen  <achristensen@webkit.org>
1259
1260         Stop using LegacySync messages in WebPasteboardProxy
1261         https://bugs.webkit.org/show_bug.cgi?id=196060
1262
1263         Reviewed by Chris Dumez.
1264
1265         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
1266         (WebKit::WebPasteboardProxy::getPasteboardTypes):
1267         (WebKit::WebPasteboardProxy::getPasteboardPathnamesForType):
1268         (WebKit::WebPasteboardProxy::getPasteboardStringForType):
1269         (WebKit::WebPasteboardProxy::getPasteboardStringsForType):
1270         (WebKit::WebPasteboardProxy::getPasteboardBufferForType):
1271         (WebKit::WebPasteboardProxy::pasteboardCopy):
1272         (WebKit::WebPasteboardProxy::getPasteboardChangeCount):
1273         (WebKit::WebPasteboardProxy::getPasteboardUniqueName):
1274         (WebKit::WebPasteboardProxy::getPasteboardColor):
1275         (WebKit::WebPasteboardProxy::getPasteboardURL):
1276         (WebKit::WebPasteboardProxy::addPasteboardTypes):
1277         (WebKit::WebPasteboardProxy::setPasteboardTypes):
1278         (WebKit::WebPasteboardProxy::setPasteboardURL):
1279         (WebKit::WebPasteboardProxy::setPasteboardColor):
1280         (WebKit::WebPasteboardProxy::setPasteboardStringForType):
1281         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
1282         (WebKit::WebPasteboardProxy::getNumberOfFiles):
1283         (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
1284         (WebKit::WebPasteboardProxy::writeCustomData):
1285         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
1286         (WebKit::WebPasteboardProxy::readURLFromPasteboard):
1287         (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
1288         (WebKit::WebPasteboardProxy::getPasteboardItemsCount):
1289         (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
1290         (WebKit::WebPasteboardProxy::informationForItemAtIndex):
1291         * UIProcess/WebPasteboardProxy.cpp:
1292         (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
1293         (WebKit::WebPasteboardProxy::writeCustomData):
1294         * UIProcess/WebPasteboardProxy.h:
1295         * UIProcess/WebPasteboardProxy.messages.in:
1296         * UIProcess/gtk/WebPasteboardProxyGtk.cpp:
1297         (WebKit::WebPasteboardProxy::writeToClipboard):
1298         (WebKit::WebPasteboardProxy::readFromClipboard):
1299         * UIProcess/wpe/WebPasteboardProxyWPE.cpp:
1300         (WebKit::WebPasteboardProxy::getPasteboardTypes):
1301         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
1302         (WebKit::WebPasteboardProxy::writeWebContentToPasteboard):
1303         (WebKit::WebPasteboardProxy::writeStringToPasteboard):
1304
1305 2019-03-21  Andy Estes  <aestes@apple.com>
1306
1307         [iOS] Apple Pay should be available in documents with no user agent scripts
1308         https://bugs.webkit.org/show_bug.cgi?id=196061
1309         <rdar://problem/48649391>
1310
1311         Reviewed by Brady Eidson.
1312
1313         * Shared/AuxiliaryProcess.h:
1314         * Shared/Cocoa/AuxiliaryProcessCocoa.mm:
1315         (WebKit::AuxiliaryProcess::parentProcessHasEntitlement):
1316
1317         Added a convenience function for checking parent process entitlements.
1318
1319         * Shared/WebPreferences.yaml:
1320         * Shared/WebPreferencesDefaultValues.h:
1321         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1322         (-[WKWebViewConfiguration init]):
1323
1324         Enabled Apple Pay by default on platforms that enable APPLE_PAY_REMOTE_UI.
1325
1326         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
1327         (WebKit::WebPaymentCoordinator::supportsUnrestrictedApplePay const):
1328         * WebProcess/ApplePay/WebPaymentCoordinator.h:
1329
1330         Implemented supportsUnrestrictedApplePay by checking for the
1331         com.apple.private.WebKit.UnrestrictedApplePay entitlement on platforms that enable
1332         APPLE_PAY_REMOTE_UI.
1333
1334         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
1335         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1336         (didClearWindowObjectForFrame):
1337         (setUpPageLoaderClient):
1338
1339         Added injected bundle SPI that TestWebKitAPI uses to inject the WebCore Internals interface.
1340
1341         * WebProcess/WebPage/WebPage.cpp:
1342         (WebKit::WebPage::runJavaScript):
1343
1344         Changed to call ScriptController::executeUserAgentScriptInWorld.
1345
1346 2019-03-21  Chris Dumez  <cdumez@apple.com>
1347
1348         WebKit should throw when trying to create a WKWebView with a related view that is using a different data store
1349         https://bugs.webkit.org/show_bug.cgi?id=196041
1350         <rdar://problem/49083230>
1351
1352         Reviewed by Alex Christensen.
1353
1354         WebKit should throw when trying to create a WKWebView with a related view that is using a different data store.
1355         We do not support having several WebsiteDataStores sharing the same WebProcess.
1356
1357         * UIProcess/API/Cocoa/WKWebView.mm:
1358         (-[WKWebView _initializeWithConfiguration:]):
1359         * UIProcess/WebProcessPool.cpp:
1360         (WebKit::WebProcessPool::createWebPage):
1361
1362 2019-03-21  Alex Christensen  <achristensen@webkit.org>
1363
1364         Add SPI to inform applications of WKContentRuleList actions
1365         https://bugs.webkit.org/show_bug.cgi?id=195965
1366         <rdar://problem/42664365>
1367
1368         Reviewed by Geoff Garen.
1369
1370         * NetworkProcess/NetworkLoadChecker.cpp:
1371         (WebKit::NetworkLoadChecker::checkRequest):
1372         (WebKit::NetworkLoadChecker::processContentRuleListsForLoad):
1373         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad): Deleted.
1374         * NetworkProcess/NetworkLoadChecker.h:
1375         * UIProcess/API/APINavigationClient.h:
1376         (API::NavigationClient::contentRuleListNotification):
1377         * UIProcess/API/C/WKPage.cpp:
1378         (WKPageSetPageNavigationClient):
1379         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1380         * UIProcess/Cocoa/NavigationState.h:
1381         * UIProcess/Cocoa/NavigationState.mm:
1382         (WebKit::NavigationState::setNavigationDelegate):
1383         (WebKit::NavigationState::NavigationClient::contentRuleListNotification):
1384         * UIProcess/WebPageProxy.cpp:
1385         (WebKit::WebPageProxy::contentRuleListNotification):
1386         * UIProcess/WebPageProxy.h:
1387         * UIProcess/WebPageProxy.messages.in:
1388         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1389         (WebKit::WebChromeClient::contentRuleListNotification):
1390         * WebProcess/WebCoreSupport/WebChromeClient.h:
1391
1392 2019-03-21  Simon Fraser  <simon.fraser@apple.com>
1393
1394         Add an internal feature flag to disable the -webkit-overflow-scrolling CSS property
1395         https://bugs.webkit.org/show_bug.cgi?id=196058
1396         rdar://problem/49078202
1397
1398         Reviewed by Antti Koivisto.
1399
1400         Add an internal feature flag called "LegacyOverflowScrollingTouchEnabled", initially
1401         on by default.
1402
1403         * Shared/WebPreferences.yaml:
1404
1405 2019-03-21  Antti Koivisto  <antti@apple.com>
1406
1407         UI-process hit-testing needs to know about containing block relationships
1408         https://bugs.webkit.org/show_bug.cgi?id=195845
1409         <rdar://problem/48949633>
1410
1411         Reviewed by Simon Fraser.
1412
1413         Test: fast/scrolling/ios/overflow-scroll-overlap-5.html
1414
1415         When an overflow scroller contains a positioned element the element may not be on a descendant layer of the scroller,
1416         yet should move along with it. This needs to be taken into account in UI-side hit testing.
1417
1418         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
1419         (WebKit::RemoteLayerTreeNode::nonAncestorScrollContainerIDs const):
1420         (WebKit::RemoteLayerTreeNode::addNonAncestorScrollContainerID):
1421         (WebKit::RemoteLayerTreeNode::clearNonAncestorScrollContainerIDs):
1422
1423         Maintain non-ancestor scrolling relationships for layers.
1424
1425         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1426         (WebKit::RemoteScrollingCoordinatorProxy::commitScrollingTreeState):
1427         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
1428         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
1429         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1430         (WebKit::isScrolledBy):
1431
1432         Helper to figure out who scrolls who.
1433
1434         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
1435         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1436         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
1437
1438         After commit, pull the non-ancestor scrolling relationships from the scrolling tree and update the layer tree.
1439
1440 2019-03-21  Daniel Bates  <dabates@apple.com>
1441
1442         [iOS] Inline -_ensureFormAccessoryView into -formAccessoryView and have -_updateAccessory ensure we have a form accessory
1443         https://bugs.webkit.org/show_bug.cgi?id=196021
1444
1445         Reviewed by Wenson Hsieh.
1446
1447         Every caller of -_ensureFormAccessoryView, except -formAccessoryView, immediately follows the call
1448         with a call to -_updateAccessory. Let's just have -_updateAccessory ensure we have a form accessory
1449         view and inline the implementation of -_ensureFormAccessoryView into -formAccessoryView so we can
1450         remove one method.
1451
1452         * UIProcess/ios/WKContentViewInteraction.mm:
1453         (-[WKContentView inputView]): Remove call to -_ensureFormAccessoryView, -_updateAccessory will do
1454         the equivalent work for us.
1455         (-[WKContentView formAccessoryView]): Moved implementation of -_ensureFormAccessoryView into here.
1456         (-[WKContentView _updateAccessory]): Call self.formAccessoryView to ensure we have a form accessory view.
1457         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1458         Remove call to -_ensureFormAccessoryView, -_updateAccessory will do
1459         the equivalent work for us.
1460         (-[WKContentView _ensureFormAccessoryView]): Deleted.
1461
1462 2019-03-21  Shawn Roberts  <sroberts@apple.com>
1463
1464         Unreviewed, rolling out r243250.
1465
1466         Causing 109 Failures and 2 crashes on iOS Sim Debug
1467         OpenSource/Internal queues
1468
1469         Reverted changeset:
1470
1471         "[iOS WK2] Turn on async overflow scrolling by default"
1472         https://bugs.webkit.org/show_bug.cgi?id=196011
1473         https://trac.webkit.org/changeset/243250
1474
1475 2019-03-21  Brent Fulgham  <bfulgham@apple.com>
1476
1477         Fix possible memory leak when dismissing a color picker
1478         https://bugs.webkit.org/show_bug.cgi?id=196026
1479         <rdar://problem/48778568>
1480
1481         Reviewed by Wenson Hsieh.
1482
1483         Fix a problem with WebPageProxy::endColorPicker where an early return could leave a color picker
1484         with a +1 reference count after dismissing it.
1485
1486         * UIProcess/WebColorPicker.cpp:
1487         (WebKit::WebColorPicker::endPicker):
1488         * UIProcess/WebPageProxy.cpp:
1489         (WebKit::WebPageProxy::endColorPicker):
1490         (WebKit::WebPageProxy::didEndColorPicker):
1491
1492 2019-03-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1493
1494         [GTK][WPE] Add API to provide geolocation information
1495         https://bugs.webkit.org/show_bug.cgi?id=195940
1496
1497         Reviewed by Michael Catanzaro.
1498
1499         Add WebKitGeolocationManager public class to handle geolocation position updates. WebKitGeolocationProvider has
1500         been removed and the default implementation based on GeoClue is done by WebKitGeolocationManager.
1501
1502         * PlatformGTK.cmake:
1503         * PlatformWPE.cmake:
1504         * SourcesGTK.txt:
1505         * SourcesWPE.txt:
1506         * UIProcess/API/glib/WebKitGeolocationManager.cpp: Added.
1507         (_WebKitGeolocationPosition::_WebKitGeolocationPosition):
1508         (webkit_geolocation_position_new):
1509         (webkit_geolocation_position_copy):
1510         (webkit_geolocation_position_free):
1511         (webkit_geolocation_position_set_timestamp):
1512         (webkit_geolocation_position_set_altitude):
1513         (webkit_geolocation_position_set_altitude_accuracy):
1514         (webkit_geolocation_position_set_heading):
1515         (webkit_geolocation_position_set_speed):
1516         (webkitGeolocationManagerStop):
1517         (webkitGeolocationManagerSetEnableHighAccuracy):
1518         (webkitGeolocationManagerCreate):
1519         (webkitGeolocationManagerGetProperty):
1520         (webkit_geolocation_manager_class_init):
1521         (webkit_gelocation_manager_update_position):
1522         (webkit_gelocation_manager_failed):
1523         (webkit_geolocation_manager_get_enable_high_accuracy):
1524         * UIProcess/API/glib/WebKitGeolocationManagerPrivate.h: Copied from Source/WebCore/platform/geoclue/GeolocationProviderGeoclueClient.h.
1525         * UIProcess/API/glib/WebKitGeolocationProvider.cpp: Removed.
1526         * UIProcess/API/glib/WebKitGeolocationProvider.h: Removed.
1527         * UIProcess/API/glib/WebKitWebContext.cpp:
1528         (webkitWebContextConstructed): Create a WebKitGeolocationManager instead of a WebKitGeolocationProvider.
1529         (webkit_web_context_get_geolocation_manager): Get the WebKitGeolocationManager.
1530         * UIProcess/API/gtk/WebKitGeolocationManager.h: Added.
1531         * UIProcess/API/gtk/WebKitWebContext.h:
1532         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1533         * UIProcess/API/gtk/docs/webkit2gtk-4.0.types:
1534         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
1535         * UIProcess/API/gtk/webkit2.h:
1536         * UIProcess/API/wpe/WebKitGeolocationManager.h: Added.
1537         * UIProcess/API/wpe/WebKitWebContext.h:
1538         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
1539         * UIProcess/API/wpe/docs/wpe-docs.sgml:
1540         * UIProcess/API/wpe/webkit.h:
1541
1542 2019-03-20  Youenn Fablet  <youenn@apple.com>
1543
1544         Compute quota after network process restart based on default quota and space used
1545         https://bugs.webkit.org/show_bug.cgi?id=195804
1546
1547         Reviewed by Chris Dumez.
1548
1549         Make sure that Cache Storage quota user waits to declare as initialized to its manager
1550         until all data is loaded so that it can report a valid space used from the start.
1551
1552         Add test API to reset the quota to its default value and compute it according current space use.
1553
1554         * NetworkProcess/NetworkProcess.cpp:
1555         (WebKit::NetworkProcess::updateQuotaBasedOnSpaceUsageForTesting):
1556         * NetworkProcess/NetworkProcess.h:
1557         * NetworkProcess/NetworkProcess.messages.in:
1558         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1559         (WebKit::CacheStorage::Caches::create):
1560         (WebKit::CacheStorage::Caches::Caches):
1561         (WebKit::CacheStorage::Caches::whenInitialized):
1562         * NetworkProcess/cache/CacheStorageEngineCaches.h:
1563         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
1564         (WebKit::CacheStorageEngineConnection::dereference):
1565         * WebProcess/Cache/WebCacheStorageConnection.cpp:
1566         (WebKit::WebCacheStorageConnection::setQuotaBasedOnSpaceUsage):
1567         * WebProcess/Cache/WebCacheStorageConnection.h:
1568
1569 2019-03-20  Simon Fraser  <simon.fraser@apple.com>
1570
1571         Rename ENABLE_ACCELERATED_OVERFLOW_SCROLLING macro to ENABLE_OVERFLOW_SCROLLING_TOUCH
1572         https://bugs.webkit.org/show_bug.cgi?id=196049
1573
1574         Reviewed by Tim Horton.
1575
1576         This macro is about the -webkit-overflow-scrolling CSS property, not accelerated
1577         overflow scrolling in general, so rename it.
1578
1579         * Configurations/FeatureDefines.xcconfig:
1580
1581 2019-03-20  Jiewen Tan  <jiewen_tan@apple.com>
1582
1583         Extend Networking Process sandbox for some system frameworks
1584         https://bugs.webkit.org/show_bug.cgi?id=196036
1585         <rdar://problem/47594150>
1586
1587         Reviewed by Brent Fulgham.
1588
1589         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
1590         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
1591
1592 2019-03-20  Alex Christensen  <achristensen@webkit.org>
1593
1594         Reduce use of LegacySync IPC message type
1595         https://bugs.webkit.org/show_bug.cgi?id=194835
1596
1597         Reviewed by Darin Adler.
1598
1599         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1600         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
1601         (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
1602         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
1603         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
1604         (WebKit::NetworkConnectionToWebProcess::blobSize):
1605         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
1606         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
1607         * NetworkProcess/NetworkConnectionToWebProcess.h:
1608         (WebKit::NetworkConnectionToWebProcess::getNetworkLoadInformationRequest):
1609         (WebKit::NetworkConnectionToWebProcess::getNetworkLoadInformationResponse):
1610         (WebKit::NetworkConnectionToWebProcess::getNetworkLoadIntermediateInformation):
1611         (WebKit::NetworkConnectionToWebProcess::takeNetworkLoadInformationMetrics):
1612         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1613         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1614         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
1615         (WebKit::UserMediaCaptureManagerProxy::capabilities):
1616         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
1617         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
1618         * UIProcess/Plugins/PluginProcessProxy.h:
1619         * UIProcess/Plugins/PluginProcessProxy.messages.in:
1620         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
1621         (WebKit::PluginProcessProxy::launchProcess):
1622         (WebKit::PluginProcessProxy::launchApplicationAtURL):
1623         (WebKit::PluginProcessProxy::openURL):
1624         (WebKit::PluginProcessProxy::openFile):
1625         * UIProcess/WebFullScreenManagerProxy.cpp:
1626         (WebKit::WebFullScreenManagerProxy::supportsFullScreen):
1627         * UIProcess/WebFullScreenManagerProxy.h:
1628         * UIProcess/WebFullScreenManagerProxy.messages.in:
1629         * WebProcess/WebProcess.cpp:
1630         (WebKit::WebProcess::fetchWebsiteData):
1631         (WebKit::WebProcess::deleteWebsiteData):
1632         (WebKit::WebProcess::deleteWebsiteDataForOrigins):
1633         (WebKit::WebProcess::processWillSuspendImminently):
1634         * WebProcess/WebProcess.h:
1635         * WebProcess/WebProcess.messages.in:
1636
1637 2019-03-20  Keith Rollin  <krollin@apple.com>
1638
1639         Update checks that determine if WebKit is system WebKit
1640         https://bugs.webkit.org/show_bug.cgi?id=195756
1641
1642         Unreviewed tweak of r243251 after unreviewed build fix after r243230.
1643
1644         * Shared/mac/AuxiliaryProcessMac.mm:
1645         (WebKit::AuxiliaryProcess::isSystemWebKit):
1646
1647 2019-03-20  Keith Rollin  <krollin@apple.com>
1648
1649         Update checks that determine if WebKit is system WebKit
1650         https://bugs.webkit.org/show_bug.cgi?id=195756
1651
1652         Unreviewed build fix after r243230.
1653
1654         * Shared/mac/AuxiliaryProcessMac.mm:
1655         (WebKit::AuxiliaryProcess::isSystemWebKit):
1656
1657 2019-03-20  Simon Fraser  <simon.fraser@apple.com>
1658
1659         [iOS WK2] Turn on async overflow scrolling by default
1660         https://bugs.webkit.org/show_bug.cgi?id=196011
1661         rdar://problem/48453859
1662
1663         Reviewed by Antti Koivisto.
1664
1665         Turn async overflow scroll on by default for iOS WK2.
1666
1667         * Shared/WebPreferences.yaml:
1668         * Shared/WebPreferencesDefaultValues.h:
1669
1670 2019-03-20  Youenn Fablet  <youenn@apple.com>
1671
1672         Have smaller default quotas for third party frames
1673         https://bugs.webkit.org/show_bug.cgi?id=195841
1674
1675         Reviewed by Geoffrey Garen.
1676
1677         * NetworkProcess/NetworkProcess.cpp:
1678         (WebKit::NetworkProcess::storageQuotaManager):
1679         For third party iframes, use the default quota divided by 10.
1680
1681 2019-03-20  Dean Jackson  <dino@apple.com>
1682
1683         [iOS] Enable fast clicking everywhere
1684         https://bugs.webkit.org/show_bug.cgi?id=196023
1685         <rdar://problem/49073589>
1686
1687         Reviewed by Wenson Hsieh.
1688
1689         Set FastClicksEverywhere to on by default for iPhone & iPad.
1690
1691         * Shared/WebPreferences.yaml:
1692         * Shared/WebPreferencesDefaultValues.h:
1693
1694 2019-03-20  Chris Dumez  <cdumez@apple.com>
1695
1696         Regression(PSON): ViewGestureController is not properly notified of process swaps on iOS
1697         https://bugs.webkit.org/show_bug.cgi?id=196029
1698         <rdar://problem/48954651>
1699
1700         Reviewed by Tim Horton.
1701
1702         If there is a ViewGestureController when process swapping, make sure we disconnect it
1703         from the old process and reconnect it to the new one. This matches what is done in
1704         WebViewImpl for macOS (see r238356).
1705
1706         * UIProcess/API/Cocoa/WKWebView.mm:
1707         (-[WKWebView _processWillSwap]):
1708         (-[WKWebView _processDidExit]):
1709         (-[WKWebView _didRelaunchProcess]):
1710
1711 2019-03-20  Carlos Garcia Campos  <cgarcia@igalia.com>
1712
1713         [GTK] REGRESSION(r243094): crash when launching minibrowser
1714         https://bugs.webkit.org/show_bug.cgi?id=195951
1715
1716         Reviewed by Joseph Pecoraro.
1717
1718         Always return the inspector from WebPageProxy::inspector() when the page hasn't been closed. The inspector is
1719         created in WebPageProxy constructor and it's safe to use even before a process has been launched, because
1720         m_inspectedPage is null-checked everywhere.
1721
1722         * UIProcess/WebPageProxy.cpp:
1723         (WebKit::WebPageProxy::inspector const):
1724
1725 2019-03-20  Keith Rollin  <krollin@apple.com>
1726
1727         Update checks that determine if WebKit is system WebKit
1728         https://bugs.webkit.org/show_bug.cgi?id=195756
1729
1730         Reviewed by Alexey Proskuryakov.
1731
1732         The system WebKit can be installed in additional locations, so check
1733         for and allow those, too.
1734
1735         * Shared/mac/AuxiliaryProcessMac.mm:
1736         (WebKit::AuxiliaryProcess::isSystemWebKit):
1737
1738 2019-03-20  Per Arne Vollan  <pvollan@apple.com>
1739
1740         [iOS] Unable to PiP web videos in Safari due to sandbox violation
1741         https://bugs.webkit.org/show_bug.cgi?id=196015
1742         <rdar://problem/48867037>
1743
1744         Reviewed by Brent Fulgham.
1745
1746         The sandbox should allow getting the iokit property 'ui-pip'.
1747
1748         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1749
1750 2019-03-20  John Wilander  <wilander@apple.com>
1751
1752         (Test fix) Override minimumTimeBetweenDataRecordsRemoval in ResourceLoadStatisticsStore::shouldRemoveDataRecord() during layout tests
1753         https://bugs.webkit.org/show_bug.cgi?id=196017
1754
1755         Unreviewed test fix.
1756
1757         This patch adds a check of parameters().isRunningTest to the return of
1758         ResourceLoadStatisticsStore::shouldRemoveDataRecord() to allow successive
1759         layout tests to remove website data, effectively overriding the
1760         minimumTimeBetweenDataRecordsRemoval setting.
1761
1762         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
1763         (WebKit::ResourceLoadStatisticsStore::shouldRemoveDataRecords const):
1764
1765 2019-03-20  Daniel Bates  <dabates@apple.com>
1766
1767         [iOS] Group UIWebFormAccessoryDelegate-related code and tighten it up a bit
1768         https://bugs.webkit.org/show_bug.cgi?id=196018
1769
1770         Reviewed by Wenson Hsieh.
1771
1772         * UIProcess/ios/WKContentViewInteraction.mm:
1773         (-[WKContentView accessoryClear]): Use uniform initializer syntax. Code could send the empty
1774         string, but I resisted since null string, as we do now, likely encodes more compactly and we
1775         avoid a per-process alloc.
1776         (-[WKContentView accessoryTab:]): Fix style nit; missing space between capture list and arguments
1777         in lambda. Also use lamdba capture initializer syntax and remove a local.
1778         (-[WKContentView _updateAccessory]): Remove a FIXME as it can't be satified with the current
1779         design without more bookkeeping. The design for showing and hiding an AutoFill button added in
1780         r166933 requires knowing the title for the button when showing it via -setAccessoryViewCustomButtonTitle.
1781         We could re-implement such that -setAccessoryViewCustomButtonTitle: stores the title and calls
1782         -_updateAccessory, but that has the disadvantage of increasing the memory footprint of WKContentView
1783         for the stored title and that seems worse than centralizing the logic in _updateAccessory. So,
1784         let's not fix this FIXME. Now that we are removing the FIXME, change to use an early return style.
1785         (-[WKContentView _hideKeyboard]): Micro optimization; only call _updateAccessory if we have
1786         a form accessory view. This method is called everytime we load a page (more precisely when we
1787         commit the load for a page) in addition to everytime we blur (defocus) an element. No need to
1788         update an accessory if we don't have one.
1789  
1790 2019-03-20  Olivier Robin  <olivierrobin@chromium.org>
1791
1792         Fix _getContentsAsAttributedStringWithCompletionHandler availability for iOS.
1793         https://bugs.webkit.org/show_bug.cgi?id=195999
1794
1795         Reviewed by Tim Horton.
1796
1797         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1798
1799 2019-03-20  Brent Fulgham  <bfulgham@apple.com>
1800
1801         Adopt RegistrableDomain in the Storage Access API prompt code paths
1802         https://bugs.webkit.org/show_bug.cgi?id=195957
1803         <rdar://problem/49048028>
1804
1805         Reviewed by Chris Dumez.
1806
1807         While making the code changes in Bug 195866 we noticed that strings were being
1808         used to pass the origins for the API calls. We should adopt the RegistrableDomain
1809         class to improve type safety and avoid introducing bugs in the future.
1810
1811         * UIProcess/API/APIUIClient.h:
1812         (API::UIClient::requestStorageAccessConfirm):
1813         * UIProcess/API/C/WKPage.cpp:
1814         (WKPageSetPageUIClient):
1815         * UIProcess/Cocoa/UIDelegate.h:
1816         * UIProcess/Cocoa/UIDelegate.mm:
1817         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
1818         * UIProcess/Cocoa/WKStorageAccessAlert.h:
1819         * UIProcess/Cocoa/WKStorageAccessAlert.mm:
1820         (WebKit::presentStorageAccessAlert):
1821         * UIProcess/WebPageProxy.cpp:
1822         (WebKit::WebPageProxy::requestStorageAccessConfirm):
1823
1824 2019-03-20  Chris Dumez  <cdumez@apple.com>
1825
1826         Unreviewed, fix typo in comment added in r243156.
1827
1828         * UIProcess/WebPageProxy.cpp:
1829         (WebKit::WebPageProxy::postMessageToInjectedBundle):
1830
1831 2019-03-20  Chris Dumez  <cdumez@apple.com>
1832
1833         Unreviewed, drop invalid assertions landed in r243163.
1834
1835         Those assertions were causing some API tests to crash.
1836         Also include some post-review suggestions from Darin.
1837
1838         * Shared/CallbackID.h:
1839         (WebKit::CallbackID::operator=):
1840         * Shared/OptionalCallbackID.h:
1841         (WebKit::OptionalCallbackID::operator=):
1842
1843 2019-03-20  Chris Dumez  <cdumez@apple.com>
1844
1845         Unreviewed, fix assertion failures in API tests after r243159.
1846
1847         * UIProcess/VisitedLinkStore.cpp:
1848         (WebKit::VisitedLinkStore::removeProcess):
1849
1850 2019-03-20  Tim Horton  <timothy_horton@apple.com>
1851
1852         Add an platform-driven spell-checking mechanism
1853         https://bugs.webkit.org/show_bug.cgi?id=195795
1854
1855         Reviewed by Ryosuke Niwa.
1856
1857         * DerivedSources-input.xcfilelist:
1858         * DerivedSources-output.xcfilelist:
1859         * DerivedSources.make:
1860         * SourcesCocoa.txt:
1861         * UIProcess/Cocoa/TextCheckingController.h: Added.
1862         * UIProcess/Cocoa/TextCheckingController.mm: Added.
1863         (WebKit::TextCheckingController::TextCheckingController):
1864         (WebKit::TextCheckingController::replaceRelativeToSelection):
1865         (WebKit::TextCheckingController::removeAnnotationRelativeToSelection):
1866         * UIProcess/ios/WKContentViewInteraction.h:
1867         * UIProcess/ios/WKContentViewInteraction.mm:
1868         (-[WKContentView setupInteraction]):
1869         (-[WKContentView replaceSelectionOffset:length:withAnnotatedString:relativeReplacementRange:]):
1870         (-[WKContentView removeAnnotation:forSelectionOffset:length:]):
1871         * WebKit.xcodeproj/project.pbxproj:
1872         * WebProcess/WebPage/WebPage.cpp:
1873         * WebProcess/WebPage/WebPage.h:
1874         (WebKit::WebPage::textCheckingController):
1875         Plumb two UITextInput methods through to the Web Content process.
1876         I added a new object instead of just sticking things on WebPage
1877         because there are quite a few more related ones coming down the pipeline,
1878         and will also end up being messages going in the opposite direction.
1879
1880         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h: Added.
1881         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.messages.in: Added.
1882         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm: Added.
1883         (WebKit::TextCheckingControllerProxy::TextCheckingControllerProxy):
1884         (WebKit::TextCheckingControllerProxy::~TextCheckingControllerProxy):
1885         (WebKit::relevantMarkerTypes):
1886         (WebKit::TextCheckingControllerProxy::rangeAndOffsetRelativeToSelection):
1887         (WebKit::TextCheckingControllerProxy::replaceRelativeToSelection):
1888         (WebKit::TextCheckingControllerProxy::removeAnnotationRelativeToSelection):
1889         Make it possible for the platform to maintain arbitrary key-value pairs
1890         attached to document ranges, as a way for it to keep track of various
1891         text checking context (e.g. if something has been checked, replaced,
1892         what language it might be, ...).
1893
1894         Allow it to replace the text of a range and the annotations in that range,
1895         or remove annotations in a range. Ranges are specified relative to
1896         the selection.
1897
1898         One large missing piece is giving the platform the ability to retrieve
1899         annotations in a range; that is coming in a future patch.
1900
1901         We translate certain annotations into traditional WebCore spelling
1902         and grammar document markers, for normal display-time treatment.
1903
1904         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
1905         (-[WKAccessibilityWebPageObject convertScreenPointToRootView:]):
1906         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
1907         Unified sources fixes.
1908
1909 2019-03-19  Jiewen Tan  <jiewen_tan@apple.com>
1910
1911         [WebAuthN] Implement FIDO AppID extension
1912         https://bugs.webkit.org/show_bug.cgi?id=143491
1913         <rdar://problem/48298273>
1914
1915         Reviewed by Brent Fulgham.
1916
1917         In U2fHidAuthenticator::continueSignCommandAfterResponseReceived, it will retry the current command
1918         with the AppID if it exists when SW_WRONG_DATA is received from devices. Noted, it will not set
1919         the AuthenticationExtensionsClientOutputs::appid to false in any circumstances. In other words, the
1920         field will be empty if AppID is supplied in AuthenticationExtensionsClientInputs and not used.
1921
1922         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
1923         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
1924         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
1925         * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp:
1926         (WebKit::U2fHidAuthenticator::issueSignCommand):
1927         (WebKit::U2fHidAuthenticator::continueSignCommandAfterResponseReceived):
1928         * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.h:
1929
1930 2019-03-19  Ross Kirsling  <ross.kirsling@sony.com>
1931
1932         Unreviewed adjustment to r242842 per Darin's request.
1933
1934         * Platform/win/LoggingWin.cpp:
1935         (WebKit::logLevelString):
1936
1937 2019-03-19  Gyuyoung Kim  <gyuyoung.kim@lge.com>
1938
1939         [WPE] Fix build warnings because of missing an argument when initializing wpe_input_axis_event
1940         https://bugs.webkit.org/show_bug.cgi?id=195931
1941
1942         Reviewed by Michael Catanzaro.
1943
1944         There are still build warnings when building wpe port. It looks like
1945         these build warnings have been caused by missing to set an argument
1946         for the modifier parameter of wpe_input_axis_event. This patch sets 0
1947         for the modifier argument to avoid the build warnings.
1948
1949         * UIProcess/API/wpe/ScrollGestureController.cpp:
1950         (WebKit::ScrollGestureController::handleEvent):
1951
1952 2019-03-19  John Wilander  <wilander@apple.com>
1953
1954         Resource Load Statistics (experimental): Clear non-cookie website data for sites that have been navigated to, with link decoration, by a prevalent resource
1955         https://bugs.webkit.org/show_bug.cgi?id=195923
1956         <rdar://problem/49001272>
1957
1958         Reviewed by Alex Christensen.
1959
1960         Cross-site trackers abuse link query parameters to transport user identifiers and then store
1961         them in first-party storage space. To address this, we've done three things:
1962         - r236448 capped all persistent client-side cookies to seven days of storage.
1963         - r242288 further capped persistent client-side cookies for navigations with link decoration from prevalent resources.
1964         - r242603 added logging of navigations with link decoration from prevalent resources.
1965
1966         This patch introduces an experimental feature that removes non-cookie website data for sites
1967         that have been navigated to, with link decoration, by a prevalent resource.
1968
1969         To achieve this, resource domains to remove website data for are now marked with an enum called
1970         WebsiteDataToRemove with values All, AllButHttpOnlyCookies, AllButCookies. As resources are
1971         iterated, they are marked for either of these values and the new function
1972         ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor() leads to the marking with
1973         WebsiteDataToRemove::AllButCookies.
1974
1975         Then NetworkProcess::deleteWebsiteDataForRegistrableDomains() looks at this setting and removes
1976         website data accordingly.
1977
1978         The thinking behind this is that the lifetime cap applied in r236448 and r242288 take care of
1979         script writable cookies, and this patch takes care of all other script writable storage.
1980
1981         The infrastructure to handle user interaction expiration is now parameterized so that multiple
1982         expiries can be applied. In this particular case, seven days of browser use.
1983
1984         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1985         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
1986         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
1987         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
1988         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllWebsiteDataFor const):
1989         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllButCookiesFor const):
1990         (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor):
1991         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1992         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1993         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUserInteraction):
1994         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUnexpiredRecentUserInteraction const):
1995         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllWebsiteDataFor const):
1996         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor const):
1997         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor):
1998         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
1999         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
2000         (WebKit::domainsToString):
2001         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
2002         (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const):
2003         (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates):
2004         (WebKit::ResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
2005         (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const):
2006         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
2007         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2008         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
2009         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomains):
2010         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
2011            Renamed to reflect that it actually takes a parameter for which types of data to remove.
2012         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2013         * NetworkProcess/NetworkProcess.cpp:
2014         (WebKit::NetworkProcess::initializeNetworkProcess):
2015         (WebKit::NetworkProcess::setCrossSiteLoadWithLinkDecorationForTesting):
2016         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
2017         (WebKit::NetworkProcess::deleteCookiesForTesting):
2018         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
2019            Renamed to reflect that it actually takes a parameter for which types of data to remove.
2020         * NetworkProcess/NetworkProcess.h:
2021         * NetworkProcess/NetworkProcess.messages.in:
2022         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2023         (WebKit::NetworkProcessCreationParameters::encode const):
2024         (WebKit::NetworkProcessCreationParameters::decode):
2025         * NetworkProcess/NetworkProcessCreationParameters.h:
2026         * NetworkProcess/NetworkSession.cpp:
2027         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomains):
2028         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
2029            Renamed to reflect that it actually takes a parameter for which types of data to remove.
2030         * NetworkProcess/NetworkSession.h:
2031         * Shared/WebPreferences.yaml:
2032         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2033         (WKWebsiteDataStoreSetStatisticsCrossSiteLoadWithLinkDecoration):
2034         (WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction):
2035         (WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords):
2036         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2037         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2038         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2039         * UIProcess/Network/NetworkProcessProxy.cpp:
2040         (WebKit::NetworkProcessProxy::setCrossSiteLoadWithLinkDecorationForTesting):
2041         * UIProcess/Network/NetworkProcessProxy.h:
2042         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2043         (WebKit::WebsiteDataStore::setCrossSiteLoadWithLinkDecorationForTesting):
2044         * UIProcess/WebsiteData/WebsiteDataStore.h:
2045
2046 2019-03-19  Chris Dumez  <cdumez@apple.com>
2047
2048         Unreviewed build fix after r243173.
2049
2050         * UIProcess/Cocoa/UIDelegate.mm:
2051         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
2052
2053 2019-03-19  Brent Fulgham  <bfulgham@apple.com>
2054
2055         Add default prompt implementation for the Storage Access API
2056         https://bugs.webkit.org/show_bug.cgi?id=195866
2057         <rdar://problem/45150009>
2058
2059         Reviewed by Chris Dumez.
2060
2061         This patch revises the UIDelegate implementation with a default permission dialog
2062         for the Storage Access API. This allows us to use and test the API in MiniBrowser,
2063         rather than requiring a full-fledged web browser to drive testing.
2064  
2065         * UIProcess/Cocoa/UIDelegate.h:
2066         * UIProcess/Cocoa/UIDelegate.mm:
2067         (WebKit::UIDelegate::UIClient::presentStorageAccessConfirmDialog): Added.
2068         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm): Modify to call new default
2069         implementation if the WKWebVIew client doesn't implement the necessary SPI.
2070         * UIProcess/Cocoa/WKStorageAccessAlert.h: Added.
2071         * UIProcess/Cocoa/WKStorageAccessAlert.mm: Added.
2072         (WebKit::presentStorageAccessAlert):
2073         * WebKit.xcodeproj/project.pbxproj:
2074
2075 2019-03-19  Conrad Shultz  <conrad_shultz@apple.com>
2076
2077         REGRESSION (r242369): Only use picker-supported UTIs when creating image picker
2078         https://bugs.webkit.org/show_bug.cgi?id=195955
2079
2080         Reviewed by Chris Dumez and Wenson Hsieh.
2081
2082         r242369 started passing UTIs to -[UIImagePickerController setMediaTypes:] that correspond to types accepted by the
2083         file input element. However, UIImagePickerController expects a specific subset of UTIs. In the worst case, if no
2084         expected types are passed, this can cause a crash.
2085
2086         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2087         (UTIsForMIMETypes):
2088         Return a set rather than an array.
2089         (-[WKFileUploadPanel _mediaTypesForPickerSourceType:]):
2090         Rather than hardcode specific UTIs, ask UIImagePickerController for its available types. If an accepted type
2091         is in the list of available types, use it. Otherwise, if an accepted type conforms to an available type,
2092         use the available type. This is an O(n^2) process, but there typically are only a handful of types, so
2093         this seems acceptable.
2094         (-[WKFileUploadPanel _showDocumentPickerMenu]):
2095         Convert the set from UTIsForMIMETypes() to an array.
2096
2097 2019-03-19  Michael Catanzaro  <mcatanzaro@igalia.com>
2098
2099         Build cleanly with GCC 9
2100         https://bugs.webkit.org/show_bug.cgi?id=195920
2101
2102         Reviewed by Chris Dumez.
2103
2104         WebKit triggers three new GCC 9 warnings:
2105
2106         """
2107         -Wdeprecated-copy, implied by -Wextra, warns about the C++11 deprecation of implicitly
2108         declared copy constructor and assignment operator if one of them is user-provided.
2109         """
2110
2111         Solution is to either add a copy constructor or copy assignment operator, if required, or
2112         else remove one if it is redundant.
2113
2114         """
2115         -Wredundant-move, implied by -Wextra, warns about redundant calls to std::move.
2116         -Wpessimizing-move, implied by -Wall, warns when a call to std::move prevents copy elision.
2117         """
2118
2119         These account for most of this patch. Solution is to just remove the bad WTFMove().
2120
2121         Additionally, -Wclass-memaccess has been enhanced to catch a few cases that GCC 8 didn't.
2122         These are solved by casting nontrivial types to void* before using memcpy. (Of course, it
2123         would be safer to not use memcpy on nontrivial types, but that's too complex for this
2124         patch. Searching for memcpy used with static_cast<void*> will reveal other cases to fix.)
2125
2126         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
2127         (WebKit::CacheStorage::Cache::decode):
2128         * Platform/IPC/ArgumentCoders.h:
2129         * Shared/CallbackID.h:
2130         (WebKit::CallbackID::operator=):
2131         * Shared/OptionalCallbackID.h:
2132         (WebKit::OptionalCallbackID::operator=):
2133         * Shared/Plugins/NPIdentifierData.cpp:
2134         (WebKit::NPIdentifierData::decode):
2135         * Shared/Plugins/NPVariantData.cpp:
2136         (WebKit::NPVariantData::decode):
2137         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
2138         (WebKit::NetscapePluginModule::getOrCreate):
2139         * Shared/RTCNetwork.cpp:
2140         (WebKit::RTCNetwork::IPAddress::decode):
2141         * Shared/SessionState.cpp:
2142         (WebKit::HTTPBody::Element::decode):
2143         (WebKit::FrameState::decode):
2144         (WebKit::BackForwardListItemState::decode):
2145         * Shared/WebCompiledContentRuleListData.cpp:
2146         (WebKit::WebCompiledContentRuleListData::decode):
2147         * Shared/WebCoreArgumentCoders.cpp:
2148         (IPC::ArgumentCoder<FloatPoint>::decode):
2149         (IPC::ArgumentCoder<FloatRect>::decode):
2150         (IPC::ArgumentCoder<FloatQuad>::decode):
2151         (IPC::ArgumentCoder<ViewportArguments>::decode):
2152         (IPC::ArgumentCoder<IntPoint>::decode):
2153         (IPC::ArgumentCoder<IntRect>::decode):
2154         (IPC::ArgumentCoder<IntSize>::decode):
2155         (IPC::ArgumentCoder<MimeClassInfo>::decode):
2156         (IPC::ArgumentCoder<PluginInfo>::decode):
2157         (IPC::ArgumentCoder<SelectionRect>::decode):
2158         (IPC::ArgumentCoder<CompositionUnderline>::decode):
2159         (IPC::ArgumentCoder<BlobPart>::decode):
2160         (IPC::ArgumentCoder<TextIndicatorData>::decode):
2161         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
2162         (IPC::ArgumentCoder<ScrollOffsetRange<float>>::decode):
2163         * Shared/WebPageCreationParameters.cpp:
2164         (WebKit::WebPageCreationParameters::decode):
2165         * Shared/WebPlatformTouchPoint.cpp:
2166         (WebKit::WebPlatformTouchPoint::decode):
2167         * Shared/WebsiteData/WebsiteData.cpp:
2168         (WebKit::WebsiteData::Entry::decode):
2169         * Shared/WebsiteDataStoreParameters.cpp:
2170         (WebKit::WebsiteDataStoreParameters::decode):
2171         * UIProcess/API/APIContentRuleListStore.cpp:
2172         (API::decodeContentRuleListMetaData):
2173         * UIProcess/WebPageProxy.cpp:
2174         (WebKit::WebPageProxy::launchProcessForReload):
2175         (WebKit::WebPageProxy::launchProcessWithItem):
2176         (WebKit::WebPageProxy::loadRequest):
2177         (WebKit::WebPageProxy::loadFile):
2178         (WebKit::WebPageProxy::loadData):
2179         (WebKit::WebPageProxy::reload):
2180         * UIProcess/WebProcessCache.cpp:
2181         (WebKit::WebProcessCache::takeProcess):
2182         * UIProcess/WebProcessPool.cpp:
2183         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
2184         * WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.cpp:
2185         (WebKit::InjectedBundleCSSStyleDeclarationHandle::getOrCreate):
2186         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
2187         (WebKit::InjectedBundleRangeHandle::getOrCreate):
2188         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2189         (WebKit::InjectedBundle::create):
2190         * WebProcess/Network/WebLoaderStrategy.cpp:
2191         (WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler):
2192         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2193         (WebKit::CompositingCoordinator::createGraphicsLayer):
2194         * WebProcess/WebPage/WebPage.cpp:
2195         (WebKit::WebPage::pdfSnapshotAtSize):
2196         (WebKit::WebPage::createDocumentLoader):
2197         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
2198         (WebKit::StorageNamespaceImpl::copy):
2199
2200 2019-03-19  Chris Dumez  <cdumez@apple.com>
2201
2202         Spew: Unhandled web process message 'VisitedLinkTableController:VisitedLinkStateChanged'
2203         https://bugs.webkit.org/show_bug.cgi?id=194787
2204         <rdar://problem/48175520>
2205
2206         Reviewed by Geoff Garen.
2207
2208         The unhandled 'VisitedLinkTableController:VisitedLinkStateChanged' message logging happens
2209         when IPC is sent to a WebProcess which does not have a VisitedLinkTableController with the
2210         given identifier. VisitedLinkTableController are kept alive by the WebPage in the WebProcess
2211         side so this indicates that there is no WebPage using this VisitedLinkTableController anymore.
2212
2213         In the UIProcess side, our tracking of who is using which VisitedLinkStore was very poor.
2214         WebPageProxy objects would ask their process to register itself with the page's visitedLinkStore
2215         as soon as the WebPage object has been created on the WebProcess side. This part was fine.
2216         However, unregistration from the visitedLinkStores would only happen when either the
2217         visitedLinkStore would get destroyed or when the WebProcess would shutdown. This means that
2218         WebProcess could stay registered with a visitedLinkStore even after the page that was using it
2219         has been closed, which would lead to such logging.
2220
2221         To address the issue, the WebProcessProxy now keeps track for which pages are using which
2222         visitedLinkStore. When a visitedLinkStore is used by a page for the first time, the
2223         WebProcessProxy will register itself with the visitedLinkStore. Similarly, when the last page
2224         using a given visitedLinkStore is closed, the process unregisters itself from the
2225         visitedLinkStore, thus avoiding the bug.
2226
2227         I also simplified a lot the logic for having a page telling the WebProcessProxy it started
2228         using a visitedLinkStore. Previously, it would have to wait until the process is done launching
2229         before notifying the WebProcessProxy. Now, the WebPageProxy merely tells the WebProcessProxy
2230         that it is starting to use a visitedLinkStore as soon as it sent the CreateWebPage IPC to the
2231         WebProcess (no matter if the process is still launching or not). At this point, the
2232         WebProcessProxy registers the page as a user of the visitedLinkStore and takes care of waiting
2233         until it is done launching before registering itself with the visitedLinkStore.
2234
2235         * UIProcess/ProvisionalPageProxy.cpp:
2236         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
2237         (WebKit::ProvisionalPageProxy::initializeWebPage):
2238         (WebKit::ProvisionalPageProxy::processDidFinishLaunching): Deleted.
2239         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
2240         * UIProcess/ProvisionalPageProxy.h:
2241         * UIProcess/VisitedLinkStore.cpp:
2242         (WebKit::VisitedLinkStore::~VisitedLinkStore):
2243         (WebKit::VisitedLinkStore::addProcess):
2244         * UIProcess/WebPageProxy.cpp:
2245         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2246         (WebKit::WebPageProxy::initializeWebPage):
2247         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2248         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
2249         (WebKit::WebPageProxy::processDidFinishLaunching): Deleted.
2250         * UIProcess/WebPageProxy.h:
2251         * UIProcess/WebProcessProxy.cpp:
2252         (WebKit::WebProcessProxy::shutDown):
2253         (WebKit::WebProcessProxy::removeWebPage):
2254         (WebKit::WebProcessProxy::addVisitedLinkStoreUser):
2255         (WebKit::WebProcessProxy::removeVisitedLinkStoreUser):
2256         (WebKit::WebProcessProxy::addWebUserContentControllerProxy):
2257         (WebKit::WebProcessProxy::didFinishLaunching):
2258         (WebKit::WebProcessProxy::addVisitedLinkStore): Deleted.
2259         (WebKit::WebProcessProxy::didDestroyVisitedLinkStore): Deleted.
2260         * UIProcess/WebProcessProxy.h:
2261
2262 2019-03-19  Chris Dumez  <cdumez@apple.com>
2263
2264         REGRESSION (r243094): internal media test fairplay-hls-error.html is failing
2265         https://bugs.webkit.org/show_bug.cgi?id=195954
2266         <rdar://problem/49005981>
2267
2268         Reviewed by Geoffrey Garen.
2269
2270         TestController::resetStateToConsistentValues() tries to send a "reset" message to its
2271         injected bundle. Part of the "reset" message sets the external hosts that we're allowed
2272         to load. If there is no WebProcess yet when WKPagePostMessageToInjectedBundle() is called,
2273         then this message does not get sent and the allowed hosts do not get set, causing this
2274         test failure.
2275
2276         To address the issue, make sure we launch the initial process if necessary when
2277         WebPageProxy::postMessageToInjectedBundle() is called, in order to maintain backward
2278         compatibility.
2279
2280         * UIProcess/WebPageProxy.cpp:
2281         (WebKit::WebPageProxy::postMessageToInjectedBundle):
2282
2283 2019-03-19  Chris Dumez  <cdumez@apple.com>
2284
2285         Unreviewed, rolling out r243142.
2286
2287         Caused assertion hits in WK2 Debug
2288
2289         Reverted changeset:
2290
2291         "Spew: Unhandled web process message
2292         'VisitedLinkTableController:VisitedLinkStateChanged'"
2293         https://bugs.webkit.org/show_bug.cgi?id=194787
2294         https://trac.webkit.org/changeset/243142
2295
2296 2019-03-19  Daniel Bates  <dabates@apple.com>
2297
2298         [iOS] Focus not preserved when switching between tabs
2299         https://bugs.webkit.org/show_bug.cgi?id=195820
2300         <rdar://problem/43614450>
2301
2302         Reviewed by Brent Fulgham.
2303
2304         Fixes a usability annoyance when using a hardware keyboard; focus is not preserved when switching between tabs.
2305         Do not unconditionally tell the WebProcess to blur the currently focused element when the content view (WKContentView)
2306         resigns first responder. Instead only tell it to blur when the content view is resigning because either the
2307         accessory view was dismissed (Done button was pressed) or the keyboard was dismissed (the hide keyboard button
2308         was pressed).
2309
2310         * UIProcess/ios/WKContentViewInteraction.h:
2311         * UIProcess/ios/WKContentViewInteraction.mm: Add new ivar to track whether the content view is resigning
2312         first responder status because the accessory view is being dismissed.
2313         (-[WKContentView resignFirstResponderForWebView]): Only tell WebKit to blur the focused element if we are
2314         resigning because the accessory view is being dismissed or the keyboard was hidden. We continue to do all
2315         other steps when resigning, including hiding the keyboard. Note that by not telling WebKit to blur the
2316         focused element we let it's focus controller manage the focused element with respect to the current
2317         page activation state (i.e. whether the content view is first responder or not). When the content view
2318         becomes the first responder then WebKit's focus controller will be told that the page has become activated
2319         and will tell the UIProcess to focus the currently focused element, which will bring up the keyboard.
2320         (-[WKContentView accessoryDone]): Update state so we know that a subsequent call to resign first responder
2321         was due to the accessory view being dismissed.
2322
2323 2019-03-19  Per Arne Vollan  <pvollan@apple.com>
2324
2325         [iOS] Remove overridden rules in sandbox
2326         https://bugs.webkit.org/show_bug.cgi?id=193840
2327         <rdar://problem/47558526>
2328
2329         Reviewed by Brent Fulgham.
2330
2331         On iOS, there are some rules overridden in the same sandbox file. The overridden rules
2332         should be removed.
2333
2334         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2335
2336 2019-03-19  Timothy Hatcher  <timothy@apple.com>
2337
2338         Make WebKit/NSAttributedString.h a public header.
2339         https://bugs.webkit.org/show_bug.cgi?id=195944
2340
2341         Reviewed by Dean Jackson.
2342
2343         * WebKit.xcodeproj/project.pbxproj:
2344
2345 2019-03-19  Chris Dumez  <cdumez@apple.com>
2346
2347         Drop NetworkCacheStatistics code
2348         https://bugs.webkit.org/show_bug.cgi?id=195910
2349
2350         Reviewed by Antti Koivisto.
2351
2352         Drop NetworkCacheStatistics code. It was a temporary experiment and has not been used in a long time.
2353
2354         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2355         (WebKit::NetworkProcessCreationParameters::encode const):
2356         (WebKit::NetworkProcessCreationParameters::decode):
2357         * NetworkProcess/NetworkProcessCreationParameters.h:
2358         * NetworkProcess/cache/NetworkCache.cpp:
2359         (WebKit::NetworkCache::Cache::Cache):
2360         (WebKit::NetworkCache::Cache::retrieve):
2361         (WebKit::NetworkCache::Cache::store):
2362         (WebKit::NetworkCache::Cache::storeRedirect):
2363         (WebKit::NetworkCache::Cache::update):
2364         (WebKit::NetworkCache::Cache::clear):
2365         * NetworkProcess/cache/NetworkCache.h:
2366         * NetworkProcess/cache/NetworkCacheStatistics.cpp: Removed.
2367         * NetworkProcess/cache/NetworkCacheStatistics.h: Removed.
2368         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2369         (WebKit::NetworkCache::traverseRecordsFiles):
2370         * NetworkProcess/cache/NetworkCacheStorage.h:
2371         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2372         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2373         * NetworkProcess/soup/NetworkProcessSoup.cpp:
2374         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
2375         * Sources.txt:
2376         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2377         (WebKit::registerUserDefaultsIfNeeded):
2378         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2379         * UIProcess/soup/WebProcessPoolSoup.cpp:
2380         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2381         * WebKit.xcodeproj/project.pbxproj:
2382
2383 2019-03-19  Chris Dumez  <cdumez@apple.com>
2384
2385         Spew: Unhandled web process message 'VisitedLinkTableController:VisitedLinkStateChanged'
2386         https://bugs.webkit.org/show_bug.cgi?id=194787
2387         <rdar://problem/48175520>
2388
2389         Reviewed by Geoffrey Garen.
2390
2391         The unhandled 'VisitedLinkTableController:VisitedLinkStateChanged' message logging happens
2392         when IPC is sent to a WebProcess which does not have a VisitedLinkTableController with the
2393         given identifier. VisitedLinkTableController are kept alive by the WebPage in the WebProcess
2394         side so this indicates that there is no WebPage using this VisitedLinkTableController anymore.
2395
2396         In the UIProcess side, our tracking of who is using which VisitedLinkStore was very poor.
2397         WebPageProxy objects would ask their process to register itself with the page's visitedLinkStore
2398         as soon as the WebPage object has been created on the WebProcess side. This part was fine.
2399         However, unregistration from the visitedLinkStores would only happen when either the
2400         visitedLinkStore would get destroyed or when the WebProcess would shutdown. This means that
2401         WebProcess could stay registered with a visitedLinkStore even after the page that was using it
2402         has been closed, which would lead to such logging.
2403
2404         To address the issue, the WebProcessProxy now keeps track for which pages are using which
2405         visitedLinkStore. When a visitedLinkStore is used by a page for the first time, the
2406         WebProcessProxy will register itself with the visitedLinkStore. Similarly, when the last page
2407         using a given visitedLinkStore is closed, the process unregisters itself from the
2408         visitedLinkStore, thus avoiding the bug.
2409
2410         I also simplified a lot the logic for having a page telling the WebProcessProxy it started
2411         using a visitedLinkStore. Previously, it would have to wait until the process is done launching
2412         before notifying the WebProcessProxy. Now, the WebPageProxy merely tells the WebProcessProxy
2413         that it is starting to use a visitedLinkStore as soon as it sent the CreateWebPage IPC to the
2414         WebProcess (no matter if the process is still launching or not). At this point, the
2415         WebProcessProxy registers the page as a user of the visitedLinkStore and takes care of waiting
2416         until it is done launching before registering itself with the visitedLinkStore.
2417
2418         * UIProcess/ProvisionalPageProxy.cpp:
2419         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
2420         (WebKit::ProvisionalPageProxy::initializeWebPage):
2421         (WebKit::ProvisionalPageProxy::processDidFinishLaunching): Deleted.
2422         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
2423         * UIProcess/ProvisionalPageProxy.h:
2424         * UIProcess/VisitedLinkStore.cpp:
2425         (WebKit::VisitedLinkStore::~VisitedLinkStore):
2426         (WebKit::VisitedLinkStore::addProcess):
2427         * UIProcess/WebPageProxy.cpp:
2428         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2429         (WebKit::WebPageProxy::initializeWebPage):
2430         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2431         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
2432         (WebKit::WebPageProxy::processDidFinishLaunching): Deleted.
2433         * UIProcess/WebPageProxy.h:
2434         * UIProcess/WebProcessProxy.cpp:
2435         (WebKit::WebProcessProxy::shutDown):
2436         (WebKit::WebProcessProxy::removeWebPage):
2437         (WebKit::WebProcessProxy::addVisitedLinkStoreUser):
2438         (WebKit::WebProcessProxy::removeVisitedLinkStoreUser):
2439         (WebKit::WebProcessProxy::addWebUserContentControllerProxy):
2440         (WebKit::WebProcessProxy::didFinishLaunching):
2441         (WebKit::WebProcessProxy::addVisitedLinkStore): Deleted.
2442         (WebKit::WebProcessProxy::didDestroyVisitedLinkStore): Deleted.
2443         * UIProcess/WebProcessProxy.h:
2444
2445 2019-03-19  Alex Christensen  <achristensen@webkit.org>
2446
2447         Make WTFLogChannelState and WTFLogLevel enum classes
2448         https://bugs.webkit.org/show_bug.cgi?id=195904
2449
2450         Reviewed by Eric Carlson.
2451
2452         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2453         (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
2454         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
2455         (WebKit::NetworkRTCProvider::NetworkRTCProvider):
2456
2457 2019-03-19  Michael Catanzaro  <mcatanzaro@igalia.com>
2458
2459         Unreviewed, rolling out r243132.
2460
2461         Broke GTK build
2462
2463         Reverted changeset:
2464
2465         "Make WTFLogChannelState and WTFLogLevel enum classes"
2466         https://bugs.webkit.org/show_bug.cgi?id=195904
2467         https://trac.webkit.org/changeset/243132
2468
2469 2019-03-19  Antti Koivisto  <antti@apple.com>
2470
2471         Layer with no backing store should still hit-test over a scroller
2472         https://bugs.webkit.org/show_bug.cgi?id=195378
2473         <rdar://problem/48652078>
2474
2475         Reviewed by Simon Fraser.
2476
2477         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
2478         (WebKit::RemoteLayerTreeHost::makeNode):
2479         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
2480         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
2481         (WebKit::collectDescendantViewsAtPoint):
2482
2483         No need for special WKTiledBackingView, tiled views now have correct event regions.
2484
2485 2019-03-18  Alex Christensen  <achristensen@webkit.org>
2486
2487         Make WTFLogChannelState and WTFLogLevel enum classes
2488         https://bugs.webkit.org/show_bug.cgi?id=195904
2489
2490         Reviewed by Eric Carlson.
2491
2492         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2493         (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
2494         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
2495         (WebKit::NetworkRTCProvider::NetworkRTCProvider):
2496
2497 2019-03-18  Commit Queue  <commit-queue@webkit.org>
2498
2499         Unreviewed, rolling out r243092 and r243096.
2500         https://bugs.webkit.org/show_bug.cgi?id=195926
2501
2502         Caused assertions in tests (Requested by smfr on #webkit).
2503
2504         Reverted changesets:
2505
2506         "Layer with no backing store should still hit-test over a
2507         scroller"
2508         https://bugs.webkit.org/show_bug.cgi?id=195378
2509         https://trac.webkit.org/changeset/243092
2510
2511         "Try to fix Windows build."
2512         https://trac.webkit.org/changeset/243096
2513
2514 2019-03-18  Timothy Hatcher  <timothy@apple.com>
2515
2516         WKWebView.GetContentsShouldReturnAttributedString is crashing on iOS Simulator.
2517         https://bugs.webkit.org/show_bug.cgi?id=195916
2518
2519         Reviewed by Tim Horton.
2520
2521         Add direct support for UIColor so it does not try to use the NSSecureCoding path.
2522         This avoids needs to list the classes when decoding the attributes NSDictionary
2523         and matches the macOS NSColor encoder/decoder.
2524
2525         * Shared/Cocoa/ArgumentCodersCocoa.mm:
2526         (IPC::typeFromObject):
2527         (IPC::encodeColorInternal):
2528         (IPC::decodeColorInternal):
2529         (IPC::encodeObject):
2530         (IPC::decodeObject):
2531
2532 2019-03-18  Timothy Hatcher  <timothy@apple.com>
2533
2534         Add new NSAttributedString API for converting HTML.
2535         https://bugs.webkit.org/show_bug.cgi?id=195636
2536         rdar://problem/45055697
2537
2538         Reviewed by Tim Horton.
2539
2540         * Platform/spi/ios/UIKitSPI.h:
2541         * SourcesCocoa.txt:
2542         * UIProcess/API/Cocoa/NSAttributedString.h: Added.
2543         * UIProcess/API/Cocoa/NSAttributedString.mm: Added.
2544         (-[_WKAttributedStringNavigationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
2545         (-[_WKAttributedStringNavigationDelegate webView:didFailProvisionalNavigation:withError:]):
2546         (-[_WKAttributedStringNavigationDelegate webView:didFailNavigation:withError:]):
2547         (-[_WKAttributedStringNavigationDelegate webView:didFinishNavigation:]):
2548         (+[_WKAttributedStringWebViewCache cache]):
2549         (+[_WKAttributedStringWebViewCache configuration]):
2550         (+[_WKAttributedStringWebViewCache clearConfiguration]):
2551         (+[_WKAttributedStringWebViewCache retrieveOrCreateWebView]):
2552         (+[_WKAttributedStringWebViewCache cacheWebView:]):
2553         (+[_WKAttributedStringWebViewCache resetPurgeDelay]):
2554         (+[_WKAttributedStringWebViewCache purgeSingleWebView]):
2555         (+[_WKAttributedStringWebViewCache purgeAllWebViews]):
2556         (+[NSAttributedString _loadFromHTMLWithOptions:contentLoader:completionHandler:]):
2557         (+[NSAttributedString loadFromHTMLWithRequest:options:completionHandler:]):
2558         (+[NSAttributedString loadFromHTMLWithFileURL:options:completionHandler:]):
2559         (+[NSAttributedString loadFromHTMLWithString:options:completionHandler:]):
2560         (+[NSAttributedString loadFromHTMLWithData:options:completionHandler:]):
2561         * UIProcess/API/Cocoa/NSAttributedStringPrivate.h: Copied from Source/WebKit/UIProcess/API/Cocoa/WKErrorInternal.h.
2562         * UIProcess/API/Cocoa/WKError.h:
2563         * UIProcess/API/Cocoa/WKError.mm:
2564         (localizedDescriptionForErrorCode):
2565         (createNSError):
2566         * UIProcess/API/Cocoa/WKErrorInternal.h:
2567         * WebKit.xcodeproj/project.pbxproj:
2568         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
2569         (WebKit::WebPage::getContentsAsAttributedString):
2570
2571 2019-03-18  Alex Christensen  <achristensen@webkit.org>
2572
2573         Implement DownloadMonitor to prevent long-running slow downloads from background apps
2574         https://bugs.webkit.org/show_bug.cgi?id=195785
2575
2576         Reviewed by Geoffrey Garen.
2577
2578         This is similar to what was updated in <rdar://problem/42677685> but for WebKit Downloads.
2579         To test it I implemented a throttled TCP server, SPI to speed up DownloadMonitor's timer,
2580         and SPI to synthesize the application going into the background and foreground, which
2581         NSNotificationCenter does on iOS.
2582
2583         * NetworkProcess/Downloads/Download.cpp:
2584         (WebKit::Download::didReceiveData):
2585         (WebKit::Download::didFinish):
2586         (WebKit::Download::didFail):
2587         (WebKit::Download::didCancel):
2588         * NetworkProcess/Downloads/Download.h:
2589         (WebKit::Download::applicationEnteredBackground):
2590         (WebKit::Download::applicationEnteredForeground):
2591         (WebKit::Download::manager const):
2592         * NetworkProcess/Downloads/DownloadManager.cpp:
2593         (WebKit::DownloadManager::downloadFinished):
2594         (WebKit::DownloadManager::applicationDidEnterBackground):
2595         (WebKit::DownloadManager::applicationWillEnterForeground):
2596         * NetworkProcess/Downloads/DownloadManager.h:
2597         * NetworkProcess/Downloads/DownloadMap.cpp:
2598         (WebKit::DownloadMap::values):
2599         * NetworkProcess/Downloads/DownloadMap.h:
2600         * NetworkProcess/Downloads/DownloadMonitor.cpp: Added.
2601         (WebKit::operator _kbps):
2602         (WebKit::timeUntilNextInterval):
2603         (WebKit::DownloadMonitor::DownloadMonitor):
2604         (WebKit::DownloadMonitor::measuredThroughputRate const):
2605         (WebKit::DownloadMonitor::downloadReceivedBytes):
2606         (WebKit::DownloadMonitor::applicationEnteredForeground):
2607         (WebKit::DownloadMonitor::applicationEnteredBackground):
2608         (WebKit::DownloadMonitor::speedMultiplier const):
2609         (WebKit::DownloadMonitor::timerFired):
2610         * NetworkProcess/Downloads/DownloadMonitor.h: Added.
2611         * NetworkProcess/NetworkProcess.cpp:
2612         (WebKit::NetworkProcess::initializeNetworkProcess):
2613         (WebKit::NetworkProcess::applicationDidEnterBackground):
2614         (WebKit::NetworkProcess::applicationWillEnterForeground):
2615         * NetworkProcess/NetworkProcess.h:
2616         * NetworkProcess/NetworkProcess.messages.in:
2617         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2618         (WebKit::NetworkProcessCreationParameters::encode const):
2619         (WebKit::NetworkProcessCreationParameters::decode):
2620         * NetworkProcess/NetworkProcessCreationParameters.h:
2621         * Sources.txt:
2622         * SourcesCocoa.txt:
2623         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2624         (API::ProcessPoolConfiguration::copy):
2625         * UIProcess/API/APIProcessPoolConfiguration.h:
2626         * UIProcess/API/C/WKContext.cpp:
2627         (WKContextDownloadURLRequest):
2628         (WKContextResumeDownload):
2629         * UIProcess/API/Cocoa/WKProcessPool.mm:
2630         (-[WKProcessPool _synthesizeAppIsBackground:]):
2631         (-[WKProcessPool _downloadURLRequest:originatingWebView:]):
2632         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2633         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2634         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2635         (-[_WKProcessPoolConfiguration downloadMonitorSpeedMultiplier]):
2636         (-[_WKProcessPoolConfiguration setDownloadMonitorSpeedMultiplier:]):
2637         * UIProcess/Cocoa/DownloadProxyMapCocoa.mm: Added.
2638         (WebKit::DownloadProxyMap::platformCreate):
2639         (WebKit::DownloadProxyMap::platformDestroy):
2640         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2641         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2642         * UIProcess/Downloads/DownloadProxy.cpp:
2643         (WebKit::DownloadProxy::didFinish):
2644         (WebKit::DownloadProxy::didFail):
2645         (WebKit::DownloadProxy::didCancel):
2646         * UIProcess/Downloads/DownloadProxyMap.cpp:
2647         (WebKit::DownloadProxyMap::DownloadProxyMap):
2648         (WebKit::DownloadProxyMap::~DownloadProxyMap):
2649         (WebKit::DownloadProxyMap::platformCreate):
2650         (WebKit::DownloadProxyMap::platformDestroy):
2651         (WebKit::DownloadProxyMap::applicationDidEnterBackground):
2652         (WebKit::DownloadProxyMap::applicationWillEnterForeground):
2653         (WebKit::DownloadProxyMap::createDownloadProxy):
2654         (WebKit::DownloadProxyMap::downloadFinished):
2655         * UIProcess/Downloads/DownloadProxyMap.h:
2656         * UIProcess/Network/NetworkProcessProxy.cpp:
2657         (WebKit::NetworkProcessProxy::synthesizeAppIsBackground):
2658         (WebKit::NetworkProcessProxy::createDownloadProxy):
2659         * UIProcess/Network/NetworkProcessProxy.h:
2660         * UIProcess/PageClient.h:
2661         * UIProcess/WebPageProxy.cpp:
2662         (WebKit::WebPageProxy::receivedPolicyDecision):
2663         (WebKit::WebPageProxy::handleDownloadRequest):
2664         * UIProcess/WebPageProxy.h:
2665         * UIProcess/WebProcessPool.cpp:
2666         (WebKit::WebProcessPool::download):
2667         (WebKit::WebProcessPool::resumeDownload):
2668         (WebKit::WebProcessPool::createDownloadProxy):
2669         (WebKit::WebProcessPool::synthesizeAppIsBackground):
2670         * UIProcess/WebProcessPool.h:
2671         * UIProcess/ios/PageClientImplIOS.h:
2672         * UIProcess/ios/PageClientImplIOS.mm:
2673         (WebKit::PageClientImpl::handleDownloadRequest):
2674         * UIProcess/mac/PageClientImplMac.h:
2675         * UIProcess/mac/PageClientImplMac.mm:
2676         (WebKit::PageClientImpl::handleDownloadRequest):
2677         * WebKit.xcodeproj/project.pbxproj:
2678
2679 2019-03-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2680
2681         [iOS] Native selection views sometimes appear in hidden editable areas after losing focus
2682         https://bugs.webkit.org/show_bug.cgi?id=195894
2683         <rdar://problem/48849989>
2684
2685         Reviewed by Tim Horton.
2686
2687         On certain websites, focus is moved away from an editable element while maintaining a selection inside the
2688         editable element. In the case where the editable element is hidden, this currently breaks our text interaction
2689         suppression heuristics, which suppress text selection gestures and overlays inside focused hidden editable
2690         elements. To fix this, we refactor our text interaction suppression heuristics, such that they are not dependent
2691         on an editable element being focused. See changes below for more details.
2692
2693         Test: editing/selection/ios/hide-selection-in-non-focused-element.html
2694
2695         * Shared/EditorState.cpp:
2696         (WebKit::EditorState::PostLayoutData::encode const):
2697         (WebKit::EditorState::PostLayoutData::decode):
2698         * Shared/EditorState.h:
2699
2700         Rename elementIsTransparentOrFullyClipped to editableRootIsTransparentOrFullyClipped, and additionally compute
2701         this flag by checking whether the root editable element containing the selection is transparent or clipped,
2702         instead of using the currently focused element.
2703
2704         * Shared/FocusedElementInformation.cpp:
2705         (WebKit::FocusedElementInformation::encode const):
2706         (WebKit::FocusedElementInformation::decode):
2707         * Shared/FocusedElementInformation.h:
2708
2709         Remove the elementIsTransparentOrFullyClipped flag from FocusedElementInformation (see below for more detail).
2710
2711         * UIProcess/ios/WKContentViewInteraction.h:
2712
2713         Rename FocusedElementIsTransparentOrFullyClipped to EditableRootIsTransparentOrFullyClipped.
2714
2715         * UIProcess/ios/WKContentViewInteraction.mm:
2716         (-[WKContentView _zoomToRevealFocusedElement]):
2717         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2718
2719         Remove logic that currently uses state on FocusedElementInformation to determine whether to suppress platform
2720         text interactions; instead, only use EditorState to make this determination. This logic was originally added in
2721         the initial implementation of the text interaction suppression heuristic as a way to begin suppressing text
2722         selection state before zooming to reveal the focused element; however, since we now zoom to reveal the text
2723         selection when focusing editable elements, zooming is deferred until the next complete EditorState update
2724         arrives in the UI process so we don't need to worry about beginning to suppress text interactions prior to this
2725         initial editor state update.
2726
2727         (-[WKContentView _elementDidBlur]):
2728         (-[WKContentView _updateSelectionAssistantSuppressionState]):
2729
2730         Add a helper method that updates text selection suppression state using the current EditorState.
2731
2732         (-[WKContentView _selectionChanged]):
2733         (-[WKContentView _updateChangedSelection:]):
2734
2735         Always update text suppression state when receiving an EditorState, instead of only doing so when processing a
2736         text selection gesture.
2737
2738         (-[WKContentView _startSuppressingSelectionAssistantForReason:]):
2739
2740         Renamed from _beginSuppressingSelectionAssistantForReason:, to better match "start/end" terminology of
2741         _endSuppressingSelectionAssistantForReason:.
2742
2743         (-[WKContentView dropInteraction:performDrop:]):
2744         (-[WKContentView _beginSuppressingSelectionAssistantForReason:]): Deleted.
2745         * UIProcess/ios/WebPageProxyIOS.mm:
2746         (WebKit::WebPageProxy::editorStateChanged):
2747
2748         Ensure that we run logic to zoom to the focused element *after* updating text selection suppression state, so we
2749         don't erroneously zoom to reveal hidden editable elements.
2750
2751         * WebProcess/WebPage/ios/WebPageIOS.mm:
2752         (WebKit::WebPage::platformEditorState const):
2753         (WebKit::WebPage::getFocusedElementInformation):
2754
2755 2019-03-18  Chris Dumez  <cdumez@apple.com>
2756
2757         Delay WebProcess launch until a load is triggered in a Web view
2758         https://bugs.webkit.org/show_bug.cgi?id=195758
2759         <rdar://problem/48126013>
2760
2761         Reviewed by Geoff Garen.
2762
2763         This is achieved by constructing WebPageProxy objects with a WebProcessProxy that is in
2764         terminated state (because it never launched its process). This is convenient because
2765         it is a state that the WebPageProxy supports, which normally happened by the WebProcess
2766         crashes. When trying to do a load, we were already checking if the WebPageProxy's process
2767         was running (via an isValid() check) and we would re-launch the WebProcess if necessary
2768         by calling reattachToWebProcess(). For clarity, given that this state is no longer
2769         indicating that the WebProcess crashed, I renamed isValid() to hasRunningProcess() and
2770         reattachToWebProcess() to launchProcess().
2771
2772         The reason delaying the WebProcess launch until the first load is useful is because it
2773         allows us to leverage the WebProcessCache given that we now know which registrable
2774         domain is going to be loaded in the process.
2775
2776         This is a progression from a power usage standpoint. When it comes to page load time,
2777         it would be a progression if we found a suitable process in the cache. I do not expect
2778         a performance hit when no process is found in the cache because of process prewarming.
2779
2780         * Shared/API/Cocoa/RemoteObjectRegistry.h:
2781         * Shared/API/Cocoa/RemoteObjectRegistry.mm:
2782         (WebKit::m_launchInitialProcessIfNecessary):
2783         (WebKit::RemoteObjectRegistry::sendInvocation):
2784         * UIProcess/API/Cocoa/WKProcessPool.mm:
2785         (-[WKProcessPool _processCacheSize]):
2786         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2787         * UIProcess/API/Cocoa/WKWebView.mm:
2788         (-[WKWebView _isValid]):
2789         * UIProcess/Automation/WebAutomationSession.cpp:
2790         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
2791         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2792         (WebKit::WebPageProxy::performDictionaryLookupAtLocation):
2793         (WebKit::WebPageProxy::performDictionaryLookupOfCurrentSelection):
2794         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
2795         (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState):
2796         (WebKit::DrawingAreaProxyCoordinatedGraphics::waitForAndDispatchDidUpdateBackingStoreState):
2797         (WebKit::DrawingAreaProxyCoordinatedGraphics::dispatchAfterEnsuringDrawing):
2798         * UIProcess/DrawingAreaProxy.cpp:
2799         (WebKit::DrawingAreaProxy::setViewExposedRect):
2800         (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired):
2801         * UIProcess/GeolocationPermissionRequestManagerProxy.cpp:
2802         (WebKit::GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision):
2803         * UIProcess/InspectorTargetProxy.cpp:
2804         (WebKit::InspectorTargetProxy::connect):
2805         (WebKit::InspectorTargetProxy::disconnect):
2806         (WebKit::InspectorTargetProxy::sendMessageToTargetBackend):
2807         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2808         (WebKit::RemoteLayerTreeDrawingAreaProxy::sizeDidChange):
2809         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
2810         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
2811         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2812         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
2813         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
2814         (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest):
2815         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
2816         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2817         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
2818         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
2819         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged):
2820         * UIProcess/ViewGestureController.cpp:
2821         (WebKit::ViewGestureController::ViewGestureController):
2822         * UIProcess/WebBackForwardList.cpp:
2823         (WebKit::WebBackForwardList::~WebBackForwardList):
2824         * UIProcess/WebCookieManagerProxy.cpp:
2825         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
2826         * UIProcess/WebEditCommandProxy.cpp:
2827         (WebKit::WebEditCommandProxy::unapply):
2828         (WebKit::WebEditCommandProxy::reapply):
2829         * UIProcess/WebFrameProxy.cpp:
2830         (WebKit::WebFrameProxy::stopLoading const):
2831         * UIProcess/WebInspectorProxy.cpp:
2832         (WebKit::WebInspectorProxy::WebInspectorProxy):
2833         * UIProcess/WebPageProxy.cpp:
2834         (WebKit::m_resetRecentCrashCountTimer):
2835         (WebKit::WebPageProxy::hasRunningProcess const):
2836         (WebKit::WebPageProxy::setUIClient):
2837         (WebKit::WebPageProxy::setIconLoadingClient):
2838         (WebKit::WebPageProxy::launchProcess):
2839         (WebKit::WebPageProxy::swapToWebProcess):
2840         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2841         (WebKit::WebPageProxy::didAttachToRunningProcess):
2842         (WebKit::WebPageProxy::launchProcessForReload):
2843         (WebKit::WebPageProxy::launchProcessWithItem):
2844         (WebKit::WebPageProxy::initializeWebPage):
2845         (WebKit::WebPageProxy::tryClose):
2846         (WebKit::WebPageProxy::loadRequest):
2847         (WebKit::WebPageProxy::loadFile):
2848         (WebKit::WebPageProxy::loadData):
2849         (WebKit::WebPageProxy::loadAlternateHTML):
2850         (WebKit::WebPageProxy::loadWebArchiveData):
2851         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
2852         (WebKit::WebPageProxy::stopLoading):
2853         (WebKit::WebPageProxy::reload):
2854         (WebKit::WebPageProxy::goToBackForwardItem):
2855         (WebKit::WebPageProxy::tryRestoreScrollPosition):
2856         (WebKit::WebPageProxy::setControlledByAutomation):
2857         (WebKit::WebPageProxy::setIndicating):
2858         (WebKit::WebPageProxy::setBackgroundColor):
2859         (WebKit::WebPageProxy::setTopContentInset):
2860         (WebKit::WebPageProxy::setUnderlayColor):
2861         (WebKit::WebPageProxy::viewWillStartLiveResize):
2862         (WebKit::WebPageProxy::viewWillEndLiveResize):
2863         (WebKit::WebPageProxy::dispatchActivityStateChange):
2864         (WebKit::WebPageProxy::layerHostingModeDidChange):
2865         (WebKit::WebPageProxy::waitForDidUpdateActivityState):
2866         (WebKit::WebPageProxy::setInitialFocus):
2867         (WebKit::WebPageProxy::clearSelection):
2868         (WebKit::WebPageProxy::restoreSelectionInFocusedEditableElement):
2869         (WebKit::WebPageProxy::validateCommand):
2870         (WebKit::WebPageProxy::increaseListLevel):
2871         (WebKit::WebPageProxy::decreaseListLevel):
2872         (WebKit::WebPageProxy::changeListType):
2873         (WebKit::WebPageProxy::setBaseWritingDirection):
2874         (WebKit::WebPageProxy::setNeedsFontAttributes):
2875         (WebKit::WebPageProxy::executeEditCommand):
2876         (WebKit::WebPageProxy::requestFontAttributesAtSelectionStart):
2877         (WebKit::WebPageProxy::setEditable):
2878         (WebKit::WebPageProxy::performDragControllerAction):
2879         (WebKit::WebPageProxy::dragEnded):
2880         (WebKit::WebPageProxy::didStartDrag):
2881         (WebKit::WebPageProxy::dragCancelled):
2882         (WebKit::WebPageProxy::handleMouseEvent):
2883         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
2884         (WebKit::WebPageProxy::handleWheelEvent):
2885         (WebKit::WebPageProxy::handleKeyboardEvent):
2886         (WebKit::WebPageProxy::handleGestureEvent):
2887         (WebKit::WebPageProxy::handleTouchEventSynchronously):
2888         (WebKit::WebPageProxy::handleTouchEventAsynchronously):
2889         (WebKit::WebPageProxy::handleTouchEvent):
2890         (WebKit::WebPageProxy::scrollBy):
2891         (WebKit::WebPageProxy::centerSelectionInVisibleArea):
2892         (WebKit::WebPageProxy::receivedPolicyDecision):
2893         (WebKit::WebPageProxy::setUserAgent):
2894         (WebKit::WebPageProxy::resumeActiveDOMObjectsAndAnimations):
2895         (WebKit::WebPageProxy::suspendActiveDOMObjectsAndAnimations):
2896         (WebKit::WebPageProxy::setCustomTextEncodingName):
2897         (WebKit::WebPageProxy::setTextZoomFactor):
2898         (WebKit::WebPageProxy::setPageZoomFactor):
2899         (WebKit::WebPageProxy::setPageAndTextZoomFactors):
2900         (WebKit::WebPageProxy::scalePage):
2901         (WebKit::WebPageProxy::scalePageInViewCoordinates):
2902         (WebKit::WebPageProxy::scaleView):
2903         (WebKit::WebPageProxy::windowScreenDidChange):
2904         (WebKit::WebPageProxy::setCustomDeviceScaleFactor):
2905         (WebKit::WebPageProxy::accessibilitySettingsDidChange):
2906         (WebKit::WebPageProxy::updateAccessibilityEventsEnabled):
2907         (WebKit::WebPageProxy::setUseFixedLayout):
2908         (WebKit::WebPageProxy::setFixedLayoutSize):
2909         (WebKit::WebPageProxy::setAlwaysShowsHorizontalScroller):
2910         (WebKit::WebPageProxy::setAlwaysShowsVerticalScroller):
2911         (WebKit::WebPageProxy::listenForLayoutMilestones):
2912         (WebKit::WebPageProxy::setSuppressScrollbarAnimations):
2913         (WebKit::WebPageProxy::setEnableVerticalRubberBanding):
2914         (WebKit::WebPageProxy::setEnableHorizontalRubberBanding):
2915         (WebKit::WebPageProxy::setBackgroundExtendsBeyondPage):
2916         (WebKit::WebPageProxy::setPaginationMode):
2917         (WebKit::WebPageProxy::setPaginationBehavesLikeColumns):
2918         (WebKit::WebPageProxy::setPageLength):
2919         (WebKit::WebPageProxy::setGapBetweenPages):
2920         (WebKit::WebPageProxy::setPaginationLineGridEnabled):
2921         (WebKit::WebPageProxy::countStringMatches):
2922         (WebKit::WebPageProxy::replaceMatches):
2923         (WebKit::WebPageProxy::launchInitialProcessIfNecessary):
2924         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
2925         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
2926         (WebKit::WebPageProxy::getRenderTreeExternalRepresentation):
2927         (WebKit::WebPageProxy::getSourceForFrame):
2928         (WebKit::WebPageProxy::getContentsAsString):
2929         (WebKit::WebPageProxy::getContentsAsAttributedString):
2930         (WebKit::WebPageProxy::getBytecodeProfile):
2931         (WebKit::WebPageProxy::getSamplingProfilerOutput):
2932         (WebKit::WebPageProxy::getContentsAsMHTMLData):
2933         (WebKit::WebPageProxy::getSelectionOrContentsAsString):
2934         (WebKit::WebPageProxy::getSelectionAsWebArchiveData):
2935         (WebKit::WebPageProxy::getMainResourceDataOfFrame):
2936         (WebKit::WebPageProxy::getResourceDataFromFrame):
2937         (WebKit::WebPageProxy::getWebArchiveOfFrame):
2938         (WebKit::WebPageProxy::forceRepaint):
2939         (WebKit::WebPageProxy::preferencesDidChange):
2940         (WebKit::WebPageProxy::setMediaVolume):
2941         (WebKit::WebPageProxy::setMuted):
2942         (WebKit::WebPageProxy::setMediaCaptureEnabled):
2943         (WebKit::WebPageProxy::stopMediaCapture):
2944         (WebKit::WebPageProxy::stopAllMediaPlayback):
2945         (WebKit::WebPageProxy::suspendAllMediaPlayback):
2946         (WebKit::WebPageProxy::resumeAllMediaPlayback):
2947         (WebKit::WebPageProxy::handleMediaEvent):
2948         (WebKit::WebPageProxy::setVolumeOfMediaElement):
2949         (WebKit::WebPageProxy::setMayStartMediaWhenInWindow):
2950         (WebKit::WebPageProxy::didChooseColor):
2951         (WebKit::WebPageProxy::didEndColorPicker):
2952         (WebKit::WebPageProxy::didSelectOption):
2953         (WebKit::WebPageProxy::inspector const):
2954         (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
2955         (WebKit::WebPageProxy::didChooseFilesForOpenPanel):
2956         (WebKit::WebPageProxy::didCancelForOpenPanel):
2957         (WebKit::WebPageProxy::removeEditCommand):
2958         (WebKit::WebPageProxy::processDidBecomeUnresponsive):
2959         (WebKit::WebPageProxy::processDidBecomeResponsive):
2960         (WebKit::WebPageProxy::processDidTerminate):
2961         (WebKit::WebPageProxy::processWillBecomeSuspended):
2962         (WebKit::WebPageProxy::processWillBecomeForeground):
2963         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2964         (WebKit::WebPageProxy::setCanRunModal):
2965         (WebKit::WebPageProxy::canRunModal):
2966         (WebKit::WebPageProxy::computePagesForPrinting):
2967         (WebKit::WebPageProxy::drawRectToImage):
2968         (WebKit::WebPageProxy::drawPagesToPDF):
2969         (WebKit::WebPageProxy::drawPagesForPrinting):
2970         (WebKit::WebPageProxy::updateBackingStoreDiscardableState):
2971         (WebKit::WebPageProxy::setViewLayoutSize):
2972         (WebKit::WebPageProxy::setAutoSizingShouldExpandToViewHeight):
2973         (WebKit::WebPageProxy::setViewportSizeForCSSViewportUnits):
2974         (WebKit::WebPageProxy::setComposition):
2975         (WebKit::WebPageProxy::confirmComposition):
2976         (WebKit::WebPageProxy::cancelComposition):
2977         (WebKit::WebPageProxy::setScrollPinningBehavior):
2978         (WebKit::WebPageProxy::setOverlayScrollbarStyle):
2979         (WebKit::WebPageProxy::changeFontAttributes):
2980         (WebKit::WebPageProxy::changeFont):
2981         (WebKit::WebPageProxy::setTextAsync):
2982         (WebKit::WebPageProxy::insertTextAsync):
2983         (WebKit::WebPageProxy::getMarkedRangeAsync):
2984         (WebKit::WebPageProxy::getSelectedRangeAsync):
2985         (WebKit::WebPageProxy::characterIndexForPointAsync):
2986         (WebKit::WebPageProxy::firstRectForCharacterRangeAsync):
2987         (WebKit::WebPageProxy::setCompositionAsync):
2988         (WebKit::WebPageProxy::confirmCompositionAsync):
2989         (WebKit::WebPageProxy::takeSnapshot):
2990         (WebKit::WebPageProxy::requestActiveNowPlayingSessionInfo):
2991         (WebKit::WebPageProxy::setUseSystemAppearance):
2992         (WebKit::WebPageProxy::installActivityStateChangeCompletionHandler):
2993         (WebKit::WebPageProxy::setPlaybackTarget):
2994         (WebKit::WebPageProxy::externalOutputDeviceAvailableDidChange):
2995         (WebKit::WebPageProxy::setShouldPlayToPlaybackTarget):
2996         (WebKit::WebPageProxy::clearWheelEventTestTrigger):
2997         (WebKit::WebPageProxy::callAfterNextPresentationUpdate):
2998         (WebKit::WebPageProxy::setShouldScaleViewToFitDocument):
2999         (WebKit::WebPageProxy::getLoadDecisionForIcon):
3000         (WebKit::WebPageProxy::setResourceCachingDisabled):
3001         (WebKit::WebPageProxy::setUserInterfaceLayoutDirection):
3002         (WebKit::WebPageProxy::effectiveAppearanceDidChange):
3003         (WebKit::WebPageProxy::insertAttachment):
3004         (WebKit::WebPageProxy::updateAttachmentAttributes):
3005         (WebKit::WebPageProxy::getApplicationManifest):
3006         (WebKit::WebPageProxy::textInputContextsInRect):
3007         (WebKit::WebPageProxy::focusTextInputContext):
3008         * UIProcess/WebPageProxy.h:
3009         * UIProcess/WebProcessPool.cpp:
3010         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
3011         (WebKit::WebProcessPool::initializeNewWebProcess):
3012         (WebKit::WebProcessPool::disconnectProcess):
3013         (WebKit::WebProcessPool::createWebPage):
3014         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
3015         * UIProcess/WebProcessPool.h:
3016         * UIProcess/WebProcessProxy.cpp:
3017         (WebKit::WebProcessProxy::create):
3018         (WebKit::WebProcessProxy::addExistingWebPage):
3019         (WebKit::WebProcessProxy::maybeShutDown):
3020         * UIProcess/WebProcessProxy.h:
3021         * UIProcess/gstreamer/InstallMissingMediaPluginsPermissionRequest.cpp:
3022         (WebKit::InstallMissingMediaPluginsPermissionRequest::allow):
3023         (WebKit::InstallMissingMediaPluginsPermissionRequest::didEndRequestInstallMissingMediaPlugins):
3024         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
3025         (WebKit::WebInspectorProxy::platformDetach):
3026         * UIProcess/ios/WKContentViewInteraction.mm:
3027         (-[WKContentView setupInteraction]):
3028         (-[WKContentView _webTouchEventsRecognized:]):
3029         (-[WKContentView _hoverGestureRecognizerChanged:]):
3030         * UIProcess/ios/WebPageProxyIOS.mm:
3031         (WebKit::WebPageProxy::requestFocusedElementInformation):
3032         (WebKit::WebPageProxy::updateVisibleContentRects):
3033         (WebKit::WebPageProxy::updateStringForFind):
3034         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
3035         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize):
3036         (WebKit::WebPageProxy::setForceAlwaysUserScalable):
3037         (WebKit::WebPageProxy::setMaximumUnobscuredSize):
3038         (WebKit::WebPageProxy::setDeviceOrientation):
3039         (WebKit::WebPageProxy::setOverrideViewportArguments):
3040         (WebKit::WebPageProxy::selectWithGesture):
3041         (WebKit::WebPageProxy::updateSelectionWithTouches):
3042         (WebKit::WebPageProxy::requestAutocorrectionData):
3043         (WebKit::WebPageProxy::applyAutocorrection):
3044         (WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
3045         (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
3046         (WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection):
3047         (WebKit::WebPageProxy::selectPositionAtPoint):
3048         (WebKit::WebPageProxy::beginSelectionInDirection):
3049         (WebKit::WebPageProxy::updateSelectionWithExtentPoint):
3050         (WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
3051         (WebKit::WebPageProxy::requestDictationContext):
3052         (WebKit::WebPageProxy::getSelectionContext):
3053         (WebKit::WebPageProxy::selectWithTwoTouches):
3054         (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset):
3055         (WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText):
3056         (WebKit::WebPageProxy::moveSelectionByOffset):
3057         (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens):
3058         (WebKit::WebPageProxy::focusNextFocusedElement):
3059         (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
3060         (WebKit::WebPageProxy::requestEvasionRectsAboveSelection):
3061         (WebKit::WebPageProxy::requestDragStart):
3062         (WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
3063         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
3064         (WebKit::TiledCoreAnimationDrawingAreaProxy::sizeDidChange):
3065         (WebKit::TiledCoreAnimationDrawingAreaProxy::viewLayoutSizeDidChange):
3066         (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence):
3067         (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing):
3068         * UIProcess/mac/WebPageProxyMac.mm:
3069         (WebKit::WebPageProxy::windowAndViewFramesChanged):
3070         (WebKit::WebPageProxy::setMainFrameIsScrollable):
3071         (WebKit::WebPageProxy::insertDictatedTextAsync):
3072         (WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync):
3073         (WebKit::WebPageProxy::fontAtSelection):
3074         (WebKit::WebPageProxy::stringSelectionForPasteboard):
3075         (WebKit::WebPageProxy::dataSelectionForPasteboard):
3076         (WebKit::WebPageProxy::readSelectionFromPasteboard):
3077         (WebKit::WebPageProxy::sendComplexTextInputToPlugin):
3078         (WebKit::WebPageProxy::registerWebProcessAccessibilityToken):
3079         (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens):
3080         (WebKit::WebPageProxy::acceptsFirstMouse):
3081         * UIProcess/win/WebInspectorProxyWin.cpp:
3082         (WebKit::WebInspectorProxy::platformDetach):
3083         * UIProcess/win/WebView.cpp:
3084         (WebKit::WebView::cursorToShow const):
3085         * WebProcess/WebPage/WebPage.cpp:
3086         (WebKit::m_hostFileDescriptor):
3087
3088 2019-03-18  Antti Koivisto  <antti@apple.com>
3089
3090         Layer with no backing store should still hit-test over a scroller
3091         https://bugs.webkit.org/show_bug.cgi?id=195378
3092         <rdar://problem/48652078>
3093
3094         Reviewed by Simon Fraser.
3095
3096         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
3097         (WebKit::RemoteLayerTreeHost::makeNode):
3098         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
3099         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
3100         (WebKit::collectDescendantViewsAtPoint):
3101
3102         No need for special WKTiledBackingView, tiled views now have correct event regions.
3103
3104 2019-03-18  Daniel Bates  <dabates@apple.com>
3105
3106         [iOS] No DOM keypress event emitted for cursor key commands when non-editable element is focused
3107         https://bugs.webkit.org/show_bug.cgi?id=195626
3108         <rdar://problem/48810626>
3109
3110         Reviewed by Wenson Hsieh.
3111
3112         Following the UIKit fix <rdar://problem/47333786> WebKit will be asked whether it can perform some
3113         more actions, including cursor movements and more editing actions. All such actions are only applicable
3114         to editable elements. By responding NO to UIKit for such actions when we are not in an editable element
3115         we avoid the need to do such bookkeeping ourselves as UIKit will forward our response back to us
3116         on return from -handleKeyTextCommandForCurrentEvent, called from -[WKContentView _interpretKeyEvent].
3117         WebKit is then in a position to try to handle the event or in the case of all standard text editing
3118         key commands at the time of writing (e.g. Control + a) tell WebCore that it did not handle the event
3119         so that WebCore can continue the DOM key event dispatch algorithm. For standard text editing key
3120         commands, such as Control + a, we will emit a DOM keypress event for the 'a'.
3121
3122         * UIProcess/ios/WKContentViewInteraction.mm:
3123         (-[WKContentView canPerformAction:withSender:]):
3124
3125 2019-03-18  Adrian Perez de Castro  <aperez@igalia.com>
3126
3127         [WPE] Bump public API to wpe-1.0
3128         https://bugs.webkit.org/show_bug.cgi?id=195887
3129
3130         Reviewed by Philippe Normand.
3131
3132         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: Renamed from Source/WebKit/UIProcess/API/wpe/docs/wpe-0.1-sections.txt.
3133         * WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-1.0-sections.txt: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-0.1-sections.txt.
3134
3135 2019-03-18  Adrian Perez de Castro  <aperez@igalia.com>
3136
3137         [WPE] Bump dependencies to wpe-1.0 and wpebackend-fdo-1.0
3138         https://bugs.webkit.org/show_bug.cgi?id=195786
3139
3140         Reviewed by Philippe Normand.
3141
3142         * wpe/wpe-web-extension.pc.in: Change dependency to wpe-1.0
3143         * wpe/wpe-webkit.pc.in: Ditto.
3144
3145 2019-03-17  Fujii Hironori  <Hironori.Fujii@sony.com>
3146
3147         [iOS] Block the accessibility server when accessibility is not enabled.
3148         https://bugs.webkit.org/show_bug.cgi?id=195342
3149         <rdar://problem/48615720>
3150
3151         Unreviewed build fix for WinCairo.
3152
3153         * Shared/SandboxExtension.h: Use ProcessID instead of pid_t.
3154
3155 2019-03-16  Dean Jackson  <dino@apple.com>
3156
3157         ASSERT(gestureRecognizer == _doubleTapGestureRecognizer) in _doubleTapDidFail:
3158         https://bugs.webkit.org/show_bug.cgi?id=195857
3159         <rdar://problem/48954679>
3160
3161         Reviewed by Wenson Hsieh.
3162
3163         Reset an existing gesture recognizer before creating a new one.
3164
3165         * UIProcess/ios/WKContentViewInteraction.mm:
3166         (-[WKContentView _createAndConfigureDoubleTapGestureRecognizer]):
3167         (-[WKContentView _setDoubleTapGesturesEnabled:]):
3168
3169 2019-03-16  Jer Noble  <jer.noble@apple.com>
3170
3171         Add a new MediaCapabilitiesExtensionsEnabled setting
3172         https://bugs.webkit.org/show_bug.cgi?id=195843
3173
3174         Reviewed by Geoffrey Garen.
3175
3176         * Shared/WebPreferences.yaml:
3177
3178 2019-03-16  Wenson Hsieh  <wenson_hsieh@apple.com>
3179
3180         [iOS] Software keyboard never appears when editing on some websites
3181         https://bugs.webkit.org/show_bug.cgi?id=195824
3182         <rdar://problem/48020610>
3183
3184         Reviewed by Ryosuke Niwa.
3185
3186         In the scenario where an element has already been programmatically focused but the UI process isn't showing an
3187         input view for it, there are a couple of different ways in which an input view may still be shown for that
3188         element:
3189
3190         1. If the page attempts to programmatically focus the element, we'll invoke elementDidRefocus to recompute
3191         information about the focused element and propagate it to the UI process. By default, if programmatic focus was
3192         triggered under the scope of user interaction, we'll allow the input view to appear.
3193
3194         2. In the case where page does not attempt to programmatically focus the element but a click is dispatched,
3195         there is logic in WebPage::completeSyntheticClick to send information about the already-focused element.
3196
3197         On the web page relevant to this bug, focus is programmatically moved to hidden contenteditable areas upon page
3198         load, and touchstart is also prevented; furthermore, the page does not attempt to programmatically refocus the
3199         hidden editable area upon receiving touchstart. This means that the user will never be able to bring up the
3200         keyboard, since the editable area is already programmatically focused and subsequent attempts to tap in the
3201         page do nothing, because the page has already focused the hidden editable area (with the expectation that the
3202         software keyboard should already be present).
3203
3204         To fix this, we bring some of the same logic in completeSyntheticClick over to dispatchTouchEvent, by sending
3205         focused element information to the UI process if the focused element did not change over the course of
3206         dispatching the touch event. Similar code was introduced in r167774 to fix the same type of issue (i.e.
3207         inability to bring up the software keyboard), but this was later reverted in r188405 due to causing bugs such as
3208         <rdar://problem/22204108>, wherein this logic to bring up the keyboard in dispatchTouchEvent would scroll and
3209         zoom the page, such that the click event fired after touchend would be dispatched in the wrong location and (in
3210         the case of <rdar://problem/22204108>) caused the focused element to immediately blur again.
3211
3212         To mitigate this issue, we add the additional constraint that we only send focused element info in the case
3213         where the touch won't also generate a click later down the road, by requiring that the dispatched event was
3214         handled by the page (i.e. prevented).
3215
3216         Test: fast/events/touch/ios/show-keyboard-after-preventing-touchstart.html
3217
3218         * WebProcess/WebPage/WebPage.cpp:
3219         (WebKit::WebPage::dispatchTouchEvent):
3220
3221 2019-03-16  Zalan Bujtas  <zalan@apple.com>
3222
3223         Unable to close trending window on naver.com.
3224         https://bugs.webkit.org/show_bug.cgi?id=195842
3225         <rdar://problem/48067338>
3226
3227         Reviewed by Simon Fraser.
3228
3229         * WebProcess/WebPage/ios/WebPageIOS.mm:
3230         (WebKit::dispatchSyntheticMouseMove):
3231         (WebKit::WebPage::handleSyntheticClick):
3232         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
3233
3234 2019-03-16  Timothy Hatcher  <timothy@apple.com>
3235
3236         REGRESSION (r242807): Unified sources build failure from missing imports.
3237         https://bugs.webkit.org/show_bug.cgi?id=195852
3238
3239         Unreviewed speculative build fix.
3240
3241         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3242         Include <wtf/SoftLinking.h> and "UIKitSPI.h" on iOS.
3243
3244 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
3245
3246         [iOS] Block the accessibility server when accessibility is not enabled.
3247         https://bugs.webkit.org/show_bug.cgi?id=195342
3248
3249         Reviewed by Brent Fulgham.
3250
3251         By default, block the iOS accessibility server in the sandbox. If accessibility is enabled,
3252         let the UI process issue a mach extension to the WebContent process. The UI process will
3253         issue the mach extension the the WebContent process by its process identifier. The sandbox
3254         extension handle is sent to the WebContent process to be consumed. The message will be sent
3255         when the WebProcess has finished launching, and also when accessibility is turned on.
3256
3257         * Platform/spi/ios/AccessibilitySupportSPI.h:
3258         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3259         * Shared/SandboxExtension.h:
3260         * Shared/mac/SandboxExtensionMac.mm:
3261         (WebKit::SandboxExtensionImpl::create):
3262         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
3263         (WebKit::SandboxExtensionImpl::SandboxExtensionImpl):
3264         (WebKit::SandboxExtension::createHandleForMachLookupByPid):
3265         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3266         (WebKit::WebProcessPool::registerNotificationObservers):
3267         (WebKit::WebProcessPool::unregisterNotificationObservers):
3268         * UIProcess/WebProcessPool.h:
3269         * UIProcess/WebProcessProxy.cpp:
3270         (WebKit::WebProcessProxy::didFinishLaunching):
3271         * UIProcess/WebProcessProxy.h:
3272         * UIProcess/ios/WebProcessProxyIOS.mm:
3273         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
3274         * WebProcess/WebProcess.cpp:
3275         (WebKit::WebProcess::unblockAccessibilityServer):
3276         * WebProcess/WebProcess.h:
3277         * WebProcess/WebProcess.messages.in:
3278
3279 2019-03-15  Timothy Hatcher  <timothy@apple.com>
3280
3281         Unreviewed speculative build fix for non-Cocoa ports after r243012.
3282
3283         * UIProcess/WebPageProxy.cpp:
3284         (WebKit::WebPageProxy::getContentsAsAttributedString):
3285         * UIProcess/WebPageProxy.h:
3286
3287 2019-03-15  Truitt Savell  <tsavell@apple.com>
3288
3289         Unreviewed, rolling out r243008.
3290
3291         This revision broke High Sierra builders
3292
3293         Reverted changeset:
3294
3295         "[iOS] Block the accessibility server when accessibility is
3296         not enabled."
3297         https://bugs.webkit.org/show_bug.cgi?id=195342
3298         https://trac.webkit.org/changeset/243008
3299
3300 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
3301
3302         All networking from WebKit.Networking fails when Network Extension content filter is enabled
3303         https://bugs.webkit.org/show_bug.cgi?id=195815
3304         <rdar://problem/47598758>
3305
3306         Reviewed by Brent Fulgham.
3307
3308         The sandbox needs to allow an associated mach lookup.
3309
3310         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3311         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
3312
3313 2019-03-15  Sihui Liu  <sihui_liu@apple.com>
3314
3315         [ Mojave WK1 ] Layout Test storage/indexeddb/database-odd-names.html is failing
3316         https://bugs.webkit.org/show_bug.cgi?id=190350
3317         <rdar://problem/45089503>
3318
3319         Reviewed by Geoffrey Garen.
3320
3321         * NetworkProcess/NetworkProcess.cpp:
3322         (WebKit::NetworkProcess::collectIndexedDatabaseOriginsForVersion):
3323         (WebKit::NetworkProcess::indexedDatabaseOrigins):
3324         * NetworkProcess/NetworkProcess.h:
3325         * UIProcess/Network/NetworkProcessProxy.cpp:
3326         (WebKit::NetworkProcessProxy::addSession):
3327         (WebKit::NetworkProcessProxy::createSymLinkForFileUpgrade): For efficientcy and atomicity, we choose to use
3328         symlink to create v0 folder. Because network process does not have the permission to create a symlink, we need 
3329         to do this in UI process. UI process would create v0 folder inside the IndexedDB directory if there isn't one.
3330         Also if there is a v0 directory but it doesn't have content, it means it's not a correct symlink and we need to 
3331         delete it and create again.
3332
3333         * UIProcess/Network/NetworkProcessProxy.h:
3334         * UIProcess/WebProcessPool.cpp:
3335         (WebKit::WebProcessPool::ensureNetworkProcess):
3336
3337 2019-03-15  Sihui Liu  <sihui_liu@apple.com>
3338
3339         [ Mojave WK1 ] Layout Test storage/indexeddb/database-odd-names.html is failing
3340         https://bugs.webkit.org/show_bug.cgi?id=190350
3341         <rdar://problem/45089503>
3342
3343         Reviewed by Geoffrey Garen.
3344
3345         * NetworkProcess/NetworkProcess.cpp:
3346         (WebKit::NetworkProcess::collectIndexedDatabaseOriginsForVersion):
3347         (WebKit::NetworkProcess::indexedDatabaseOrigins):
3348         * NetworkProcess/NetworkProcess.h:
3349         * UIProcess/Network/NetworkProcessProxy.cpp:
3350         (WebKit::NetworkProcessProxy::addSession):
3351         (WebKit::NetworkProcessProxy::createSymLinkForFileUpgrade):
3352         * UIProcess/Network/NetworkProcessProxy.h:
3353         * UIProcess/WebProcessPool.cpp:
3354         (WebKit::WebProcessPool::ensureNetworkProcess):
3355
3356 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
3357
3358         [iOS] Restrict iokit-user-client-class "IOHIDLibUserClient" from WebKit
3359         https://bugs.webkit.org/show_bug.cgi?id=195821
3360         <rdar://problem/47606250>
3361
3362         Reviewed by Brent Fulgham.
3363
3364         This should be removed from the WebContent sandbox on iOS.
3365
3366         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3367
3368 2019-03-15  Alex Christensen  <achristensen@webkit.org>
3369
3370         _WKDownload should conform to NSCopying protocol
3371         https://bugs.webkit.org/show_bug.cgi?id=195718
3372
3373         Reviewed by Tim Horton.
3374
3375         This will allow us to use it as keys in NSMutableDictionaries, which Safari already kind of does.
3376
3377         * UIProcess/API/Cocoa/_WKDownload.h:
3378         * UIProcess/API/Cocoa/_WKDownload.mm:
3379         (-[_WKDownload copyWithZone:]):
3380
3381 2019-03-15  Dean Jackson  <dino@apple.com>
3382
3383         Provide an option for an always-on fast click mode in iOS
3384         https://bugs.webkit.org/show_bug.cgi?id=195822
3385         <rdar://problem/48939357>
3386
3387         Reviewed by Sam Weinig.
3388
3389         Add an option that will always trigger a click and never
3390         wait for a double tap to zoom. It is disabled by default.
3391
3392         * Shared/WebPreferences.yaml:
3393         * UIProcess/ios/WKContentViewInteraction.mm:
3394         (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:]):
3395
3396 2019-03-15  Timothy Hatcher  <timothy@apple.com>
3397
3398         Add support to WebPage for getting the contents as an attributed string.
3399         https://bugs.webkit.org/show_bug.cgi?id=195636
3400         rdar://problem/45055697
3401
3402         Reviewed by Tim Horton.
3403
3404         * Shared/mac/AttributedString.h:
3405         (WebKit::AttributedString::AttributedString):
3406         * Shared/mac/AttributedString.mm:
3407         (IPC::ArgumentCoder<WebKit::AttributedString>::encode):
3408         (IPC::ArgumentCoder<WebKit::AttributedString>::decode):
3409         * UIProcess/API/Cocoa/WKWebView.mm:
3410         (-[WKWebView _getContentsAsAttributedStringWithCompletionHandler:]):
3411         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3412         * UIProcess/WebPageProxy.cpp:
3413         (WebKit::WebPageProxy::getContentsAsAttributedString):
3414         * UIProcess/WebPageProxy.h:
3415         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: